@whetstone-research/doppler-sdk 0.0.1-alpha.8 → 0.0.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 (368) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +726 -25
  3. package/dist/DopplerSDK.d.mts +45 -7
  4. package/dist/DopplerSDK.d.ts +45 -7
  5. package/dist/DopplerSDK.js +35 -12
  6. package/dist/DopplerSDK.mjs +34 -11
  7. package/dist/abis/bytecodes.d.mts +3 -2
  8. package/dist/abis/bytecodes.d.ts +3 -2
  9. package/dist/abis/bytecodes.js +9 -6
  10. package/dist/abis/bytecodes.mjs +1 -2
  11. package/dist/abis/index.d.mts +1507 -129
  12. package/dist/abis/index.d.ts +1507 -129
  13. package/dist/abis/index.js +43 -20
  14. package/dist/abis/index.mjs +2 -3
  15. package/dist/addresses.d.mts +16 -3
  16. package/dist/addresses.d.ts +16 -3
  17. package/dist/addresses.js +13 -5
  18. package/dist/addresses.mjs +2 -2
  19. package/dist/builders/DynamicAuctionBuilder.d.mts +119 -0
  20. package/dist/builders/DynamicAuctionBuilder.d.ts +119 -0
  21. package/dist/builders/DynamicAuctionBuilder.js +29 -0
  22. package/dist/builders/DynamicAuctionBuilder.js.map +1 -0
  23. package/dist/builders/DynamicAuctionBuilder.mjs +20 -0
  24. package/dist/builders/DynamicAuctionBuilder.mjs.map +1 -0
  25. package/dist/builders/MulticurveBuilder.d.mts +132 -0
  26. package/dist/builders/MulticurveBuilder.d.ts +132 -0
  27. package/dist/builders/MulticurveBuilder.js +29 -0
  28. package/dist/builders/MulticurveBuilder.js.map +1 -0
  29. package/dist/builders/MulticurveBuilder.mjs +20 -0
  30. package/dist/builders/MulticurveBuilder.mjs.map +1 -0
  31. package/dist/builders/StaticAuctionBuilder.d.mts +124 -0
  32. package/dist/builders/StaticAuctionBuilder.d.ts +124 -0
  33. package/dist/builders/StaticAuctionBuilder.js +29 -0
  34. package/dist/builders/StaticAuctionBuilder.js.map +1 -0
  35. package/dist/builders/StaticAuctionBuilder.mjs +20 -0
  36. package/dist/builders/StaticAuctionBuilder.mjs.map +1 -0
  37. package/dist/builders/index.d.mts +8 -0
  38. package/dist/builders/index.d.ts +8 -0
  39. package/dist/builders/index.js +56 -0
  40. package/dist/builders/index.js.map +1 -0
  41. package/dist/builders/index.mjs +23 -0
  42. package/dist/builders/index.mjs.map +1 -0
  43. package/dist/builders/shared.d.mts +116 -0
  44. package/dist/builders/shared.d.ts +116 -0
  45. package/dist/builders/shared.js +39 -0
  46. package/dist/builders/shared.js.map +1 -0
  47. package/dist/builders/shared.mjs +18 -0
  48. package/dist/builders/shared.mjs.map +1 -0
  49. package/dist/builders.d.mts +8 -131
  50. package/dist/builders.d.ts +8 -131
  51. package/dist/builders.js +44 -5
  52. package/dist/builders.mjs +22 -3
  53. package/dist/chunk-3PNCB4W5.js +4 -0
  54. package/dist/{chunk-KRN3ROUE.js.map → chunk-3PNCB4W5.js.map} +1 -1
  55. package/dist/chunk-3RK7LRAA.js +282 -0
  56. package/dist/chunk-3RK7LRAA.js.map +1 -0
  57. package/dist/chunk-4HM3ERBU.js +13 -0
  58. package/dist/chunk-4HM3ERBU.js.map +1 -0
  59. package/dist/{chunk-7W72MFJO.mjs → chunk-4TROGENW.mjs} +5 -4
  60. package/dist/chunk-4TROGENW.mjs.map +1 -0
  61. package/dist/chunk-5TL5V6UX.mjs +3 -0
  62. package/dist/{chunk-AZLFJNTG.mjs.map → chunk-5TL5V6UX.mjs.map} +1 -1
  63. package/dist/chunk-64AWG57M.mjs +192 -0
  64. package/dist/chunk-64AWG57M.mjs.map +1 -0
  65. package/dist/chunk-6KWCHTK3.js +166 -0
  66. package/dist/chunk-6KWCHTK3.js.map +1 -0
  67. package/dist/chunk-6OOWOPCX.js +1708 -0
  68. package/dist/chunk-6OOWOPCX.js.map +1 -0
  69. package/dist/chunk-7BBRPWQJ.js +257 -0
  70. package/dist/chunk-7BBRPWQJ.js.map +1 -0
  71. package/dist/{chunk-FVTIDXYK.mjs → chunk-AKSEBAR7.mjs} +29 -19
  72. package/dist/chunk-AKSEBAR7.mjs.map +1 -0
  73. package/dist/chunk-AS64GWBX.js +204 -0
  74. package/dist/chunk-AS64GWBX.js.map +1 -0
  75. package/dist/chunk-AULFBXM5.mjs +331 -0
  76. package/dist/chunk-AULFBXM5.mjs.map +1 -0
  77. package/dist/chunk-AW3WR2D3.mjs +238 -0
  78. package/dist/chunk-AW3WR2D3.mjs.map +1 -0
  79. package/dist/chunk-BIQQ53O2.js +45 -0
  80. package/dist/chunk-BIQQ53O2.js.map +1 -0
  81. package/dist/chunk-C6MPV3CY.js +260 -0
  82. package/dist/chunk-C6MPV3CY.js.map +1 -0
  83. package/dist/{chunk-AYPP5JEQ.mjs → chunk-CLEQO6GU.mjs} +5 -5
  84. package/dist/chunk-CLEQO6GU.mjs.map +1 -0
  85. package/dist/chunk-CVHPLURA.js +147 -0
  86. package/dist/chunk-CVHPLURA.js.map +1 -0
  87. package/dist/chunk-D2RBCFNW.mjs +130 -0
  88. package/dist/chunk-D2RBCFNW.mjs.map +1 -0
  89. package/dist/chunk-ECD4FV3A.mjs +11 -0
  90. package/dist/chunk-ECD4FV3A.mjs.map +1 -0
  91. package/dist/chunk-EDJBZPMW.mjs +255 -0
  92. package/dist/chunk-EDJBZPMW.mjs.map +1 -0
  93. package/dist/chunk-FPAI4QYW.mjs +145 -0
  94. package/dist/chunk-FPAI4QYW.mjs.map +1 -0
  95. package/dist/chunk-HM25ZMO3.js +18 -0
  96. package/dist/chunk-HM25ZMO3.js.map +1 -0
  97. package/dist/chunk-IHC6UYKK.js +4 -0
  98. package/dist/{chunk-DRBRT57F.js.map → chunk-IHC6UYKK.js.map} +1 -1
  99. package/dist/{chunk-DMAHXBA5.mjs → chunk-J5BFFL3X.mjs} +87 -47
  100. package/dist/chunk-J5BFFL3X.mjs.map +1 -0
  101. package/dist/chunk-JIKAD4YL.js +4 -0
  102. package/dist/{chunk-KEXKKQVW.js.map → chunk-JIKAD4YL.js.map} +1 -1
  103. package/dist/{chunk-EFAPDN4J.js → chunk-JWEXGALU.js} +730 -33
  104. package/dist/chunk-JWEXGALU.js.map +1 -0
  105. package/dist/{chunk-4K5GBNQV.mjs → chunk-KDT76YQE.mjs} +52 -13
  106. package/dist/chunk-KDT76YQE.mjs.map +1 -0
  107. package/dist/chunk-LMQLMMEX.js +317 -0
  108. package/dist/chunk-LMQLMMEX.js.map +1 -0
  109. package/dist/{chunk-TOMVBPNZ.js → chunk-LS4TK6SX.js} +9 -4
  110. package/dist/chunk-LS4TK6SX.js.map +1 -0
  111. package/dist/chunk-M4WMHD3X.mjs +40 -0
  112. package/dist/chunk-M4WMHD3X.mjs.map +1 -0
  113. package/dist/chunk-MCOK3UFR.mjs +280 -0
  114. package/dist/chunk-MCOK3UFR.mjs.map +1 -0
  115. package/dist/chunk-MGQSQCFG.js +176 -0
  116. package/dist/chunk-MGQSQCFG.js.map +1 -0
  117. package/dist/chunk-MKE3BUL3.mjs +3 -0
  118. package/dist/{chunk-CYDWEPFL.mjs.map → chunk-MKE3BUL3.mjs.map} +1 -1
  119. package/dist/chunk-MNJ5OYPE.mjs +17 -0
  120. package/dist/chunk-MNJ5OYPE.mjs.map +1 -0
  121. package/dist/chunk-MNXD45J7.mjs +164 -0
  122. package/dist/chunk-MNXD45J7.mjs.map +1 -0
  123. package/dist/chunk-NGDPQC5E.js +333 -0
  124. package/dist/chunk-NGDPQC5E.js.map +1 -0
  125. package/dist/chunk-NNNCVFOH.mjs +16 -0
  126. package/dist/chunk-NNNCVFOH.mjs.map +1 -0
  127. package/dist/chunk-NZ4BJ2IC.mjs +315 -0
  128. package/dist/chunk-NZ4BJ2IC.mjs.map +1 -0
  129. package/dist/chunk-OKNM7ODQ.js +29 -0
  130. package/dist/chunk-OKNM7ODQ.js.map +1 -0
  131. package/dist/{chunk-DCFHANLR.mjs → chunk-OTG75GVH.mjs} +725 -34
  132. package/dist/chunk-OTG75GVH.mjs.map +1 -0
  133. package/dist/chunk-OZ6DGBRL.mjs +25 -0
  134. package/dist/chunk-OZ6DGBRL.mjs.map +1 -0
  135. package/dist/chunk-P25HBGP5.mjs +3 -0
  136. package/dist/chunk-P25HBGP5.mjs.map +1 -0
  137. package/dist/{chunk-XG7K4R56.js → chunk-P7KLEPVI.js} +52 -12
  138. package/dist/chunk-P7KLEPVI.js.map +1 -0
  139. package/dist/{chunk-OPKQMN46.mjs → chunk-PAPXGPJB.mjs} +9 -4
  140. package/dist/chunk-PAPXGPJB.mjs.map +1 -0
  141. package/dist/chunk-PCNXJAU5.js +19 -0
  142. package/dist/chunk-PCNXJAU5.js.map +1 -0
  143. package/dist/{chunk-5IT5OXQ5.js → chunk-PD6HWEMG.js} +40 -30
  144. package/dist/chunk-PD6HWEMG.js.map +1 -0
  145. package/dist/{chunk-ER42VG7H.js → chunk-PH2KXREH.js} +20 -3
  146. package/dist/chunk-PH2KXREH.js.map +1 -0
  147. package/dist/chunk-Q5ERW5ZW.mjs +107 -0
  148. package/dist/chunk-Q5ERW5ZW.mjs.map +1 -0
  149. package/dist/chunk-Q7YNBSVH.js +28 -0
  150. package/dist/chunk-Q7YNBSVH.js.map +1 -0
  151. package/dist/{chunk-T644D54P.mjs → chunk-QKO2FZGN.mjs} +16 -4
  152. package/dist/chunk-QKO2FZGN.mjs.map +1 -0
  153. package/dist/{chunk-CIRZKWLL.js → chunk-RVFSRYI5.js} +5 -3
  154. package/dist/chunk-RVFSRYI5.js.map +1 -0
  155. package/dist/{chunk-KPBCG4X2.js → chunk-RW37KJ77.js} +11 -11
  156. package/dist/chunk-RW37KJ77.js.map +1 -0
  157. package/dist/chunk-SD7BHT2F.mjs +3 -0
  158. package/dist/chunk-SD7BHT2F.mjs.map +1 -0
  159. package/dist/chunk-SP5M57BG.mjs +258 -0
  160. package/dist/chunk-SP5M57BG.mjs.map +1 -0
  161. package/dist/chunk-TKSHYEYA.mjs +1706 -0
  162. package/dist/chunk-TKSHYEYA.mjs.map +1 -0
  163. package/dist/chunk-WTS75RUC.js +4 -0
  164. package/dist/chunk-WTS75RUC.js.map +1 -0
  165. package/dist/{chunk-ZRDU6CIB.js → chunk-XRPIGMA2.js} +108 -68
  166. package/dist/chunk-XRPIGMA2.js.map +1 -0
  167. package/dist/chunk-XTKSM4QE.js +132 -0
  168. package/dist/chunk-XTKSM4QE.js.map +1 -0
  169. package/dist/chunk-XUE3CIJ5.mjs +174 -0
  170. package/dist/chunk-XUE3CIJ5.mjs.map +1 -0
  171. package/dist/chunk-YYUOLM6U.js +244 -0
  172. package/dist/chunk-YYUOLM6U.js.map +1 -0
  173. package/dist/chunk-ZH44DHVR.mjs +26 -0
  174. package/dist/chunk-ZH44DHVR.mjs.map +1 -0
  175. package/dist/chunk-ZPHOOG72.js +112 -0
  176. package/dist/chunk-ZPHOOG72.js.map +1 -0
  177. package/dist/constants.d.mts +7 -2
  178. package/dist/constants.d.ts +7 -2
  179. package/dist/constants.js +57 -38
  180. package/dist/constants.mjs +1 -2
  181. package/dist/deployments.generated.d.mts +2 -0
  182. package/dist/deployments.generated.d.ts +2 -0
  183. package/dist/deployments.generated.js +12 -0
  184. package/dist/deployments.generated.js.map +1 -0
  185. package/dist/deployments.generated.mjs +3 -0
  186. package/dist/deployments.generated.mjs.map +1 -0
  187. package/dist/entities/DopplerFactory.d.mts +139 -11
  188. package/dist/entities/DopplerFactory.d.ts +139 -11
  189. package/dist/entities/DopplerFactory.js +17 -7
  190. package/dist/entities/DopplerFactory.mjs +16 -6
  191. package/dist/entities/auction/DynamicAuction.d.mts +19 -4
  192. package/dist/entities/auction/DynamicAuction.d.ts +19 -4
  193. package/dist/entities/auction/DynamicAuction.js +6 -6
  194. package/dist/entities/auction/DynamicAuction.mjs +5 -5
  195. package/dist/entities/auction/MulticurvePool.d.mts +55 -0
  196. package/dist/entities/auction/MulticurvePool.d.ts +55 -0
  197. package/dist/entities/auction/MulticurvePool.js +18 -0
  198. package/dist/entities/auction/MulticurvePool.js.map +1 -0
  199. package/dist/entities/auction/MulticurvePool.mjs +9 -0
  200. package/dist/entities/auction/MulticurvePool.mjs.map +1 -0
  201. package/dist/entities/auction/StaticAuction.d.mts +6 -3
  202. package/dist/entities/auction/StaticAuction.d.ts +6 -3
  203. package/dist/entities/auction/StaticAuction.js +6 -6
  204. package/dist/entities/auction/StaticAuction.mjs +5 -5
  205. package/dist/entities/auction/index.d.mts +3 -0
  206. package/dist/entities/auction/index.d.ts +3 -0
  207. package/dist/entities/auction/index.js +16 -9
  208. package/dist/entities/auction/index.mjs +10 -7
  209. package/dist/entities/quoter/Quoter.d.mts +44 -2
  210. package/dist/entities/quoter/Quoter.d.ts +44 -2
  211. package/dist/entities/quoter/Quoter.js +6 -6
  212. package/dist/entities/quoter/Quoter.mjs +5 -5
  213. package/dist/entities/quoter/index.d.mts +3 -0
  214. package/dist/entities/quoter/index.d.ts +3 -0
  215. package/dist/entities/quoter/index.js +6 -6
  216. package/dist/entities/quoter/index.mjs +5 -5
  217. package/dist/entities/token/derc20/Derc20.d.mts +33 -7
  218. package/dist/entities/token/derc20/Derc20.d.ts +33 -7
  219. package/dist/entities/token/derc20/Derc20.js +4 -5
  220. package/dist/entities/token/derc20/Derc20.mjs +3 -4
  221. package/dist/entities/token/derc20/index.d.mts +3 -0
  222. package/dist/entities/token/derc20/index.d.ts +3 -0
  223. package/dist/entities/token/derc20/index.js +4 -5
  224. package/dist/entities/token/derc20/index.mjs +3 -4
  225. package/dist/entities/token/eth/Eth.d.mts +7 -3
  226. package/dist/entities/token/eth/Eth.d.ts +7 -3
  227. package/dist/entities/token/eth/Eth.js +2 -3
  228. package/dist/entities/token/eth/Eth.mjs +1 -2
  229. package/dist/entities/token/eth/index.d.mts +3 -0
  230. package/dist/entities/token/eth/index.d.ts +3 -0
  231. package/dist/entities/token/eth/index.js +2 -3
  232. package/dist/entities/token/eth/index.mjs +1 -2
  233. package/dist/entities/token/index.d.mts +3 -0
  234. package/dist/entities/token/index.d.ts +3 -0
  235. package/dist/entities/token/index.js +6 -7
  236. package/dist/entities/token/index.mjs +4 -5
  237. package/dist/index.d.mts +18 -6
  238. package/dist/index.d.ts +18 -6
  239. package/dist/index.js +305 -140
  240. package/dist/index.js.map +1 -1
  241. package/dist/index.mjs +32 -19
  242. package/dist/index.mjs.map +1 -1
  243. package/dist/types.d.mts +260 -22
  244. package/dist/types.d.ts +260 -22
  245. package/dist/types.js +12 -3
  246. package/dist/types.mjs +3 -2
  247. package/dist/utils/airlock.d.mts +11 -0
  248. package/dist/utils/airlock.d.ts +11 -0
  249. package/dist/utils/airlock.js +26 -0
  250. package/dist/utils/airlock.js.map +1 -0
  251. package/dist/utils/airlock.mjs +5 -0
  252. package/dist/utils/airlock.mjs.map +1 -0
  253. package/dist/utils/balanceDelta.d.mts +10 -0
  254. package/dist/utils/balanceDelta.d.ts +10 -0
  255. package/dist/utils/balanceDelta.js +12 -0
  256. package/dist/utils/balanceDelta.js.map +1 -0
  257. package/dist/utils/balanceDelta.mjs +3 -0
  258. package/dist/utils/balanceDelta.mjs.map +1 -0
  259. package/dist/utils/computeOptimalGamma.d.mts +7 -0
  260. package/dist/utils/computeOptimalGamma.d.ts +7 -0
  261. package/dist/utils/computeOptimalGamma.js +12 -0
  262. package/dist/utils/computeOptimalGamma.js.map +1 -0
  263. package/dist/utils/computeOptimalGamma.mjs +3 -0
  264. package/dist/utils/computeOptimalGamma.mjs.map +1 -0
  265. package/dist/utils/index.d.mts +11 -0
  266. package/dist/utils/index.d.ts +11 -0
  267. package/dist/utils/index.js +114 -24
  268. package/dist/utils/index.mjs +14 -4
  269. package/dist/utils/isToken0Expected.d.mts +13 -0
  270. package/dist/utils/isToken0Expected.d.ts +13 -0
  271. package/dist/utils/isToken0Expected.js +12 -0
  272. package/dist/utils/isToken0Expected.js.map +1 -0
  273. package/dist/utils/isToken0Expected.mjs +3 -0
  274. package/dist/utils/isToken0Expected.mjs.map +1 -0
  275. package/dist/utils/marketCapHelpers.d.mts +309 -0
  276. package/dist/utils/marketCapHelpers.d.ts +309 -0
  277. package/dist/utils/marketCapHelpers.js +54 -0
  278. package/dist/utils/marketCapHelpers.js.map +1 -0
  279. package/dist/utils/marketCapHelpers.mjs +5 -0
  280. package/dist/utils/marketCapHelpers.mjs.map +1 -0
  281. package/dist/utils/poolKey.d.mts +17 -0
  282. package/dist/utils/poolKey.d.ts +17 -0
  283. package/dist/utils/poolKey.js +12 -0
  284. package/dist/utils/poolKey.js.map +1 -0
  285. package/dist/utils/poolKey.mjs +3 -0
  286. package/dist/utils/poolKey.mjs.map +1 -0
  287. package/dist/utils/priceHelpers.d.mts +3 -3
  288. package/dist/utils/priceHelpers.d.ts +3 -3
  289. package/dist/utils/priceHelpers.js +10 -11
  290. package/dist/utils/priceHelpers.mjs +2 -3
  291. package/dist/utils/tickMath.d.mts +8 -1
  292. package/dist/utils/tickMath.d.ts +8 -1
  293. package/dist/utils/tickMath.js +17 -14
  294. package/dist/utils/tickMath.mjs +1 -2
  295. package/dist/utils/tokenAddressMiner.d.mts +30 -0
  296. package/dist/utils/tokenAddressMiner.d.ts +30 -0
  297. package/dist/utils/tokenAddressMiner.js +14 -0
  298. package/dist/utils/tokenAddressMiner.js.map +1 -0
  299. package/dist/utils/tokenAddressMiner.mjs +5 -0
  300. package/dist/utils/tokenAddressMiner.mjs.map +1 -0
  301. package/package.json +14 -11
  302. package/dist/__tests__/mocks/addresses.d.mts +0 -46
  303. package/dist/__tests__/mocks/addresses.d.ts +0 -46
  304. package/dist/__tests__/mocks/addresses.js +0 -53
  305. package/dist/__tests__/mocks/addresses.js.map +0 -1
  306. package/dist/__tests__/mocks/addresses.mjs +0 -44
  307. package/dist/__tests__/mocks/addresses.mjs.map +0 -1
  308. package/dist/__tests__/mocks/clients.d.mts +0 -22
  309. package/dist/__tests__/mocks/clients.d.ts +0 -22
  310. package/dist/__tests__/mocks/clients.js +0 -17036
  311. package/dist/__tests__/mocks/clients.js.map +0 -1
  312. package/dist/__tests__/mocks/clients.mjs +0 -17032
  313. package/dist/__tests__/mocks/clients.mjs.map +0 -1
  314. package/dist/chunk-2N5JZSZ4.js +0 -14
  315. package/dist/chunk-2N5JZSZ4.js.map +0 -1
  316. package/dist/chunk-3OZRDL3O.js +0 -162
  317. package/dist/chunk-3OZRDL3O.js.map +0 -1
  318. package/dist/chunk-4K5GBNQV.mjs.map +0 -1
  319. package/dist/chunk-5IT5OXQ5.js.map +0 -1
  320. package/dist/chunk-7F5IXZLH.js +0 -308
  321. package/dist/chunk-7F5IXZLH.js.map +0 -1
  322. package/dist/chunk-7VP5VR7J.js +0 -82
  323. package/dist/chunk-7VP5VR7J.js.map +0 -1
  324. package/dist/chunk-7W72MFJO.mjs.map +0 -1
  325. package/dist/chunk-AYPP5JEQ.mjs.map +0 -1
  326. package/dist/chunk-AZLFJNTG.mjs +0 -3
  327. package/dist/chunk-CIRZKWLL.js.map +0 -1
  328. package/dist/chunk-CYDWEPFL.mjs +0 -3
  329. package/dist/chunk-DCFHANLR.mjs.map +0 -1
  330. package/dist/chunk-DMAHXBA5.mjs.map +0 -1
  331. package/dist/chunk-DRBRT57F.js +0 -4
  332. package/dist/chunk-EFAPDN4J.js.map +0 -1
  333. package/dist/chunk-ER42VG7H.js.map +0 -1
  334. package/dist/chunk-FVTIDXYK.mjs.map +0 -1
  335. package/dist/chunk-IHBIBFZK.mjs +0 -12
  336. package/dist/chunk-IHBIBFZK.mjs.map +0 -1
  337. package/dist/chunk-IXSKPEHB.mjs +0 -160
  338. package/dist/chunk-IXSKPEHB.mjs.map +0 -1
  339. package/dist/chunk-KEXKKQVW.js +0 -42
  340. package/dist/chunk-KFD6U3LQ.mjs +0 -305
  341. package/dist/chunk-KFD6U3LQ.mjs.map +0 -1
  342. package/dist/chunk-KPBCG4X2.js.map +0 -1
  343. package/dist/chunk-KRN3ROUE.js +0 -4
  344. package/dist/chunk-KT7U37XS.mjs +0 -207
  345. package/dist/chunk-KT7U37XS.mjs.map +0 -1
  346. package/dist/chunk-LOROXNH3.mjs +0 -37
  347. package/dist/chunk-LOROXNH3.mjs.map +0 -1
  348. package/dist/chunk-O6GYIJ6X.mjs +0 -80
  349. package/dist/chunk-O6GYIJ6X.mjs.map +0 -1
  350. package/dist/chunk-OPKQMN46.mjs.map +0 -1
  351. package/dist/chunk-RIMM47JL.mjs +0 -176
  352. package/dist/chunk-RIMM47JL.mjs.map +0 -1
  353. package/dist/chunk-SUOMK3CU.js +0 -872
  354. package/dist/chunk-SUOMK3CU.js.map +0 -1
  355. package/dist/chunk-T644D54P.mjs.map +0 -1
  356. package/dist/chunk-TOMVBPNZ.js.map +0 -1
  357. package/dist/chunk-XEMZQHTX.mjs +0 -870
  358. package/dist/chunk-XEMZQHTX.mjs.map +0 -1
  359. package/dist/chunk-XG7K4R56.js.map +0 -1
  360. package/dist/chunk-XQ2VMR26.js +0 -180
  361. package/dist/chunk-XQ2VMR26.js.map +0 -1
  362. package/dist/chunk-ZAIP54LX.js +0 -209
  363. package/dist/chunk-ZAIP54LX.js.map +0 -1
  364. package/dist/chunk-ZRDU6CIB.js.map +0 -1
  365. package/dist/magic-string.es-CBLXTCZP.js +0 -1304
  366. package/dist/magic-string.es-CBLXTCZP.js.map +0 -1
  367. package/dist/magic-string.es-QHA47FSB.mjs +0 -1298
  368. package/dist/magic-string.es-QHA47FSB.mjs.map +0 -1
