@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,309 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { MarketCapRange, MarketCapValidationResult } from '../types.js';
|
|
3
|
+
import 'viem/chains';
|
|
4
|
+
import '../addresses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Market cap conversion utilities for token launches
|
|
8
|
+
*
|
|
9
|
+
* These utilities convert between market cap (USD) and Uniswap ticks
|
|
10
|
+
* following the mathematical relationship:
|
|
11
|
+
*
|
|
12
|
+
* Market Cap (USD) → Token Price (USD) → Ratio (numeraire/token) → Tick
|
|
13
|
+
*
|
|
14
|
+
* Based on reference implementation: plan/priceMultiCurve.py
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert market cap to token price
|
|
19
|
+
*
|
|
20
|
+
* @param marketCapUSD - Market capitalization in USD
|
|
21
|
+
* @param tokenSupply - Total token supply (as bigint with decimals, e.g., parseEther('1000000000'))
|
|
22
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
23
|
+
* @returns Price of one token in USD
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // $1M market cap with 1B tokens (18 decimals)
|
|
28
|
+
* const price = marketCapToTokenPrice(1_000_000, parseEther('1000000000'))
|
|
29
|
+
* // Returns: 0.001 (each token is worth $0.001)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function marketCapToTokenPrice(marketCapUSD: number, tokenSupply: bigint, tokenDecimals?: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* Convert token price to price ratio (numeraire per token)
|
|
35
|
+
*
|
|
36
|
+
* @param tokenPriceUSD - Price of one token in USD
|
|
37
|
+
* @param numerairePriceUSD - Price of numeraire (e.g., ETH) in USD
|
|
38
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
39
|
+
* @param numeraireDecimals - Numeraire decimals (default: 18)
|
|
40
|
+
* @returns Price ratio adjusted for decimals
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* // Token at $0.001, ETH at $3000, both 18 decimals
|
|
45
|
+
* const ratio = tokenPriceToRatio(0.001, 3000, 18, 18)
|
|
46
|
+
* // Returns: 3,000,000 (3M ETH wei per token wei at this ratio)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function tokenPriceToRatio(tokenPriceUSD: number, numerairePriceUSD: number, tokenDecimals?: number, numeraireDecimals?: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Convert ratio to tick using Uniswap's formula: tick = log(ratio) / log(1.0001)
|
|
52
|
+
*
|
|
53
|
+
* @param ratio - Price ratio (must be positive)
|
|
54
|
+
* @returns Raw tick value (before spacing adjustment)
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* ratioToTick(1) // Returns: 0
|
|
59
|
+
* ratioToTick(1.0001) // Returns: ~1
|
|
60
|
+
* ratioToTick(Math.pow(1.0001, 1000)) // Returns: ~1000
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function ratioToTick(ratio: number): number;
|
|
64
|
+
/**
|
|
65
|
+
* Determine if the new token will be token1 in the Uniswap pair
|
|
66
|
+
*
|
|
67
|
+
* Uniswap orders tokens by address (token0 < token1 in hex comparison).
|
|
68
|
+
* This affects how ticks are interpreted for price calculations.
|
|
69
|
+
*
|
|
70
|
+
* @param tokenAddress - Address of the new token
|
|
71
|
+
* @param numeraireAddress - Address of the numeraire (e.g., WETH)
|
|
72
|
+
* @returns true if token will be token1, false if token0
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* isToken1('0xB000...', '0xA000...') // true (B > A)
|
|
77
|
+
* isToken1('0xA000...', '0xB000...') // false (A < B)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function isToken1(tokenAddress: string, numeraireAddress: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Complete conversion from market cap to usable tick
|
|
83
|
+
*
|
|
84
|
+
* This is the main entry point combining all conversion steps:
|
|
85
|
+
* 1. Market cap → Token price
|
|
86
|
+
* 2. Token price → Ratio
|
|
87
|
+
* 3. Ratio → Raw tick
|
|
88
|
+
* 4. Raw tick → Nearest usable tick (aligned to spacing)
|
|
89
|
+
* 5. Handle token ordering (negate if token is token1)
|
|
90
|
+
*
|
|
91
|
+
* **Important**: The returned tick includes token ordering adjustment.
|
|
92
|
+
* When the token is token1 (determined from numeraire address), the tick is NEGATED:
|
|
93
|
+
* - Higher market cap → smaller (more negative) tick
|
|
94
|
+
* - Lower market cap → larger (less negative) tick
|
|
95
|
+
*
|
|
96
|
+
* Builders apply additional transformations based on auction type.
|
|
97
|
+
* See builder implementations for auction-specific tick conventions.
|
|
98
|
+
*
|
|
99
|
+
* @param marketCapUSD - Target market cap in USD
|
|
100
|
+
* @param tokenSupply - Total token supply (with decimals, as bigint)
|
|
101
|
+
* @param numerairePriceUSD - Price of numeraire in USD (e.g., ETH = 3000)
|
|
102
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
103
|
+
* @param numeraireDecimals - Numeraire decimals (default: 18)
|
|
104
|
+
* @param tickSpacing - Tick spacing of the pool (e.g., 60, 100)
|
|
105
|
+
* @param numeraire - Address of the numeraire token (e.g., WETH). Used to determine token ordering.
|
|
106
|
+
* @returns Nearest usable tick (negated when token is token1)
|
|
107
|
+
*
|
|
108
|
+
* @throws Error if calculated tick is out of bounds [-887272, 887272]
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* // With WETH numeraire on Base:
|
|
113
|
+
* const tick = marketCapToTick(
|
|
114
|
+
* 1_000_000, // $1M market cap
|
|
115
|
+
* parseEther('1000000000'), // 1B tokens
|
|
116
|
+
* 3000, // ETH = $3000
|
|
117
|
+
* 18, 18, // both 18 decimals
|
|
118
|
+
* 60, // tick spacing
|
|
119
|
+
* '0x4200000000000000000000000000000000000006' // WETH address
|
|
120
|
+
* )
|
|
121
|
+
* // Returns negative tick (e.g., -149100) because token will be token1
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
declare function marketCapToTick(marketCapUSD: number, tokenSupply: bigint, numerairePriceUSD: number, tokenDecimals: number | undefined, numeraireDecimals: number | undefined, tickSpacing: number, numeraire: Address): number;
|
|
125
|
+
/**
|
|
126
|
+
* Convert a market cap range to tick range
|
|
127
|
+
*
|
|
128
|
+
* Used for V3 Static Auctions and V4 Dynamic Auctions where you need
|
|
129
|
+
* a start and end tick for the bonding curve.
|
|
130
|
+
*
|
|
131
|
+
* **Important**: This function applies token ordering via marketCapToTick
|
|
132
|
+
* (negates ticks when token is token1), then normalizes so startTick < endTick.
|
|
133
|
+
*
|
|
134
|
+
* Due to the negation + normalization:
|
|
135
|
+
* - When token is token1: both ticks are NEGATIVE
|
|
136
|
+
* - startTick = more negative (corresponds to LOWER market cap)
|
|
137
|
+
* - endTick = less negative (corresponds to HIGHER market cap)
|
|
138
|
+
* - When token is token0: both ticks are POSITIVE
|
|
139
|
+
* - startTick = smaller positive (corresponds to LOWER market cap)
|
|
140
|
+
* - endTick = larger positive (corresponds to HIGHER market cap)
|
|
141
|
+
*
|
|
142
|
+
* Builders apply additional transformations based on auction type semantics.
|
|
143
|
+
* See builder implementations for auction-specific tick handling.
|
|
144
|
+
*
|
|
145
|
+
* @param marketCapRange - Start and end market caps in USD (start < end required)
|
|
146
|
+
* @param tokenSupply - Total token supply (with decimals)
|
|
147
|
+
* @param numerairePriceUSD - Price of numeraire in USD
|
|
148
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
149
|
+
* @param numeraireDecimals - Numeraire decimals (default: 18)
|
|
150
|
+
* @param tickSpacing - Tick spacing
|
|
151
|
+
* @param numeraire - Address of the numeraire token. Used to determine token ordering.
|
|
152
|
+
* @returns Object with startTick and endTick (startTick < endTick numerically)
|
|
153
|
+
*
|
|
154
|
+
* @throws Error if start >= end market cap or if ticks are out of bounds
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* // With WETH numeraire on Base:
|
|
159
|
+
* const { startTick, endTick } = marketCapRangeToTicks(
|
|
160
|
+
* { start: 500_000, end: 50_000_000 }, // $500k → $50M
|
|
161
|
+
* parseEther('1000000000'),
|
|
162
|
+
* 3000,
|
|
163
|
+
* 18, 18,
|
|
164
|
+
* 60,
|
|
165
|
+
* '0x4200000000000000000000000000000000000006' // WETH address
|
|
166
|
+
* )
|
|
167
|
+
* // Returns: startTick=-156080 (500k), endTick=-110020 (50M)
|
|
168
|
+
* // Note: startTick < endTick, but startTick corresponds to LOWER market cap
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare function marketCapRangeToTicks(marketCapRange: MarketCapRange, tokenSupply: bigint, numerairePriceUSD: number, tokenDecimals: number | undefined, numeraireDecimals: number | undefined, tickSpacing: number, numeraire: Address): {
|
|
172
|
+
startTick: number;
|
|
173
|
+
endTick: number;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Transform ticks from marketCapRangeToTicks format to auction contract format.
|
|
177
|
+
*
|
|
178
|
+
* For range-based auctions (Static V3, Dynamic V4), the contracts expect ticks
|
|
179
|
+
* in a specific format based on token ordering. This function handles the
|
|
180
|
+
* negation and swapping required when the token is token1.
|
|
181
|
+
*
|
|
182
|
+
* @param rawStartTick - Start tick from marketCapRangeToTicks (lower market cap)
|
|
183
|
+
* @param rawEndTick - End tick from marketCapRangeToTicks (higher market cap)
|
|
184
|
+
* @param numeraire - Address of the numeraire token. Used to determine token ordering.
|
|
185
|
+
* @returns Transformed ticks ready for auction contract
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const { startTick: raw1, endTick: raw2 } = marketCapRangeToTicks(...)
|
|
190
|
+
* const { startTick, endTick } = transformTicksForAuction(raw1, raw2, WETH_ADDRESS)
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare function transformTicksForAuction(rawStartTick: number, rawEndTick: number, numeraire: Address): {
|
|
194
|
+
startTick: number;
|
|
195
|
+
endTick: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Apply curvature offsets to a peg tick for Multicurve positions
|
|
199
|
+
*
|
|
200
|
+
* Multicurve positions are defined relative to a "peg" tick (starting market cap).
|
|
201
|
+
* Offsets define how far above/below the peg each curve extends.
|
|
202
|
+
*
|
|
203
|
+
* Token ordering (determined from numeraire address) affects how offsets are applied:
|
|
204
|
+
* - token1: tickLower = pegTick + offsetLower, tickUpper = pegTick + offsetUpper
|
|
205
|
+
* - token0: tickLower = pegTick - offsetUpper, tickUpper = pegTick - offsetLower
|
|
206
|
+
*
|
|
207
|
+
* @param pegTick - Base tick calculated from starting market cap
|
|
208
|
+
* @param offsetLower - Lower offset in ticks (distance from peg)
|
|
209
|
+
* @param offsetUpper - Upper offset in ticks (distance from peg)
|
|
210
|
+
* @param numeraire - Address of the numeraire token. Used to determine token ordering.
|
|
211
|
+
* @returns Tick range with offsets applied
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* // Peg at -200000, curve from peg to 10000 ticks above (WETH numeraire)
|
|
216
|
+
* const { tickLower, tickUpper } = applyTickOffsets(
|
|
217
|
+
* -200000, 0, 10000,
|
|
218
|
+
* '0x4200000000000000000000000000000000000006'
|
|
219
|
+
* )
|
|
220
|
+
* // Returns: { tickLower: -200000, tickUpper: -190000 }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
declare function applyTickOffsets(pegTick: number, offsetLower: number, offsetUpper: number, numeraire: Address): {
|
|
224
|
+
tickLower: number;
|
|
225
|
+
tickUpper: number;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Convert a market cap range to tick range for Multicurve curves.
|
|
229
|
+
*
|
|
230
|
+
* Unlike range-based auctions, Multicurve curves use ticks directly without
|
|
231
|
+
* the negate-and-swap transformation. This function converts market cap
|
|
232
|
+
* bounds to the appropriate tick bounds based on token ordering.
|
|
233
|
+
*
|
|
234
|
+
* @param marketCapLower - Lower market cap bound in USD
|
|
235
|
+
* @param marketCapUpper - Upper market cap bound in USD
|
|
236
|
+
* @param tokenSupply - Total token supply (with decimals)
|
|
237
|
+
* @param numerairePriceUSD - Price of numeraire in USD
|
|
238
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
239
|
+
* @param numeraireDecimals - Numeraire decimals (default: 18)
|
|
240
|
+
* @param tickSpacing - Tick spacing
|
|
241
|
+
* @param numeraire - Address of the numeraire token
|
|
242
|
+
* @returns Tick range { tickLower, tickUpper } where tickLower < tickUpper
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const { tickLower, tickUpper } = marketCapRangeToTicksForCurve(
|
|
247
|
+
* 500_000, // $500k lower
|
|
248
|
+
* 1_000_000, // $1M upper
|
|
249
|
+
* parseEther('1000000000'),
|
|
250
|
+
* 3000,
|
|
251
|
+
* 18, 18,
|
|
252
|
+
* 60,
|
|
253
|
+
* WETH_ADDRESS
|
|
254
|
+
* )
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
declare function marketCapRangeToTicksForCurve(marketCapLower: number, marketCapUpper: number, tokenSupply: bigint, numerairePriceUSD: number, tokenDecimals: number | undefined, numeraireDecimals: number | undefined, tickSpacing: number, numeraire: Address): {
|
|
258
|
+
tickLower: number;
|
|
259
|
+
tickUpper: number;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Validate market cap parameters and return warnings for unusual values
|
|
263
|
+
*
|
|
264
|
+
* This doesn't prevent execution but helps catch potential mistakes:
|
|
265
|
+
* - Very small market caps (< $1,000)
|
|
266
|
+
* - Very large market caps (> $1 trillion)
|
|
267
|
+
* - Extreme token prices (< $0.000001 or > $1M)
|
|
268
|
+
*
|
|
269
|
+
* @param marketCap - Market cap value to validate
|
|
270
|
+
* @param tokenSupply - Token supply (with decimals)
|
|
271
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
272
|
+
* @returns Validation result with warnings array
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* const result = validateMarketCapParameters(500, parseEther('1000000'))
|
|
277
|
+
* if (result.warnings.length > 0) {
|
|
278
|
+
* console.warn('Warnings:', result.warnings)
|
|
279
|
+
* }
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
declare function validateMarketCapParameters(marketCap: number, tokenSupply: bigint, tokenDecimals?: number): MarketCapValidationResult;
|
|
283
|
+
/**
|
|
284
|
+
* Calculate market cap from a tick (reverse conversion)
|
|
285
|
+
*
|
|
286
|
+
* Useful for displaying what market cap a given tick represents.
|
|
287
|
+
*
|
|
288
|
+
* @param tick - Uniswap tick value
|
|
289
|
+
* @param tokenSupply - Total token supply (with decimals)
|
|
290
|
+
* @param numerairePriceUSD - Price of numeraire in USD
|
|
291
|
+
* @param tokenDecimals - Token decimals (default: 18)
|
|
292
|
+
* @param numeraireDecimals - Numeraire decimals (default: 18)
|
|
293
|
+
* @param numeraire - Address of the numeraire token. Used to determine token ordering.
|
|
294
|
+
* @returns Market cap in USD
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* const marketCap = tickToMarketCap(
|
|
299
|
+
* -192100,
|
|
300
|
+
* parseEther('1000000000'),
|
|
301
|
+
* 3000,
|
|
302
|
+
* 18, 18,
|
|
303
|
+
* '0x4200000000000000000000000000000000000006' // WETH address
|
|
304
|
+
* )
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function tickToMarketCap(tick: number, tokenSupply: bigint, numerairePriceUSD: number, tokenDecimals: number | undefined, numeraireDecimals: number | undefined, numeraire: Address): number;
|
|
308
|
+
|
|
309
|
+
export { MarketCapRange, MarketCapValidationResult, applyTickOffsets, isToken1, marketCapRangeToTicks, marketCapRangeToTicksForCurve, marketCapToTick, marketCapToTokenPrice, ratioToTick, tickToMarketCap, tokenPriceToRatio, transformTicksForAuction, validateMarketCapParameters };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkAS64GWBX_js = require('../chunk-AS64GWBX.js');
|
|
4
|
+
require('../chunk-HM25ZMO3.js');
|
|
5
|
+
require('../chunk-P7KLEPVI.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "applyTickOffsets", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkAS64GWBX_js.applyTickOffsets; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "isToken1", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkAS64GWBX_js.isToken1; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "marketCapRangeToTicks", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkAS64GWBX_js.marketCapRangeToTicks; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "marketCapRangeToTicksForCurve", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkAS64GWBX_js.marketCapRangeToTicksForCurve; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "marketCapToTick", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkAS64GWBX_js.marketCapToTick; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "marketCapToTokenPrice", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkAS64GWBX_js.marketCapToTokenPrice; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "ratioToTick", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkAS64GWBX_js.ratioToTick; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "tickToMarketCap", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkAS64GWBX_js.tickToMarketCap; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "tokenPriceToRatio", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkAS64GWBX_js.tokenPriceToRatio; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "transformTicksForAuction", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkAS64GWBX_js.transformTicksForAuction; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "validateMarketCapParameters", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkAS64GWBX_js.validateMarketCapParameters; }
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=marketCapHelpers.js.map
|
|
54
|
+
//# sourceMappingURL=marketCapHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"marketCapHelpers.js"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { applyTickOffsets, isToken1, marketCapRangeToTicks, marketCapRangeToTicksForCurve, marketCapToTick, marketCapToTokenPrice, ratioToTick, tickToMarketCap, tokenPriceToRatio, transformTicksForAuction, validateMarketCapParameters } from '../chunk-64AWG57M.mjs';
|
|
2
|
+
import '../chunk-NNNCVFOH.mjs';
|
|
3
|
+
import '../chunk-KDT76YQE.mjs';
|
|
4
|
+
//# sourceMappingURL=marketCapHelpers.mjs.map
|
|
5
|
+
//# sourceMappingURL=marketCapHelpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"marketCapHelpers.mjs"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { V4PoolKey } from '../types.mjs';
|
|
3
|
+
import 'viem/chains';
|
|
4
|
+
import '../addresses.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Computes the PoolId (bytes32) from a V4 PoolKey
|
|
8
|
+
*
|
|
9
|
+
* In Uniswap V4, a PoolId is computed as keccak256(abi.encode(poolKey))
|
|
10
|
+
* where poolKey contains: currency0, currency1, fee, tickSpacing, hooks
|
|
11
|
+
*
|
|
12
|
+
* @param poolKey - The V4 pool key containing currency0, currency1, fee, tickSpacing, and hooks
|
|
13
|
+
* @returns The computed PoolId as a bytes32 hex string
|
|
14
|
+
*/
|
|
15
|
+
declare function computePoolId(poolKey: V4PoolKey): Hex;
|
|
16
|
+
|
|
17
|
+
export { computePoolId };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { V4PoolKey } from '../types.js';
|
|
3
|
+
import 'viem/chains';
|
|
4
|
+
import '../addresses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Computes the PoolId (bytes32) from a V4 PoolKey
|
|
8
|
+
*
|
|
9
|
+
* In Uniswap V4, a PoolId is computed as keccak256(abi.encode(poolKey))
|
|
10
|
+
* where poolKey contains: currency0, currency1, fee, tickSpacing, hooks
|
|
11
|
+
*
|
|
12
|
+
* @param poolKey - The V4 pool key containing currency0, currency1, fee, tickSpacing, and hooks
|
|
13
|
+
* @returns The computed PoolId as a bytes32 hex string
|
|
14
|
+
*/
|
|
15
|
+
declare function computePoolId(poolKey: V4PoolKey): Hex;
|
|
16
|
+
|
|
17
|
+
export { computePoolId };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQ7YNBSVH_js = require('../chunk-Q7YNBSVH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "computePoolId", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkQ7YNBSVH_js.computePoolId; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=poolKey.js.map
|
|
12
|
+
//# sourceMappingURL=poolKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"poolKey.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"poolKey.mjs"}
|
|
@@ -25,11 +25,11 @@ declare function calculateTokensToSell(targetRaiseETH: number, avgPricePerToken:
|
|
|
25
25
|
* Calculate gamma for dynamic auctions
|
|
26
26
|
* @param startTick Starting tick
|
|
27
27
|
* @param endTick Ending tick
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
28
|
+
* @param duration Duration in seconds
|
|
29
|
+
* @param epochLength Epoch length in seconds
|
|
30
30
|
* @returns Gamma value
|
|
31
31
|
*/
|
|
32
|
-
declare function calculateGamma(startTick: number, endTick: number,
|
|
32
|
+
declare function calculateGamma(startTick: number, endTick: number, duration: number, epochLength: number): number;
|
|
33
33
|
/**
|
|
34
34
|
* Estimate the price at a specific epoch in a dynamic auction
|
|
35
35
|
* @param startTick Starting tick
|
|
@@ -25,11 +25,11 @@ declare function calculateTokensToSell(targetRaiseETH: number, avgPricePerToken:
|
|
|
25
25
|
* Calculate gamma for dynamic auctions
|
|
26
26
|
* @param startTick Starting tick
|
|
27
27
|
* @param endTick Ending tick
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
28
|
+
* @param duration Duration in seconds
|
|
29
|
+
* @param epochLength Epoch length in seconds
|
|
30
30
|
* @returns Gamma value
|
|
31
31
|
*/
|
|
32
|
-
declare function calculateGamma(startTick: number, endTick: number,
|
|
32
|
+
declare function calculateGamma(startTick: number, endTick: number, duration: number, epochLength: number): number;
|
|
33
33
|
/**
|
|
34
34
|
* Estimate the price at a specific epoch in a dynamic auction
|
|
35
35
|
* @param startTick Starting tick
|
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-KEXKKQVW.js');
|
|
3
|
+
var chunkRW37KJ77_js = require('../chunk-RW37KJ77.js');
|
|
4
|
+
require('../chunk-P7KLEPVI.js');
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
Object.defineProperty(exports, "calculateFDV", {
|
|
10
9
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkRW37KJ77_js.calculateFDV; }
|
|
12
11
|
});
|
|
13
12
|
Object.defineProperty(exports, "calculateGamma", {
|
|
14
13
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkRW37KJ77_js.calculateGamma; }
|
|
16
15
|
});
|
|
17
16
|
Object.defineProperty(exports, "calculateMarketCap", {
|
|
18
17
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkRW37KJ77_js.calculateMarketCap; }
|
|
20
19
|
});
|
|
21
20
|
Object.defineProperty(exports, "calculateTickRange", {
|
|
22
21
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkRW37KJ77_js.calculateTickRange; }
|
|
24
23
|
});
|
|
25
24
|
Object.defineProperty(exports, "calculateTokensToSell", {
|
|
26
25
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkRW37KJ77_js.calculateTokensToSell; }
|
|
28
27
|
});
|
|
29
28
|
Object.defineProperty(exports, "estimatePriceAtEpoch", {
|
|
30
29
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkRW37KJ77_js.estimatePriceAtEpoch; }
|
|
32
31
|
});
|
|
33
32
|
Object.defineProperty(exports, "estimateSlippage", {
|
|
34
33
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkRW37KJ77_js.estimateSlippage; }
|
|
36
35
|
});
|
|
37
36
|
Object.defineProperty(exports, "formatTickAsPrice", {
|
|
38
37
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkRW37KJ77_js.formatTickAsPrice; }
|
|
40
39
|
});
|
|
41
40
|
//# sourceMappingURL=priceHelpers.js.map
|
|
42
41
|
//# sourceMappingURL=priceHelpers.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-LOROXNH3.mjs';
|
|
1
|
+
export { calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice } from '../chunk-CLEQO6GU.mjs';
|
|
2
|
+
import '../chunk-KDT76YQE.mjs';
|
|
4
3
|
//# sourceMappingURL=priceHelpers.mjs.map
|
|
5
4
|
//# sourceMappingURL=priceHelpers.mjs.map
|
|
@@ -8,6 +8,7 @@ declare const MAX_TICK = 887272;
|
|
|
8
8
|
declare const MIN_SQRT_RATIO = 4295128739n;
|
|
9
9
|
declare const MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342n;
|
|
10
10
|
declare const Q96: bigint;
|
|
11
|
+
declare const Q192: bigint;
|
|
11
12
|
/**
|
|
12
13
|
* Get the sqrt ratio at a given tick
|
|
13
14
|
* @param tick The tick value
|
|
@@ -16,12 +17,16 @@ declare const Q96: bigint;
|
|
|
16
17
|
declare function getSqrtRatioAtTick(tick: number): bigint;
|
|
17
18
|
/**
|
|
18
19
|
* Get the tick at a given sqrt ratio
|
|
20
|
+
* Based on Uniswap v3 TickMath.sol with corrected BigInt handling
|
|
21
|
+
*
|
|
19
22
|
* @param sqrtRatioX96 The sqrt price as a Q64.96 fixed point number
|
|
20
23
|
* @returns The tick value
|
|
21
24
|
*/
|
|
22
25
|
declare function getTickAtSqrtRatio(sqrtRatioX96: bigint): number;
|
|
23
26
|
/**
|
|
24
27
|
* Convert sqrtPriceX96 to a human-readable price
|
|
28
|
+
* Uses BigInt arithmetic throughout to avoid precision loss with Q96
|
|
29
|
+
*
|
|
25
30
|
* @param sqrtPriceX96 The sqrt price as a Q64.96 fixed point number
|
|
26
31
|
* @param decimals0 Decimals of token0
|
|
27
32
|
* @param decimals1 Decimals of token1
|
|
@@ -31,6 +36,8 @@ declare function getTickAtSqrtRatio(sqrtRatioX96: bigint): number;
|
|
|
31
36
|
declare function sqrtPriceX96ToPrice(sqrtPriceX96: bigint, decimals0: number, decimals1: number, token0IsBase?: boolean): number;
|
|
32
37
|
/**
|
|
33
38
|
* Convert a human-readable price to sqrtPriceX96
|
|
39
|
+
* Uses BigInt arithmetic throughout to avoid precision loss with Q96
|
|
40
|
+
*
|
|
34
41
|
* @param price The price (token1/token0)
|
|
35
42
|
* @param decimals0 Decimals of token0
|
|
36
43
|
* @param decimals1 Decimals of token1
|
|
@@ -62,4 +69,4 @@ declare function priceToTick(price: number, decimals0: number, decimals1: number
|
|
|
62
69
|
*/
|
|
63
70
|
declare function getNearestUsableTick(tick: number, tickSpacing: number): number;
|
|
64
71
|
|
|
65
|
-
export { MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, Q96, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, priceToSqrtPriceX96, priceToTick, sqrtPriceX96ToPrice, tickToPrice };
|
|
72
|
+
export { MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, Q192, Q96, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, priceToSqrtPriceX96, priceToTick, sqrtPriceX96ToPrice, tickToPrice };
|
package/dist/utils/tickMath.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const MAX_TICK = 887272;
|
|
|
8
8
|
declare const MIN_SQRT_RATIO = 4295128739n;
|
|
9
9
|
declare const MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342n;
|
|
10
10
|
declare const Q96: bigint;
|
|
11
|
+
declare const Q192: bigint;
|
|
11
12
|
/**
|
|
12
13
|
* Get the sqrt ratio at a given tick
|
|
13
14
|
* @param tick The tick value
|
|
@@ -16,12 +17,16 @@ declare const Q96: bigint;
|
|
|
16
17
|
declare function getSqrtRatioAtTick(tick: number): bigint;
|
|
17
18
|
/**
|
|
18
19
|
* Get the tick at a given sqrt ratio
|
|
20
|
+
* Based on Uniswap v3 TickMath.sol with corrected BigInt handling
|
|
21
|
+
*
|
|
19
22
|
* @param sqrtRatioX96 The sqrt price as a Q64.96 fixed point number
|
|
20
23
|
* @returns The tick value
|
|
21
24
|
*/
|
|
22
25
|
declare function getTickAtSqrtRatio(sqrtRatioX96: bigint): number;
|
|
23
26
|
/**
|
|
24
27
|
* Convert sqrtPriceX96 to a human-readable price
|
|
28
|
+
* Uses BigInt arithmetic throughout to avoid precision loss with Q96
|
|
29
|
+
*
|
|
25
30
|
* @param sqrtPriceX96 The sqrt price as a Q64.96 fixed point number
|
|
26
31
|
* @param decimals0 Decimals of token0
|
|
27
32
|
* @param decimals1 Decimals of token1
|
|
@@ -31,6 +36,8 @@ declare function getTickAtSqrtRatio(sqrtRatioX96: bigint): number;
|
|
|
31
36
|
declare function sqrtPriceX96ToPrice(sqrtPriceX96: bigint, decimals0: number, decimals1: number, token0IsBase?: boolean): number;
|
|
32
37
|
/**
|
|
33
38
|
* Convert a human-readable price to sqrtPriceX96
|
|
39
|
+
* Uses BigInt arithmetic throughout to avoid precision loss with Q96
|
|
40
|
+
*
|
|
34
41
|
* @param price The price (token1/token0)
|
|
35
42
|
* @param decimals0 Decimals of token0
|
|
36
43
|
* @param decimals1 Decimals of token1
|
|
@@ -62,4 +69,4 @@ declare function priceToTick(price: number, decimals0: number, decimals1: number
|
|
|
62
69
|
*/
|
|
63
70
|
declare function getNearestUsableTick(tick: number, tickSpacing: number): number;
|
|
64
71
|
|
|
65
|
-
export { MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, Q96, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, priceToSqrtPriceX96, priceToTick, sqrtPriceX96ToPrice, tickToPrice };
|
|
72
|
+
export { MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, Q192, Q96, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, priceToSqrtPriceX96, priceToTick, sqrtPriceX96ToPrice, tickToPrice };
|