@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.
- package/LICENSE +21 -0
- package/README.md +726 -25
- package/dist/DopplerSDK.d.mts +45 -7
- package/dist/DopplerSDK.d.ts +45 -7
- package/dist/DopplerSDK.js +35 -12
- package/dist/DopplerSDK.mjs +34 -11
- package/dist/abis/bytecodes.d.mts +3 -2
- package/dist/abis/bytecodes.d.ts +3 -2
- package/dist/abis/bytecodes.js +9 -6
- package/dist/abis/bytecodes.mjs +1 -2
- package/dist/abis/index.d.mts +1507 -129
- package/dist/abis/index.d.ts +1507 -129
- package/dist/abis/index.js +43 -20
- package/dist/abis/index.mjs +2 -3
- package/dist/addresses.d.mts +16 -3
- package/dist/addresses.d.ts +16 -3
- package/dist/addresses.js +13 -5
- package/dist/addresses.mjs +2 -2
- package/dist/builders/DynamicAuctionBuilder.d.mts +119 -0
- package/dist/builders/DynamicAuctionBuilder.d.ts +119 -0
- package/dist/builders/DynamicAuctionBuilder.js +29 -0
- package/dist/builders/DynamicAuctionBuilder.js.map +1 -0
- package/dist/builders/DynamicAuctionBuilder.mjs +20 -0
- package/dist/builders/DynamicAuctionBuilder.mjs.map +1 -0
- package/dist/builders/MulticurveBuilder.d.mts +132 -0
- package/dist/builders/MulticurveBuilder.d.ts +132 -0
- package/dist/builders/MulticurveBuilder.js +29 -0
- package/dist/builders/MulticurveBuilder.js.map +1 -0
- package/dist/builders/MulticurveBuilder.mjs +20 -0
- package/dist/builders/MulticurveBuilder.mjs.map +1 -0
- package/dist/builders/StaticAuctionBuilder.d.mts +124 -0
- package/dist/builders/StaticAuctionBuilder.d.ts +124 -0
- package/dist/builders/StaticAuctionBuilder.js +29 -0
- package/dist/builders/StaticAuctionBuilder.js.map +1 -0
- package/dist/builders/StaticAuctionBuilder.mjs +20 -0
- package/dist/builders/StaticAuctionBuilder.mjs.map +1 -0
- package/dist/builders/index.d.mts +8 -0
- package/dist/builders/index.d.ts +8 -0
- package/dist/builders/index.js +56 -0
- package/dist/builders/index.js.map +1 -0
- package/dist/builders/index.mjs +23 -0
- package/dist/builders/index.mjs.map +1 -0
- package/dist/builders/shared.d.mts +116 -0
- package/dist/builders/shared.d.ts +116 -0
- package/dist/builders/shared.js +39 -0
- package/dist/builders/shared.js.map +1 -0
- package/dist/builders/shared.mjs +18 -0
- package/dist/builders/shared.mjs.map +1 -0
- package/dist/builders.d.mts +8 -131
- package/dist/builders.d.ts +8 -131
- package/dist/builders.js +44 -5
- package/dist/builders.mjs +22 -3
- package/dist/chunk-3PNCB4W5.js +4 -0
- package/dist/{chunk-KRN3ROUE.js.map → chunk-3PNCB4W5.js.map} +1 -1
- package/dist/chunk-3RK7LRAA.js +282 -0
- package/dist/chunk-3RK7LRAA.js.map +1 -0
- package/dist/chunk-4HM3ERBU.js +13 -0
- package/dist/chunk-4HM3ERBU.js.map +1 -0
- package/dist/{chunk-7W72MFJO.mjs → chunk-4TROGENW.mjs} +5 -4
- package/dist/chunk-4TROGENW.mjs.map +1 -0
- package/dist/chunk-5TL5V6UX.mjs +3 -0
- package/dist/{chunk-AZLFJNTG.mjs.map → chunk-5TL5V6UX.mjs.map} +1 -1
- package/dist/chunk-64AWG57M.mjs +192 -0
- package/dist/chunk-64AWG57M.mjs.map +1 -0
- package/dist/chunk-6KWCHTK3.js +166 -0
- package/dist/chunk-6KWCHTK3.js.map +1 -0
- package/dist/chunk-6OOWOPCX.js +1708 -0
- package/dist/chunk-6OOWOPCX.js.map +1 -0
- package/dist/chunk-7BBRPWQJ.js +257 -0
- package/dist/chunk-7BBRPWQJ.js.map +1 -0
- package/dist/{chunk-FVTIDXYK.mjs → chunk-AKSEBAR7.mjs} +29 -19
- package/dist/chunk-AKSEBAR7.mjs.map +1 -0
- package/dist/chunk-AS64GWBX.js +204 -0
- package/dist/chunk-AS64GWBX.js.map +1 -0
- package/dist/chunk-AULFBXM5.mjs +331 -0
- package/dist/chunk-AULFBXM5.mjs.map +1 -0
- package/dist/chunk-AW3WR2D3.mjs +238 -0
- package/dist/chunk-AW3WR2D3.mjs.map +1 -0
- package/dist/chunk-BIQQ53O2.js +45 -0
- package/dist/chunk-BIQQ53O2.js.map +1 -0
- package/dist/chunk-C6MPV3CY.js +260 -0
- package/dist/chunk-C6MPV3CY.js.map +1 -0
- package/dist/{chunk-AYPP5JEQ.mjs → chunk-CLEQO6GU.mjs} +5 -5
- package/dist/chunk-CLEQO6GU.mjs.map +1 -0
- package/dist/chunk-CVHPLURA.js +147 -0
- package/dist/chunk-CVHPLURA.js.map +1 -0
- package/dist/chunk-D2RBCFNW.mjs +130 -0
- package/dist/chunk-D2RBCFNW.mjs.map +1 -0
- package/dist/chunk-ECD4FV3A.mjs +11 -0
- package/dist/chunk-ECD4FV3A.mjs.map +1 -0
- package/dist/chunk-EDJBZPMW.mjs +255 -0
- package/dist/chunk-EDJBZPMW.mjs.map +1 -0
- package/dist/chunk-FPAI4QYW.mjs +145 -0
- package/dist/chunk-FPAI4QYW.mjs.map +1 -0
- package/dist/chunk-HM25ZMO3.js +18 -0
- package/dist/chunk-HM25ZMO3.js.map +1 -0
- package/dist/chunk-IHC6UYKK.js +4 -0
- package/dist/{chunk-DRBRT57F.js.map → chunk-IHC6UYKK.js.map} +1 -1
- package/dist/{chunk-DMAHXBA5.mjs → chunk-J5BFFL3X.mjs} +87 -47
- package/dist/chunk-J5BFFL3X.mjs.map +1 -0
- package/dist/chunk-JIKAD4YL.js +4 -0
- package/dist/{chunk-KEXKKQVW.js.map → chunk-JIKAD4YL.js.map} +1 -1
- package/dist/{chunk-EFAPDN4J.js → chunk-JWEXGALU.js} +730 -33
- package/dist/chunk-JWEXGALU.js.map +1 -0
- package/dist/{chunk-4K5GBNQV.mjs → chunk-KDT76YQE.mjs} +52 -13
- package/dist/chunk-KDT76YQE.mjs.map +1 -0
- package/dist/chunk-LMQLMMEX.js +317 -0
- package/dist/chunk-LMQLMMEX.js.map +1 -0
- package/dist/{chunk-TOMVBPNZ.js → chunk-LS4TK6SX.js} +9 -4
- package/dist/chunk-LS4TK6SX.js.map +1 -0
- package/dist/chunk-M4WMHD3X.mjs +40 -0
- package/dist/chunk-M4WMHD3X.mjs.map +1 -0
- package/dist/chunk-MCOK3UFR.mjs +280 -0
- package/dist/chunk-MCOK3UFR.mjs.map +1 -0
- package/dist/chunk-MGQSQCFG.js +176 -0
- package/dist/chunk-MGQSQCFG.js.map +1 -0
- package/dist/chunk-MKE3BUL3.mjs +3 -0
- package/dist/{chunk-CYDWEPFL.mjs.map → chunk-MKE3BUL3.mjs.map} +1 -1
- package/dist/chunk-MNJ5OYPE.mjs +17 -0
- package/dist/chunk-MNJ5OYPE.mjs.map +1 -0
- package/dist/chunk-MNXD45J7.mjs +164 -0
- package/dist/chunk-MNXD45J7.mjs.map +1 -0
- package/dist/chunk-NGDPQC5E.js +333 -0
- package/dist/chunk-NGDPQC5E.js.map +1 -0
- package/dist/chunk-NNNCVFOH.mjs +16 -0
- package/dist/chunk-NNNCVFOH.mjs.map +1 -0
- package/dist/chunk-NZ4BJ2IC.mjs +315 -0
- package/dist/chunk-NZ4BJ2IC.mjs.map +1 -0
- package/dist/chunk-OKNM7ODQ.js +29 -0
- package/dist/chunk-OKNM7ODQ.js.map +1 -0
- package/dist/{chunk-DCFHANLR.mjs → chunk-OTG75GVH.mjs} +725 -34
- package/dist/chunk-OTG75GVH.mjs.map +1 -0
- package/dist/chunk-OZ6DGBRL.mjs +25 -0
- package/dist/chunk-OZ6DGBRL.mjs.map +1 -0
- package/dist/chunk-P25HBGP5.mjs +3 -0
- package/dist/chunk-P25HBGP5.mjs.map +1 -0
- package/dist/{chunk-XG7K4R56.js → chunk-P7KLEPVI.js} +52 -12
- package/dist/chunk-P7KLEPVI.js.map +1 -0
- package/dist/{chunk-OPKQMN46.mjs → chunk-PAPXGPJB.mjs} +9 -4
- package/dist/chunk-PAPXGPJB.mjs.map +1 -0
- package/dist/chunk-PCNXJAU5.js +19 -0
- package/dist/chunk-PCNXJAU5.js.map +1 -0
- package/dist/{chunk-5IT5OXQ5.js → chunk-PD6HWEMG.js} +40 -30
- package/dist/chunk-PD6HWEMG.js.map +1 -0
- package/dist/{chunk-ER42VG7H.js → chunk-PH2KXREH.js} +20 -3
- package/dist/chunk-PH2KXREH.js.map +1 -0
- package/dist/chunk-Q5ERW5ZW.mjs +107 -0
- package/dist/chunk-Q5ERW5ZW.mjs.map +1 -0
- package/dist/chunk-Q7YNBSVH.js +28 -0
- package/dist/chunk-Q7YNBSVH.js.map +1 -0
- package/dist/{chunk-T644D54P.mjs → chunk-QKO2FZGN.mjs} +16 -4
- package/dist/chunk-QKO2FZGN.mjs.map +1 -0
- package/dist/{chunk-CIRZKWLL.js → chunk-RVFSRYI5.js} +5 -3
- package/dist/chunk-RVFSRYI5.js.map +1 -0
- package/dist/{chunk-KPBCG4X2.js → chunk-RW37KJ77.js} +11 -11
- package/dist/chunk-RW37KJ77.js.map +1 -0
- package/dist/chunk-SD7BHT2F.mjs +3 -0
- package/dist/chunk-SD7BHT2F.mjs.map +1 -0
- package/dist/chunk-SP5M57BG.mjs +258 -0
- package/dist/chunk-SP5M57BG.mjs.map +1 -0
- package/dist/chunk-TKSHYEYA.mjs +1706 -0
- package/dist/chunk-TKSHYEYA.mjs.map +1 -0
- package/dist/chunk-WTS75RUC.js +4 -0
- package/dist/chunk-WTS75RUC.js.map +1 -0
- package/dist/{chunk-ZRDU6CIB.js → chunk-XRPIGMA2.js} +108 -68
- package/dist/chunk-XRPIGMA2.js.map +1 -0
- package/dist/chunk-XTKSM4QE.js +132 -0
- package/dist/chunk-XTKSM4QE.js.map +1 -0
- package/dist/chunk-XUE3CIJ5.mjs +174 -0
- package/dist/chunk-XUE3CIJ5.mjs.map +1 -0
- package/dist/chunk-YYUOLM6U.js +244 -0
- package/dist/chunk-YYUOLM6U.js.map +1 -0
- package/dist/chunk-ZH44DHVR.mjs +26 -0
- package/dist/chunk-ZH44DHVR.mjs.map +1 -0
- package/dist/chunk-ZPHOOG72.js +112 -0
- package/dist/chunk-ZPHOOG72.js.map +1 -0
- package/dist/constants.d.mts +7 -2
- package/dist/constants.d.ts +7 -2
- package/dist/constants.js +57 -38
- package/dist/constants.mjs +1 -2
- package/dist/deployments.generated.d.mts +2 -0
- package/dist/deployments.generated.d.ts +2 -0
- package/dist/deployments.generated.js +12 -0
- package/dist/deployments.generated.js.map +1 -0
- package/dist/deployments.generated.mjs +3 -0
- package/dist/deployments.generated.mjs.map +1 -0
- package/dist/entities/DopplerFactory.d.mts +139 -11
- package/dist/entities/DopplerFactory.d.ts +139 -11
- package/dist/entities/DopplerFactory.js +17 -7
- package/dist/entities/DopplerFactory.mjs +16 -6
- package/dist/entities/auction/DynamicAuction.d.mts +19 -4
- package/dist/entities/auction/DynamicAuction.d.ts +19 -4
- package/dist/entities/auction/DynamicAuction.js +6 -6
- package/dist/entities/auction/DynamicAuction.mjs +5 -5
- package/dist/entities/auction/MulticurvePool.d.mts +55 -0
- package/dist/entities/auction/MulticurvePool.d.ts +55 -0
- package/dist/entities/auction/MulticurvePool.js +18 -0
- package/dist/entities/auction/MulticurvePool.js.map +1 -0
- package/dist/entities/auction/MulticurvePool.mjs +9 -0
- package/dist/entities/auction/MulticurvePool.mjs.map +1 -0
- package/dist/entities/auction/StaticAuction.d.mts +6 -3
- package/dist/entities/auction/StaticAuction.d.ts +6 -3
- package/dist/entities/auction/StaticAuction.js +6 -6
- package/dist/entities/auction/StaticAuction.mjs +5 -5
- package/dist/entities/auction/index.d.mts +3 -0
- package/dist/entities/auction/index.d.ts +3 -0
- package/dist/entities/auction/index.js +16 -9
- package/dist/entities/auction/index.mjs +10 -7
- package/dist/entities/quoter/Quoter.d.mts +44 -2
- package/dist/entities/quoter/Quoter.d.ts +44 -2
- package/dist/entities/quoter/Quoter.js +6 -6
- package/dist/entities/quoter/Quoter.mjs +5 -5
- package/dist/entities/quoter/index.d.mts +3 -0
- package/dist/entities/quoter/index.d.ts +3 -0
- package/dist/entities/quoter/index.js +6 -6
- package/dist/entities/quoter/index.mjs +5 -5
- package/dist/entities/token/derc20/Derc20.d.mts +33 -7
- package/dist/entities/token/derc20/Derc20.d.ts +33 -7
- package/dist/entities/token/derc20/Derc20.js +4 -5
- package/dist/entities/token/derc20/Derc20.mjs +3 -4
- package/dist/entities/token/derc20/index.d.mts +3 -0
- package/dist/entities/token/derc20/index.d.ts +3 -0
- package/dist/entities/token/derc20/index.js +4 -5
- package/dist/entities/token/derc20/index.mjs +3 -4
- package/dist/entities/token/eth/Eth.d.mts +7 -3
- package/dist/entities/token/eth/Eth.d.ts +7 -3
- package/dist/entities/token/eth/Eth.js +2 -3
- package/dist/entities/token/eth/Eth.mjs +1 -2
- package/dist/entities/token/eth/index.d.mts +3 -0
- package/dist/entities/token/eth/index.d.ts +3 -0
- package/dist/entities/token/eth/index.js +2 -3
- package/dist/entities/token/eth/index.mjs +1 -2
- package/dist/entities/token/index.d.mts +3 -0
- package/dist/entities/token/index.d.ts +3 -0
- package/dist/entities/token/index.js +6 -7
- package/dist/entities/token/index.mjs +4 -5
- package/dist/index.d.mts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +305 -140
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -19
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +260 -22
- package/dist/types.d.ts +260 -22
- package/dist/types.js +12 -3
- package/dist/types.mjs +3 -2
- package/dist/utils/airlock.d.mts +11 -0
- package/dist/utils/airlock.d.ts +11 -0
- package/dist/utils/airlock.js +26 -0
- package/dist/utils/airlock.js.map +1 -0
- package/dist/utils/airlock.mjs +5 -0
- package/dist/utils/airlock.mjs.map +1 -0
- package/dist/utils/balanceDelta.d.mts +10 -0
- package/dist/utils/balanceDelta.d.ts +10 -0
- package/dist/utils/balanceDelta.js +12 -0
- package/dist/utils/balanceDelta.js.map +1 -0
- package/dist/utils/balanceDelta.mjs +3 -0
- package/dist/utils/balanceDelta.mjs.map +1 -0
- package/dist/utils/computeOptimalGamma.d.mts +7 -0
- package/dist/utils/computeOptimalGamma.d.ts +7 -0
- package/dist/utils/computeOptimalGamma.js +12 -0
- package/dist/utils/computeOptimalGamma.js.map +1 -0
- package/dist/utils/computeOptimalGamma.mjs +3 -0
- package/dist/utils/computeOptimalGamma.mjs.map +1 -0
- package/dist/utils/index.d.mts +11 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +114 -24
- package/dist/utils/index.mjs +14 -4
- package/dist/utils/isToken0Expected.d.mts +13 -0
- package/dist/utils/isToken0Expected.d.ts +13 -0
- package/dist/utils/isToken0Expected.js +12 -0
- package/dist/utils/isToken0Expected.js.map +1 -0
- package/dist/utils/isToken0Expected.mjs +3 -0
- package/dist/utils/isToken0Expected.mjs.map +1 -0
- package/dist/utils/marketCapHelpers.d.mts +309 -0
- package/dist/utils/marketCapHelpers.d.ts +309 -0
- package/dist/utils/marketCapHelpers.js +54 -0
- package/dist/utils/marketCapHelpers.js.map +1 -0
- package/dist/utils/marketCapHelpers.mjs +5 -0
- package/dist/utils/marketCapHelpers.mjs.map +1 -0
- package/dist/utils/poolKey.d.mts +17 -0
- package/dist/utils/poolKey.d.ts +17 -0
- package/dist/utils/poolKey.js +12 -0
- package/dist/utils/poolKey.js.map +1 -0
- package/dist/utils/poolKey.mjs +3 -0
- package/dist/utils/poolKey.mjs.map +1 -0
- package/dist/utils/priceHelpers.d.mts +3 -3
- package/dist/utils/priceHelpers.d.ts +3 -3
- package/dist/utils/priceHelpers.js +10 -11
- package/dist/utils/priceHelpers.mjs +2 -3
- package/dist/utils/tickMath.d.mts +8 -1
- package/dist/utils/tickMath.d.ts +8 -1
- package/dist/utils/tickMath.js +17 -14
- package/dist/utils/tickMath.mjs +1 -2
- package/dist/utils/tokenAddressMiner.d.mts +30 -0
- package/dist/utils/tokenAddressMiner.d.ts +30 -0
- package/dist/utils/tokenAddressMiner.js +14 -0
- package/dist/utils/tokenAddressMiner.js.map +1 -0
- package/dist/utils/tokenAddressMiner.mjs +5 -0
- package/dist/utils/tokenAddressMiner.mjs.map +1 -0
- package/package.json +14 -11
- package/dist/__tests__/mocks/addresses.d.mts +0 -46
- package/dist/__tests__/mocks/addresses.d.ts +0 -46
- package/dist/__tests__/mocks/addresses.js +0 -53
- package/dist/__tests__/mocks/addresses.js.map +0 -1
- package/dist/__tests__/mocks/addresses.mjs +0 -44
- package/dist/__tests__/mocks/addresses.mjs.map +0 -1
- package/dist/__tests__/mocks/clients.d.mts +0 -22
- package/dist/__tests__/mocks/clients.d.ts +0 -22
- package/dist/__tests__/mocks/clients.js +0 -17036
- package/dist/__tests__/mocks/clients.js.map +0 -1
- package/dist/__tests__/mocks/clients.mjs +0 -17032
- package/dist/__tests__/mocks/clients.mjs.map +0 -1
- package/dist/chunk-2N5JZSZ4.js +0 -14
- package/dist/chunk-2N5JZSZ4.js.map +0 -1
- package/dist/chunk-3OZRDL3O.js +0 -162
- package/dist/chunk-3OZRDL3O.js.map +0 -1
- package/dist/chunk-4K5GBNQV.mjs.map +0 -1
- package/dist/chunk-5IT5OXQ5.js.map +0 -1
- package/dist/chunk-7F5IXZLH.js +0 -308
- package/dist/chunk-7F5IXZLH.js.map +0 -1
- package/dist/chunk-7VP5VR7J.js +0 -82
- package/dist/chunk-7VP5VR7J.js.map +0 -1
- package/dist/chunk-7W72MFJO.mjs.map +0 -1
- package/dist/chunk-AYPP5JEQ.mjs.map +0 -1
- package/dist/chunk-AZLFJNTG.mjs +0 -3
- package/dist/chunk-CIRZKWLL.js.map +0 -1
- package/dist/chunk-CYDWEPFL.mjs +0 -3
- package/dist/chunk-DCFHANLR.mjs.map +0 -1
- package/dist/chunk-DMAHXBA5.mjs.map +0 -1
- package/dist/chunk-DRBRT57F.js +0 -4
- package/dist/chunk-EFAPDN4J.js.map +0 -1
- package/dist/chunk-ER42VG7H.js.map +0 -1
- package/dist/chunk-FVTIDXYK.mjs.map +0 -1
- package/dist/chunk-IHBIBFZK.mjs +0 -12
- package/dist/chunk-IHBIBFZK.mjs.map +0 -1
- package/dist/chunk-IXSKPEHB.mjs +0 -160
- package/dist/chunk-IXSKPEHB.mjs.map +0 -1
- package/dist/chunk-KEXKKQVW.js +0 -42
- package/dist/chunk-KFD6U3LQ.mjs +0 -305
- package/dist/chunk-KFD6U3LQ.mjs.map +0 -1
- package/dist/chunk-KPBCG4X2.js.map +0 -1
- package/dist/chunk-KRN3ROUE.js +0 -4
- package/dist/chunk-KT7U37XS.mjs +0 -207
- package/dist/chunk-KT7U37XS.mjs.map +0 -1
- package/dist/chunk-LOROXNH3.mjs +0 -37
- package/dist/chunk-LOROXNH3.mjs.map +0 -1
- package/dist/chunk-O6GYIJ6X.mjs +0 -80
- package/dist/chunk-O6GYIJ6X.mjs.map +0 -1
- package/dist/chunk-OPKQMN46.mjs.map +0 -1
- package/dist/chunk-RIMM47JL.mjs +0 -176
- package/dist/chunk-RIMM47JL.mjs.map +0 -1
- package/dist/chunk-SUOMK3CU.js +0 -872
- package/dist/chunk-SUOMK3CU.js.map +0 -1
- package/dist/chunk-T644D54P.mjs.map +0 -1
- package/dist/chunk-TOMVBPNZ.js.map +0 -1
- package/dist/chunk-XEMZQHTX.mjs +0 -870
- package/dist/chunk-XEMZQHTX.mjs.map +0 -1
- package/dist/chunk-XG7K4R56.js.map +0 -1
- package/dist/chunk-XQ2VMR26.js +0 -180
- package/dist/chunk-XQ2VMR26.js.map +0 -1
- package/dist/chunk-ZAIP54LX.js +0 -209
- package/dist/chunk-ZAIP54LX.js.map +0 -1
- package/dist/chunk-ZRDU6CIB.js.map +0 -1
- package/dist/magic-string.es-CBLXTCZP.js +0 -1304
- package/dist/magic-string.es-CBLXTCZP.js.map +0 -1
- package/dist/magic-string.es-QHA47FSB.mjs +0 -1298
- package/dist/magic-string.es-QHA47FSB.mjs.map +0 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { derc20Abi } from './chunk-OTG75GVH.mjs';
|
|
2
|
+
|
|
3
|
+
// src/entities/token/derc20/Derc20.ts
|
|
4
|
+
var Derc20 = class _Derc20 {
|
|
5
|
+
get rpc() {
|
|
6
|
+
return this.publicClient;
|
|
7
|
+
}
|
|
8
|
+
static splitSignature(signature) {
|
|
9
|
+
const sig = signature.toLowerCase();
|
|
10
|
+
const r = `0x${sig.slice(2, 66)}`;
|
|
11
|
+
const s = `0x${sig.slice(66, 130)}`;
|
|
12
|
+
let v = parseInt(sig.slice(130, 132), 16);
|
|
13
|
+
if (v < 27) v += 27;
|
|
14
|
+
return { v, r, s };
|
|
15
|
+
}
|
|
16
|
+
constructor(publicClient, walletClient, address) {
|
|
17
|
+
this.publicClient = publicClient;
|
|
18
|
+
this.walletClient = walletClient;
|
|
19
|
+
this.address = address;
|
|
20
|
+
}
|
|
21
|
+
/** Get the human-readable name of the token */
|
|
22
|
+
async getName() {
|
|
23
|
+
return await this.rpc.readContract({
|
|
24
|
+
address: this.address,
|
|
25
|
+
abi: derc20Abi,
|
|
26
|
+
functionName: "name"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Get the symbol/ticker of the token */
|
|
30
|
+
async getSymbol() {
|
|
31
|
+
return await this.rpc.readContract({
|
|
32
|
+
address: this.address,
|
|
33
|
+
abi: derc20Abi,
|
|
34
|
+
functionName: "symbol"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** Get the number of decimals used for token divisions */
|
|
38
|
+
async getDecimals() {
|
|
39
|
+
return await this.rpc.readContract({
|
|
40
|
+
address: this.address,
|
|
41
|
+
abi: derc20Abi,
|
|
42
|
+
functionName: "decimals"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Get the token URI for the token */
|
|
46
|
+
async getTokenURI() {
|
|
47
|
+
return await this.rpc.readContract({
|
|
48
|
+
address: this.address,
|
|
49
|
+
abi: derc20Abi,
|
|
50
|
+
functionName: "tokenURI"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// -------------------------
|
|
54
|
+
// Governance (Votes) reads
|
|
55
|
+
// -------------------------
|
|
56
|
+
/** Get the current delegate for an account */
|
|
57
|
+
async getDelegates(account) {
|
|
58
|
+
return await this.rpc.readContract({
|
|
59
|
+
address: this.address,
|
|
60
|
+
abi: derc20Abi,
|
|
61
|
+
functionName: "delegates",
|
|
62
|
+
args: [account]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Get current voting power for an account */
|
|
66
|
+
async getVotes(account) {
|
|
67
|
+
return await this.rpc.readContract({
|
|
68
|
+
address: this.address,
|
|
69
|
+
abi: derc20Abi,
|
|
70
|
+
functionName: "getVotes",
|
|
71
|
+
args: [account]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Get historical voting power at a given timepoint (block) */
|
|
75
|
+
async getPastVotes(account, timepoint) {
|
|
76
|
+
return await this.rpc.readContract({
|
|
77
|
+
address: this.address,
|
|
78
|
+
abi: derc20Abi,
|
|
79
|
+
functionName: "getPastVotes",
|
|
80
|
+
args: [account, timepoint]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get the allowance granted by an owner to a spender
|
|
85
|
+
* @param owner - The address that granted the allowance
|
|
86
|
+
* @param spender - The address that can spend the tokens
|
|
87
|
+
*/
|
|
88
|
+
async getAllowance(owner, spender) {
|
|
89
|
+
return await this.rpc.readContract({
|
|
90
|
+
address: this.address,
|
|
91
|
+
abi: derc20Abi,
|
|
92
|
+
functionName: "allowance",
|
|
93
|
+
args: [owner, spender]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get the token balance of a specific account
|
|
98
|
+
* @param account - Address to check balance for
|
|
99
|
+
*/
|
|
100
|
+
async getBalanceOf(account) {
|
|
101
|
+
return await this.rpc.readContract({
|
|
102
|
+
address: this.address,
|
|
103
|
+
abi: derc20Abi,
|
|
104
|
+
functionName: "balanceOf",
|
|
105
|
+
args: [account]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** Get the total supply of tokens in circulation */
|
|
109
|
+
async getTotalSupply() {
|
|
110
|
+
return await this.rpc.readContract({
|
|
111
|
+
address: this.address,
|
|
112
|
+
abi: derc20Abi,
|
|
113
|
+
functionName: "totalSupply"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** Get the duration (in seconds) of the vesting period */
|
|
117
|
+
async getVestingDuration() {
|
|
118
|
+
return await this.rpc.readContract({
|
|
119
|
+
address: this.address,
|
|
120
|
+
abi: derc20Abi,
|
|
121
|
+
functionName: "vestingDuration"
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Get the timestamp when vesting begins */
|
|
125
|
+
async getVestingStart() {
|
|
126
|
+
return await this.rpc.readContract({
|
|
127
|
+
address: this.address,
|
|
128
|
+
abi: derc20Abi,
|
|
129
|
+
functionName: "vestingStart"
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Get the total amount of tokens allocated for vesting */
|
|
133
|
+
async getVestedTotalAmount() {
|
|
134
|
+
return await this.rpc.readContract({
|
|
135
|
+
address: this.address,
|
|
136
|
+
abi: derc20Abi,
|
|
137
|
+
functionName: "vestedTotalAmount"
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Get the amount of vested tokens available for a specific address */
|
|
141
|
+
async getAvailableVestedAmount(account) {
|
|
142
|
+
return await this.rpc.readContract({
|
|
143
|
+
address: this.address,
|
|
144
|
+
abi: derc20Abi,
|
|
145
|
+
functionName: "computeAvailableVestedAmount",
|
|
146
|
+
args: [account]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** Get the current annual mint rate in tokens per year */
|
|
150
|
+
async getYearlyMintRate() {
|
|
151
|
+
return await this.rpc.readContract({
|
|
152
|
+
address: this.address,
|
|
153
|
+
abi: derc20Abi,
|
|
154
|
+
functionName: "yearlyMintRate"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/** Get the pool address for the token */
|
|
158
|
+
async getPool() {
|
|
159
|
+
return await this.rpc.readContract({
|
|
160
|
+
address: this.address,
|
|
161
|
+
abi: derc20Abi,
|
|
162
|
+
functionName: "pool"
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** Check if the liquidity pool is unlocked */
|
|
166
|
+
async getIsPoolUnlocked() {
|
|
167
|
+
return await this.rpc.readContract({
|
|
168
|
+
address: this.address,
|
|
169
|
+
abi: derc20Abi,
|
|
170
|
+
functionName: "isPoolUnlocked"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/** Get the timestamp when token minting begins */
|
|
174
|
+
async getCurrentYearStart() {
|
|
175
|
+
return await this.rpc.readContract({
|
|
176
|
+
address: this.address,
|
|
177
|
+
abi: derc20Abi,
|
|
178
|
+
functionName: "currentYearStart"
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/** Get the timestamp of the last mint */
|
|
182
|
+
async getLastMintTimestamp() {
|
|
183
|
+
return await this.rpc.readContract({
|
|
184
|
+
address: this.address,
|
|
185
|
+
abi: derc20Abi,
|
|
186
|
+
functionName: "lastMintTimestamp"
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get detailed vesting information for a specific account
|
|
191
|
+
* @param account - Address to retrieve vesting data for
|
|
192
|
+
* @returns Object containing totalAmount and releasedAmount
|
|
193
|
+
*/
|
|
194
|
+
async getVestingData(account) {
|
|
195
|
+
const result = await this.rpc.readContract({
|
|
196
|
+
address: this.address,
|
|
197
|
+
abi: derc20Abi,
|
|
198
|
+
functionName: "getVestingDataOf",
|
|
199
|
+
args: [account]
|
|
200
|
+
});
|
|
201
|
+
return {
|
|
202
|
+
totalAmount: result[0],
|
|
203
|
+
releasedAmount: result[1]
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// Write methods (require wallet client)
|
|
207
|
+
/**
|
|
208
|
+
* Approve a spender to transfer tokens on behalf of the owner
|
|
209
|
+
* @param spender - Address that will be able to spend the tokens
|
|
210
|
+
* @param value - Amount of tokens to approve
|
|
211
|
+
* @returns Transaction hash
|
|
212
|
+
*/
|
|
213
|
+
async approve(spender, value, options) {
|
|
214
|
+
if (!this.walletClient) {
|
|
215
|
+
throw new Error("Wallet client required for write operations");
|
|
216
|
+
}
|
|
217
|
+
const { request } = await this.rpc.simulateContract({
|
|
218
|
+
address: this.address,
|
|
219
|
+
abi: derc20Abi,
|
|
220
|
+
functionName: "approve",
|
|
221
|
+
args: [spender, value],
|
|
222
|
+
account: this.walletClient.account
|
|
223
|
+
});
|
|
224
|
+
return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Delegate governance votes to an address
|
|
228
|
+
*/
|
|
229
|
+
async delegate(delegatee, options) {
|
|
230
|
+
if (!this.walletClient) {
|
|
231
|
+
throw new Error("Wallet client required for write operations");
|
|
232
|
+
}
|
|
233
|
+
const { request } = await this.rpc.simulateContract({
|
|
234
|
+
address: this.address,
|
|
235
|
+
abi: derc20Abi,
|
|
236
|
+
functionName: "delegate",
|
|
237
|
+
args: [delegatee],
|
|
238
|
+
account: this.walletClient.account
|
|
239
|
+
});
|
|
240
|
+
return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Delegate governance votes using an EIP-712 signature (gasless path)
|
|
244
|
+
* Note: Caller signs typed data; a relayer or the caller submits the tx.
|
|
245
|
+
*/
|
|
246
|
+
async delegateBySig(delegatee, expiry, options) {
|
|
247
|
+
if (!this.walletClient) {
|
|
248
|
+
throw new Error("Wallet client required for write operations");
|
|
249
|
+
}
|
|
250
|
+
const acct = this.walletClient.account;
|
|
251
|
+
let accountAddress;
|
|
252
|
+
if (typeof acct === "string") {
|
|
253
|
+
accountAddress = acct;
|
|
254
|
+
} else if (acct && typeof acct === "object" && "address" in acct) {
|
|
255
|
+
accountAddress = acct.address;
|
|
256
|
+
} else {
|
|
257
|
+
throw new Error("Invalid wallet account");
|
|
258
|
+
}
|
|
259
|
+
const [nonce, name] = await Promise.all([
|
|
260
|
+
this.rpc.readContract({ address: this.address, abi: derc20Abi, functionName: "nonces", args: [accountAddress] }),
|
|
261
|
+
this.getName()
|
|
262
|
+
]);
|
|
263
|
+
const chainId = this.rpc.chain?.id ?? await this.rpc.getChainId();
|
|
264
|
+
const domain = {
|
|
265
|
+
name,
|
|
266
|
+
version: "1",
|
|
267
|
+
chainId,
|
|
268
|
+
verifyingContract: this.address
|
|
269
|
+
};
|
|
270
|
+
const types = {
|
|
271
|
+
Delegation: [
|
|
272
|
+
{ name: "delegatee", type: "address" },
|
|
273
|
+
{ name: "nonce", type: "uint256" },
|
|
274
|
+
{ name: "expiry", type: "uint256" }
|
|
275
|
+
]
|
|
276
|
+
};
|
|
277
|
+
const message = { delegatee, nonce, expiry };
|
|
278
|
+
const signature = await this.walletClient.signTypedData({
|
|
279
|
+
domain,
|
|
280
|
+
types,
|
|
281
|
+
primaryType: "Delegation",
|
|
282
|
+
message,
|
|
283
|
+
account: accountAddress
|
|
284
|
+
});
|
|
285
|
+
const { v, r, s } = _Derc20.splitSignature(signature);
|
|
286
|
+
const { request } = await this.rpc.simulateContract({
|
|
287
|
+
address: this.address,
|
|
288
|
+
abi: derc20Abi,
|
|
289
|
+
functionName: "delegateBySig",
|
|
290
|
+
args: [delegatee, nonce, expiry, v, r, s],
|
|
291
|
+
account: this.walletClient.account
|
|
292
|
+
});
|
|
293
|
+
return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Release all currently available vested tokens to the caller
|
|
297
|
+
*/
|
|
298
|
+
async release(options) {
|
|
299
|
+
if (!this.walletClient) {
|
|
300
|
+
throw new Error("Wallet client required for write operations");
|
|
301
|
+
}
|
|
302
|
+
const { request } = await this.rpc.simulateContract({
|
|
303
|
+
address: this.address,
|
|
304
|
+
abi: derc20Abi,
|
|
305
|
+
functionName: "release",
|
|
306
|
+
args: [],
|
|
307
|
+
account: this.walletClient.account
|
|
308
|
+
});
|
|
309
|
+
return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export { Derc20 };
|
|
314
|
+
//# sourceMappingURL=chunk-NZ4BJ2IC.mjs.map
|
|
315
|
+
//# sourceMappingURL=chunk-NZ4BJ2IC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/entities/token/derc20/Derc20.ts"],"names":[],"mappings":";;;AASO,IAAM,MAAA,GAAN,MAAM,OAAA,CAAO;AAAA,EAIlB,IAAY,GAAA,GAAoB;AAC9B,IAAA,OAAO,IAAA,CAAK,YAAA;AAAA,EACd;AAAA,EAEA,OAAe,eAAe,SAAA,EAA6E;AACzG,IAAA,MAAM,GAAA,GAAM,UAAU,WAAA,EAAY;AAClC,IAAA,MAAM,IAAK,CAAA,EAAA,EAAK,GAAA,CAAI,KAAA,CAAM,CAAA,EAAG,EAAE,CAAC,CAAA,CAAA;AAChC,IAAA,MAAM,IAAK,CAAA,EAAA,EAAK,GAAA,CAAI,KAAA,CAAM,EAAA,EAAI,GAAG,CAAC,CAAA,CAAA;AAClC,IAAA,IAAI,IAAI,QAAA,CAAS,GAAA,CAAI,MAAM,GAAA,EAAK,GAAG,GAAG,EAAE,CAAA;AACxC,IAAA,IAAI,CAAA,GAAI,IAAI,CAAA,IAAK,EAAA;AACjB,IAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAE;AAAA,EACnB;AAAA,EAEA,WAAA,CAAY,YAAA,EAAqC,YAAA,EAAwC,OAAA,EAAkB;AACzG,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AACpB,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AACpB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA;AAAA,EAGA,MAAM,OAAA,GAA2B;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ACL,YAAA,EAAc,SAAA;AAAA,MACd,MAAM,EAAC;AAAA,MACP,OAAA,EAAS,KAAK,YAAA,CAAa;AAAA,KAC5B,CAAA;AAED,IAAA,OAAO,MAAM,IAAA,CAAK,YAAA,CAAa,aAAA,CAAc,OAAA,EAAS,GAAA,GAAM,EAAE,GAAG,OAAA,EAAS,GAAA,EAAK,OAAA,CAAQ,GAAA,KAAQ,OAAO,CAAA;AAAA,EACxG;AACF","file":"chunk-NZ4BJ2IC.mjs","sourcesContent":["import { type Address, type WalletClient, type PublicClient } from 'viem'\nimport { derc20Abi } from '../../../abis'\nimport { SupportedPublicClient } from '@/types'\n\n/**\n * A class providing read and write access to a DERC20 token contract.\n * Enables querying standard ERC20 token properties along with custom vesting\n * and minting-related state information.\n */\nexport class Derc20 {\n private publicClient: SupportedPublicClient\n private walletClient?: WalletClient\n private address: Address\n private get rpc(): PublicClient {\n return this.publicClient as PublicClient\n }\n \n private static splitSignature(signature: `0x${string}`): { v: number; r: `0x${string}`; s: `0x${string}` } {\n const sig = signature.toLowerCase() as `0x${string}`\n const r = (`0x${sig.slice(2, 66)}`) as `0x${string}`\n const s = (`0x${sig.slice(66, 130)}`) as `0x${string}`\n let v = parseInt(sig.slice(130, 132), 16)\n if (v < 27) v += 27\n return { v, r, s }\n }\n \n constructor(publicClient: SupportedPublicClient, walletClient: WalletClient | undefined, address: Address) {\n this.publicClient = publicClient\n this.walletClient = walletClient\n this.address = address\n }\n \n /** Get the human-readable name of the token */\n async getName(): Promise<string> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'name',\n })\n }\n \n /** Get the symbol/ticker of the token */\n async getSymbol(): Promise<string> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'symbol',\n })\n }\n \n /** Get the number of decimals used for token divisions */\n async getDecimals(): Promise<number> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'decimals',\n })\n }\n \n /** Get the token URI for the token */\n async getTokenURI(): Promise<string> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'tokenURI',\n })\n }\n \n // -------------------------\n // Governance (Votes) reads\n // -------------------------\n \n /** Get the current delegate for an account */\n async getDelegates(account: Address): Promise<Address> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'delegates',\n args: [account],\n })\n }\n \n /** Get current voting power for an account */\n async getVotes(account: Address): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'getVotes',\n args: [account],\n })\n }\n \n /** Get historical voting power at a given timepoint (block) */\n async getPastVotes(account: Address, timepoint: bigint): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'getPastVotes',\n args: [account, timepoint],\n })\n }\n \n /**\n * Get the allowance granted by an owner to a spender\n * @param owner - The address that granted the allowance\n * @param spender - The address that can spend the tokens\n */\n async getAllowance(owner: Address, spender: Address): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'allowance',\n args: [owner, spender],\n })\n }\n \n /**\n * Get the token balance of a specific account\n * @param account - Address to check balance for\n */\n async getBalanceOf(account: Address): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'balanceOf',\n args: [account],\n })\n }\n \n /** Get the total supply of tokens in circulation */\n async getTotalSupply(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'totalSupply',\n })\n }\n \n /** Get the duration (in seconds) of the vesting period */\n async getVestingDuration(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'vestingDuration',\n })\n }\n \n /** Get the timestamp when vesting begins */\n async getVestingStart(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'vestingStart',\n })\n }\n \n /** Get the total amount of tokens allocated for vesting */\n async getVestedTotalAmount(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'vestedTotalAmount',\n })\n }\n \n /** Get the amount of vested tokens available for a specific address */\n async getAvailableVestedAmount(account: Address): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'computeAvailableVestedAmount',\n args: [account],\n })\n }\n \n /** Get the current annual mint rate in tokens per year */\n async getYearlyMintRate(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'yearlyMintRate',\n })\n }\n \n /** Get the pool address for the token */\n async getPool(): Promise<Address> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'pool',\n })\n }\n \n /** Check if the liquidity pool is unlocked */\n async getIsPoolUnlocked(): Promise<boolean> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'isPoolUnlocked',\n })\n }\n \n /** Get the timestamp when token minting begins */\n async getCurrentYearStart(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'currentYearStart',\n })\n }\n \n /** Get the timestamp of the last mint */\n async getLastMintTimestamp(): Promise<bigint> {\n return await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'lastMintTimestamp',\n })\n }\n \n /**\n * Get detailed vesting information for a specific account\n * @param account - Address to retrieve vesting data for\n * @returns Object containing totalAmount and releasedAmount\n */\n async getVestingData(account: Address): Promise<{\n totalAmount: bigint\n releasedAmount: bigint\n }> {\n const result = await this.rpc.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'getVestingDataOf',\n args: [account],\n })\n \n return {\n totalAmount: result[0],\n releasedAmount: result[1],\n }\n }\n \n // Write methods (require wallet client)\n \n /**\n * Approve a spender to transfer tokens on behalf of the owner\n * @param spender - Address that will be able to spend the tokens\n * @param value - Amount of tokens to approve\n * @returns Transaction hash\n */\n async approve(spender: Address, value: bigint, options?: { gas?: bigint }): Promise<`0x${string}`> {\n if (!this.walletClient) {\n throw new Error('Wallet client required for write operations')\n }\n \n const { request } = await this.rpc.simulateContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'approve',\n args: [spender, value],\n account: this.walletClient.account,\n })\n \n return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request)\n }\n \n /**\n * Delegate governance votes to an address\n */\n async delegate(delegatee: Address, options?: { gas?: bigint }): Promise<`0x${string}`> {\n if (!this.walletClient) {\n throw new Error('Wallet client required for write operations')\n }\n \n const { request } = await this.rpc.simulateContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'delegate',\n args: [delegatee],\n account: this.walletClient.account,\n })\n \n return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request)\n }\n \n /**\n * Delegate governance votes using an EIP-712 signature (gasless path)\n * Note: Caller signs typed data; a relayer or the caller submits the tx.\n */\n async delegateBySig(\n delegatee: Address,\n expiry: bigint,\n options?: { gas?: bigint }\n ): Promise<`0x${string}`> {\n if (!this.walletClient) {\n throw new Error('Wallet client required for write operations')\n }\n\n const acct = this.walletClient.account as unknown\n let accountAddress: Address\n if (typeof acct === 'string') {\n accountAddress = acct as Address\n } else if (acct && typeof acct === 'object' && 'address' in acct) {\n accountAddress = (acct as { address: Address }).address\n } else {\n throw new Error('Invalid wallet account')\n }\n const [nonce, name] = await Promise.all([\n this.rpc.readContract({ address: this.address, abi: derc20Abi, functionName: 'nonces', args: [accountAddress] }),\n this.getName(),\n ])\n const chainId = (this.rpc.chain?.id as number | undefined) ?? (await this.rpc.getChainId())\n\n const domain = {\n name,\n version: '1',\n chainId,\n verifyingContract: this.address,\n } as const\n\n const types = {\n Delegation: [\n { name: 'delegatee', type: 'address' },\n { name: 'nonce', type: 'uint256' },\n { name: 'expiry', type: 'uint256' },\n ],\n } as const\n\n const message = { delegatee, nonce, expiry } as const\n\n const signature = await this.walletClient.signTypedData({\n domain,\n types,\n primaryType: 'Delegation',\n message,\n account: accountAddress,\n })\n\n const { v, r, s } = Derc20.splitSignature(signature)\n\n const { request } = await this.rpc.simulateContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'delegateBySig',\n args: [delegatee, nonce, expiry, v, r, s],\n account: this.walletClient.account,\n })\n\n return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request)\n }\n\n /**\n * Release all currently available vested tokens to the caller\n */\n async release(options?: { gas?: bigint }): Promise<`0x${string}`> {\n if (!this.walletClient) {\n throw new Error('Wallet client required for write operations')\n }\n\n const { request } = await this.rpc.simulateContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'release',\n args: [],\n account: this.walletClient.account,\n })\n\n return await this.walletClient.writeContract(options?.gas ? { ...request, gas: options.gas } : request)\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkYYUOLM6U_js = require('./chunk-YYUOLM6U.js');
|
|
4
|
+
|
|
5
|
+
// src/types.ts
|
|
6
|
+
var NO_OP_ENABLED_CHAIN_IDS = [
|
|
7
|
+
chunkYYUOLM6U_js.CHAIN_IDS.BASE,
|
|
8
|
+
chunkYYUOLM6U_js.CHAIN_IDS.BASE_SEPOLIA,
|
|
9
|
+
chunkYYUOLM6U_js.CHAIN_IDS.UNICHAIN,
|
|
10
|
+
chunkYYUOLM6U_js.CHAIN_IDS.UNICHAIN_SEPOLIA,
|
|
11
|
+
chunkYYUOLM6U_js.CHAIN_IDS.MONAD_TESTNET,
|
|
12
|
+
chunkYYUOLM6U_js.CHAIN_IDS.MONAD_MAINNET
|
|
13
|
+
];
|
|
14
|
+
function isNoOpEnabledChain(chainId) {
|
|
15
|
+
return NO_OP_ENABLED_CHAIN_IDS.includes(chainId);
|
|
16
|
+
}
|
|
17
|
+
var LockablePoolStatus = /* @__PURE__ */ ((LockablePoolStatus2) => {
|
|
18
|
+
LockablePoolStatus2[LockablePoolStatus2["Uninitialized"] = 0] = "Uninitialized";
|
|
19
|
+
LockablePoolStatus2[LockablePoolStatus2["Initialized"] = 1] = "Initialized";
|
|
20
|
+
LockablePoolStatus2[LockablePoolStatus2["Locked"] = 2] = "Locked";
|
|
21
|
+
LockablePoolStatus2[LockablePoolStatus2["Exited"] = 3] = "Exited";
|
|
22
|
+
return LockablePoolStatus2;
|
|
23
|
+
})(LockablePoolStatus || {});
|
|
24
|
+
|
|
25
|
+
exports.LockablePoolStatus = LockablePoolStatus;
|
|
26
|
+
exports.NO_OP_ENABLED_CHAIN_IDS = NO_OP_ENABLED_CHAIN_IDS;
|
|
27
|
+
exports.isNoOpEnabledChain = isNoOpEnabledChain;
|
|
28
|
+
//# sourceMappingURL=chunk-OKNM7ODQ.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-OKNM7ODQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"names":["CHAIN_IDS","LockablePoolStatus"],"mappings":";;;;;AA0EO,IAAM,uBAAA,GAA0B;AAAA,EACrCA,0BAAA,CAAU,IAAA;AAAA,EACVA,0BAAA,CAAU,YAAA;AAAA,EACVA,0BAAA,CAAU,QAAA;AAAA,EACVA,0BAAA,CAAU,gBAAA;AAAA,EACVA,0BAAA,CAAU,aAAA;AAAA,EACVA,0BAAA,CAAU;AACZ;AAOO,SAAS,mBAAmB,OAAA,EAAgD;AACjF,EAAA,OAAQ,uBAAA,CAA8C,SAAS,OAAO,CAAA;AACxE;AAyBO,IAAK,kBAAA,qBAAAC,mBAAAA,KAAL;AACL,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,mBAAgB,CAAA,CAAA,GAAhB,eAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,iBAAc,CAAA,CAAA,GAAd,aAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AACA,EAAAA,mBAAAA,CAAAA,mBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AAJU,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-OKNM7ODQ.js","sourcesContent":["import { base, baseSepolia, ink, unichain } from 'viem/chains';\nimport { CHAIN_IDS, type SupportedChainId } from './addresses';\n// Re-export SupportedChainId so consumers can import from this module\nexport { type SupportedChainId } from './addresses';\nimport type { Address, WalletClient } from 'viem';\n\nexport type SupportedChain =\n | typeof base\n | typeof baseSepolia\n | typeof ink\n | typeof unichain\n | typeof baseSepolia;\n// Use a wide type to avoid cross-package viem type identity issues when linking packages locally.\nexport type SupportedPublicClient = unknown;\n\n// Core configuration types\n// Token configuration (discriminated union)\nexport interface StandardTokenConfig {\n type?: 'standard'; // default behavior (backwards compatible)\n name: string;\n symbol: string;\n tokenURI: string;\n yearlyMintRate?: bigint; // Optional yearly mint rate (in WAD, default: 2% = 0.02e18)\n}\n\nexport interface Doppler404TokenConfig {\n type: 'doppler404';\n name: string;\n symbol: string;\n baseURI: string;\n // Optional unit for DN404 factory (uint256). Defaults to 1000 when omitted.\n unit?: bigint;\n}\n\nexport type TokenConfig = StandardTokenConfig | Doppler404TokenConfig;\n\nexport interface SaleConfig {\n initialSupply: bigint;\n numTokensToSell: bigint;\n numeraire: Address; // e.g., WETH address\n}\n\n// Static Auction Pool configuration\nexport interface StaticPoolConfig {\n startTick: number;\n endTick: number;\n fee: number; // e.g., 3000 for 0.3%\n // Optional parameters for lockable initializer\n numPositions?: number; // Number of liquidity positions (default: based on tick range)\n maxShareToBeSold?: bigint; // Maximum share of tokens to sell (in WAD, default: 1e18 = 100%)\n beneficiaries?: BeneficiaryData[]; // Optional beneficiaries for fee streaming\n}\n\n// Dynamic Auction configuration\nexport interface DynamicAuctionConfig {\n duration: number; // in seconds\n epochLength: number; // in seconds\n startTick: number;\n endTick: number;\n gamma?: number; // Optional, can be auto-calculated\n minProceeds: bigint;\n maxProceeds: bigint;\n numPdSlugs?: number; // Price discovery slugs (optional)\n}\n\n// Vesting configuration\nexport interface VestingConfig {\n duration: number; // in seconds\n cliffDuration: number; // in seconds\n recipients?: Address[]; // Optional array of recipient addresses (defaults to [userAddress] if not specified)\n amounts?: bigint[]; // Optional array of vesting amounts per recipient (must match recipients length if provided)\n}\n\n// Chains where no-op governance is enabled\nexport const NO_OP_ENABLED_CHAIN_IDS = [\n CHAIN_IDS.BASE,\n CHAIN_IDS.BASE_SEPOLIA,\n CHAIN_IDS.UNICHAIN,\n CHAIN_IDS.UNICHAIN_SEPOLIA,\n CHAIN_IDS.MONAD_TESTNET,\n CHAIN_IDS.MONAD_MAINNET,\n] as const;\n\nexport type NoOpEnabledChainId = (typeof NO_OP_ENABLED_CHAIN_IDS)[number];\n\n/**\n * Check if a chain supports no-op governance\n */\nexport function isNoOpEnabledChain(chainId: number): chainId is NoOpEnabledChainId {\n return (NO_OP_ENABLED_CHAIN_IDS as readonly number[]).includes(chainId);\n}\n\n// Governance configuration (discriminated union)\nexport type GovernanceDefault = { type: 'default' };\nexport interface GovernanceCustom {\n type: 'custom';\n initialVotingDelay: number;\n initialVotingPeriod: number;\n initialProposalThreshold: bigint;\n}\nexport type GovernanceNoOp = { type: 'noOp' };\n\nexport type GovernanceOption<C extends SupportedChainId> =\n | GovernanceDefault\n | GovernanceCustom\n | (C extends NoOpEnabledChainId ? GovernanceNoOp : never);\n\n// Unified beneficiary data used for fee streaming, lockable initializers, and migration configs\n// Uses shares in WAD format (1e18 = 100%) for consistency across all beneficiary configurations\nexport interface BeneficiaryData {\n beneficiary: Address;\n shares: bigint; // shares in WAD (1e18 = 100%)\n}\n\n// Pool status for lockable initializer\nexport enum LockablePoolStatus {\n Uninitialized = 0,\n Initialized = 1,\n Locked = 2,\n Exited = 3,\n}\n\n// Lockable pool state\nexport interface LockablePoolState {\n asset: Address;\n numeraire: Address;\n tickLower: number;\n tickUpper: number;\n maxShareToBeSold: bigint;\n totalTokensOnBondingCurve: bigint;\n status: LockablePoolStatus;\n}\n\n// Multicurve pool state (V4 initializer)\nexport interface MulticurvePoolState {\n asset: Address;\n numeraire: Address;\n fee: number;\n tickSpacing: number;\n status: LockablePoolStatus; // Reuses the same enum\n poolKey: V4PoolKey;\n farTick: number;\n}\n\n// Migration configuration (discriminated union)\nexport type MigrationConfig =\n | { type: 'uniswapV2' } // Basic migration to a new Uniswap v2 pool\n | {\n type: 'uniswapV3';\n fee: number;\n tickSpacing: number;\n }\n | {\n type: 'uniswapV4';\n fee: number;\n tickSpacing: number;\n // Configuration for fee streaming via StreamableFeesLocker (optional)\n // When omitted, fees are not locked and beneficiaries are not configured\n // This is useful when using noOp governance where lock duration is not meaningful\n streamableFees?: {\n lockDuration: number; // in seconds\n beneficiaries: BeneficiaryData[]; // Uses shares in WAD (1e18 = 100%)\n };\n }\n | { type: 'noOp' }; // No migration - used with lockable beneficiaries\n\n// Create Static Auction parameters\nexport interface CreateStaticAuctionParams<C extends SupportedChainId = SupportedChainId> {\n // Token configuration\n token: TokenConfig;\n\n // Sale configuration\n sale: SaleConfig;\n\n // Static Auction (Uniswap v3) Pool configuration\n pool: StaticPoolConfig;\n\n // Vesting configuration (optional)\n vesting?: VestingConfig;\n\n // Governance configuration (required). Use `{ type: 'noOp' }` where enabled,\n // `{ type: 'default' }` for standard defaults, or `{ type: 'custom', ... }` to customize.\n governance: GovernanceOption<C>;\n\n // Explicit Migration Configuration\n migration: MigrationConfig;\n\n // Integrator details\n integrator?: Address;\n userAddress: Address;\n\n // Optional address overrides for on-chain modules used during encoding/creation\n modules?: ModuleAddressOverrides;\n\n // Optional transaction gas limit override for the create() transaction\n // If omitted, SDK will default to 13,500,000 gas for create()\n gas?: bigint;\n}\n\n// Create Dynamic Auction parameters\nexport interface CreateDynamicAuctionParams<C extends SupportedChainId = SupportedChainId> {\n // Token configuration\n token: TokenConfig;\n\n // Sale configuration\n sale: SaleConfig;\n\n // Dynamic Auction (Uniswap v4 Hook) configuration\n auction: DynamicAuctionConfig;\n\n // Pool configuration\n pool: {\n fee: number; // e.g., 3000 for 0.3%\n tickSpacing: number;\n };\n\n // Vesting configuration (optional)\n vesting?: VestingConfig;\n\n // Governance configuration (required). Use `{ type: 'noOp' }` where enabled,\n // `{ type: 'default' }` for standard defaults, or `{ type: 'custom', ... }` to customize.\n governance: GovernanceOption<C>;\n\n // Explicit Migration Configuration\n migration: MigrationConfig;\n\n // Integrator details\n integrator?: Address;\n userAddress: Address;\n\n // Time configuration (internal use)\n startTimeOffset?: number;\n blockTimestamp?: number; // Optional: use this block timestamp instead of fetching latest\n\n // Optional transaction gas limit override for the create() transaction\n // If omitted, SDK will default to 13,500,000 gas for create()\n gas?: bigint;\n\n // Optional address overrides for on-chain modules used during encoding/creation\n modules?: ModuleAddressOverrides;\n}\n\n// Price range configuration for automatic tick calculation\nexport interface PriceRange {\n startPrice: number;\n endPrice: number;\n}\n\n// Tick range configuration\nexport interface TickRange {\n startTick: number;\n endTick: number;\n}\n\n// ============================================================================\n// Market Cap Configuration Types\n// ============================================================================\n\n/**\n * Market cap range in USD for price configurations.\n * Used to define start and end market caps for bonding curves.\n */\nexport interface MarketCapRange {\n /** Starting market cap in USD (e.g., 100_000 for $100k) */\n start: number;\n /** Ending market cap in USD (e.g., 10_000_000 for $10M) */\n end: number;\n}\n\n/**\n * Base configuration for market cap-based tick calculations.\n * Used by builder methods to convert market caps to ticks.\n */\nexport interface MarketCapConfig {\n /** Target market cap range in USD */\n marketCap: MarketCapRange;\n /** Price of numeraire in USD (e.g., 3000 for ETH at $3000) */\n numerairePrice: number;\n /** \n * Token supply override. If not provided, inferred from saleConfig.initialSupply.\n * Must include decimals (e.g., parseEther('1000000000') for 1B tokens).\n */\n tokenSupply?: bigint;\n /** Token decimals (default: 18) */\n tokenDecimals?: number;\n /** Numeraire decimals (default: 18) */\n numeraireDecimals?: number;\n}\n\n/**\n * Market cap configuration for V3 Static Auctions.\n * Extends base config with V3-specific parameters.\n */\nexport interface StaticAuctionMarketCapConfig extends MarketCapConfig {\n /** Fee tier in basis points (e.g., 10000 for 1%). Default: 10000 */\n fee?: number;\n /** Number of liquidity positions. Default: 15 */\n numPositions?: number;\n /** Maximum share of tokens to sell per position (WAD). Default: 35% */\n maxShareToBeSold?: bigint;\n}\n\n/**\n * Market cap range for V4 Dynamic Auctions (Dutch auctions).\n * Uses start/min because price descends from start to minimum.\n */\nexport interface DynamicMarketCapRange {\n /** Starting market cap in USD - auction begins here (e.g., 500_000 for $500k) */\n start: number;\n /** Minimum market cap in USD - floor price the auction descends to (e.g., 50_000 for $50k) */\n min: number;\n}\n\n/**\n * Market cap configuration for V4 Dynamic Auctions.\n * Uses start/min (not start/end) because Dutch auctions descend from start to minimum.\n */\nexport interface DynamicAuctionMarketCapConfig {\n /** Target market cap range (start = launch price, min = floor price) */\n marketCap: DynamicMarketCapRange;\n /** Price of numeraire in USD (e.g., 3000 for ETH at $3000) */\n numerairePrice: number;\n /** \n * Token supply override. If not provided, inferred from saleConfig.initialSupply.\n * Must include decimals (e.g., parseEther('1000000000') for 1B tokens).\n */\n tokenSupply?: bigint;\n /** Token decimals (default: 18) */\n tokenDecimals?: number;\n /** Numeraire decimals (default: 18) */\n numeraireDecimals?: number;\n /** Minimum proceeds required for successful auction */\n minProceeds: bigint;\n /** Maximum proceeds cap for the auction */\n maxProceeds: bigint;\n /** Auction duration in seconds. Default: 7 days */\n duration?: number;\n /** Epoch length in seconds. Default: 3600 (1 hour) */\n epochLength?: number;\n /** Gamma (tick decay per epoch). Auto-calculated if not provided */\n gamma?: number;\n /** Number of price discovery slugs. Default: 5 */\n numPdSlugs?: number;\n}\n\n/**\n * Result of market cap parameter validation.\n */\nexport interface MarketCapValidationResult {\n /** Whether all parameters are within normal bounds */\n valid: boolean;\n /** Warning messages for unusual but technically valid values */\n warnings: string[];\n}\n\n// ============================================================================\n// New Multicurve Market Cap API (no tick math required)\n// ============================================================================\n\n/**\n * Curve configuration for Multicurve pools using market cap ranges.\n * Each curve defines a market cap range and liquidity distribution.\n */\nexport interface MulticurveMarketCapRangeCurve {\n /** Market cap range for this curve */\n marketCap: {\n /** Start market cap in USD (for the first curve, this is the launch price) */\n start: number;\n /** End market cap in USD */\n end: number;\n };\n /** Number of liquidity positions in this curve */\n numPositions: number;\n /** Share of total supply allocated to this curve (WAD, e.g., parseEther('0.3') = 30%) */\n shares: bigint;\n}\n\n/**\n * Market cap-based configuration for Multicurve pools.\n * No tick math required - just specify market caps in USD.\n */\nexport interface MulticurveMarketCapCurvesConfig {\n /** Price of numeraire in USD (e.g., 3000 for ETH at $3000) */\n numerairePrice: number;\n /** \n * Array of curves defining market cap ranges and liquidity distribution.\n * The first curve's marketCap.start is the launch price.\n * Curves must be contiguous (no gaps allowed).\n */\n curves: MulticurveMarketCapRangeCurve[];\n /** Token supply override */\n tokenSupply?: bigint;\n /** Token decimals (default: 18) */\n tokenDecimals?: number;\n /** Numeraire decimals (default: 18) */\n numeraireDecimals?: number;\n /** Fee tier (default: FEE_TIERS.LOW) */\n fee?: number;\n /** Tick spacing (derived from fee if not provided) */\n tickSpacing?: number;\n /** Optional beneficiaries for fee streaming */\n beneficiaries?: BeneficiaryData[];\n}\n\n// Build configuration for static auctions (V3-style)\nexport interface StaticAuctionBuildConfig {\n // Token details\n name: string;\n symbol: string;\n totalSupply?: bigint; // default: 1 billion\n numTokensToSell?: bigint; // default: 900 million\n tokenURI: string;\n\n // Time parameters\n startTimeOffset?: number; // Optional - seconds to add to current block timestamp (default: 30)\n\n // Price parameters - must provide either priceRange or tickRange\n numeraire: Address; // Required for V3\n tickRange?: TickRange;\n priceRange?: PriceRange;\n fee?: number; // default: 10000 (1%)\n\n // Pool parameters (V3 specific)\n numPositions?: number; // default: 15\n maxShareToBeSold?: bigint; // default: 35% in WAD\n\n // Vesting parameters\n yearlyMintRate?: bigint; // default: 2%\n vestingDuration?: bigint; // default: 1 year\n recipients?: Address[]; // defaults to [userAddress]\n amounts?: bigint[]; // defaults based on pre-mint calculation\n\n // Migration configuration\n migration: MigrationConfig;\n\n // Other parameters\n integrator?: Address;\n useGovernance?: boolean; // default: true\n}\n\n// Build configuration for dynamic auctions (V4-style)\nexport interface DynamicAuctionBuildConfig {\n // Token details\n name: string;\n symbol: string;\n totalSupply: bigint;\n numTokensToSell: bigint;\n tokenURI: string;\n\n // Time parameters\n startTimeOffset?: number; // Optional - seconds to add to block timestamp (default: 30)\n blockTimestamp?: number; // Optional - specific block timestamp to use (default: fetch latest)\n duration?: number; // in seconds (default: 604800 = 7 days)\n epochLength?: number; // in seconds (default: 3600)\n\n // Price parameters - must provide either priceRange or tickRange\n numeraire?: Address; // defaults to zero address\n tickRange?: TickRange;\n priceRange?: PriceRange;\n tickSpacing: number;\n gamma?: number; // auto-calculated if not provided\n fee: number; // In basis points\n\n // Sale parameters\n minProceeds: bigint;\n maxProceeds: bigint;\n numPdSlugs?: number; // default: 5\n\n // Vesting parameters\n yearlyMintRate?: bigint; // default: 2%\n vestingDuration: bigint;\n recipients: Address[];\n amounts: bigint[];\n\n // Migration configuration\n migration: MigrationConfig;\n\n // Other parameters\n integrator?: Address;\n useGovernance?: boolean; // default: true\n}\n\n// SDK initialization configuration\nexport interface DopplerSDKConfig {\n publicClient: SupportedPublicClient;\n walletClient?: WalletClient;\n chainId: number;\n}\n\n// Pool information types\nexport interface PoolInfo {\n address: Address;\n tokenAddress: Address;\n numeraireAddress: Address;\n fee: number;\n liquidity: bigint;\n sqrtPriceX96: bigint;\n}\n\nexport interface HookInfo {\n hookAddress: Address;\n tokenAddress: Address;\n numeraireAddress: Address;\n poolId: string;\n currentEpoch: number;\n totalProceeds: bigint;\n totalTokensSold: bigint;\n earlyExit: boolean;\n insufficientProceeds: boolean;\n startingTime: bigint;\n endingTime: bigint;\n epochLength: bigint;\n minimumProceeds: bigint;\n maximumProceeds: bigint;\n}\n\n// Quote result type\nexport interface QuoteResult {\n amountOut: bigint;\n priceImpact: number;\n fee: bigint;\n route: string[];\n}\n\n// Lockable Uniswap V3 Initializer encode params\nexport interface LockableV3InitializerParams {\n fee: number;\n tickLower: number;\n tickUpper: number;\n numPositions: number;\n maxShareToBeSold: bigint;\n beneficiaries: BeneficiaryData[];\n}\n\n// Multicurve curve configuration (mirrors solidity struct)\nexport interface MulticurveCurve {\n tickLower: number; // int24\n tickUpper: number; // int24\n numPositions: number; // uint16\n shares: bigint; // uint256 (WAD)\n}\n\nexport type MulticurveMarketCapPreset = 'low' | 'medium' | 'high';\n\nexport interface V4PoolKey {\n currency0: Address;\n currency1: Address;\n fee: number;\n tickSpacing: number;\n hooks: Address;\n}\n\nexport interface MulticurveBundleExactOutResult {\n asset: Address;\n poolKey: V4PoolKey;\n amountIn: bigint;\n gasEstimate: bigint;\n}\n\nexport interface MulticurveBundleExactInResult {\n asset: Address;\n poolKey: V4PoolKey;\n amountOut: bigint;\n gasEstimate: bigint;\n}\n\n// Create Multicurve initializer parameters\nexport interface CreateMulticurveParams<C extends SupportedChainId = SupportedChainId> {\n // Token configuration\n token: TokenConfig;\n\n // Sale configuration\n sale: SaleConfig;\n\n // Pool configuration for multicurve initializer\n pool: {\n fee: number;\n tickSpacing: number;\n curves: MulticurveCurve[];\n // Optional beneficiaries to lock the pool (fee collection only, no migration)\n beneficiaries?: BeneficiaryData[];\n };\n\n // Optional scheduled launch configuration\n schedule?: {\n startTime: number;\n };\n\n // Vesting configuration (optional)\n vesting?: VestingConfig;\n\n // Governance configuration\n governance: GovernanceOption<C>;\n\n // Migration configuration (can be any supported migrator: V2, V3, or V4)\n migration: MigrationConfig;\n\n // Integrator details\n integrator?: Address;\n userAddress: Address;\n\n // Optional address overrides for on-chain modules used during encoding/creation\n modules?: ModuleAddressOverrides;\n\n // Optional transaction gas limit override for the create() transaction\n gas?: bigint;\n}\n\n// Final Params object that gets passed as arg to create\nexport interface CreateParams {\n initialSupply: bigint,\n numTokensToSell: bigint,\n numeraire: Address,\n tokenFactory: Address,\n tokenFactoryData: `0x${string}`,\n governanceFactory: Address,\n governanceFactoryData: `0x${string}`,\n poolInitializer: Address,\n poolInitializerData: `0x${string}`,\n liquidityMigrator: Address,\n liquidityMigratorData: `0x${string}`,\n integrator: Address,\n salt: `0x${string}`,\n}\n\n// Optional per-call module address overrides. When provided, these take precedence\n// over chain defaults resolved via getAddresses(chainId).\nexport interface ModuleAddressOverrides {\n // Core deployment & routing\n airlock?: Address;\n tokenFactory?: Address;\n\n // Initializers\n v3Initializer?: Address;\n lockableV3Initializer?: Address;\n v4Initializer?: Address;\n v4MulticurveInitializer?: Address;\n v4ScheduledMulticurveInitializer?: Address;\n\n // Governance\n governanceFactory?: Address;\n\n // Dynamic auction infra\n poolManager?: Address;\n dopplerDeployer?: Address;\n\n // Migrators\n v2Migrator?: Address;\n v3Migrator?: Address;\n v4Migrator?: Address;\n noOpMigrator?: Address;\n}\n"]}
|