@@ -1,872 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkXQ2VMR26_js = require('./chunk-XQ2VMR26.js');
4
- var chunkER42VG7H_js = require('./chunk-ER42VG7H.js');
5
- var chunkEFAPDN4J_js = require('./chunk-EFAPDN4J.js');
6
- var chunkCIRZKWLL_js = require('./chunk-CIRZKWLL.js');
7
- var viem = require('viem');
8
-
9
- var DopplerFactory = class {
10
- constructor(publicClient, walletClient, chainId) {
11
- this.publicClient = publicClient;
12
- this.walletClient = walletClient;
13
- this.chainId = chainId;
14
- }
15
- // Note: The legacy buildDynamicAuctionConfig and buildStaticAuctionConfig helper methods
16
- // have been removed in favor of dedicated builders that construct
17
- // CreateDynamicAuctionParams and CreateStaticAuctionParams.
18
- /**
19
- * Create a new static auction (using Uniswap V3 for initial liquidity)
20
- * @param params Configuration for the static auction
21
- * @returns The address of the created pool and token
22
- */
23
- async createStaticAuction(params) {
24
- this.validateStaticAuctionParams(params);
25
- const addresses = chunkXQ2VMR26_js.getAddresses(this.chainId);
26
- const poolInitializerData = viem.encodeAbiParameters(
27
- [
28
- {
29
- type: "tuple",
30
- components: [
31
- { type: "uint24", name: "fee" },
32
- { type: "int24", name: "tickLower" },
33
- { type: "int24", name: "tickUpper" },
34
- { type: "uint16", name: "numPositions" },
35
- { type: "uint256", name: "maxShareToBeSold" }
36
- ]
37
- }
38
- ],
39
- [{
40
- fee: params.pool.fee,
41
- tickLower: params.pool.startTick,
42
- tickUpper: params.pool.endTick,
43
- numPositions: params.pool.numPositions ?? chunkER42VG7H_js.DEFAULT_V3_NUM_POSITIONS,
44
- maxShareToBeSold: params.pool.maxShareToBeSold ?? chunkER42VG7H_js.DEFAULT_V3_MAX_SHARE_TO_BE_SOLD
45
- }]
46
- );
47
- const liquidityMigratorData = this.encodeMigrationData(params.migration);
48
- const isDoppler404 = params.token.type === "doppler404";
49
- let tokenFactoryData;
50
- if (isDoppler404) {
51
- const baseURI = params.token.baseURI;
52
- const unit = params.token.unit !== void 0 ? BigInt(params.token.unit) : 1000n;
53
- if (!addresses.doppler404Factory || addresses.doppler404Factory === chunkER42VG7H_js.ZERO_ADDRESS) {
54
- throw new Error("Doppler404 factory address not configured for this chain");
55
- }
56
- tokenFactoryData = viem.encodeAbiParameters(
57
- [
58
- { type: "string" },
59
- { type: "string" },
60
- { type: "string" },
61
- { type: "uint256" }
62
- ],
63
- [
64
- params.token.name,
65
- params.token.symbol,
66
- baseURI,
67
- unit
68
- ]
69
- );
70
- } else {
71
- const vestingDuration = params.vesting?.duration ?? BigInt(0);
72
- const yearlyMintRate = params.token.yearlyMintRate ?? chunkER42VG7H_js.DEFAULT_V3_YEARLY_MINT_RATE;
73
- tokenFactoryData = viem.encodeAbiParameters(
74
- [
75
- { type: "string" },
76
- { type: "string" },
77
- { type: "uint256" },
78
- { type: "uint256" },
79
- { type: "address[]" },
80
- { type: "uint256[]" },
81
- { type: "string" }
82
- ],
83
- [
84
- params.token.name,
85
- params.token.symbol,
86
- yearlyMintRate,
87
- BigInt(vestingDuration),
88
- params.vesting ? [params.userAddress] : [],
89
- params.vesting ? [params.sale.initialSupply - params.sale.numTokensToSell] : [],
90
- params.token.tokenURI
91
- ]
92
- );
93
- }
94
- const standardGovernanceParams = params.governance?.noOp === true ? void 0 : params.governance;
95
- const governanceFactoryData = viem.encodeAbiParameters(
96
- [
97
- { type: "string" },
98
- { type: "uint48" },
99
- { type: "uint32" },
100
- { type: "uint256" }
101
- ],
102
- [
103
- params.token.name,
104
- standardGovernanceParams?.initialVotingDelay ?? chunkER42VG7H_js.DEFAULT_V3_INITIAL_VOTING_DELAY,
105
- standardGovernanceParams?.initialVotingPeriod ?? chunkER42VG7H_js.DEFAULT_V3_INITIAL_VOTING_PERIOD,
106
- standardGovernanceParams?.initialProposalThreshold ?? chunkER42VG7H_js.DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD
107
- ]
108
- );
109
- const useNoOpGovernance = typeof params.governance?.noOp === "boolean" && params.governance.noOp === true;
110
- const governanceFactoryAddress = (() => {
111
- if (useNoOpGovernance) {
112
- const noOpGovernanceFactoryAddress = addresses.noOpGovernanceFactory ?? chunkER42VG7H_js.ZERO_ADDRESS;
113
- if (!noOpGovernanceFactoryAddress || noOpGovernanceFactoryAddress === chunkER42VG7H_js.ZERO_ADDRESS) {
114
- throw new Error("No-op governance requested, but noOpGovernanceFactory is not deployed on this chain. Provide standard governance via withGovernance() or use a supported chain.");
115
- }
116
- return noOpGovernanceFactoryAddress;
117
- }
118
- const standardGovernanceFactoryAddress = addresses.governanceFactory;
119
- if (!standardGovernanceFactoryAddress || standardGovernanceFactoryAddress === chunkER42VG7H_js.ZERO_ADDRESS) {
120
- throw new Error("Standard governance requested but governanceFactory is not deployed on this chain.");
121
- }
122
- return standardGovernanceFactoryAddress;
123
- })();
124
- const salt = this.generateRandomSalt(params.userAddress);
125
- const createParams = {
126
- initialSupply: params.sale.initialSupply,
127
- numTokensToSell: params.sale.numTokensToSell,
128
- numeraire: params.sale.numeraire,
129
- tokenFactory: isDoppler404 ? addresses.doppler404Factory : addresses.tokenFactory,
130
- tokenFactoryData,
131
- governanceFactory: governanceFactoryAddress,
132
- governanceFactoryData,
133
- poolInitializer: addresses.v3Initializer,
134
- poolInitializerData,
135
- liquidityMigrator: this.getMigratorAddress(params.migration),
136
- liquidityMigratorData,
137
- integrator: params.integrator ?? chunkER42VG7H_js.ZERO_ADDRESS,
138
- salt
139
- };
140
- if (!this.walletClient) {
141
- throw new Error("Wallet client required for write operations");
142
- }
143
- const { request, result } = await this.publicClient.simulateContract({
144
- address: addresses.airlock,
145
- abi: chunkEFAPDN4J_js.airlockAbi,
146
- functionName: "create",
147
- args: [{ ...createParams }],
148
- account: this.walletClient.account
149
- });
150
- const hash = await this.walletClient.writeContract(request);
151
- const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
152
- if (result && Array.isArray(result) && result.length >= 2) {
153
- return {
154
- poolAddress: result[1],
155
- // pool is the second element
156
- tokenAddress: result[0],
157
- // asset (token) is the first element
158
- transactionHash: hash
159
- };
160
- }
161
- const createEvent = receipt.logs.find((log) => {
162
- try {
163
- const decoded = viem.decodeEventLog({
164
- abi: chunkEFAPDN4J_js.airlockAbi,
165
- data: log.data,
166
- topics: log.topics
167
- });
168
- return decoded.eventName === "Create";
169
- } catch {
170
- return false;
171
- }
172
- });
173
- if (createEvent) {
174
- const decoded = viem.decodeEventLog({
175
- abi: chunkEFAPDN4J_js.airlockAbi,
176
- data: createEvent.data,
177
- topics: createEvent.topics
178
- });
179
- if (decoded.eventName === "Create") {
180
- return {
181
- poolAddress: decoded.args.poolOrHook,
182
- tokenAddress: decoded.args.asset,
183
- transactionHash: hash
184
- };
185
- }
186
- }
187
- throw new Error("Failed to get pool and token addresses from transaction");
188
- }
189
- /**
190
- * Generate a random salt based on user address
191
- */
192
- generateRandomSalt(account) {
193
- const array = new Uint8Array(32);
194
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
195
- crypto.getRandomValues(array);
196
- } else {
197
- const timestamp = Date.now();
198
- const timestampBytes = new Uint8Array(8);
199
- for (let i = 0; i < 8; i++) {
200
- timestampBytes[i] = timestamp >> i * 8 & 255;
201
- }
202
- for (let i = 0; i < 32; i++) {
203
- if (i < 8) {
204
- array[i] = timestampBytes[i];
205
- } else {
206
- array[i] = i;
207
- }
208
- }
209
- }
210
- if (account) {
211
- const addressBytes = account.slice(2).padStart(40, "0");
212
- for (let i = 0; i < 20; i++) {
213
- const addressByte = parseInt(
214
- addressBytes.slice(i * 2, (i + 1) * 2),
215
- 16
216
- );
217
- array[i] ^= addressByte;
218
- }
219
- }
220
- return `0x${Array.from(array).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
221
- }
222
- /**
223
- * Create a new dynamic auction (using Uniswap V4 hook for gradual Dutch auction)
224
- * @param params Configuration for the dynamic auction
225
- * @returns The address of the created hook and token
226
- */
227
- async createDynamicAuction(params) {
228
- this.validateDynamicAuctionParams(params);
229
- const addresses = chunkXQ2VMR26_js.getAddresses(this.chainId);
230
- const gamma = params.auction.gamma ?? this.computeOptimalGamma(
231
- params.auction.startTick,
232
- params.auction.endTick,
233
- params.auction.duration,
234
- params.auction.epochLength,
235
- params.pool.tickSpacing
236
- );
237
- let blockTimestamp;
238
- if (params.blockTimestamp !== void 0) {
239
- blockTimestamp = params.blockTimestamp;
240
- } else {
241
- const latestBlock = await this.publicClient.getBlock({ blockTag: "latest" });
242
- blockTimestamp = Number(latestBlock.timestamp);
243
- }
244
- const startTimeOffset = params.startTimeOffset ?? 30;
245
- const startTime = blockTimestamp + startTimeOffset;
246
- const endTime = blockTimestamp + params.auction.duration * chunkER42VG7H_js.DAY_SECONDS + startTimeOffset;
247
- const dopplerData = {
248
- minimumProceeds: params.auction.minProceeds,
249
- maximumProceeds: params.auction.maxProceeds,
250
- startingTime: BigInt(startTime),
251
- endingTime: BigInt(endTime),
252
- startingTick: params.auction.startTick,
253
- endingTick: params.auction.endTick,
254
- epochLength: BigInt(params.auction.epochLength),
255
- gamma,
256
- isToken0: false,
257
- // Will be determined during mining
258
- numPDSlugs: BigInt(params.auction.numPdSlugs ?? chunkER42VG7H_js.DEFAULT_PD_SLUGS),
259
- fee: params.pool.fee,
260
- tickSpacing: params.pool.tickSpacing
261
- };
262
- const isDoppler404 = params.token.type === "doppler404";
263
- if (isDoppler404) {
264
- if (!addresses.doppler404Factory || addresses.doppler404Factory === chunkER42VG7H_js.ZERO_ADDRESS) {
265
- throw new Error("Doppler404 factory address not configured for this chain");
266
- }
267
- }
268
- const vestingDuration = params.vesting?.duration ?? BigInt(0);
269
- const tokenFactoryData = isDoppler404 ? {
270
- name: params.token.name,
271
- symbol: params.token.symbol,
272
- baseURI: params.token.baseURI,
273
- unit: params.token.unit !== void 0 ? BigInt(params.token.unit) : 1000n
274
- } : {
275
- name: params.token.name,
276
- symbol: params.token.symbol,
277
- initialSupply: params.sale.initialSupply,
278
- airlock: addresses.airlock,
279
- yearlyMintRate: params.token.yearlyMintRate ?? chunkER42VG7H_js.DEFAULT_V4_YEARLY_MINT_RATE,
280
- vestingDuration: BigInt(vestingDuration),
281
- recipients: params.vesting ? [params.userAddress] : [],
282
- amounts: params.vesting ? [params.sale.initialSupply - params.sale.numTokensToSell] : [],
283
- tokenURI: params.token.tokenURI
284
- };
285
- const [salt, hookAddress, tokenAddress, poolInitializerData, encodedTokenFactoryData] = this.mineHookAddress({
286
- airlock: addresses.airlock,
287
- poolManager: addresses.poolManager,
288
- deployer: addresses.dopplerDeployer,
289
- initialSupply: params.sale.initialSupply,
290
- numTokensToSell: params.sale.numTokensToSell,
291
- numeraire: params.sale.numeraire,
292
- tokenFactory: isDoppler404 ? addresses.doppler404Factory : addresses.tokenFactory,
293
- tokenFactoryData,
294
- poolInitializer: addresses.v4Initializer,
295
- poolInitializerData: dopplerData,
296
- tokenVariant: isDoppler404 ? "doppler404" : "standard"
297
- });
298
- const liquidityMigratorData = this.encodeMigrationData(params.migration);
299
- const standardGovernanceParams = params.governance?.noOp === true ? void 0 : params.governance;
300
- const governanceFactoryData = viem.encodeAbiParameters(
301
- [
302
- { type: "string" },
303
- { type: "uint48" },
304
- { type: "uint32" },
305
- { type: "uint256" }
306
- ],
307
- [
308
- params.token.name,
309
- standardGovernanceParams?.initialVotingDelay ?? chunkER42VG7H_js.DEFAULT_V4_INITIAL_VOTING_DELAY,
310
- standardGovernanceParams?.initialVotingPeriod ?? chunkER42VG7H_js.DEFAULT_V4_INITIAL_VOTING_PERIOD,
311
- standardGovernanceParams?.initialProposalThreshold ?? chunkER42VG7H_js.DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD
312
- ]
313
- );
314
- const useNoOpGovernance = typeof params.governance?.noOp === "boolean" && params.governance.noOp === true;
315
- const governanceFactoryAddress = (() => {
316
- if (useNoOpGovernance) {
317
- const noOpGovernanceFactoryAddress = addresses.noOpGovernanceFactory ?? chunkER42VG7H_js.ZERO_ADDRESS;
318
- if (!noOpGovernanceFactoryAddress || noOpGovernanceFactoryAddress === chunkER42VG7H_js.ZERO_ADDRESS) {
319
- throw new Error("No-op governance requested, but noOpGovernanceFactory is not deployed on this chain. Provide standard governance via withGovernance() or use a supported chain.");
320
- }
321
- return noOpGovernanceFactoryAddress;
322
- }
323
- const standardGovernanceFactoryAddress = addresses.governanceFactory;
324
- if (!standardGovernanceFactoryAddress || standardGovernanceFactoryAddress === chunkER42VG7H_js.ZERO_ADDRESS) {
325
- throw new Error("Standard governance requested but governanceFactory is not deployed on this chain.");
326
- }
327
- return standardGovernanceFactoryAddress;
328
- })();
329
- const createParams = {
330
- initialSupply: params.sale.initialSupply,
331
- numTokensToSell: params.sale.numTokensToSell,
332
- numeraire: params.sale.numeraire,
333
- tokenFactory: isDoppler404 ? addresses.doppler404Factory : addresses.tokenFactory,
334
- tokenFactoryData: encodedTokenFactoryData,
335
- governanceFactory: governanceFactoryAddress,
336
- governanceFactoryData,
337
- poolInitializer: addresses.v4Initializer,
338
- poolInitializerData,
339
- liquidityMigrator: this.getMigratorAddress(params.migration),
340
- liquidityMigratorData,
341
- integrator: params.integrator ?? chunkER42VG7H_js.ZERO_ADDRESS,
342
- salt
343
- };
344
- if (!this.walletClient) {
345
- throw new Error("Wallet client required for write operations");
346
- }
347
- const { request, result } = await this.publicClient.simulateContract({
348
- address: addresses.airlock,
349
- abi: chunkEFAPDN4J_js.airlockAbi,
350
- functionName: "create",
351
- args: [{ ...createParams }],
352
- account: this.walletClient.account
353
- });
354
- const hash = await this.walletClient.writeContract(request);
355
- const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
356
- let actualHookAddress = hookAddress;
357
- let actualTokenAddress = tokenAddress;
358
- if (result && Array.isArray(result) && result.length >= 2) {
359
- actualTokenAddress = result[0];
360
- actualHookAddress = result[1];
361
- } else {
362
- const createEvent = receipt.logs.find((log) => {
363
- try {
364
- const decoded = viem.decodeEventLog({
365
- abi: chunkEFAPDN4J_js.airlockAbi,
366
- data: log.data,
367
- topics: log.topics
368
- });
369
- return decoded.eventName === "Create";
370
- } catch {
371
- return false;
372
- }
373
- });
374
- if (createEvent) {
375
- const decoded = viem.decodeEventLog({
376
- abi: chunkEFAPDN4J_js.airlockAbi,
377
- data: createEvent.data,
378
- topics: createEvent.topics
379
- });
380
- if (decoded.eventName === "Create") {
381
- actualHookAddress = decoded.args.poolOrHook;
382
- actualTokenAddress = decoded.args.asset;
383
- }
384
- }
385
- }
386
- const poolId = this.computePoolId({
387
- currency0: actualTokenAddress < params.sale.numeraire ? actualTokenAddress : params.sale.numeraire,
388
- currency1: actualTokenAddress < params.sale.numeraire ? params.sale.numeraire : actualTokenAddress,
389
- fee: params.pool.fee,
390
- tickSpacing: params.pool.tickSpacing,
391
- hooks: actualHookAddress
392
- });
393
- return {
394
- hookAddress: actualHookAddress,
395
- tokenAddress: actualTokenAddress,
396
- poolId,
397
- transactionHash: hash
398
- };
399
- }
400
- /**
401
- * Encode migration data based on the MigrationConfig
402
- * This replaces the manual encoding methods from the old SDKs
403
- */
404
- encodeMigrationData(config) {
405
- switch (config.type) {
406
- case "uniswapV2":
407
- return "0x";
408
- case "uniswapV3":
409
- return viem.encodeAbiParameters(
410
- [
411
- { type: "uint24" },
412
- // fee
413
- { type: "int24" }
414
- // tickSpacing
415
- ],
416
- [config.fee, config.tickSpacing]
417
- );
418
- case "uniswapV4":
419
- const WAD2 = BigInt(1e18);
420
- const beneficiaryData = [];
421
- for (const b of config.streamableFees.beneficiaries) {
422
- beneficiaryData.push({
423
- beneficiary: b.address,
424
- shares: BigInt(b.percentage) * WAD2 / BigInt(chunkER42VG7H_js.BASIS_POINTS)
425
- });
426
- }
427
- beneficiaryData.sort((a, b) => {
428
- const addrA = a.beneficiary.toLowerCase();
429
- const addrB = b.beneficiary.toLowerCase();
430
- return addrA < addrB ? -1 : addrA > addrB ? 1 : 0;
431
- });
432
- return viem.encodeAbiParameters(
433
- [
434
- { type: "uint24" },
435
- // fee
436
- { type: "int24" },
437
- // tickSpacing
438
- { type: "uint32" },
439
- // lockDuration
440
- {
441
- type: "tuple[]",
442
- components: [
443
- { type: "address", name: "beneficiary" },
444
- { type: "uint96", name: "shares" }
445
- ]
446
- }
447
- ],
448
- [
449
- config.fee,
450
- config.tickSpacing,
451
- config.streamableFees.lockDuration,
452
- beneficiaryData.map((b) => ({
453
- beneficiary: b.beneficiary,
454
- shares: b.shares
455
- }))
456
- ]
457
- );
458
- default:
459
- throw new Error(`Unknown migration type: ${config.type}`);
460
- }
461
- }
462
- /**
463
- * Validate static auction parameters
464
- */
465
- validateStaticAuctionParams(params) {
466
- if (!params.token.name || params.token.name.trim().length === 0) {
467
- throw new Error("Token name is required");
468
- }
469
- if (!params.token.symbol || params.token.symbol.trim().length === 0) {
470
- throw new Error("Token symbol is required");
471
- }
472
- if (params.pool.startTick >= params.pool.endTick) {
473
- throw new Error("Start tick must be less than end tick");
474
- }
475
- if (params.sale.initialSupply <= BigInt(0)) {
476
- throw new Error("Initial supply must be positive");
477
- }
478
- if (params.sale.numTokensToSell <= BigInt(0)) {
479
- throw new Error("Number of tokens to sell must be positive");
480
- }
481
- if (params.sale.numTokensToSell > params.sale.initialSupply) {
482
- throw new Error("Cannot sell more tokens than initial supply");
483
- }
484
- if (params.vesting) {
485
- const vestedAmount = params.sale.initialSupply - params.sale.numTokensToSell;
486
- if (vestedAmount <= BigInt(0)) {
487
- throw new Error("No tokens available for vesting");
488
- }
489
- }
490
- if (params.migration.type === "uniswapV4" && params.migration.streamableFees) {
491
- const beneficiaries = params.migration.streamableFees.beneficiaries;
492
- if (beneficiaries.length === 0) {
493
- throw new Error("At least one beneficiary is required for V4 migration");
494
- }
495
- const totalPercentage = beneficiaries.reduce((sum, b) => sum + b.percentage, 0);
496
- if (totalPercentage !== chunkER42VG7H_js.BASIS_POINTS) {
497
- throw new Error(`Beneficiary percentages must sum to ${chunkER42VG7H_js.BASIS_POINTS} (100%), but got ${totalPercentage}`);
498
- }
499
- }
500
- }
501
- /**
502
- * Validate dynamic auction parameters
503
- */
504
- validateDynamicAuctionParams(params) {
505
- if (!params.token.name || params.token.name.trim().length === 0) {
506
- throw new Error("Token name is required");
507
- }
508
- if (!params.token.symbol || params.token.symbol.trim().length === 0) {
509
- throw new Error("Token symbol is required");
510
- }
511
- if (params.auction.startTick >= params.auction.endTick) {
512
- throw new Error("Start tick must be less than end tick");
513
- }
514
- if (params.sale.initialSupply <= BigInt(0)) {
515
- throw new Error("Initial supply must be positive");
516
- }
517
- if (params.sale.numTokensToSell <= BigInt(0)) {
518
- throw new Error("Number of tokens to sell must be positive");
519
- }
520
- if (params.sale.numTokensToSell > params.sale.initialSupply) {
521
- throw new Error("Cannot sell more tokens than initial supply");
522
- }
523
- if (params.auction.duration <= 0) {
524
- throw new Error("Auction duration must be positive");
525
- }
526
- if (params.auction.epochLength <= 0) {
527
- throw new Error("Epoch length must be positive");
528
- }
529
- if (params.pool.tickSpacing <= 0) {
530
- throw new Error("Tick spacing must be positive");
531
- }
532
- const totalDuration = params.auction.duration * chunkER42VG7H_js.DAY_SECONDS;
533
- if (totalDuration % params.auction.epochLength !== 0) {
534
- throw new Error("Epoch length must divide total duration evenly");
535
- }
536
- if (params.auction.gamma !== void 0) {
537
- if (params.auction.gamma % params.pool.tickSpacing !== 0) {
538
- throw new Error("Gamma must be divisible by tick spacing");
539
- }
540
- }
541
- if (params.migration.type === "uniswapV4" && params.migration.streamableFees) {
542
- const beneficiaries = params.migration.streamableFees.beneficiaries;
543
- if (beneficiaries.length === 0) {
544
- throw new Error("At least one beneficiary is required for V4 migration");
545
- }
546
- const totalPercentage = beneficiaries.reduce((sum, b) => sum + b.percentage, 0);
547
- if (totalPercentage !== chunkER42VG7H_js.BASIS_POINTS) {
548
- throw new Error(`Beneficiary percentages must sum to ${chunkER42VG7H_js.BASIS_POINTS} (100%), but got ${totalPercentage}`);
549
- }
550
- }
551
- }
552
- /**
553
- * Get the airlock contract address for the current chain
554
- */
555
- getAirlockAddress() {
556
- const addresses = chunkXQ2VMR26_js.getAddresses(this.chainId);
557
- return addresses.airlock;
558
- }
559
- /**
560
- * Get the appropriate initializer address based on auction type
561
- */
562
- getInitializerAddress(isStatic) {
563
- const addresses = chunkXQ2VMR26_js.getAddresses(this.chainId);
564
- return isStatic ? addresses.v3Initializer : addresses.v4Initializer;
565
- }
566
- /**
567
- * Get the appropriate migrator address based on migration config
568
- */
569
- getMigratorAddress(config) {
570
- const addresses = chunkXQ2VMR26_js.getAddresses(this.chainId);
571
- switch (config.type) {
572
- case "uniswapV2":
573
- return addresses.v2Migrator;
574
- case "uniswapV3":
575
- return addresses.v3Migrator;
576
- case "uniswapV4":
577
- return addresses.v4Migrator;
578
- default:
579
- throw new Error(`Unknown migration type: ${config.type}`);
580
- }
581
- }
582
- // computeTicks moved to builders. No longer needed here.
583
- /**
584
- * Compute optimal gamma parameter based on price range and time parameters
585
- * Gamma determines how much the price can move per epoch during the sale.
586
- */
587
- computeOptimalGamma(startTick, endTick, durationDays, epochLength, tickSpacing) {
588
- const totalEpochs = durationDays * chunkER42VG7H_js.DAY_SECONDS / epochLength;
589
- const tickDelta = Math.abs(endTick - startTick);
590
- let gamma = Math.ceil(tickDelta / totalEpochs) * tickSpacing;
591
- gamma = Math.max(tickSpacing, gamma);
592
- if (gamma % tickSpacing !== 0) {
593
- throw new Error("Computed gamma must be divisible by tick spacing");
594
- }
595
- return gamma;
596
- }
597
- /**
598
- * Mines a salt and hook address with the appropriate flags
599
- *
600
- * This method iterates through possible salt values to find a combination that:
601
- * - Produces a hook address with required Doppler flags
602
- * - Maintains proper token ordering relative to numeraire
603
- * - Ensures deterministic deployment addresses
604
- *
605
- * @param params - Parameters for hook address mining
606
- * @returns Tuple of [salt, hook address, token address, pool data, token data]
607
- * @throws {Error} If no valid salt can be found within the search limit
608
- * @private
609
- */
610
- mineHookAddress(params) {
611
- const isToken0 = params.numeraire !== "0x0000000000000000000000000000000000000000";
612
- const {
613
- minimumProceeds,
614
- maximumProceeds,
615
- startingTime,
616
- endingTime,
617
- startingTick,
618
- endingTick,
619
- epochLength,
620
- gamma,
621
- numPDSlugs,
622
- fee,
623
- tickSpacing
624
- } = params.poolInitializerData;
625
- const poolInitializerData = viem.encodeAbiParameters(
626
- [
627
- { type: "uint256" },
628
- { type: "uint256" },
629
- { type: "uint256" },
630
- { type: "uint256" },
631
- { type: "int24" },
632
- { type: "int24" },
633
- { type: "uint256" },
634
- { type: "int24" },
635
- { type: "bool" },
636
- { type: "uint256" },
637
- { type: "uint24" },
638
- { type: "int24" }
639
- ],
640
- [
641
- minimumProceeds,
642
- maximumProceeds,
643
- startingTime,
644
- endingTime,
645
- startingTick,
646
- endingTick,
647
- epochLength,
648
- gamma,
649
- isToken0,
650
- numPDSlugs,
651
- fee,
652
- tickSpacing
653
- ]
654
- );
655
- const { poolManager, numTokensToSell, poolInitializer } = params;
656
- const hookInitHashData = viem.encodeAbiParameters(
657
- [
658
- { type: "address" },
659
- { type: "uint256" },
660
- { type: "uint256" },
661
- { type: "uint256" },
662
- { type: "uint256" },
663
- { type: "uint256" },
664
- { type: "int24" },
665
- { type: "int24" },
666
- { type: "uint256" },
667
- { type: "int24" },
668
- { type: "bool" },
669
- { type: "uint256" },
670
- { type: "address" },
671
- { type: "uint24" }
672
- ],
673
- [
674
- poolManager,
675
- numTokensToSell,
676
- minimumProceeds,
677
- maximumProceeds,
678
- startingTime,
679
- endingTime,
680
- startingTick,
681
- endingTick,
682
- epochLength,
683
- gamma,
684
- isToken0,
685
- numPDSlugs,
686
- poolInitializer,
687
- fee
688
- ]
689
- );
690
- const hookInitHash = viem.keccak256(
691
- viem.encodePacked(
692
- ["bytes", "bytes"],
693
- [chunkCIRZKWLL_js.DopplerBytecode, hookInitHashData]
694
- )
695
- );
696
- const tokenFactoryData = params.tokenVariant === "doppler404" ? viem.encodeAbiParameters(
697
- [
698
- { type: "string" },
699
- { type: "string" },
700
- { type: "string" },
701
- { type: "uint256" }
702
- ],
703
- [
704
- params.tokenFactoryData.name,
705
- params.tokenFactoryData.symbol,
706
- params.tokenFactoryData.baseURI,
707
- params.tokenFactoryData.unit ?? 1000n
708
- ]
709
- ) : (() => {
710
- const {
711
- name,
712
- symbol,
713
- yearlyMintRate,
714
- vestingDuration,
715
- recipients,
716
- amounts,
717
- tokenURI
718
- } = params.tokenFactoryData;
719
- return viem.encodeAbiParameters(
720
- [
721
- { type: "string" },
722
- { type: "string" },
723
- { type: "uint256" },
724
- { type: "uint256" },
725
- { type: "address[]" },
726
- { type: "uint256[]" },
727
- { type: "string" }
728
- ],
729
- [
730
- name,
731
- symbol,
732
- yearlyMintRate,
733
- vestingDuration,
734
- recipients,
735
- amounts,
736
- tokenURI
737
- ]
738
- );
739
- })();
740
- const { airlock, initialSupply } = params;
741
- let tokenInitHash;
742
- if (params.tokenVariant === "doppler404") {
743
- const { name, symbol, baseURI } = params.tokenFactoryData;
744
- const { airlock: airlock2, initialSupply: initialSupply2 } = params;
745
- const initHashData = viem.encodeAbiParameters(
746
- [
747
- { type: "string" },
748
- { type: "string" },
749
- { type: "uint256" },
750
- { type: "address" },
751
- { type: "address" },
752
- { type: "string" }
753
- ],
754
- [
755
- name,
756
- symbol,
757
- initialSupply2,
758
- airlock2,
759
- airlock2,
760
- baseURI
761
- ]
762
- );
763
- tokenInitHash = viem.keccak256(
764
- viem.encodePacked(["bytes", "bytes"], [chunkCIRZKWLL_js.DopplerDN404Bytecode, initHashData])
765
- );
766
- } else {
767
- const { name, symbol, yearlyMintRate, vestingDuration, recipients, amounts, tokenURI } = params.tokenFactoryData;
768
- const { airlock: airlock2, initialSupply: initialSupply2 } = params;
769
- const initHashData = viem.encodeAbiParameters(
770
- [
771
- { type: "string" },
772
- { type: "string" },
773
- { type: "uint256" },
774
- { type: "address" },
775
- { type: "address" },
776
- { type: "uint256" },
777
- { type: "uint256" },
778
- { type: "address[]" },
779
- { type: "uint256[]" },
780
- { type: "string" }
781
- ],
782
- [
783
- name,
784
- symbol,
785
- initialSupply2,
786
- airlock2,
787
- airlock2,
788
- yearlyMintRate,
789
- vestingDuration,
790
- recipients,
791
- amounts,
792
- tokenURI
793
- ]
794
- );
795
- tokenInitHash = viem.keccak256(
796
- viem.encodePacked(["bytes", "bytes"], [params.customDerc20Bytecode ?? chunkCIRZKWLL_js.DERC20Bytecode, initHashData])
797
- );
798
- }
799
- const flags = BigInt(
800
- 1 << 13 | // BEFORE_INITIALIZE_FLAG
801
- 1 << 12 | // AFTER_INITIALIZE_FLAG
802
- 1 << 11 | // BEFORE_ADD_LIQUIDITY_FLAG
803
- 1 << 7 | // BEFORE_SWAP_FLAG
804
- 1 << 6 | // AFTER_SWAP_FLAG
805
- 1 << 5
806
- // BEFORE_DONATE_FLAG
807
- );
808
- for (let salt = BigInt(0); salt < BigInt(1e6); salt++) {
809
- const saltBytes = `0x${salt.toString(16).padStart(64, "0")}`;
810
- const hook = this.computeCreate2Address(
811
- saltBytes,
812
- hookInitHash,
813
- params.deployer
814
- );
815
- const hookBigInt = BigInt(hook);
816
- if (tokenInitHash) {
817
- const token = this.computeCreate2Address(
818
- saltBytes,
819
- tokenInitHash,
820
- params.tokenFactory
821
- );
822
- const tokenBigInt = BigInt(token);
823
- const numeraireBigInt = BigInt(params.numeraire);
824
- if ((hookBigInt & chunkER42VG7H_js.FLAG_MASK) === flags && (isToken0 && tokenBigInt < numeraireBigInt || !isToken0 && tokenBigInt > numeraireBigInt)) {
825
- return [saltBytes, hook, token, poolInitializerData, tokenFactoryData];
826
- }
827
- }
828
- }
829
- throw new Error("AirlockMiner: could not find salt");
830
- }
831
- /**
832
- * Computes the CREATE2 address for a contract deployment
833
- * @param salt - The salt used for deployment
834
- * @param initCodeHash - Hash of the initialization code
835
- * @param deployer - Address of the deploying contract
836
- * @returns The computed contract address
837
- * @private
838
- */
839
- computeCreate2Address(salt, initCodeHash, deployer) {
840
- const encoded = viem.encodePacked(
841
- ["bytes1", "address", "bytes32", "bytes32"],
842
- ["0xff", deployer, salt, initCodeHash]
843
- );
844
- return viem.getAddress(`0x${viem.keccak256(encoded).slice(-40)}`);
845
- }
846
- /**
847
- * Compute V4 pool ID from pool key components
848
- */
849
- computePoolId(poolKey) {
850
- const encoded = viem.encodeAbiParameters(
851
- [
852
- { type: "address" },
853
- { type: "address" },
854
- { type: "uint24" },
855
- { type: "int24" },
856
- { type: "address" }
857
- ],
858
- [
859
- poolKey.currency0,
860
- poolKey.currency1,
861
- poolKey.fee,
862
- poolKey.tickSpacing,
863
- poolKey.hooks
864
- ]
865
- );
866
- return viem.keccak256(encoded);
867
- }
868
- };
869
-
870
- exports.DopplerFactory = DopplerFactory;
871
- //# sourceMappingURL=chunk-SUOMK3CU.js.map
872
- //# sourceMappingURL=chunk-SUOMK3CU.js.map