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