@whetstone-research/doppler-sdk 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +432 -0
  2. package/dist/DopplerSDK.d.mts +56 -0
  3. package/dist/DopplerSDK.d.ts +56 -0
  4. package/dist/DopplerSDK.js +23 -0
  5. package/dist/DopplerSDK.js.map +1 -0
  6. package/dist/DopplerSDK.mjs +14 -0
  7. package/dist/DopplerSDK.mjs.map +1 -0
  8. package/dist/__tests__/mocks/addresses.d.mts +46 -0
  9. package/dist/__tests__/mocks/addresses.d.ts +46 -0
  10. package/dist/__tests__/mocks/addresses.js +53 -0
  11. package/dist/__tests__/mocks/addresses.js.map +1 -0
  12. package/dist/__tests__/mocks/addresses.mjs +44 -0
  13. package/dist/__tests__/mocks/addresses.mjs.map +1 -0
  14. package/dist/__tests__/mocks/clients.d.mts +22 -0
  15. package/dist/__tests__/mocks/clients.d.ts +22 -0
  16. package/dist/__tests__/mocks/clients.js +17088 -0
  17. package/dist/__tests__/mocks/clients.js.map +1 -0
  18. package/dist/__tests__/mocks/clients.mjs +17084 -0
  19. package/dist/__tests__/mocks/clients.mjs.map +1 -0
  20. package/dist/abis/bytecodes.d.mts +5 -0
  21. package/dist/abis/bytecodes.d.ts +5 -0
  22. package/dist/abis/bytecodes.js +21 -0
  23. package/dist/abis/bytecodes.js.map +1 -0
  24. package/dist/abis/bytecodes.mjs +4 -0
  25. package/dist/abis/bytecodes.mjs.map +1 -0
  26. package/dist/abis/index.d.mts +1864 -0
  27. package/dist/abis/index.d.ts +1864 -0
  28. package/dist/abis/index.js +74 -0
  29. package/dist/abis/index.js.map +1 -0
  30. package/dist/abis/index.mjs +5 -0
  31. package/dist/abis/index.mjs.map +1 -0
  32. package/dist/addresses.d.mts +46 -0
  33. package/dist/addresses.d.ts +46 -0
  34. package/dist/addresses.js +21 -0
  35. package/dist/addresses.js.map +1 -0
  36. package/dist/addresses.mjs +4 -0
  37. package/dist/addresses.mjs.map +1 -0
  38. package/dist/chunk-2LPOXGKT.mjs +181 -0
  39. package/dist/chunk-2LPOXGKT.mjs.map +1 -0
  40. package/dist/chunk-4K5GBNQV.mjs +157 -0
  41. package/dist/chunk-4K5GBNQV.mjs.map +1 -0
  42. package/dist/chunk-5B7IYSVK.js +82 -0
  43. package/dist/chunk-5B7IYSVK.js.map +1 -0
  44. package/dist/chunk-6H6BP7GZ.mjs +12 -0
  45. package/dist/chunk-6H6BP7GZ.mjs.map +1 -0
  46. package/dist/chunk-6REZA4TU.mjs +268 -0
  47. package/dist/chunk-6REZA4TU.mjs.map +1 -0
  48. package/dist/chunk-AYPP5JEQ.mjs +67 -0
  49. package/dist/chunk-AYPP5JEQ.mjs.map +1 -0
  50. package/dist/chunk-AZLFJNTG.mjs +3 -0
  51. package/dist/chunk-AZLFJNTG.mjs.map +1 -0
  52. package/dist/chunk-BYK425DD.mjs +160 -0
  53. package/dist/chunk-BYK425DD.mjs.map +1 -0
  54. package/dist/chunk-BYR4WWCZ.mjs +80 -0
  55. package/dist/chunk-BYR4WWCZ.mjs.map +1 -0
  56. package/dist/chunk-CYDWEPFL.mjs +3 -0
  57. package/dist/chunk-CYDWEPFL.mjs.map +1 -0
  58. package/dist/chunk-DLL6MEJA.js +270 -0
  59. package/dist/chunk-DLL6MEJA.js.map +1 -0
  60. package/dist/chunk-DRBRT57F.js +4 -0
  61. package/dist/chunk-DRBRT57F.js.map +1 -0
  62. package/dist/chunk-ER42VG7H.js +102 -0
  63. package/dist/chunk-ER42VG7H.js.map +1 -0
  64. package/dist/chunk-FOESYJP3.mjs +3 -0
  65. package/dist/chunk-FOESYJP3.mjs.map +1 -0
  66. package/dist/chunk-IGLVXIHA.js +924 -0
  67. package/dist/chunk-IGLVXIHA.js.map +1 -0
  68. package/dist/chunk-IPW2I4JJ.mjs +922 -0
  69. package/dist/chunk-IPW2I4JJ.mjs.map +1 -0
  70. package/dist/chunk-IX32KFK3.js +14 -0
  71. package/dist/chunk-IX32KFK3.js.map +1 -0
  72. package/dist/chunk-JHKPKTCV.js +1269 -0
  73. package/dist/chunk-JHKPKTCV.js.map +1 -0
  74. package/dist/chunk-K7BWQVAX.js +185 -0
  75. package/dist/chunk-K7BWQVAX.js.map +1 -0
  76. package/dist/chunk-KEXKKQVW.js +42 -0
  77. package/dist/chunk-KEXKKQVW.js.map +1 -0
  78. package/dist/chunk-KPBCG4X2.js +76 -0
  79. package/dist/chunk-KPBCG4X2.js.map +1 -0
  80. package/dist/chunk-KRN3ROUE.js +4 -0
  81. package/dist/chunk-KRN3ROUE.js.map +1 -0
  82. package/dist/chunk-L4TKYN6R.mjs +207 -0
  83. package/dist/chunk-L4TKYN6R.mjs.map +1 -0
  84. package/dist/chunk-LOROXNH3.mjs +37 -0
  85. package/dist/chunk-LOROXNH3.mjs.map +1 -0
  86. package/dist/chunk-NDWBEGEN.mjs +8 -0
  87. package/dist/chunk-NDWBEGEN.mjs.map +1 -0
  88. package/dist/chunk-O55NMSZK.mjs +131 -0
  89. package/dist/chunk-O55NMSZK.mjs.map +1 -0
  90. package/dist/chunk-OMN7RXR4.js +12 -0
  91. package/dist/chunk-OMN7RXR4.js.map +1 -0
  92. package/dist/chunk-OPKQMN46.mjs +54 -0
  93. package/dist/chunk-OPKQMN46.mjs.map +1 -0
  94. package/dist/chunk-P7CHGWY7.js +4 -0
  95. package/dist/chunk-P7CHGWY7.js.map +1 -0
  96. package/dist/chunk-QSQGLWNY.mjs +3 -0
  97. package/dist/chunk-QSQGLWNY.mjs.map +1 -0
  98. package/dist/chunk-R3YCKIM4.js +133 -0
  99. package/dist/chunk-R3YCKIM4.js.map +1 -0
  100. package/dist/chunk-RV64M4Q6.mjs +3 -0
  101. package/dist/chunk-RV64M4Q6.mjs.map +1 -0
  102. package/dist/chunk-SIVXK7WY.js +162 -0
  103. package/dist/chunk-SIVXK7WY.js.map +1 -0
  104. package/dist/chunk-T644D54P.mjs +65 -0
  105. package/dist/chunk-T644D54P.mjs.map +1 -0
  106. package/dist/chunk-TOMVBPNZ.js +56 -0
  107. package/dist/chunk-TOMVBPNZ.js.map +1 -0
  108. package/dist/chunk-VEIVYUYF.js +4 -0
  109. package/dist/chunk-VEIVYUYF.js.map +1 -0
  110. package/dist/chunk-WQHTNL5L.js +4 -0
  111. package/dist/chunk-WQHTNL5L.js.map +1 -0
  112. package/dist/chunk-X3UMAHOJ.js +4 -0
  113. package/dist/chunk-X3UMAHOJ.js.map +1 -0
  114. package/dist/chunk-XG7K4R56.js +170 -0
  115. package/dist/chunk-XG7K4R56.js.map +1 -0
  116. package/dist/chunk-XJGF77WN.mjs +1254 -0
  117. package/dist/chunk-XJGF77WN.mjs.map +1 -0
  118. package/dist/chunk-XNMXN5SZ.mjs +3 -0
  119. package/dist/chunk-XNMXN5SZ.mjs.map +1 -0
  120. package/dist/chunk-YPNUUFAD.js +209 -0
  121. package/dist/chunk-YPNUUFAD.js.map +1 -0
  122. package/dist/constants.d.mts +50 -0
  123. package/dist/constants.d.ts +50 -0
  124. package/dist/constants.js +153 -0
  125. package/dist/constants.js.map +1 -0
  126. package/dist/constants.mjs +4 -0
  127. package/dist/constants.mjs.map +1 -0
  128. package/dist/entities/DopplerFactory.d.mts +118 -0
  129. package/dist/entities/DopplerFactory.d.ts +118 -0
  130. package/dist/entities/DopplerFactory.js +17 -0
  131. package/dist/entities/DopplerFactory.js.map +1 -0
  132. package/dist/entities/DopplerFactory.mjs +8 -0
  133. package/dist/entities/DopplerFactory.mjs.map +1 -0
  134. package/dist/entities/auction/DynamicAuction.d.mts +57 -0
  135. package/dist/entities/auction/DynamicAuction.d.ts +57 -0
  136. package/dist/entities/auction/DynamicAuction.js +16 -0
  137. package/dist/entities/auction/DynamicAuction.js.map +1 -0
  138. package/dist/entities/auction/DynamicAuction.mjs +7 -0
  139. package/dist/entities/auction/DynamicAuction.mjs.map +1 -0
  140. package/dist/entities/auction/StaticAuction.d.mts +41 -0
  141. package/dist/entities/auction/StaticAuction.d.ts +41 -0
  142. package/dist/entities/auction/StaticAuction.js +16 -0
  143. package/dist/entities/auction/StaticAuction.js.map +1 -0
  144. package/dist/entities/auction/StaticAuction.mjs +7 -0
  145. package/dist/entities/auction/StaticAuction.mjs.map +1 -0
  146. package/dist/entities/auction/index.d.mts +4 -0
  147. package/dist/entities/auction/index.d.ts +4 -0
  148. package/dist/entities/auction/index.js +22 -0
  149. package/dist/entities/auction/index.js.map +1 -0
  150. package/dist/entities/auction/index.mjs +9 -0
  151. package/dist/entities/auction/index.mjs.map +1 -0
  152. package/dist/entities/quoter/Quoter.d.mts +108 -0
  153. package/dist/entities/quoter/Quoter.d.ts +108 -0
  154. package/dist/entities/quoter/Quoter.js +16 -0
  155. package/dist/entities/quoter/Quoter.js.map +1 -0
  156. package/dist/entities/quoter/Quoter.mjs +7 -0
  157. package/dist/entities/quoter/Quoter.mjs.map +1 -0
  158. package/dist/entities/quoter/index.d.mts +2 -0
  159. package/dist/entities/quoter/index.d.ts +2 -0
  160. package/dist/entities/quoter/index.js +17 -0
  161. package/dist/entities/quoter/index.js.map +1 -0
  162. package/dist/entities/quoter/index.mjs +8 -0
  163. package/dist/entities/quoter/index.mjs.map +1 -0
  164. package/dist/entities/token/derc20/Derc20.d.mts +76 -0
  165. package/dist/entities/token/derc20/Derc20.d.ts +76 -0
  166. package/dist/entities/token/derc20/Derc20.js +15 -0
  167. package/dist/entities/token/derc20/Derc20.js.map +1 -0
  168. package/dist/entities/token/derc20/Derc20.mjs +6 -0
  169. package/dist/entities/token/derc20/Derc20.mjs.map +1 -0
  170. package/dist/entities/token/derc20/index.d.mts +2 -0
  171. package/dist/entities/token/derc20/index.d.ts +2 -0
  172. package/dist/entities/token/derc20/index.js +16 -0
  173. package/dist/entities/token/derc20/index.js.map +1 -0
  174. package/dist/entities/token/derc20/index.mjs +7 -0
  175. package/dist/entities/token/derc20/index.mjs.map +1 -0
  176. package/dist/entities/token/eth/Eth.d.mts +50 -0
  177. package/dist/entities/token/eth/Eth.d.ts +50 -0
  178. package/dist/entities/token/eth/Eth.js +13 -0
  179. package/dist/entities/token/eth/Eth.js.map +1 -0
  180. package/dist/entities/token/eth/Eth.mjs +4 -0
  181. package/dist/entities/token/eth/Eth.mjs.map +1 -0
  182. package/dist/entities/token/eth/index.d.mts +2 -0
  183. package/dist/entities/token/eth/index.d.ts +2 -0
  184. package/dist/entities/token/eth/index.js +14 -0
  185. package/dist/entities/token/eth/index.js.map +1 -0
  186. package/dist/entities/token/eth/index.mjs +5 -0
  187. package/dist/entities/token/eth/index.mjs.map +1 -0
  188. package/dist/entities/token/index.d.mts +3 -0
  189. package/dist/entities/token/index.d.ts +3 -0
  190. package/dist/entities/token/index.js +23 -0
  191. package/dist/entities/token/index.js.map +1 -0
  192. package/dist/entities/token/index.mjs +10 -0
  193. package/dist/entities/token/index.mjs.map +1 -0
  194. package/dist/index.d.mts +19 -0
  195. package/dist/index.d.ts +19 -0
  196. package/dist/index.js +338 -0
  197. package/dist/index.js.map +1 -0
  198. package/dist/index.mjs +28 -0
  199. package/dist/index.mjs.map +1 -0
  200. package/dist/magic-string.es-NMLAOY5A.js +1298 -0
  201. package/dist/magic-string.es-NMLAOY5A.js.map +1 -0
  202. package/dist/magic-string.es-QCVTE6QG.mjs +1292 -0
  203. package/dist/magic-string.es-QCVTE6QG.mjs.map +1 -0
  204. package/dist/types.d.mts +206 -0
  205. package/dist/types.d.ts +206 -0
  206. package/dist/types.js +13 -0
  207. package/dist/types.js.map +1 -0
  208. package/dist/types.mjs +4 -0
  209. package/dist/types.mjs.map +1 -0
  210. package/dist/utils/index.d.mts +2 -0
  211. package/dist/utils/index.d.ts +2 -0
  212. package/dist/utils/index.js +91 -0
  213. package/dist/utils/index.js.map +1 -0
  214. package/dist/utils/index.mjs +6 -0
  215. package/dist/utils/index.mjs.map +1 -0
  216. package/dist/utils/priceHelpers.d.mts +86 -0
  217. package/dist/utils/priceHelpers.d.ts +86 -0
  218. package/dist/utils/priceHelpers.js +42 -0
  219. package/dist/utils/priceHelpers.js.map +1 -0
  220. package/dist/utils/priceHelpers.mjs +5 -0
  221. package/dist/utils/priceHelpers.mjs.map +1 -0
  222. package/dist/utils/tickMath.d.mts +65 -0
  223. package/dist/utils/tickMath.d.ts +65 -0
  224. package/dist/utils/tickMath.js +57 -0
  225. package/dist/utils/tickMath.js.map +1 -0
  226. package/dist/utils/tickMath.mjs +4 -0
  227. package/dist/utils/tickMath.mjs.map +1 -0
  228. package/package.json +62 -0
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var chunkSIVXK7WY_js = require('./chunk-SIVXK7WY.js');
4
+ var chunkDLL6MEJA_js = require('./chunk-DLL6MEJA.js');
5
+ var chunkR3YCKIM4_js = require('./chunk-R3YCKIM4.js');
6
+ var chunkIGLVXIHA_js = require('./chunk-IGLVXIHA.js');
7
+
8
+ // src/DopplerSDK.ts
9
+ var DopplerSDK = class {
10
+ constructor(config) {
11
+ this.publicClient = config.publicClient;
12
+ this.walletClient = config.walletClient;
13
+ this.chainId = config.chainId;
14
+ }
15
+ /**
16
+ * Get the factory instance for creating auctions
17
+ */
18
+ get factory() {
19
+ if (!this._factory) {
20
+ this._factory = new chunkIGLVXIHA_js.DopplerFactory(this.publicClient, this.walletClient, this.chainId);
21
+ }
22
+ return this._factory;
23
+ }
24
+ /**
25
+ * Get the quoter instance for price queries
26
+ */
27
+ get quoter() {
28
+ if (!this._quoter) {
29
+ this._quoter = new chunkSIVXK7WY_js.Quoter(this.publicClient, this.chainId);
30
+ }
31
+ return this._quoter;
32
+ }
33
+ /**
34
+ * Get a StaticAuction instance for interacting with a static auction pool
35
+ * @param poolAddress The address of the Uniswap V3 pool
36
+ */
37
+ async getStaticAuction(poolAddress) {
38
+ return new chunkR3YCKIM4_js.StaticAuction(this.publicClient, poolAddress);
39
+ }
40
+ /**
41
+ * Get a DynamicAuction instance for interacting with a dynamic auction hook
42
+ * @param hookAddress The address of the Uniswap V4 hook
43
+ */
44
+ async getDynamicAuction(hookAddress) {
45
+ return new chunkDLL6MEJA_js.DynamicAuction(this.publicClient, hookAddress);
46
+ }
47
+ /**
48
+ * Get information about a static auction pool
49
+ * @param poolAddress The address of the pool
50
+ */
51
+ async getPoolInfo(poolAddress) {
52
+ const auction = new chunkR3YCKIM4_js.StaticAuction(this.publicClient, poolAddress);
53
+ return auction.getPoolInfo();
54
+ }
55
+ /**
56
+ * Get information about a dynamic auction hook
57
+ * @param hookAddress The address of the hook
58
+ */
59
+ async getHookInfo(hookAddress) {
60
+ const auction = new chunkDLL6MEJA_js.DynamicAuction(this.publicClient, hookAddress);
61
+ return auction.getHookInfo();
62
+ }
63
+ /**
64
+ * Get the current chain ID
65
+ */
66
+ getChainId() {
67
+ return this.chainId;
68
+ }
69
+ /**
70
+ * Get the underlying clients
71
+ */
72
+ getClients() {
73
+ return {
74
+ publicClient: this.publicClient,
75
+ walletClient: this.walletClient
76
+ };
77
+ }
78
+ };
79
+
80
+ exports.DopplerSDK = DopplerSDK;
81
+ //# sourceMappingURL=chunk-5B7IYSVK.js.map
82
+ //# sourceMappingURL=chunk-5B7IYSVK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/DopplerSDK.ts"],"names":["DopplerFactory","Quoter","StaticAuction","DynamicAuction"],"mappings":";;;;;;;;AAMO,IAAM,aAAN,MAAiB;AAAA,EAOtB,YAAY,MAAA,EAA0B;AACpC,IAAA,IAAA,CAAK,eAAe,MAAA,CAAO,YAAA;AAC3B,IAAA,IAAA,CAAK,eAAe,MAAA,CAAO,YAAA;AAC3B,IAAA,IAAA,CAAK,UAAU,MAAA,CAAO,OAAA;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAAA,GAA0B;AAC5B,IAAA,IAAI,CAAC,KAAK,QAAA,EAAU;AAClB,MAAA,IAAA,CAAK,QAAA,GAAW,IAAIA,+BAAA,CAAe,IAAA,CAAK,cAAc,IAAA,CAAK,YAAA,EAAc,KAAK,OAAO,CAAA;AAAA,IACvF;AACA,IAAA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ourcesContent":["import type { Address, PublicClient, WalletClient } from 'viem'\nimport type { DopplerSDKConfig, HookInfo, PoolInfo } from './types'\nimport { DopplerFactory } from './entities/DopplerFactory'\nimport { StaticAuction, DynamicAuction } from './entities/auction'\nimport { Quoter } from './entities/quoter'\n\nexport class DopplerSDK {\n private publicClient: PublicClient\n private walletClient?: WalletClient\n private chainId: number\n private _factory?: DopplerFactory\n private _quoter?: Quoter\n\n constructor(config: DopplerSDKConfig) {\n this.publicClient = config.publicClient\n this.walletClient = config.walletClient\n this.chainId = config.chainId\n }\n\n /**\n * Get the factory instance for creating auctions\n */\n get factory(): DopplerFactory {\n if (!this._factory) {\n this._factory = new DopplerFactory(this.publicClient, this.walletClient, this.chainId)\n }\n return this._factory\n }\n\n /**\n * Get the quoter instance for price queries\n */\n get quoter(): Quoter {\n if (!this._quoter) {\n this._quoter = new Quoter(this.publicClient, this.chainId)\n }\n return this._quoter\n }\n\n /**\n * Get a StaticAuction instance for interacting with a static auction pool\n * @param poolAddress The address of the Uniswap V3 pool\n */\n async getStaticAuction(poolAddress: Address): Promise<StaticAuction> {\n return new StaticAuction(this.publicClient, poolAddress)\n }\n\n /**\n * Get a DynamicAuction instance for interacting with a dynamic auction hook\n * @param hookAddress The address of the Uniswap V4 hook\n */\n async getDynamicAuction(hookAddress: Address): Promise<DynamicAuction> {\n return new DynamicAuction(this.publicClient, hookAddress)\n }\n\n /**\n * Get information about a static auction pool\n * @param poolAddress The address of the pool\n */\n async getPoolInfo(poolAddress: Address): Promise<PoolInfo> {\n const auction = new StaticAuction(this.publicClient, poolAddress)\n return auction.getPoolInfo()\n }\n\n /**\n * Get information about a dynamic auction hook\n * @param hookAddress The address of the hook\n */\n async getHookInfo(hookAddress: Address): Promise<HookInfo> {\n const auction = new DynamicAuction(this.publicClient, hookAddress)\n return auction.getHookInfo()\n }\n\n /**\n * Get the current chain ID\n */\n getChainId(): number {\n return this.chainId\n }\n\n /**\n * Get the underlying clients\n */\n getClients(): { publicClient: PublicClient; walletClient?: WalletClient } {\n return {\n publicClient: this.publicClient,\n walletClient: this.walletClient\n }\n }\n}"]}
@@ -0,0 +1,12 @@
1
+ // src/types.ts
2
+ var LockablePoolStatus = /* @__PURE__ */ ((LockablePoolStatus2) => {
3
+ LockablePoolStatus2[LockablePoolStatus2["Uninitialized"] = 0] = "Uninitialized";
4
+ LockablePoolStatus2[LockablePoolStatus2["Initialized"] = 1] = "Initialized";
5
+ LockablePoolStatus2[LockablePoolStatus2["Locked"] = 2] = "Locked";
6
+ LockablePoolStatus2[LockablePoolStatus2["Exited"] = 3] = "Exited";
7
+ return LockablePoolStatus2;
8
+ })(LockablePoolStatus || {});
9
+
10
+ export { LockablePoolStatus };
11
+ //# sourceMappingURL=chunk-6H6BP7GZ.mjs.map
12
+ //# sourceMappingURL=chunk-6H6BP7GZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"names":["LockablePoolStatus"],"mappings":";AAiEO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,mBAAgB,CAAA,CAAA,GAAhB,eAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,iBAAc,CAAA,CAAA,GAAd,aAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AAJU,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-6H6BP7GZ.mjs","sourcesContent":["import type { Address, PublicClient, WalletClient } from 'viem'\n\n// Core configuration types\nexport interface TokenConfig {\n name: string\n symbol: string\n tokenURI: string\n yearlyMintRate?: bigint // Optional yearly mint rate (in WAD, default: 2% = 0.02e18)\n}\n\nexport interface SaleConfig {\n initialSupply: bigint\n numTokensToSell: bigint\n numeraire: Address // e.g., WETH address\n}\n\n// Static Auction Pool configuration\nexport interface StaticPoolConfig {\n startTick: number\n endTick: number\n fee: number // e.g., 3000 for 0.3%\n // Optional parameters for lockable initializer\n numPositions?: number // Number of liquidity positions (default: based on tick range)\n maxShareToBeSold?: bigint // Maximum share of tokens to sell (in WAD, default: 1e18 = 100%)\n lockableBeneficiaries?: LockableBeneficiaryData[] // Optional beneficiaries for fee streaming\n}\n\n// Dynamic Auction configuration\nexport interface DynamicAuctionConfig {\n duration: number // in days\n epochLength: number // in seconds\n startTick: number\n endTick: number\n gamma?: number // Optional, can be auto-calculated\n minProceeds: bigint\n maxProceeds: bigint\n numPdSlugs?: number // Price discovery slugs (optional)\n}\n\n// Vesting configuration\nexport interface VestingConfig {\n duration: number // in seconds\n cliffDuration: number // in seconds\n}\n\n// Governance configuration\nexport interface GovernanceConfig {\n initialVotingDelay?: number // in seconds (default: depends on version)\n initialVotingPeriod?: number // in seconds (default: depends on version)\n initialProposalThreshold?: bigint // in tokens (default: 0)\n}\n\n// Beneficiary data for streamable fees\nexport interface BeneficiaryData {\n address: Address\n percentage: number // basis points (e.g., 5000 = 50%)\n}\n\n// Lockable initializer beneficiary data (uses shares instead of percentage)\nexport interface LockableBeneficiaryData {\n beneficiary: Address\n shares: bigint // shares in WAD (1e18 = 100%)\n}\n\n// Pool status for lockable initializer\nexport enum LockablePoolStatus {\n Uninitialized = 0,\n Initialized = 1,\n Locked = 2,\n Exited = 3\n}\n\n// Lockable pool state\nexport interface LockablePoolState {\n asset: Address\n numeraire: Address\n tickLower: number\n tickUpper: number\n maxShareToBeSold: bigint\n totalTokensOnBondingCurve: bigint\n status: LockablePoolStatus\n}\n\n// Migration configuration (discriminated union)\nexport type MigrationConfig =\n | { type: 'uniswapV2' } // Basic migration to a new Uniswap v2 pool\n | {\n type: 'uniswapV3'\n fee: number\n tickSpacing: number\n }\n | {\n type: 'uniswapV4'\n fee: number\n tickSpacing: number\n // Configuration for fee streaming via StreamableFeesLocker\n streamableFees: {\n lockDuration: number // in seconds\n beneficiaries: BeneficiaryData[]\n }\n // For no-op governance where 100% of liquidity is permanently locked\n noOpGovernance?: boolean\n }\n\n// Create Static Auction parameters\nexport interface CreateStaticAuctionParams {\n // Token configuration\n token: TokenConfig\n\n // Sale configuration\n sale: SaleConfig\n\n // Static Auction (Uniswap v3) Pool configuration\n pool: StaticPoolConfig\n\n // Vesting configuration (optional)\n vesting?: VestingConfig\n\n // Governance configuration (optional)\n governance?: GovernanceConfig\n\n // Explicit Migration Configuration\n migration: MigrationConfig\n\n // Integrator details\n integrator?: Address\n userAddress: Address\n}\n\n// Create Dynamic Auction parameters\nexport interface CreateDynamicAuctionParams {\n // Token configuration\n token: TokenConfig\n\n // Sale configuration\n sale: SaleConfig\n\n // Dynamic Auction (Uniswap v4 Hook) configuration\n auction: DynamicAuctionConfig\n \n // Pool configuration\n pool: {\n fee: number // e.g., 3000 for 0.3%\n tickSpacing: number\n }\n\n // Vesting configuration (optional)\n vesting?: VestingConfig\n\n // Governance configuration (optional)\n governance?: GovernanceConfig\n\n // Explicit Migration Configuration\n migration: MigrationConfig\n\n // Integrator details\n integrator?: Address\n userAddress: Address\n \n // Time configuration (internal use)\n startTimeOffset?: number\n blockTimestamp?: number // Optional: use this block timestamp instead of fetching latest\n}\n\n// Price range configuration for automatic tick calculation\nexport interface PriceRange {\n startPrice: number\n endPrice: number\n}\n\n// Tick range configuration\nexport interface TickRange {\n startTick: number\n endTick: number\n}\n\n// Build configuration for static auctions (V3-style)\nexport interface StaticAuctionBuildConfig {\n // Token details\n name: string\n symbol: string\n totalSupply?: bigint // default: 1 billion\n numTokensToSell?: bigint // default: 900 million\n tokenURI: string\n\n // Time parameters\n startTimeOffset?: number // Optional - seconds to add to current block timestamp (default: 30)\n\n // Price parameters - must provide either priceRange or tickRange\n numeraire: Address // Required for V3\n tickRange?: TickRange\n priceRange?: PriceRange\n fee?: number // default: 10000 (1%)\n \n // Pool parameters (V3 specific)\n numPositions?: number // default: 15\n maxShareToBeSold?: bigint // default: 35% in WAD\n\n // Vesting parameters\n yearlyMintRate?: bigint // default: 2%\n vestingDuration?: bigint // default: 1 year\n recipients?: Address[] // defaults to [userAddress]\n amounts?: bigint[] // defaults based on pre-mint calculation\n\n // Migration configuration\n migration: MigrationConfig\n\n // Other parameters\n integrator?: Address\n useGovernance?: boolean // default: true\n}\n\n// Build configuration for dynamic auctions (V4-style)\nexport interface DynamicAuctionBuildConfig {\n // Token details\n name: string\n symbol: string\n totalSupply: bigint\n numTokensToSell: bigint\n tokenURI: string\n\n // Time parameters\n startTimeOffset?: number // Optional - seconds to add to block timestamp (default: 30)\n blockTimestamp?: number // Optional - specific block timestamp to use (default: fetch latest)\n duration?: number // in days (default: 7)\n epochLength?: number // in seconds (default: 3600)\n\n // Price parameters - must provide either priceRange or tickRange\n numeraire?: Address // defaults to zero address\n tickRange?: TickRange\n priceRange?: PriceRange\n tickSpacing: number\n gamma?: number // auto-calculated if not provided\n fee: number // In basis points\n\n // Sale parameters\n minProceeds: bigint\n maxProceeds: bigint\n numPdSlugs?: number // default: 5\n\n // Vesting parameters\n yearlyMintRate?: bigint // default: 2%\n vestingDuration: bigint\n recipients: Address[]\n amounts: bigint[]\n\n // Migration configuration\n migration: MigrationConfig\n\n // Other parameters\n integrator?: Address\n useGovernance?: boolean // default: true\n}\n\n// SDK initialization configuration\nexport interface DopplerSDKConfig {\n publicClient: PublicClient\n walletClient?: WalletClient\n chainId: number\n}\n\n// Pool information types\nexport interface PoolInfo {\n address: Address\n tokenAddress: Address\n numeraireAddress: Address\n fee: number\n liquidity: bigint\n sqrtPriceX96: bigint\n}\n\nexport interface HookInfo {\n hookAddress: Address\n tokenAddress: Address\n numeraireAddress: Address\n poolId: string\n currentEpoch: number\n totalProceeds: bigint\n totalTokensSold: bigint\n earlyExit: boolean\n insufficientProceeds: boolean\n startingTime: bigint\n endingTime: bigint\n epochLength: bigint\n minimumProceeds: bigint\n maximumProceeds: bigint\n}\n\n\n// Quote result type\nexport interface QuoteResult {\n amountOut: bigint\n priceImpact: number\n fee: bigint\n route: string[]\n}\n\n// Lockable Uniswap V3 Initializer encode params\nexport interface LockableV3InitializerParams {\n fee: number\n tickLower: number\n tickUpper: number\n numPositions: number\n maxShareToBeSold: bigint\n beneficiaries: LockableBeneficiaryData[]\n}"]}
@@ -0,0 +1,268 @@
1
+ import { getAddresses } from './chunk-2LPOXGKT.mjs';
2
+ import { dopplerHookAbi, airlockAbi } from './chunk-XJGF77WN.mjs';
3
+ import { encodeAbiParameters, keccak256 } from 'viem';
4
+
5
+ var DynamicAuction = class {
6
+ constructor(client, hookAddress) {
7
+ this.client = client;
8
+ this.hookAddress = hookAddress;
9
+ }
10
+ /**
11
+ * Get the hook address
12
+ */
13
+ getAddress() {
14
+ return this.hookAddress;
15
+ }
16
+ /**
17
+ * Get current hook information
18
+ */
19
+ async getHookInfo() {
20
+ const [
21
+ state,
22
+ earlyExit,
23
+ insufficientProceeds,
24
+ poolKey,
25
+ startingTime,
26
+ endingTime,
27
+ epochLength,
28
+ minimumProceeds,
29
+ maximumProceeds,
30
+ numTokensToSell
31
+ ] = await Promise.all([
32
+ this.client.readContract({
33
+ address: this.hookAddress,
34
+ abi: dopplerHookAbi,
35
+ functionName: "state"
36
+ }),
37
+ this.client.readContract({
38
+ address: this.hookAddress,
39
+ abi: dopplerHookAbi,
40
+ functionName: "earlyExit"
41
+ }),
42
+ this.client.readContract({
43
+ address: this.hookAddress,
44
+ abi: dopplerHookAbi,
45
+ functionName: "insufficientProceeds"
46
+ }),
47
+ this.client.readContract({
48
+ address: this.hookAddress,
49
+ abi: dopplerHookAbi,
50
+ functionName: "poolKey"
51
+ }),
52
+ this.client.readContract({
53
+ address: this.hookAddress,
54
+ abi: dopplerHookAbi,
55
+ functionName: "startingTime"
56
+ }),
57
+ this.client.readContract({
58
+ address: this.hookAddress,
59
+ abi: dopplerHookAbi,
60
+ functionName: "endingTime"
61
+ }),
62
+ this.client.readContract({
63
+ address: this.hookAddress,
64
+ abi: dopplerHookAbi,
65
+ functionName: "epochLength"
66
+ }),
67
+ this.client.readContract({
68
+ address: this.hookAddress,
69
+ abi: dopplerHookAbi,
70
+ functionName: "minimumProceeds"
71
+ }),
72
+ this.client.readContract({
73
+ address: this.hookAddress,
74
+ abi: dopplerHookAbi,
75
+ functionName: "maximumProceeds"
76
+ }),
77
+ this.client.readContract({
78
+ address: this.hookAddress,
79
+ abi: dopplerHookAbi,
80
+ functionName: "numTokensToSell"
81
+ })
82
+ ]);
83
+ const currentTime = BigInt(Math.floor(Date.now() / 1e3));
84
+ const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0);
85
+ const currentEpoch = epochLength > 0n ? Number(elapsedTime / epochLength) : 0;
86
+ const isToken0 = poolKey.currency0 !== "0x0000000000000000000000000000000000000000";
87
+ const tokenAddress = isToken0 ? poolKey.currency0 : poolKey.currency1;
88
+ const numeraireAddress = isToken0 ? poolKey.currency1 : poolKey.currency0;
89
+ const poolId = this.computePoolId(poolKey);
90
+ return {
91
+ hookAddress: this.hookAddress,
92
+ tokenAddress,
93
+ numeraireAddress,
94
+ poolId,
95
+ currentEpoch,
96
+ totalProceeds: state.totalProceeds,
97
+ totalTokensSold: state.totalTokensSold,
98
+ earlyExit,
99
+ insufficientProceeds,
100
+ startingTime,
101
+ endingTime,
102
+ epochLength,
103
+ minimumProceeds,
104
+ maximumProceeds
105
+ };
106
+ }
107
+ /**
108
+ * Get the token address for this auction
109
+ */
110
+ async getTokenAddress() {
111
+ const poolKey = await this.client.readContract({
112
+ address: this.hookAddress,
113
+ abi: dopplerHookAbi,
114
+ functionName: "poolKey"
115
+ });
116
+ const isToken0 = await this.client.readContract({
117
+ address: this.hookAddress,
118
+ abi: dopplerHookAbi,
119
+ functionName: "isToken0"
120
+ });
121
+ return isToken0 ? poolKey.currency0 : poolKey.currency1;
122
+ }
123
+ /**
124
+ * Get the pool ID for this auction
125
+ */
126
+ async getPoolId() {
127
+ const poolKey = await this.client.readContract({
128
+ address: this.hookAddress,
129
+ abi: dopplerHookAbi,
130
+ functionName: "poolKey"
131
+ });
132
+ return this.computePoolId(poolKey);
133
+ }
134
+ /**
135
+ * Check if the auction has graduated (ready for migration)
136
+ */
137
+ async hasGraduated() {
138
+ const tokenAddress = await this.getTokenAddress();
139
+ const chainId = await this.client.getChainId();
140
+ const addresses = getAddresses(chainId);
141
+ const assetData = await this.client.readContract({
142
+ address: addresses.airlock,
143
+ abi: airlockAbi,
144
+ functionName: "getAssetData",
145
+ args: [tokenAddress]
146
+ });
147
+ return assetData[3] === "0x0000000000000000000000000000000000000000";
148
+ }
149
+ /**
150
+ * Get the current epoch
151
+ */
152
+ async getCurrentEpoch() {
153
+ const [startingTime, epochLength] = await Promise.all([
154
+ this.client.readContract({
155
+ address: this.hookAddress,
156
+ abi: dopplerHookAbi,
157
+ functionName: "startingTime"
158
+ }),
159
+ this.client.readContract({
160
+ address: this.hookAddress,
161
+ abi: dopplerHookAbi,
162
+ functionName: "epochLength"
163
+ })
164
+ ]);
165
+ const currentTime = BigInt(Math.floor(Date.now() / 1e3));
166
+ const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0);
167
+ return Number(elapsedTime / epochLength);
168
+ }
169
+ /**
170
+ * Get the current price in the auction
171
+ * Returns the current tick based on the epoch and gamma parameters
172
+ */
173
+ async getCurrentPrice() {
174
+ const [
175
+ state,
176
+ startingTick,
177
+ endingTick,
178
+ gamma,
179
+ startingTime,
180
+ epochLength
181
+ ] = await Promise.all([
182
+ this.client.readContract({
183
+ address: this.hookAddress,
184
+ abi: dopplerHookAbi,
185
+ functionName: "state"
186
+ }),
187
+ this.client.readContract({
188
+ address: this.hookAddress,
189
+ abi: dopplerHookAbi,
190
+ functionName: "startingTick"
191
+ }),
192
+ this.client.readContract({
193
+ address: this.hookAddress,
194
+ abi: dopplerHookAbi,
195
+ functionName: "endingTick"
196
+ }),
197
+ this.client.readContract({
198
+ address: this.hookAddress,
199
+ abi: dopplerHookAbi,
200
+ functionName: "gamma"
201
+ }),
202
+ this.client.readContract({
203
+ address: this.hookAddress,
204
+ abi: dopplerHookAbi,
205
+ functionName: "startingTime"
206
+ }),
207
+ this.client.readContract({
208
+ address: this.hookAddress,
209
+ abi: dopplerHookAbi,
210
+ functionName: "epochLength"
211
+ })
212
+ ]);
213
+ const currentTime = BigInt(Math.floor(Date.now() / 1e3));
214
+ const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0);
215
+ const currentEpoch = epochLength > 0n ? Number(elapsedTime / epochLength) : 0;
216
+ const direction = endingTick > startingTick ? 1 : -1;
217
+ const tickMovement = Math.floor(currentEpoch * gamma * direction);
218
+ const currentTick = Math.floor(startingTick + tickMovement);
219
+ return BigInt(currentTick);
220
+ }
221
+ /**
222
+ * Get total proceeds collected so far
223
+ */
224
+ async getTotalProceeds() {
225
+ const state = await this.client.readContract({
226
+ address: this.hookAddress,
227
+ abi: dopplerHookAbi,
228
+ functionName: "state"
229
+ });
230
+ return state.totalProceeds;
231
+ }
232
+ /**
233
+ * Check if the auction ended early due to max proceeds
234
+ */
235
+ async hasEndedEarly() {
236
+ return await this.client.readContract({
237
+ address: this.hookAddress,
238
+ abi: dopplerHookAbi,
239
+ functionName: "earlyExit"
240
+ });
241
+ }
242
+ /**
243
+ * Compute V4 pool ID from pool key components
244
+ */
245
+ computePoolId(poolKey) {
246
+ const encoded = encodeAbiParameters(
247
+ [
248
+ { type: "address" },
249
+ { type: "address" },
250
+ { type: "uint24" },
251
+ { type: "int24" },
252
+ { type: "address" }
253
+ ],
254
+ [
255
+ poolKey.currency0,
256
+ poolKey.currency1,
257
+ poolKey.fee,
258
+ poolKey.tickSpacing,
259
+ poolKey.hooks
260
+ ]
261
+ );
262
+ return keccak256(encoded);
263
+ }
264
+ };
265
+
266
+ export { DynamicAuction };
267
+ //# sourceMappingURL=chunk-6REZA4TU.mjs.map
268
+ //# sourceMappingURL=chunk-6REZA4TU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/entities/auction/DynamicAuction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OACpB;AAAA,MACA;AAAA,QACE,OAAA,CAAQ,SAAA;AAAA,QACR,OAAA,CAAQ,SAAA;AAAA,QACR,OAAA,CAAQ,GAAA;AAAA,QACR,OAAA,CAAQ,WAAA;AAAA,QACR,OAAA,CAAQ;AAAA;AACV,KACF;AACA,IAAA,OAAO,UAAU,OAAO,CAAA;AAAA,EAC1B;AACF","file":"chunk-6REZA4TU.mjs","sourcesContent":["import { type Address, type PublicClient, encodePacked, keccak256, encodeAbiParameters } from 'viem'\nimport type { HookInfo } from '../../types'\nimport { dopplerHookAbi, airlockAbi } from '../../abis'\nimport { getAddresses } from '../../addresses'\n\n/**\n * DynamicAuction class for interacting with dynamic auctions (Uniswap V4 hook based)\n * \n * Dynamic auctions use a Uniswap V4 hook to create a gradual Dutch auction\n * where the price moves dynamically over time according to set parameters.\n */\nexport class DynamicAuction {\n private client: PublicClient\n private hookAddress: Address\n \n constructor(client: PublicClient, hookAddress: Address) {\n this.client = client\n this.hookAddress = hookAddress\n }\n \n /**\n * Get the hook address\n */\n getAddress(): Address {\n return this.hookAddress\n }\n \n /**\n * Get current hook information\n */\n async getHookInfo(): Promise<HookInfo> {\n // Fetch all hook data in parallel\n const [\n state,\n earlyExit,\n insufficientProceeds,\n poolKey,\n startingTime,\n endingTime,\n epochLength,\n minimumProceeds,\n maximumProceeds,\n numTokensToSell,\n ] = await Promise.all([\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'state',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'earlyExit',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'insufficientProceeds',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'poolKey',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'startingTime',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'endingTime',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'epochLength',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'minimumProceeds',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'maximumProceeds',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'numTokensToSell',\n }),\n ])\n \n // Calculate current epoch\n const currentTime = BigInt(Math.floor(Date.now() / 1000))\n const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0)\n const currentEpoch = epochLength > 0n ? Number(elapsedTime / epochLength) : 0\n \n // Determine token addresses from poolKey\n const isToken0 = poolKey.currency0 !== '0x0000000000000000000000000000000000000000'\n const tokenAddress = isToken0 ? poolKey.currency0 : poolKey.currency1\n const numeraireAddress = isToken0 ? poolKey.currency1 : poolKey.currency0\n \n // Compute pool ID\n const poolId = this.computePoolId(poolKey)\n \n return {\n hookAddress: this.hookAddress,\n tokenAddress,\n numeraireAddress,\n poolId,\n currentEpoch,\n totalProceeds: state.totalProceeds,\n totalTokensSold: state.totalTokensSold,\n earlyExit,\n insufficientProceeds,\n startingTime,\n endingTime,\n epochLength,\n minimumProceeds,\n maximumProceeds,\n }\n }\n \n /**\n * Get the token address for this auction\n */\n async getTokenAddress(): Promise<Address> {\n const poolKey = await this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'poolKey',\n })\n \n const isToken0 = await this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'isToken0',\n })\n \n return isToken0 ? poolKey.currency0 : poolKey.currency1\n }\n \n /**\n * Get the pool ID for this auction\n */\n async getPoolId(): Promise<string> {\n const poolKey = await this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'poolKey',\n })\n \n return this.computePoolId(poolKey)\n }\n \n /**\n * Check if the auction has graduated (ready for migration)\n */\n async hasGraduated(): Promise<boolean> {\n const tokenAddress = await this.getTokenAddress()\n const chainId = await this.client.getChainId()\n const addresses = getAddresses(chainId)\n \n const assetData = await this.client.readContract({\n address: addresses.airlock,\n abi: airlockAbi,\n functionName: 'getAssetData',\n args: [tokenAddress],\n })\n \n // The getAssetData returns: [numeraire, timelock, governance, liquidityMigrator, poolInitializer, pool, migrationPool, numTokensToSell, totalSupply, integrator]\n // Check if the asset is graduated (liquidityMigrator is set to address(0))\n return assetData[3] === '0x0000000000000000000000000000000000000000'\n }\n \n /**\n * Get the current epoch\n */\n async getCurrentEpoch(): Promise<number> {\n const [startingTime, epochLength] = await Promise.all([\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'startingTime',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'epochLength',\n }),\n ])\n \n const currentTime = BigInt(Math.floor(Date.now() / 1000))\n const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0)\n \n return Number(elapsedTime / epochLength)\n }\n \n /**\n * Get the current price in the auction\n * Returns the current tick based on the epoch and gamma parameters\n */\n async getCurrentPrice(): Promise<bigint> {\n const [\n state,\n startingTick,\n endingTick,\n gamma,\n startingTime,\n epochLength,\n ] = await Promise.all([\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'state',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'startingTick',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'endingTick',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'gamma',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'startingTime',\n }),\n this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'epochLength',\n }),\n ])\n \n // Calculate current epoch\n const currentTime = BigInt(Math.floor(Date.now() / 1000))\n const elapsedTime = currentTime > startingTime ? currentTime - startingTime : BigInt(0)\n const currentEpoch = epochLength > 0n ? Number(elapsedTime / epochLength) : 0\n \n // Calculate current tick based on the auction progression\n // The tick moves from startingTick towards endingTick based on epochs and gamma\n const direction = endingTick > startingTick ? 1 : -1\n const tickMovement = Math.floor(currentEpoch * gamma * direction)\n const currentTick = Math.floor(startingTick + tickMovement)\n \n // Convert tick to price\n // price = 1.0001^tick\n // For simplicity, returning the tick as bigint for now\n // In production, you'd convert this to actual price using TickMath\n return BigInt(currentTick)\n }\n \n /**\n * Get total proceeds collected so far\n */\n async getTotalProceeds(): Promise<bigint> {\n const state = await this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'state',\n })\n \n return state.totalProceeds\n }\n \n /**\n * Check if the auction ended early due to max proceeds\n */\n async hasEndedEarly(): Promise<boolean> {\n return await this.client.readContract({\n address: this.hookAddress,\n abi: dopplerHookAbi,\n functionName: 'earlyExit',\n })\n }\n \n /**\n * Compute V4 pool ID from pool key components\n */\n private computePoolId(poolKey: {\n currency0: Address\n currency1: Address \n fee: number\n tickSpacing: number\n hooks: Address\n }): string {\n // V4 pools are identified by the hash of their PoolKey\n const encoded = encodeAbiParameters(\n [\n { type: 'address' },\n { type: 'address' },\n { type: 'uint24' },\n { type: 'int24' },\n { type: 'address' }\n ],\n [\n poolKey.currency0,\n poolKey.currency1,\n poolKey.fee,\n poolKey.tickSpacing,\n poolKey.hooks\n ]\n )\n return keccak256(encoded)\n }\n}"]}
@@ -0,0 +1,67 @@
1
+ import { getNearestUsableTick, priceToTick, tickToPrice } from './chunk-4K5GBNQV.mjs';
2
+ import { parseEther, formatEther } from 'viem';
3
+
4
+ function calculateTickRange(minPrice, maxPrice, tickSpacing, wethDecimals = 18, tokenDecimals = 18) {
5
+ const startTick = getNearestUsableTick(
6
+ priceToTick(1 / maxPrice, tokenDecimals, wethDecimals),
7
+ tickSpacing
8
+ );
9
+ const endTick = getNearestUsableTick(
10
+ priceToTick(1 / minPrice, tokenDecimals, wethDecimals),
11
+ tickSpacing
12
+ );
13
+ return { startTick, endTick };
14
+ }
15
+ function calculateTokensToSell(targetRaiseETH, avgPricePerToken) {
16
+ const tokensToSell = targetRaiseETH / avgPricePerToken;
17
+ return parseEther(tokensToSell.toFixed(18));
18
+ }
19
+ function calculateGamma(startTick, endTick, durationDays, epochLengthHours) {
20
+ const totalEpochs = durationDays * 24 / epochLengthHours;
21
+ const tickRange = Math.abs(endTick - startTick);
22
+ return Math.floor(tickRange / totalEpochs);
23
+ }
24
+ function estimatePriceAtEpoch(startTick, gamma, currentEpoch, tokenDecimals = 18, wethDecimals = 18, isIncreasing = true) {
25
+ const direction = isIncreasing ? 1 : -1;
26
+ const currentTick = startTick + currentEpoch * gamma * direction;
27
+ const wethPerToken = tickToPrice(currentTick, tokenDecimals, wethDecimals, false);
28
+ return 1 / wethPerToken;
29
+ }
30
+ function formatTickAsPrice(tick, tokenSymbol, numeraireSymbol, tokenDecimals = 18, numeraireDecimals = 18) {
31
+ const price = tickToPrice(tick, tokenDecimals, numeraireDecimals, false);
32
+ const ethPerToken = 1 / price;
33
+ if (ethPerToken < 1e-4) {
34
+ return `${ethPerToken.toExponential(2)} ${numeraireSymbol} per ${tokenSymbol}`;
35
+ } else if (ethPerToken < 1) {
36
+ return `${ethPerToken.toFixed(6)} ${numeraireSymbol} per ${tokenSymbol}`;
37
+ } else {
38
+ return `${ethPerToken.toFixed(2)} ${numeraireSymbol} per ${tokenSymbol}`;
39
+ }
40
+ }
41
+ function calculateMarketCap(totalSupply, pricePerToken, ethPrice) {
42
+ const totalSupplyNumber = Number(formatEther(totalSupply));
43
+ const marketCapETH = totalSupplyNumber * pricePerToken;
44
+ const result = {
45
+ eth: `${marketCapETH.toFixed(2)} ETH`
46
+ };
47
+ if (ethPrice) {
48
+ const marketCapUSD = marketCapETH * ethPrice;
49
+ result.usd = `$${marketCapUSD.toLocaleString("en-US", { maximumFractionDigits: 0 })}`;
50
+ }
51
+ return result;
52
+ }
53
+ function calculateFDV(totalSupply, pricePerToken, ethPrice) {
54
+ return calculateMarketCap(totalSupply, pricePerToken, ethPrice);
55
+ }
56
+ function estimateSlippage(amountIn, liquidity, currentTick, fee) {
57
+ const feeMultiplier = 1 - fee / 1e6;
58
+ const liquidityNumber = Number(liquidity) / 1e18;
59
+ const amountNumber = Number(amountIn) / 1e18;
60
+ const impactRatio = amountNumber / liquidityNumber;
61
+ const slippage = impactRatio * 100 * feeMultiplier;
62
+ return Math.min(slippage, 100);
63
+ }
64
+
65
+ export { calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice };
66
+ //# sourceMappingURL=chunk-AYPP5JEQ.mjs.map
67
+ //# sourceMappingURL=chunk-AYPP5JEQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/priceHelpers.ts"],"names":[],"mappings":";;;AAgBO,SAAS,mBACd,QAAA,EACA,QAAA,EACA,aACA,YAAA,GAAe,EAAA,EACf,gBAAgB,EAAA,EACwB;AAGxC,EAAA,MAAM,SAAA,GAAY,oBAAA;AAAA,IAChB,WAAA,CAAY,CAAA,GAAI,QAAA,EAAU,aAAA,EAAe,YAAY,CAAA;AAAA,IACrD;AAAA,GACF;AAEA,EAAA,MAAM,OAAA,GAAU,oBAAA;AAAA,IACd,WAAA,CAAY,CAAA,GAAI,QAAA,EAAU,aAAA,EAAe,YAAY,CAAA;AAAA,IACrD;AAAA,GACF;AAEA,EAAA,OAAO,EAAE,WAAW,OAAA,EAAQ;AAC9B;AAQO,SAAS,qBAAA,CACd,gBACA,gBAAA,EACQ;AACR,EAAA,MAAM,eAAe,cAAA,GAAiB,gBAAA;AACtC,EAAA,OAAO,UAAA,CAAW,YAAA,CAAa,OAAA,CAAQ,EAAE,CAAC,CAAA;AAC5C;AAUO,SAAS,cAAA,CACd,SAAA,EACA,OAAA,EACA,YAAA,EACA,gBAAA,EACQ;AACR,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AA;AAAA,EACxE;AACF;AASO,SAAS,kBAAA,CACd,WAAA,EACA,aAAA,EACA,QAAA,EAC+B;AAC/B,EAAA,MAAM,iBAAA,GAAoB,MAAA,CAAO,WAAA,CAAY,WAAW,CAAC,CAAA;AACzD,EAAA,MAAM,eAAe,iBAAA,GAAoB,aAAA;AAEzC,EAAA,MAAM,MAAA,GAAwC;AAAA,IAC5C,GAAA,EAAK,CAAA,EAAG,YAAA,CAAa,OAAA,CAAQ,CAAC,CAAC,CAAA,IAAA;AAAA,GACjC;AAEA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,MAAM,eAAe,YAAA,GAAe,QAAA;AACpC,IAAA,MAAA,CAAO,GAAA,GAAM,IAAI,YAAA,CAAa,cAAA,CAAe,SAAS,EAAE,qBAAA,EAAuB,CAAA,EAAG,CAAC,CAAA,CAAA;AAAA,EACrF;AAEA,EAAA,OAAO,MAAA;AACT;AASO,SAAS,YAAA,CACd,WAAA,EACA,aAAA,EACA,QAAA,EAC+B;AAE/B,EAAA,OAAO,kBAAA,CAAmB,WAAA,EAAa,aAAA,EAAe,QAAQ,CAAA;AAChE;AAUO,SAAS,gBAAA,CACd,QAAA,EACA,SAAA,EACA,WAAA,EACA,GAAA,EACQ;AAGR,EAAA,MAAM,aAAA,GAAgB,IAAK,GAAA,GAAM,GAAA;AACjC,EAAA,MAAM,eAAA,GAAkB,MAAA,CAAO,SAAS,CAAA,GAAI,IAAA;AAC5C,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,QAAQ,CAAA,GAAI,IAAA;AAGxC,EAAA,MAAM,cAAc,YAAA,GAAe,eAAA;AACnC,EAAA,MAAM,QAAA,GAAW,cAAc,GAAA,GAAM,aAAA;AAErC,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,QAAA,EAAU,GAAG,CAAA;AAC/B","file":"chunk-AYPP5JEQ.mjs","sourcesContent":["/**\n * Price helper utilities for common token launch scenarios\n */\n\nimport { parseEther, formatEther } from 'viem'\nimport { priceToTick, tickToPrice, getNearestUsableTick } from './tickMath'\n\n/**\n * Calculate the tick range for a desired price range\n * @param minPrice Minimum price (ETH per token)\n * @param maxPrice Maximum price (ETH per token)\n * @param tickSpacing The tick spacing of the pool\n * @param wethDecimals Decimals of WETH (usually 18)\n * @param tokenDecimals Decimals of the token (usually 18)\n * @returns Object with startTick and endTick\n */\nexport function calculateTickRange(\n minPrice: number,\n maxPrice: number,\n tickSpacing: number,\n wethDecimals = 18,\n tokenDecimals = 18\n): { startTick: number; endTick: number } {\n // For token/WETH pools, we need to invert the price\n // because Uniswap orders tokens by address\n const startTick = getNearestUsableTick(\n priceToTick(1 / maxPrice, tokenDecimals, wethDecimals),\n tickSpacing\n )\n \n const endTick = getNearestUsableTick(\n priceToTick(1 / minPrice, tokenDecimals, wethDecimals),\n tickSpacing\n )\n \n return { startTick, endTick }\n}\n\n/**\n * Calculate the number of tokens to sell based on desired raise\n * @param targetRaiseETH Target amount to raise in ETH\n * @param avgPricePerToken Average expected price per token in ETH\n * @returns Number of tokens to sell (as bigint)\n */\nexport function calculateTokensToSell(\n targetRaiseETH: number,\n avgPricePerToken: number\n): bigint {\n const tokensToSell = targetRaiseETH / avgPricePerToken\n return parseEther(tokensToSell.toFixed(18))\n}\n\n/**\n * Calculate gamma for dynamic auctions\n * @param startTick Starting tick\n * @param endTick Ending tick\n * @param durationDays Duration in days\n * @param epochLengthHours Epoch length in hours\n * @returns Gamma value\n */\nexport function calculateGamma(\n startTick: number,\n endTick: number,\n durationDays: number,\n epochLengthHours: number\n): number {\n const totalEpochs = (durationDays * 24) / epochLengthHours\n const tickRange = Math.abs(endTick - startTick)\n return Math.floor(tickRange / totalEpochs)\n}\n\n/**\n * Estimate the price at a specific epoch in a dynamic auction\n * @param startTick Starting tick\n * @param gamma Tick movement per epoch\n * @param currentEpoch Current epoch number\n * @param tokenDecimals Token decimals\n * @param wethDecimals WETH decimals\n * @param isIncreasing Whether price increases (true) or decreases (false) over time\n * @returns Estimated price in ETH per token\n */\nexport function estimatePriceAtEpoch(\n startTick: number,\n gamma: number,\n currentEpoch: number,\n tokenDecimals = 18,\n wethDecimals = 18,\n isIncreasing = true\n): number {\n const direction = isIncreasing ? 1 : -1\n const currentTick = startTick + (currentEpoch * gamma * direction)\n \n // Get price from tick (returns WETH/token)\n const wethPerToken = tickToPrice(currentTick, tokenDecimals, wethDecimals, false)\n \n // Invert to get ETH per token\n return 1 / wethPerToken\n}\n\n/**\n * Format a tick value to a human-readable price string\n * @param tick The tick value\n * @param tokenSymbol Symbol of the token\n * @param numeraireSymbol Symbol of the numeraire (e.g., \"ETH\")\n * @param tokenDecimals Token decimals\n * @param numeraireDecimals Numeraire decimals\n * @returns Formatted price string\n */\nexport function formatTickAsPrice(\n tick: number,\n tokenSymbol: string,\n numeraireSymbol: string,\n tokenDecimals = 18,\n numeraireDecimals = 18\n): string {\n const price = tickToPrice(tick, tokenDecimals, numeraireDecimals, false)\n const ethPerToken = 1 / price\n \n if (ethPerToken < 0.0001) {\n return `${ethPerToken.toExponential(2)} ${numeraireSymbol} per ${tokenSymbol}`\n } else if (ethPerToken < 1) {\n return `${ethPerToken.toFixed(6)} ${numeraireSymbol} per ${tokenSymbol}`\n } else {\n return `${ethPerToken.toFixed(2)} ${numeraireSymbol} per ${tokenSymbol}`\n }\n}\n\n/**\n * Calculate the market cap at a given price\n * @param totalSupply Total token supply (as bigint)\n * @param pricePerToken Price per token in ETH\n * @param ethPrice Current ETH price in USD (optional)\n * @returns Market cap object with ETH and USD values\n */\nexport function calculateMarketCap(\n totalSupply: bigint,\n pricePerToken: number,\n ethPrice?: number\n): { eth: string; usd?: string } {\n const totalSupplyNumber = Number(formatEther(totalSupply))\n const marketCapETH = totalSupplyNumber * pricePerToken\n \n const result: { eth: string; usd?: string } = {\n eth: `${marketCapETH.toFixed(2)} ETH`\n }\n \n if (ethPrice) {\n const marketCapUSD = marketCapETH * ethPrice\n result.usd = `$${marketCapUSD.toLocaleString('en-US', { maximumFractionDigits: 0 })}`\n }\n \n return result\n}\n\n/**\n * Calculate fully diluted valuation (FDV)\n * @param totalSupply Total token supply including vested tokens (as bigint)\n * @param pricePerToken Price per token in ETH\n * @param ethPrice Current ETH price in USD (optional)\n * @returns FDV object with ETH and USD values\n */\nexport function calculateFDV(\n totalSupply: bigint,\n pricePerToken: number,\n ethPrice?: number\n): { eth: string; usd?: string } {\n // FDV is the same calculation as market cap but includes all tokens\n return calculateMarketCap(totalSupply, pricePerToken, ethPrice)\n}\n\n/**\n * Estimate slippage for a trade in a concentrated liquidity pool\n * @param amountIn Amount to trade\n * @param liquidity Current liquidity\n * @param currentTick Current tick\n * @param fee Pool fee (e.g., 3000 for 0.3%)\n * @returns Estimated slippage percentage\n */\nexport function estimateSlippage(\n amountIn: bigint,\n liquidity: bigint,\n currentTick: number,\n fee: number\n): number {\n // Simplified slippage estimation\n // In practice, you'd need to simulate the swap through tick ranges\n const feeMultiplier = 1 - (fee / 1000000)\n const liquidityNumber = Number(liquidity) / 1e18\n const amountNumber = Number(amountIn) / 1e18\n \n // Basic approximation: slippage increases with trade size relative to liquidity\n const impactRatio = amountNumber / liquidityNumber\n const slippage = impactRatio * 100 * feeMultiplier\n \n return Math.min(slippage, 100) // Cap at 100%\n}"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-AZLFJNTG.mjs.map
3
+ //# sourceMappingURL=chunk-AZLFJNTG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-AZLFJNTG.mjs"}