@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
package/dist/chunk-KFD6U3LQ.mjs
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V3_FEE, DEFAULT_V3_START_TICK, DEFAULT_V3_END_TICK, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, TICK_SPACINGS, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_INITIAL_VOTING_DELAY, ZERO_ADDRESS, DEFAULT_V4_YEARLY_MINT_RATE, DEFAULT_AUCTION_DURATION, DEFAULT_EPOCH_LENGTH, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_INITIAL_VOTING_DELAY, DAY_SECONDS } from './chunk-T644D54P.mjs';
|
|
2
|
-
|
|
3
|
-
// src/builders.ts
|
|
4
|
-
function computeTicks(priceRange, tickSpacing) {
|
|
5
|
-
const startTick = Math.floor(Math.log(priceRange.startPrice) / Math.log(1.0001) / tickSpacing) * tickSpacing;
|
|
6
|
-
const endTick = Math.ceil(Math.log(priceRange.endPrice) / Math.log(1.0001) / tickSpacing) * tickSpacing;
|
|
7
|
-
return { startTick, endTick };
|
|
8
|
-
}
|
|
9
|
-
function computeOptimalGamma(startTick, endTick, durationDays, epochLength, tickSpacing) {
|
|
10
|
-
const totalEpochs = durationDays * DAY_SECONDS / epochLength;
|
|
11
|
-
const tickDelta = Math.abs(endTick - startTick);
|
|
12
|
-
let gamma = Math.ceil(tickDelta / totalEpochs) * tickSpacing;
|
|
13
|
-
gamma = Math.max(tickSpacing, gamma);
|
|
14
|
-
if (gamma % tickSpacing !== 0) {
|
|
15
|
-
throw new Error("Computed gamma must be divisible by tick spacing");
|
|
16
|
-
}
|
|
17
|
-
return gamma;
|
|
18
|
-
}
|
|
19
|
-
var StaticAuctionBuilder = class {
|
|
20
|
-
tokenConfig(params) {
|
|
21
|
-
if (params.type === "doppler404") {
|
|
22
|
-
const p = params;
|
|
23
|
-
this.token = {
|
|
24
|
-
type: "doppler404",
|
|
25
|
-
name: p.name,
|
|
26
|
-
symbol: p.symbol,
|
|
27
|
-
baseURI: p.baseURI,
|
|
28
|
-
unit: p.unit
|
|
29
|
-
};
|
|
30
|
-
} else {
|
|
31
|
-
const p = params;
|
|
32
|
-
this.token = {
|
|
33
|
-
name: p.name,
|
|
34
|
-
symbol: p.symbol,
|
|
35
|
-
tokenURI: p.tokenURI,
|
|
36
|
-
yearlyMintRate: p.yearlyMintRate ?? DEFAULT_V3_YEARLY_MINT_RATE
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
saleConfig(params) {
|
|
42
|
-
this.sale = {
|
|
43
|
-
initialSupply: params.initialSupply,
|
|
44
|
-
numTokensToSell: params.numTokensToSell,
|
|
45
|
-
numeraire: params.numeraire
|
|
46
|
-
};
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
// Provide pool ticks directly
|
|
50
|
-
poolByTicks(params) {
|
|
51
|
-
const fee = params.fee ?? DEFAULT_V3_FEE;
|
|
52
|
-
const startTick = params.startTick ?? DEFAULT_V3_START_TICK;
|
|
53
|
-
const endTick = params.endTick ?? DEFAULT_V3_END_TICK;
|
|
54
|
-
this.pool = {
|
|
55
|
-
startTick,
|
|
56
|
-
endTick,
|
|
57
|
-
fee,
|
|
58
|
-
numPositions: params.numPositions ?? DEFAULT_V3_NUM_POSITIONS,
|
|
59
|
-
maxShareToBeSold: params.maxShareToBeSold ?? DEFAULT_V3_MAX_SHARE_TO_BE_SOLD
|
|
60
|
-
};
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
// Or compute ticks from a price range (tick spacing is inferred from fee)
|
|
64
|
-
poolByPriceRange(params) {
|
|
65
|
-
const fee = params.fee ?? DEFAULT_V3_FEE;
|
|
66
|
-
const tickSpacing = fee === 100 ? TICK_SPACINGS[100] : fee === 500 ? TICK_SPACINGS[500] : fee === 3e3 ? TICK_SPACINGS[3e3] : TICK_SPACINGS[1e4];
|
|
67
|
-
const ticks = computeTicks(params.priceRange, tickSpacing);
|
|
68
|
-
return this.poolByTicks({
|
|
69
|
-
startTick: ticks.startTick,
|
|
70
|
-
endTick: ticks.endTick,
|
|
71
|
-
fee,
|
|
72
|
-
numPositions: params.numPositions,
|
|
73
|
-
maxShareToBeSold: params.maxShareToBeSold
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
withVesting(params) {
|
|
77
|
-
if (!params) {
|
|
78
|
-
this.vesting = void 0;
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
this.vesting = {
|
|
82
|
-
duration: Number(params.duration ?? DEFAULT_V3_VESTING_DURATION),
|
|
83
|
-
cliffDuration: params.cliffDuration ?? 0
|
|
84
|
-
};
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
withGovernance(params) {
|
|
88
|
-
if (!params) {
|
|
89
|
-
this.governance = {
|
|
90
|
-
initialVotingDelay: DEFAULT_V3_INITIAL_VOTING_DELAY,
|
|
91
|
-
initialVotingPeriod: DEFAULT_V3_INITIAL_VOTING_PERIOD,
|
|
92
|
-
initialProposalThreshold: DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD
|
|
93
|
-
};
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
if ("useDefaults" in params) {
|
|
97
|
-
this.governance = {
|
|
98
|
-
initialVotingDelay: DEFAULT_V3_INITIAL_VOTING_DELAY,
|
|
99
|
-
initialVotingPeriod: DEFAULT_V3_INITIAL_VOTING_PERIOD,
|
|
100
|
-
initialProposalThreshold: DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD
|
|
101
|
-
};
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
if ("noOp" in params) {
|
|
105
|
-
this.governance = { noOp: true };
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
this.governance = params;
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
withMigration(migration) {
|
|
112
|
-
this.migration = migration;
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
withUserAddress(address) {
|
|
116
|
-
this.userAddress = address;
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
withIntegrator(address) {
|
|
120
|
-
this.integrator = address ?? ZERO_ADDRESS;
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
build() {
|
|
124
|
-
if (!this.token) throw new Error("tokenConfig is required");
|
|
125
|
-
if (!this.sale) throw new Error("saleConfig is required");
|
|
126
|
-
if (!this.pool) throw new Error("pool configuration is required");
|
|
127
|
-
if (!this.migration) throw new Error("migration configuration is required");
|
|
128
|
-
if (!this.userAddress) throw new Error("userAddress is required");
|
|
129
|
-
if (!this.governance) throw new Error("governance configuration is required; call withGovernance()");
|
|
130
|
-
return {
|
|
131
|
-
token: this.token,
|
|
132
|
-
sale: this.sale,
|
|
133
|
-
pool: this.pool,
|
|
134
|
-
vesting: this.vesting,
|
|
135
|
-
governance: this.governance,
|
|
136
|
-
migration: this.migration,
|
|
137
|
-
integrator: this.integrator ?? ZERO_ADDRESS,
|
|
138
|
-
userAddress: this.userAddress
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
var DynamicAuctionBuilder = class {
|
|
143
|
-
tokenConfig(params) {
|
|
144
|
-
if (params.type === "doppler404") {
|
|
145
|
-
const p = params;
|
|
146
|
-
this.token = {
|
|
147
|
-
type: "doppler404",
|
|
148
|
-
name: p.name,
|
|
149
|
-
symbol: p.symbol,
|
|
150
|
-
baseURI: p.baseURI,
|
|
151
|
-
unit: p.unit
|
|
152
|
-
};
|
|
153
|
-
} else {
|
|
154
|
-
const p = params;
|
|
155
|
-
this.token = {
|
|
156
|
-
name: p.name,
|
|
157
|
-
symbol: p.symbol,
|
|
158
|
-
tokenURI: p.tokenURI,
|
|
159
|
-
yearlyMintRate: p.yearlyMintRate ?? DEFAULT_V4_YEARLY_MINT_RATE
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return this;
|
|
163
|
-
}
|
|
164
|
-
saleConfig(params) {
|
|
165
|
-
this.sale = {
|
|
166
|
-
initialSupply: params.initialSupply,
|
|
167
|
-
numTokensToSell: params.numTokensToSell,
|
|
168
|
-
numeraire: params.numeraire ?? ZERO_ADDRESS
|
|
169
|
-
};
|
|
170
|
-
return this;
|
|
171
|
-
}
|
|
172
|
-
poolConfig(params) {
|
|
173
|
-
this.pool = { fee: params.fee, tickSpacing: params.tickSpacing };
|
|
174
|
-
return this;
|
|
175
|
-
}
|
|
176
|
-
// Provide ticks directly
|
|
177
|
-
auctionByTicks(params) {
|
|
178
|
-
const duration = params.durationDays ?? DEFAULT_AUCTION_DURATION;
|
|
179
|
-
const epochLength = params.epochLength ?? DEFAULT_EPOCH_LENGTH;
|
|
180
|
-
const gamma = params.gamma ?? (this.pool ? computeOptimalGamma(params.startTick, params.endTick, duration, epochLength, this.pool.tickSpacing) : void 0);
|
|
181
|
-
this.auction = {
|
|
182
|
-
duration,
|
|
183
|
-
epochLength,
|
|
184
|
-
startTick: params.startTick,
|
|
185
|
-
endTick: params.endTick,
|
|
186
|
-
gamma,
|
|
187
|
-
minProceeds: params.minProceeds,
|
|
188
|
-
maxProceeds: params.maxProceeds,
|
|
189
|
-
numPdSlugs: params.numPdSlugs
|
|
190
|
-
};
|
|
191
|
-
return this;
|
|
192
|
-
}
|
|
193
|
-
// Or compute ticks from price range
|
|
194
|
-
auctionByPriceRange(params) {
|
|
195
|
-
const tickSpacing = params.tickSpacing ?? this.pool?.tickSpacing;
|
|
196
|
-
if (!tickSpacing) {
|
|
197
|
-
throw new Error("tickSpacing is required (set poolConfig first or pass tickSpacing)");
|
|
198
|
-
}
|
|
199
|
-
const ticks = computeTicks(params.priceRange, tickSpacing);
|
|
200
|
-
return this.auctionByTicks({
|
|
201
|
-
startTick: ticks.startTick,
|
|
202
|
-
endTick: ticks.endTick,
|
|
203
|
-
minProceeds: params.minProceeds,
|
|
204
|
-
maxProceeds: params.maxProceeds,
|
|
205
|
-
durationDays: params.durationDays,
|
|
206
|
-
epochLength: params.epochLength,
|
|
207
|
-
gamma: params.gamma,
|
|
208
|
-
numPdSlugs: params.numPdSlugs
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
withVesting(params) {
|
|
212
|
-
if (!params) {
|
|
213
|
-
this.vesting = void 0;
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
this.vesting = {
|
|
217
|
-
duration: Number(params.duration ?? 0n),
|
|
218
|
-
cliffDuration: params.cliffDuration ?? 0
|
|
219
|
-
};
|
|
220
|
-
return this;
|
|
221
|
-
}
|
|
222
|
-
withGovernance(params) {
|
|
223
|
-
if (!params) {
|
|
224
|
-
this.governance = {
|
|
225
|
-
initialVotingDelay: DEFAULT_V4_INITIAL_VOTING_DELAY,
|
|
226
|
-
initialVotingPeriod: DEFAULT_V4_INITIAL_VOTING_PERIOD,
|
|
227
|
-
initialProposalThreshold: DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD
|
|
228
|
-
};
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
if ("useDefaults" in params) {
|
|
232
|
-
this.governance = {
|
|
233
|
-
initialVotingDelay: DEFAULT_V4_INITIAL_VOTING_DELAY,
|
|
234
|
-
initialVotingPeriod: DEFAULT_V4_INITIAL_VOTING_PERIOD,
|
|
235
|
-
initialProposalThreshold: DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD
|
|
236
|
-
};
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
if ("noOp" in params) {
|
|
240
|
-
this.governance = { noOp: true };
|
|
241
|
-
return this;
|
|
242
|
-
}
|
|
243
|
-
this.governance = params;
|
|
244
|
-
return this;
|
|
245
|
-
}
|
|
246
|
-
withMigration(migration) {
|
|
247
|
-
this.migration = migration;
|
|
248
|
-
return this;
|
|
249
|
-
}
|
|
250
|
-
withUserAddress(address) {
|
|
251
|
-
this.userAddress = address;
|
|
252
|
-
return this;
|
|
253
|
-
}
|
|
254
|
-
withIntegrator(address) {
|
|
255
|
-
this.integrator = address ?? ZERO_ADDRESS;
|
|
256
|
-
return this;
|
|
257
|
-
}
|
|
258
|
-
withTime(params) {
|
|
259
|
-
if (!params) {
|
|
260
|
-
this.startTimeOffset = void 0;
|
|
261
|
-
this.blockTimestamp = void 0;
|
|
262
|
-
return this;
|
|
263
|
-
}
|
|
264
|
-
this.startTimeOffset = params.startTimeOffset;
|
|
265
|
-
this.blockTimestamp = params.blockTimestamp;
|
|
266
|
-
return this;
|
|
267
|
-
}
|
|
268
|
-
build() {
|
|
269
|
-
if (!this.token) throw new Error("tokenConfig is required");
|
|
270
|
-
if (!this.sale) throw new Error("saleConfig is required");
|
|
271
|
-
if (!this.pool) throw new Error("poolConfig is required");
|
|
272
|
-
if (!this.auction) throw new Error("auction configuration is required");
|
|
273
|
-
if (!this.migration) throw new Error("migration configuration is required");
|
|
274
|
-
if (!this.userAddress) throw new Error("userAddress is required");
|
|
275
|
-
if (!this.governance) throw new Error("governance configuration is required; call withGovernance()");
|
|
276
|
-
let { gamma } = this.auction;
|
|
277
|
-
if (gamma === void 0) {
|
|
278
|
-
gamma = computeOptimalGamma(
|
|
279
|
-
this.auction.startTick,
|
|
280
|
-
this.auction.endTick,
|
|
281
|
-
this.auction.duration,
|
|
282
|
-
this.auction.epochLength,
|
|
283
|
-
this.pool.tickSpacing
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
const auction = { ...this.auction, gamma };
|
|
287
|
-
return {
|
|
288
|
-
token: this.token,
|
|
289
|
-
sale: this.sale,
|
|
290
|
-
auction,
|
|
291
|
-
pool: this.pool,
|
|
292
|
-
vesting: this.vesting,
|
|
293
|
-
governance: this.governance,
|
|
294
|
-
migration: this.migration,
|
|
295
|
-
integrator: this.integrator ?? ZERO_ADDRESS,
|
|
296
|
-
userAddress: this.userAddress,
|
|
297
|
-
startTimeOffset: this.startTimeOffset,
|
|
298
|
-
blockTimestamp: this.blockTimestamp
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
export { DynamicAuctionBuilder, StaticAuctionBuilder };
|
|
304
|
-
//# sourceMappingURL=chunk-KFD6U3LQ.mjs.map
|
|
305
|
-
//# sourceMappingURL=chunk-KFD6U3LQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builders.ts"],"names":[],"mappings":";;;AAkCA,SAAS,YAAA,CAAa,YAAwB,WAAgC,EAAA;AAC5E,EAAA,MAAM,SACJ,GAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAK,GAAI,CAAA,UAAA,CAAW,UAAU,CAAA,GAAI,IAAK,CAAA,GAAA,CAAI,MAAM,CAAA,GAAI,WAAW,CAC3E,GAAA,WAAA;AACF,EAAA,MAAM,OACJ,GAAA,IAAA,CAAK,IAAK,CAAA,IAAA,CAAK,GAAI,CAAA,UAAA,CAAW,QAAQ,CAAA,GAAI,IAAK,CAAA,GAAA,CAAI,MAAM,CAAA,GAAI,WAAW,CACxE,GAAA,WAAA;AACF,EAAO,OAAA,EAAE,WAAW,OAAQ,EAAA;AAC9B;AAEA,SAAS,mBACP,CAAA,SAAA,EACA,OACA,EAAA,YAAA,EACA,aACA,WACQ,EAAA;AACR,EAAM,MAAA,WAAA,GAAe,eAAe,WAAe,GAAA,WAAA;AACnD,EAAA,MAAM,SAAY,GAAA,IAAA,CAAK,GAAI,CAAA,OAAA,GAAU,SAAS,CAAA;AAC9C,EAAA,IAAI,KAAQ,GAAA,IAAA,CAAK,IAAK,CAAA,SAAA,GAAY,WAAW,CAAI,GAAA,WAAA;AACjD,EAAQ,KAAA,GAAA,IAAA,CAAK,GAAI,CAAA,WAAA,EAAa,KAAK,CAAA;AACnC,EAAI,IAAA,KAAA,GAAQ,gBAAgB,CAAG,EAAA;AAC7B,IAAM,MAAA,IAAI,MAAM,kDAAkD,CAAA;AAAA;AAEpE,EAAO,OAAA,KAAA;AACT;AA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GAAA,mBAAA;AAAA,QACN,KAAK,OAAQ,CAAA,SAAA;AAAA,QACb,KAAK,OAAQ,CAAA,OAAA;AAAA,QACb,KAAK,OAAQ,CAAA,QAAA;AAAA,QACb,KAAK,OAAQ,CAAA,WAAA;AAAA,QACb,KAAK,IAAK,CAAA;AAAA,OACZ;AAAA;AAGF,IAAA,MAAM,OAAU,GAAA,EAAE,GAAG,IAAA,CAAK,SAAS,KAAM,EAAA;AAEzC,IAAO,OAAA;AAAA,MACL,OAAO,IAAK,CAAA,KAAA;AAAA,MACZ,MAAM,IAAK,CAAA,IAAA;AAAA,MACX,OAAA;AAAA,MACA,MAAM,IAAK,CAAA,IAAA;AAAA,MACX,SAAS,IAAK,CAAA,OAAA;AAAA,MACd,YAAY,IAAK,CAAA,UAAA;AAAA,MACjB,WAAW,IAAK,CAAA,SAAA;AAAA,MAChB,UAAA,EAAY,KAAK,UAAc,IAAA,YAAA;AAAA,MAC/B,aAAa,IAAK,CAAA,WAAA;AAAA,MAClB,iBAAiB,IAAK,CAAA,eAAA;AAAA,MACtB,gBAAgB,IAAK,CAAA;AAAA,KACvB;AAAA;AAEJ","file":"chunk-KFD6U3LQ.mjs","sourcesContent":["import type { Address } from 'viem'\nimport {\n BASIS_POINTS,\n DEFAULT_AUCTION_DURATION,\n DEFAULT_EPOCH_LENGTH,\n DEFAULT_V3_END_TICK,\n DEFAULT_V3_FEE,\n DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD,\n DEFAULT_V3_INITIAL_VOTING_DELAY,\n DEFAULT_V3_INITIAL_VOTING_PERIOD,\n DEFAULT_V3_MAX_SHARE_TO_BE_SOLD,\n DEFAULT_V3_NUM_POSITIONS,\n DEFAULT_V3_START_TICK,\n DEFAULT_V3_VESTING_DURATION,\n DEFAULT_V3_YEARLY_MINT_RATE,\n DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD,\n DEFAULT_V4_INITIAL_VOTING_DELAY,\n DEFAULT_V4_INITIAL_VOTING_PERIOD,\n DEFAULT_V4_YEARLY_MINT_RATE,\n DAY_SECONDS,\n TICK_SPACINGS,\n ZERO_ADDRESS,\n} from './constants'\nimport type {\n CreateDynamicAuctionParams,\n CreateStaticAuctionParams,\n GovernanceConfig,\n GovernanceOption,\n MigrationConfig,\n PriceRange,\n TickRange,\n VestingConfig,\n} from './types'\n\nfunction computeTicks(priceRange: PriceRange, tickSpacing: number): TickRange {\n const startTick =\n Math.floor(Math.log(priceRange.startPrice) / Math.log(1.0001) / tickSpacing) *\n tickSpacing\n const endTick =\n Math.ceil(Math.log(priceRange.endPrice) / Math.log(1.0001) / tickSpacing) *\n tickSpacing\n return { startTick, endTick }\n}\n\nfunction computeOptimalGamma(\n startTick: number,\n endTick: number,\n durationDays: number,\n epochLength: number,\n tickSpacing: number,\n): number {\n const totalEpochs = (durationDays * DAY_SECONDS) / epochLength\n const tickDelta = Math.abs(endTick - startTick)\n let gamma = Math.ceil(tickDelta / totalEpochs) * tickSpacing\n gamma = Math.max(tickSpacing, gamma)\n if (gamma % tickSpacing !== 0) {\n throw new Error('Computed gamma must be divisible by tick spacing')\n }\n return gamma\n}\n\n// Static Auction Builder (V3-style)\nexport class StaticAuctionBuilder {\n private token?: CreateStaticAuctionParams['token']\n private sale?: CreateStaticAuctionParams['sale']\n private pool?: CreateStaticAuctionParams['pool']\n private vesting?: VestingConfig\n private governance?: GovernanceOption\n private migration?: MigrationConfig\n private integrator?: Address\n private userAddress?: Address\n\n tokenConfig(\n params:\n | { type?: 'standard'; name: string; symbol: string; tokenURI: string; yearlyMintRate?: bigint }\n | { type: 'doppler404'; name: string; symbol: string; baseURI: string; unit?: bigint }\n ): this {\n if ((params as any).type === 'doppler404') {\n const p = params as { type: 'doppler404'; name: string; symbol: string; baseURI: string; unit?: bigint }\n this.token = {\n type: 'doppler404',\n name: p.name,\n symbol: p.symbol,\n baseURI: p.baseURI,\n unit: p.unit,\n } as any\n } else {\n const p = params as { type?: 'standard'; name: string; symbol: string; tokenURI: string; yearlyMintRate?: bigint }\n this.token = {\n name: p.name,\n symbol: p.symbol,\n tokenURI: p.tokenURI,\n yearlyMintRate: p.yearlyMintRate ?? DEFAULT_V3_YEARLY_MINT_RATE,\n } as any\n }\n return this\n }\n\n saleConfig(params: {\n initialSupply: bigint\n numTokensToSell: bigint\n numeraire: Address\n }): this {\n this.sale = {\n initialSupply: params.initialSupply,\n numTokensToSell: params.numTokensToSell,\n numeraire: params.numeraire,\n }\n return this\n }\n\n // Provide pool ticks directly\n poolByTicks(params: {\n startTick?: number\n endTick?: number\n fee?: number\n numPositions?: number\n maxShareToBeSold?: bigint\n }): this {\n const fee = params.fee ?? DEFAULT_V3_FEE\n const startTick = params.startTick ?? DEFAULT_V3_START_TICK\n const endTick = params.endTick ?? DEFAULT_V3_END_TICK\n this.pool = {\n startTick,\n endTick,\n fee,\n numPositions: params.numPositions ?? DEFAULT_V3_NUM_POSITIONS,\n maxShareToBeSold: params.maxShareToBeSold ?? DEFAULT_V3_MAX_SHARE_TO_BE_SOLD,\n }\n return this\n }\n\n // Or compute ticks from a price range (tick spacing is inferred from fee)\n poolByPriceRange(params: {\n priceRange: PriceRange\n fee?: number\n numPositions?: number\n maxShareToBeSold?: bigint\n }): this {\n const fee = params.fee ?? DEFAULT_V3_FEE\n const tickSpacing =\n fee === 100 ? TICK_SPACINGS[100] : fee === 500 ? TICK_SPACINGS[500] : fee === 3000 ? TICK_SPACINGS[3000] : TICK_SPACINGS[10000]\n const ticks = computeTicks(params.priceRange, tickSpacing)\n return this.poolByTicks({\n startTick: ticks.startTick,\n endTick: ticks.endTick,\n fee,\n numPositions: params.numPositions,\n maxShareToBeSold: params.maxShareToBeSold,\n })\n }\n\n withVesting(params?: { duration?: bigint; cliffDuration?: number }): this {\n if (!params) {\n this.vesting = undefined\n return this\n }\n this.vesting = {\n duration: Number(params.duration ?? DEFAULT_V3_VESTING_DURATION),\n cliffDuration: params.cliffDuration ?? 0,\n }\n return this\n }\n\n withGovernance(params?: GovernanceConfig | { useDefaults?: boolean } | { noOp: true }): this {\n if (!params) {\n // No args → apply standard governance defaults (explicit selection)\n this.governance = {\n initialVotingDelay: DEFAULT_V3_INITIAL_VOTING_DELAY,\n initialVotingPeriod: DEFAULT_V3_INITIAL_VOTING_PERIOD,\n initialProposalThreshold: DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD,\n }\n return this\n }\n if ('useDefaults' in params) {\n this.governance = {\n initialVotingDelay: DEFAULT_V3_INITIAL_VOTING_DELAY,\n initialVotingPeriod: DEFAULT_V3_INITIAL_VOTING_PERIOD,\n initialProposalThreshold: DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD,\n }\n return this\n }\n if ('noOp' in params) {\n this.governance = { noOp: true }\n return this\n }\n this.governance = params as GovernanceConfig\n return this\n }\n\n withMigration(migration: MigrationConfig): this {\n this.migration = migration\n return this\n }\n\n withUserAddress(address: Address): this {\n this.userAddress = address\n return this\n }\n\n withIntegrator(address?: Address): this {\n this.integrator = address ?? ZERO_ADDRESS\n return this\n }\n\n build(): CreateStaticAuctionParams {\n if (!this.token) throw new Error('tokenConfig is required')\n if (!this.sale) throw new Error('saleConfig is required')\n if (!this.pool) throw new Error('pool configuration is required')\n if (!this.migration) throw new Error('migration configuration is required')\n if (!this.userAddress) throw new Error('userAddress is required')\n if (!this.governance) throw new Error('governance configuration is required; call withGovernance()')\n\n return {\n token: this.token,\n sale: this.sale,\n pool: this.pool,\n vesting: this.vesting,\n governance: this.governance,\n migration: this.migration,\n integrator: this.integrator ?? ZERO_ADDRESS,\n userAddress: this.userAddress,\n }\n }\n}\n\n// Dynamic Auction Builder (V4-style)\nexport class DynamicAuctionBuilder {\n private token?: CreateDynamicAuctionParams['token']\n private sale?: CreateDynamicAuctionParams['sale']\n private auction?: CreateDynamicAuctionParams['auction']\n private pool?: CreateDynamicAuctionParams['pool']\n private vesting?: VestingConfig\n private governance?: GovernanceOption\n private migration?: MigrationConfig\n private integrator?: Address\n private userAddress?: Address\n private startTimeOffset?: number\n private blockTimestamp?: number\n\n tokenConfig(\n params:\n | { type?: 'standard'; name: string; symbol: string; tokenURI: string; yearlyMintRate?: bigint }\n | { type: 'doppler404'; name: string; symbol: string; baseURI: string; unit?: bigint }\n ): this {\n if ((params as any).type === 'doppler404') {\n const p = params as { type: 'doppler404'; name: string; symbol: string; baseURI: string; unit?: bigint }\n this.token = {\n type: 'doppler404',\n name: p.name,\n symbol: p.symbol,\n baseURI: p.baseURI,\n unit: p.unit,\n } as any\n } else {\n const p = params as { type?: 'standard'; name: string; symbol: string; tokenURI: string; yearlyMintRate?: bigint }\n this.token = {\n name: p.name,\n symbol: p.symbol,\n tokenURI: p.tokenURI,\n yearlyMintRate: p.yearlyMintRate ?? DEFAULT_V4_YEARLY_MINT_RATE,\n } as any\n }\n return this\n }\n\n saleConfig(params: {\n initialSupply: bigint\n numTokensToSell: bigint\n numeraire?: Address\n }): this {\n this.sale = {\n initialSupply: params.initialSupply,\n numTokensToSell: params.numTokensToSell,\n numeraire: params.numeraire ?? ZERO_ADDRESS,\n }\n return this\n }\n\n poolConfig(params: { fee: number; tickSpacing: number }): this {\n this.pool = { fee: params.fee, tickSpacing: params.tickSpacing }\n return this\n }\n\n // Provide ticks directly\n auctionByTicks(params: {\n startTick: number\n endTick: number\n minProceeds: bigint\n maxProceeds: bigint\n durationDays?: number\n epochLength?: number\n gamma?: number\n numPdSlugs?: number\n }): this {\n const duration = params.durationDays ?? DEFAULT_AUCTION_DURATION\n const epochLength = params.epochLength ?? DEFAULT_EPOCH_LENGTH\n const gamma =\n params.gamma ?? (this.pool ? computeOptimalGamma(params.startTick, params.endTick, duration, epochLength, this.pool.tickSpacing) : undefined)\n this.auction = {\n duration,\n epochLength,\n startTick: params.startTick,\n endTick: params.endTick,\n gamma,\n minProceeds: params.minProceeds,\n maxProceeds: params.maxProceeds,\n numPdSlugs: params.numPdSlugs,\n }\n return this\n }\n\n // Or compute ticks from price range\n auctionByPriceRange(params: {\n priceRange: PriceRange\n minProceeds: bigint\n maxProceeds: bigint\n durationDays?: number\n epochLength?: number\n gamma?: number\n tickSpacing?: number // optional; will use pool.tickSpacing if not provided\n numPdSlugs?: number\n }): this {\n const tickSpacing = params.tickSpacing ?? this.pool?.tickSpacing\n if (!tickSpacing) {\n throw new Error('tickSpacing is required (set poolConfig first or pass tickSpacing)')\n }\n const ticks = computeTicks(params.priceRange, tickSpacing)\n return this.auctionByTicks({\n startTick: ticks.startTick,\n endTick: ticks.endTick,\n minProceeds: params.minProceeds,\n maxProceeds: params.maxProceeds,\n durationDays: params.durationDays,\n epochLength: params.epochLength,\n gamma: params.gamma,\n numPdSlugs: params.numPdSlugs,\n })\n }\n\n withVesting(params?: { duration?: bigint; cliffDuration?: number }): this {\n if (!params) {\n this.vesting = undefined\n return this\n }\n this.vesting = {\n duration: Number(params.duration ?? 0n),\n cliffDuration: params.cliffDuration ?? 0,\n }\n return this\n }\n\n withGovernance(params?: GovernanceConfig | { useDefaults?: boolean } | { noOp: true }): this {\n if (!params) {\n // No args → apply standard governance defaults (explicit selection)\n this.governance = {\n initialVotingDelay: DEFAULT_V4_INITIAL_VOTING_DELAY,\n initialVotingPeriod: DEFAULT_V4_INITIAL_VOTING_PERIOD,\n initialProposalThreshold: DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD,\n }\n return this\n }\n if ('useDefaults' in params) {\n this.governance = {\n initialVotingDelay: DEFAULT_V4_INITIAL_VOTING_DELAY,\n initialVotingPeriod: DEFAULT_V4_INITIAL_VOTING_PERIOD,\n initialProposalThreshold: DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD,\n }\n return this\n }\n if ('noOp' in params) {\n this.governance = { noOp: true }\n return this\n }\n this.governance = params as GovernanceConfig\n return this\n }\n\n withMigration(migration: MigrationConfig): this {\n this.migration = migration\n return this\n }\n\n withUserAddress(address: Address): this {\n this.userAddress = address\n return this\n }\n\n withIntegrator(address?: Address): this {\n this.integrator = address ?? ZERO_ADDRESS\n return this\n }\n\n withTime(params?: { startTimeOffset?: number; blockTimestamp?: number }): this {\n if (!params) {\n this.startTimeOffset = undefined\n this.blockTimestamp = undefined\n return this\n }\n this.startTimeOffset = params.startTimeOffset\n this.blockTimestamp = params.blockTimestamp\n return this\n }\n\n build(): CreateDynamicAuctionParams {\n if (!this.token) throw new Error('tokenConfig is required')\n if (!this.sale) throw new Error('saleConfig is required')\n if (!this.pool) throw new Error('poolConfig is required')\n if (!this.auction) throw new Error('auction configuration is required')\n if (!this.migration) throw new Error('migration configuration is required')\n if (!this.userAddress) throw new Error('userAddress is required')\n if (!this.governance) throw new Error('governance configuration is required; call withGovernance()')\n\n // Ensure gamma is set and valid\n let { gamma } = this.auction\n if (gamma === undefined) {\n gamma = computeOptimalGamma(\n this.auction.startTick,\n this.auction.endTick,\n this.auction.duration,\n this.auction.epochLength,\n this.pool.tickSpacing,\n )\n }\n\n const auction = { ...this.auction, gamma }\n\n return {\n token: this.token,\n sale: this.sale,\n auction,\n pool: this.pool,\n vesting: this.vesting,\n governance: this.governance,\n migration: this.migration,\n integrator: this.integrator ?? ZERO_ADDRESS,\n userAddress: this.userAddress,\n startTimeOffset: this.startTimeOffset,\n blockTimestamp: this.blockTimestamp,\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/priceHelpers.ts"],"names":["getNearestUsableTick","priceToTick","parseEther","tickToPrice","formatEther"],"mappings":";;;;;AAgBO,SAAS,mBACd,QACA,EAAA,QAAA,EACA,aACA,YAAe,GAAA,EAAA,EACf,gBAAgB,EACwB,EAAA;AAGxC,EAAA,MAAM,SAAY,GAAAA,qCAAA;AAAA,IAChBC,4BAAY,CAAA,CAAA,GAAI,QAAU,EAAA,aAAA,EAAe,YAAY,CAAA;AAAA,IACrD;AAAA,GACF;AAEA,EAAA,MAAM,OAAU,GAAAD,qCAAA;AAAA,IACdC,4BAAY,CAAA,CAAA,GAAI,QAAU,EAAA,aAAA,EAAe,YAAY,CAAA;AAAA,IACrD;AAAA,GACF;AAEA,EAAO,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,EAAA,MAAM,cAAc,YAAe,GAAA,eAAA;AACnC,EAAM,MAAA,QAAA,GAAW,cAAc,GAAM,GAAA,aAAA;AAErC,EAAO,OAAA,IAAA,CAAK,GAAI,CAAA,QAAA,EAAU,GAAG,CAAA;AAC/B","file":"chunk-KPBCG4X2.js","sourcesContent":["/**\n * Price helper utilities for common token launch scenarios\n */\n\nimport { parseEther, formatEther } from 'viem'\nimport { priceToTick, tickToPrice, getNearestUsableTick } from './tickMath'\n\n/**\n * Calculate the tick range for a desired price range\n * @param minPrice Minimum price (ETH per token)\n * @param maxPrice Maximum price (ETH per token)\n * @param tickSpacing The tick spacing of the pool\n * @param wethDecimals Decimals of WETH (usually 18)\n * @param tokenDecimals Decimals of the token (usually 18)\n * @returns Object with startTick and endTick\n */\nexport function calculateTickRange(\n minPrice: number,\n maxPrice: number,\n tickSpacing: number,\n wethDecimals = 18,\n tokenDecimals = 18\n): { startTick: number; endTick: number } {\n // For token/WETH pools, we need to invert the price\n // because Uniswap orders tokens by address\n const startTick = getNearestUsableTick(\n priceToTick(1 / maxPrice, tokenDecimals, wethDecimals),\n tickSpacing\n )\n \n const endTick = getNearestUsableTick(\n priceToTick(1 / minPrice, tokenDecimals, wethDecimals),\n tickSpacing\n )\n \n return { startTick, endTick }\n}\n\n/**\n * Calculate the number of tokens to sell based on desired raise\n * @param targetRaiseETH Target amount to raise in ETH\n * @param avgPricePerToken Average expected price per token in ETH\n * @returns Number of tokens to sell (as bigint)\n */\nexport function calculateTokensToSell(\n targetRaiseETH: number,\n avgPricePerToken: number\n): bigint {\n const tokensToSell = targetRaiseETH / avgPricePerToken\n return parseEther(tokensToSell.toFixed(18))\n}\n\n/**\n * Calculate gamma for dynamic auctions\n * @param startTick Starting tick\n * @param endTick Ending tick\n * @param durationDays Duration in days\n * @param epochLengthHours Epoch length in hours\n * @returns Gamma value\n */\nexport function calculateGamma(\n startTick: number,\n endTick: number,\n durationDays: number,\n epochLengthHours: number\n): number {\n const totalEpochs = (durationDays * 24) / epochLengthHours\n const tickRange = Math.abs(endTick - startTick)\n return Math.floor(tickRange / totalEpochs)\n}\n\n/**\n * Estimate the price at a specific epoch in a dynamic auction\n * @param startTick Starting tick\n * @param gamma Tick movement per epoch\n * @param currentEpoch Current epoch number\n * @param tokenDecimals Token decimals\n * @param wethDecimals WETH decimals\n * @param isIncreasing Whether price increases (true) or decreases (false) over time\n * @returns Estimated price in ETH per token\n */\nexport function estimatePriceAtEpoch(\n startTick: number,\n gamma: number,\n currentEpoch: number,\n tokenDecimals = 18,\n wethDecimals = 18,\n isIncreasing = true\n): number {\n const direction = isIncreasing ? 1 : -1\n const currentTick = startTick + (currentEpoch * gamma * direction)\n \n // Get price from tick (returns WETH/token)\n const wethPerToken = tickToPrice(currentTick, tokenDecimals, wethDecimals, false)\n \n // Invert to get ETH per token\n return 1 / wethPerToken\n}\n\n/**\n * Format a tick value to a human-readable price string\n * @param tick The tick value\n * @param tokenSymbol Symbol of the token\n * @param numeraireSymbol Symbol of the numeraire (e.g., \"ETH\")\n * @param tokenDecimals Token decimals\n * @param numeraireDecimals Numeraire decimals\n * @returns Formatted price string\n */\nexport function formatTickAsPrice(\n tick: number,\n tokenSymbol: string,\n numeraireSymbol: string,\n tokenDecimals = 18,\n numeraireDecimals = 18\n): string {\n const price = tickToPrice(tick, tokenDecimals, numeraireDecimals, false)\n const ethPerToken = 1 / price\n \n if (ethPerToken < 0.0001) {\n return `${ethPerToken.toExponential(2)} ${numeraireSymbol} per ${tokenSymbol}`\n } else if (ethPerToken < 1) {\n return `${ethPerToken.toFixed(6)} ${numeraireSymbol} per ${tokenSymbol}`\n } else {\n return `${ethPerToken.toFixed(2)} ${numeraireSymbol} per ${tokenSymbol}`\n }\n}\n\n/**\n * Calculate the market cap at a given price\n * @param totalSupply Total token supply (as bigint)\n * @param pricePerToken Price per token in ETH\n * @param ethPrice Current ETH price in USD (optional)\n * @returns Market cap object with ETH and USD values\n */\nexport function calculateMarketCap(\n totalSupply: bigint,\n pricePerToken: number,\n ethPrice?: number\n): { eth: string; usd?: string } {\n const totalSupplyNumber = Number(formatEther(totalSupply))\n const marketCapETH = totalSupplyNumber * pricePerToken\n \n const result: { eth: string; usd?: string } = {\n eth: `${marketCapETH.toFixed(2)} ETH`\n }\n \n if (ethPrice) {\n const marketCapUSD = marketCapETH * ethPrice\n result.usd = `$${marketCapUSD.toLocaleString('en-US', { maximumFractionDigits: 0 })}`\n }\n \n return result\n}\n\n/**\n * Calculate fully diluted valuation (FDV)\n * @param totalSupply Total token supply including vested tokens (as bigint)\n * @param pricePerToken Price per token in ETH\n * @param ethPrice Current ETH price in USD (optional)\n * @returns FDV object with ETH and USD values\n */\nexport function calculateFDV(\n totalSupply: bigint,\n pricePerToken: number,\n ethPrice?: number\n): { eth: string; usd?: string } {\n // FDV is the same calculation as market cap but includes all tokens\n return calculateMarketCap(totalSupply, pricePerToken, ethPrice)\n}\n\n/**\n * Estimate slippage for a trade in a concentrated liquidity pool\n * @param amountIn Amount to trade\n * @param liquidity Current liquidity\n * @param currentTick Current tick\n * @param fee Pool fee (e.g., 3000 for 0.3%)\n * @returns Estimated slippage percentage\n */\nexport function estimateSlippage(\n amountIn: bigint,\n liquidity: bigint,\n currentTick: number,\n fee: number\n): number {\n // Simplified slippage estimation\n // In practice, you'd need to simulate the swap through tick ranges\n const feeMultiplier = 1 - (fee / 1000000)\n const liquidityNumber = Number(liquidity) / 1e18\n const amountNumber = Number(amountIn) / 1e18\n \n // Basic approximation: slippage increases with trade size relative to liquidity\n const impactRatio = amountNumber / liquidityNumber\n const slippage = impactRatio * 100 * feeMultiplier\n \n return Math.min(slippage, 100) // Cap at 100%\n}"]}
|
package/dist/chunk-KRN3ROUE.js
DELETED
package/dist/chunk-KT7U37XS.mjs
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { derc20Abi } from './chunk-DCFHANLR.mjs';
|
|
2
|
-
|
|
3
|
-
// src/entities/token/derc20/Derc20.ts
|
|
4
|
-
var Derc20 = class {
|
|
5
|
-
constructor(publicClient, walletClient, address) {
|
|
6
|
-
this.publicClient = publicClient;
|
|
7
|
-
this.walletClient = walletClient;
|
|
8
|
-
this.address = address;
|
|
9
|
-
}
|
|
10
|
-
/** Get the human-readable name of the token */
|
|
11
|
-
async getName() {
|
|
12
|
-
return await this.publicClient.readContract({
|
|
13
|
-
address: this.address,
|
|
14
|
-
abi: derc20Abi,
|
|
15
|
-
functionName: "name"
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/** Get the symbol/ticker of the token */
|
|
19
|
-
async getSymbol() {
|
|
20
|
-
return await this.publicClient.readContract({
|
|
21
|
-
address: this.address,
|
|
22
|
-
abi: derc20Abi,
|
|
23
|
-
functionName: "symbol"
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
/** Get the number of decimals used for token divisions */
|
|
27
|
-
async getDecimals() {
|
|
28
|
-
return await this.publicClient.readContract({
|
|
29
|
-
address: this.address,
|
|
30
|
-
abi: derc20Abi,
|
|
31
|
-
functionName: "decimals"
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/** Get the token URI for the token */
|
|
35
|
-
async getTokenURI() {
|
|
36
|
-
return await this.publicClient.readContract({
|
|
37
|
-
address: this.address,
|
|
38
|
-
abi: derc20Abi,
|
|
39
|
-
functionName: "tokenURI"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get the allowance granted by an owner to a spender
|
|
44
|
-
* @param owner - The address that granted the allowance
|
|
45
|
-
* @param spender - The address that can spend the tokens
|
|
46
|
-
*/
|
|
47
|
-
async getAllowance(owner, spender) {
|
|
48
|
-
return await this.publicClient.readContract({
|
|
49
|
-
address: this.address,
|
|
50
|
-
abi: derc20Abi,
|
|
51
|
-
functionName: "allowance",
|
|
52
|
-
args: [owner, spender]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get the token balance of a specific account
|
|
57
|
-
* @param account - Address to check balance for
|
|
58
|
-
*/
|
|
59
|
-
async getBalanceOf(account) {
|
|
60
|
-
return await this.publicClient.readContract({
|
|
61
|
-
address: this.address,
|
|
62
|
-
abi: derc20Abi,
|
|
63
|
-
functionName: "balanceOf",
|
|
64
|
-
args: [account]
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/** Get the total supply of tokens in circulation */
|
|
68
|
-
async getTotalSupply() {
|
|
69
|
-
return await this.publicClient.readContract({
|
|
70
|
-
address: this.address,
|
|
71
|
-
abi: derc20Abi,
|
|
72
|
-
functionName: "totalSupply"
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/** Get the duration (in seconds) of the vesting period */
|
|
76
|
-
async getVestingDuration() {
|
|
77
|
-
return await this.publicClient.readContract({
|
|
78
|
-
address: this.address,
|
|
79
|
-
abi: derc20Abi,
|
|
80
|
-
functionName: "vestingDuration"
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
/** Get the timestamp when vesting begins */
|
|
84
|
-
async getVestingStart() {
|
|
85
|
-
return await this.publicClient.readContract({
|
|
86
|
-
address: this.address,
|
|
87
|
-
abi: derc20Abi,
|
|
88
|
-
functionName: "vestingStart"
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/** Get the total amount of tokens allocated for vesting */
|
|
92
|
-
async getVestedTotalAmount() {
|
|
93
|
-
return await this.publicClient.readContract({
|
|
94
|
-
address: this.address,
|
|
95
|
-
abi: derc20Abi,
|
|
96
|
-
functionName: "vestedTotalAmount"
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/** Get the amount of vested tokens available for a specific address */
|
|
100
|
-
async getAvailableVestedAmount(account) {
|
|
101
|
-
return await this.publicClient.readContract({
|
|
102
|
-
address: this.address,
|
|
103
|
-
abi: derc20Abi,
|
|
104
|
-
functionName: "computeAvailableVestedAmount",
|
|
105
|
-
args: [account]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/** Get the current annual mint rate in tokens per year */
|
|
109
|
-
async getYearlyMintRate() {
|
|
110
|
-
return await this.publicClient.readContract({
|
|
111
|
-
address: this.address,
|
|
112
|
-
abi: derc20Abi,
|
|
113
|
-
functionName: "yearlyMintRate"
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/** Get the pool address for the token */
|
|
117
|
-
async getPool() {
|
|
118
|
-
return await this.publicClient.readContract({
|
|
119
|
-
address: this.address,
|
|
120
|
-
abi: derc20Abi,
|
|
121
|
-
functionName: "pool"
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/** Check if the liquidity pool is unlocked */
|
|
125
|
-
async getIsPoolUnlocked() {
|
|
126
|
-
return await this.publicClient.readContract({
|
|
127
|
-
address: this.address,
|
|
128
|
-
abi: derc20Abi,
|
|
129
|
-
functionName: "isPoolUnlocked"
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/** Get the timestamp when token minting begins */
|
|
133
|
-
async getCurrentYearStart() {
|
|
134
|
-
return await this.publicClient.readContract({
|
|
135
|
-
address: this.address,
|
|
136
|
-
abi: derc20Abi,
|
|
137
|
-
functionName: "currentYearStart"
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/** Get the timestamp of the last mint */
|
|
141
|
-
async getLastMintTimestamp() {
|
|
142
|
-
return await this.publicClient.readContract({
|
|
143
|
-
address: this.address,
|
|
144
|
-
abi: derc20Abi,
|
|
145
|
-
functionName: "lastMintTimestamp"
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get detailed vesting information for a specific account
|
|
150
|
-
* @param account - Address to retrieve vesting data for
|
|
151
|
-
* @returns Object containing totalAmount and releasedAmount
|
|
152
|
-
*/
|
|
153
|
-
async getVestingData(account) {
|
|
154
|
-
const result = await this.publicClient.readContract({
|
|
155
|
-
address: this.address,
|
|
156
|
-
abi: derc20Abi,
|
|
157
|
-
functionName: "getVestingDataOf",
|
|
158
|
-
args: [account]
|
|
159
|
-
});
|
|
160
|
-
return {
|
|
161
|
-
totalAmount: result[0],
|
|
162
|
-
releasedAmount: result[1]
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
// Write methods (require wallet client)
|
|
166
|
-
/**
|
|
167
|
-
* Approve a spender to transfer tokens on behalf of the owner
|
|
168
|
-
* @param spender - Address that will be able to spend the tokens
|
|
169
|
-
* @param value - Amount of tokens to approve
|
|
170
|
-
* @returns Transaction hash
|
|
171
|
-
*/
|
|
172
|
-
async approve(spender, value) {
|
|
173
|
-
if (!this.walletClient) {
|
|
174
|
-
throw new Error("Wallet client required for write operations");
|
|
175
|
-
}
|
|
176
|
-
const { request } = await this.publicClient.simulateContract({
|
|
177
|
-
address: this.address,
|
|
178
|
-
abi: derc20Abi,
|
|
179
|
-
functionName: "approve",
|
|
180
|
-
args: [spender, value],
|
|
181
|
-
account: this.walletClient.account
|
|
182
|
-
});
|
|
183
|
-
return await this.walletClient.writeContract(request);
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Release vested tokens to the caller
|
|
187
|
-
* @param amount - Amount of vested tokens to release
|
|
188
|
-
* @returns Transaction hash
|
|
189
|
-
*/
|
|
190
|
-
async release(amount) {
|
|
191
|
-
if (!this.walletClient) {
|
|
192
|
-
throw new Error("Wallet client required for write operations");
|
|
193
|
-
}
|
|
194
|
-
const { request } = await this.publicClient.simulateContract({
|
|
195
|
-
address: this.address,
|
|
196
|
-
abi: derc20Abi,
|
|
197
|
-
functionName: "release",
|
|
198
|
-
args: [amount],
|
|
199
|
-
account: this.walletClient.account
|
|
200
|
-
});
|
|
201
|
-
return await this.walletClient.writeContract(request);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export { Derc20 };
|
|
206
|
-
//# sourceMappingURL=chunk-KT7U37XS.mjs.map
|
|
207
|
-
//# sourceMappingURL=chunk-KT7U37XS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/token/derc20/Derc20.ts"],"names":[],"mappings":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,EAAE,OAAQ,EAAA,GAAI,MAAM,IAAA,CAAK,aAAa,gBAAiB,CAAA;AAAA,MAC3D,SAAS,IAAK,CAAA,OAAA;AAAA,MACd,GAAK,EAAA,SAAA;AAAA,MACL,YAAc,EAAA,SAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAM,CAAA;AAAA,MACb,OAAA,EAAS,KAAK,YAAa,CAAA;AAAA,KAC5B,CAAA;AAED,IAAA,OAAO,MAAM,IAAA,CAAK,YAAa,CAAA,aAAA,CAAc,OAAO,CAAA;AAAA;AAExD","file":"chunk-KT7U37XS.mjs","sourcesContent":["import { type Address, type PublicClient, type WalletClient } from 'viem'\nimport { derc20Abi } from '../../../abis'\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: PublicClient\n private walletClient?: WalletClient\n private address: Address\n \n constructor(publicClient: PublicClient, 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.publicClient.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.publicClient.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.publicClient.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.publicClient.readContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'tokenURI',\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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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.publicClient.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): Promise<`0x${string}`> {\n if (!this.walletClient) {\n throw new Error('Wallet client required for write operations')\n }\n \n const { request } = await this.publicClient.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(request)\n }\n \n /**\n * Release vested tokens to the caller\n * @param amount - Amount of vested tokens to release\n * @returns Transaction hash\n */\n async release(amount: 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.publicClient.simulateContract({\n address: this.address,\n abi: derc20Abi,\n functionName: 'release',\n args: [amount],\n account: this.walletClient.account,\n })\n \n return await this.walletClient.writeContract(request)\n }\n}"]}
|
package/dist/chunk-LOROXNH3.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
};
|
|
17
|
-
var __copyProps = (to, from, except, desc) => {
|
|
18
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
-
for (let key of __getOwnPropNames(from))
|
|
20
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
-
}
|
|
23
|
-
return to;
|
|
24
|
-
};
|
|
25
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
-
mod
|
|
32
|
-
));
|
|
33
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
-
|
|
35
|
-
export { __commonJS, __publicField, __require, __toESM };
|
|
36
|
-
//# sourceMappingURL=chunk-LOROXNH3.mjs.map
|
|
37
|
-
//# sourceMappingURL=chunk-LOROXNH3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-LOROXNH3.mjs"}
|