@whetstone-research/doppler-sdk 0.0.23 → 1.0.0
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/README.md +556 -229
- package/dist/chunk-3LTCKCJC.js +319 -0
- package/dist/chunk-3LTCKCJC.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/{chunk-3PNCB4W5.js.map → chunk-PZ5AY32C.js.map} +1 -1
- package/dist/chunk-RO6R66OM.js +974 -0
- package/dist/chunk-RO6R66OM.js.map +1 -0
- package/dist/evm/index.d.ts +8533 -0
- package/dist/evm/index.js +15055 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/oracle-BSvZ6pxp.d.ts +820 -0
- package/dist/pda-RVIHNLRP.js +4 -0
- package/dist/pda-RVIHNLRP.js.map +1 -0
- package/dist/solana/index.d.ts +2495 -0
- package/dist/solana/index.js +2209 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana/react/index.d.ts +1046 -0
- package/dist/solana/react/index.js +1436 -0
- package/dist/solana/react/index.js.map +1 -0
- package/package.json +37 -21
- package/dist/DopplerSDK.d.mts +0 -94
- package/dist/DopplerSDK.d.ts +0 -94
- package/dist/DopplerSDK.js +0 -51
- package/dist/DopplerSDK.js.map +0 -1
- package/dist/DopplerSDK.mjs +0 -42
- package/dist/DopplerSDK.mjs.map +0 -1
- package/dist/abis/bytecodes/derc20.d.mts +0 -3
- package/dist/abis/bytecodes/derc20.d.ts +0 -3
- package/dist/abis/bytecodes/derc20.js +0 -9
- package/dist/abis/bytecodes/derc20.js.map +0 -1
- package/dist/abis/bytecodes/derc20.mjs +0 -3
- package/dist/abis/bytecodes/derc20.mjs.map +0 -1
- package/dist/abis/bytecodes/derc2080.d.mts +0 -3
- package/dist/abis/bytecodes/derc2080.d.ts +0 -3
- package/dist/abis/bytecodes/derc2080.js +0 -9
- package/dist/abis/bytecodes/derc2080.js.map +0 -1
- package/dist/abis/bytecodes/derc2080.mjs +0 -3
- package/dist/abis/bytecodes/derc2080.mjs.map +0 -1
- package/dist/abis/bytecodes/doppler.d.mts +0 -3
- package/dist/abis/bytecodes/doppler.d.ts +0 -3
- package/dist/abis/bytecodes/doppler.js +0 -9
- package/dist/abis/bytecodes/doppler.js.map +0 -1
- package/dist/abis/bytecodes/doppler.mjs +0 -3
- package/dist/abis/bytecodes/doppler.mjs.map +0 -1
- package/dist/abis/bytecodes/dopplerDN404.d.mts +0 -3
- package/dist/abis/bytecodes/dopplerDN404.d.ts +0 -3
- package/dist/abis/bytecodes/dopplerDN404.js +0 -9
- package/dist/abis/bytecodes/dopplerDN404.js.map +0 -1
- package/dist/abis/bytecodes/dopplerDN404.mjs +0 -3
- package/dist/abis/bytecodes/dopplerDN404.mjs.map +0 -1
- package/dist/abis/bytecodes/stateView.d.mts +0 -3
- package/dist/abis/bytecodes/stateView.d.ts +0 -3
- package/dist/abis/bytecodes/stateView.js +0 -9
- package/dist/abis/bytecodes/stateView.js.map +0 -1
- package/dist/abis/bytecodes/stateView.mjs +0 -3
- package/dist/abis/bytecodes/stateView.mjs.map +0 -1
- package/dist/abis/bytecodes.d.mts +0 -5
- package/dist/abis/bytecodes.d.ts +0 -5
- package/dist/abis/bytecodes.js +0 -33
- package/dist/abis/bytecodes.js.map +0 -1
- package/dist/abis/bytecodes.mjs +0 -8
- package/dist/abis/bytecodes.mjs.map +0 -1
- package/dist/abis/index.d.mts +0 -3460
- package/dist/abis/index.d.ts +0 -3460
- package/dist/abis/index.js +0 -122
- package/dist/abis/index.js.map +0 -1
- package/dist/abis/index.mjs +0 -9
- package/dist/abis/index.mjs.map +0 -1
- package/dist/addresses.d.mts +0 -65
- package/dist/addresses.d.ts +0 -65
- package/dist/addresses.js +0 -29
- package/dist/addresses.js.map +0 -1
- package/dist/addresses.mjs +0 -4
- package/dist/addresses.mjs.map +0 -1
- package/dist/builders/DynamicAuctionBuilder.d.mts +0 -138
- package/dist/builders/DynamicAuctionBuilder.d.ts +0 -138
- package/dist/builders/DynamicAuctionBuilder.js +0 -35
- package/dist/builders/DynamicAuctionBuilder.js.map +0 -1
- package/dist/builders/DynamicAuctionBuilder.mjs +0 -26
- package/dist/builders/DynamicAuctionBuilder.mjs.map +0 -1
- package/dist/builders/MulticurveBuilder.d.mts +0 -183
- package/dist/builders/MulticurveBuilder.d.ts +0 -183
- package/dist/builders/MulticurveBuilder.js +0 -35
- package/dist/builders/MulticurveBuilder.js.map +0 -1
- package/dist/builders/MulticurveBuilder.mjs +0 -26
- package/dist/builders/MulticurveBuilder.mjs.map +0 -1
- package/dist/builders/StaticAuctionBuilder.d.mts +0 -131
- package/dist/builders/StaticAuctionBuilder.d.ts +0 -131
- package/dist/builders/StaticAuctionBuilder.js +0 -35
- package/dist/builders/StaticAuctionBuilder.js.map +0 -1
- package/dist/builders/StaticAuctionBuilder.mjs +0 -26
- package/dist/builders/StaticAuctionBuilder.mjs.map +0 -1
- package/dist/builders/index.d.mts +0 -8
- package/dist/builders/index.d.ts +0 -8
- package/dist/builders/index.js +0 -62
- package/dist/builders/index.js.map +0 -1
- package/dist/builders/index.mjs +0 -29
- package/dist/builders/index.mjs.map +0 -1
- package/dist/builders/shared.d.mts +0 -115
- package/dist/builders/shared.d.ts +0 -115
- package/dist/builders/shared.js +0 -45
- package/dist/builders/shared.js.map +0 -1
- package/dist/builders/shared.mjs +0 -24
- package/dist/builders/shared.mjs.map +0 -1
- package/dist/chunk-25GEBO3B.mjs +0 -219
- package/dist/chunk-25GEBO3B.mjs.map +0 -1
- package/dist/chunk-3MVW6UIW.js +0 -2294
- package/dist/chunk-3MVW6UIW.js.map +0 -1
- package/dist/chunk-3NMGCQJ4.mjs +0 -6
- package/dist/chunk-3NMGCQJ4.mjs.map +0 -1
- package/dist/chunk-3PNCB4W5.js +0 -4
- package/dist/chunk-4VWQNNNW.js +0 -233
- package/dist/chunk-4VWQNNNW.js.map +0 -1
- package/dist/chunk-4XN6DQBW.js +0 -4
- package/dist/chunk-4XN6DQBW.js.map +0 -1
- package/dist/chunk-5TQOT6CW.js +0 -8
- package/dist/chunk-5TQOT6CW.js.map +0 -1
- package/dist/chunk-6BQY5EPB.js +0 -144
- package/dist/chunk-6BQY5EPB.js.map +0 -1
- package/dist/chunk-6H6X3VTZ.js +0 -18
- package/dist/chunk-6H6X3VTZ.js.map +0 -1
- package/dist/chunk-6UHDSD42.js +0 -2585
- package/dist/chunk-6UHDSD42.js.map +0 -1
- package/dist/chunk-7CAAI5DL.js +0 -273
- package/dist/chunk-7CAAI5DL.js.map +0 -1
- package/dist/chunk-7M57PU6V.js +0 -28
- package/dist/chunk-7M57PU6V.js.map +0 -1
- package/dist/chunk-7P2SPZC7.mjs +0 -2583
- package/dist/chunk-7P2SPZC7.mjs.map +0 -1
- package/dist/chunk-7ZUV6WPX.mjs +0 -3
- package/dist/chunk-7ZUV6WPX.mjs.map +0 -1
- package/dist/chunk-ABT6AT7C.mjs +0 -16
- package/dist/chunk-ABT6AT7C.mjs.map +0 -1
- package/dist/chunk-C6MH7HYT.mjs +0 -138
- package/dist/chunk-C6MH7HYT.mjs.map +0 -1
- package/dist/chunk-CATH4QRQ.mjs +0 -141
- package/dist/chunk-CATH4QRQ.mjs.map +0 -1
- package/dist/chunk-CFAAYL5M.mjs +0 -26
- package/dist/chunk-CFAAYL5M.mjs.map +0 -1
- package/dist/chunk-CMNJZKTM.js +0 -140
- package/dist/chunk-CMNJZKTM.js.map +0 -1
- package/dist/chunk-CWTGQAOG.mjs +0 -72
- package/dist/chunk-CWTGQAOG.mjs.map +0 -1
- package/dist/chunk-DNB3T5P2.js +0 -269
- package/dist/chunk-DNB3T5P2.js.map +0 -1
- package/dist/chunk-DOUF6NON.mjs +0 -3
- package/dist/chunk-DOUF6NON.mjs.map +0 -1
- package/dist/chunk-DSYPZETD.js +0 -4
- package/dist/chunk-DSYPZETD.js.map +0 -1
- package/dist/chunk-E2NF4AQB.mjs +0 -2271
- package/dist/chunk-E2NF4AQB.mjs.map +0 -1
- package/dist/chunk-EH3V2BJF.js +0 -592
- package/dist/chunk-EH3V2BJF.js.map +0 -1
- package/dist/chunk-EIXUJANI.mjs +0 -590
- package/dist/chunk-EIXUJANI.mjs.map +0 -1
- package/dist/chunk-FFV6DMPA.mjs +0 -263
- package/dist/chunk-FFV6DMPA.mjs.map +0 -1
- package/dist/chunk-FLFYAWSS.mjs +0 -238
- package/dist/chunk-FLFYAWSS.mjs.map +0 -1
- package/dist/chunk-FNUBKONK.js +0 -291
- package/dist/chunk-FNUBKONK.js.map +0 -1
- package/dist/chunk-FOESYJP3.mjs +0 -3
- package/dist/chunk-FOESYJP3.mjs.map +0 -1
- package/dist/chunk-FTRCBE3J.js +0 -320
- package/dist/chunk-FTRCBE3J.js.map +0 -1
- package/dist/chunk-FZ4FIWCR.js +0 -240
- package/dist/chunk-FZ4FIWCR.js.map +0 -1
- package/dist/chunk-GDODJJ7D.mjs +0 -36
- package/dist/chunk-GDODJJ7D.mjs.map +0 -1
- package/dist/chunk-GSBQIVME.mjs +0 -278
- package/dist/chunk-GSBQIVME.mjs.map +0 -1
- package/dist/chunk-GSTY3GO7.mjs +0 -40
- package/dist/chunk-GSTY3GO7.mjs.map +0 -1
- package/dist/chunk-H3B54PFV.mjs +0 -17
- package/dist/chunk-H3B54PFV.mjs.map +0 -1
- package/dist/chunk-H7WPK5CR.js +0 -297
- package/dist/chunk-H7WPK5CR.js.map +0 -1
- package/dist/chunk-HJFVRV47.js +0 -120
- package/dist/chunk-HJFVRV47.js.map +0 -1
- package/dist/chunk-HL7ZAAD4.mjs +0 -375
- package/dist/chunk-HL7ZAAD4.mjs.map +0 -1
- package/dist/chunk-IWJOPXYN.mjs +0 -96
- package/dist/chunk-IWJOPXYN.mjs.map +0 -1
- package/dist/chunk-J62YDWIK.js +0 -8
- package/dist/chunk-J62YDWIK.js.map +0 -1
- package/dist/chunk-JB5XXPLL.js +0 -377
- package/dist/chunk-JB5XXPLL.js.map +0 -1
- package/dist/chunk-JIKAD4YL.js +0 -4
- package/dist/chunk-JIKAD4YL.js.map +0 -1
- package/dist/chunk-KAZQJ24E.mjs +0 -59
- package/dist/chunk-KAZQJ24E.mjs.map +0 -1
- package/dist/chunk-KHUE77HC.js +0 -81
- package/dist/chunk-KHUE77HC.js.map +0 -1
- package/dist/chunk-KOAC3BBP.mjs +0 -11
- package/dist/chunk-KOAC3BBP.mjs.map +0 -1
- package/dist/chunk-OHA5KJ2M.mjs +0 -6
- package/dist/chunk-OHA5KJ2M.mjs.map +0 -1
- package/dist/chunk-OX5CESVM.js +0 -40
- package/dist/chunk-OX5CESVM.js.map +0 -1
- package/dist/chunk-P25HBGP5.mjs +0 -3
- package/dist/chunk-P25HBGP5.mjs.map +0 -1
- package/dist/chunk-P7CHGWY7.js +0 -4
- package/dist/chunk-P7CHGWY7.js.map +0 -1
- package/dist/chunk-QAPQGDWK.js +0 -8
- package/dist/chunk-QAPQGDWK.js.map +0 -1
- package/dist/chunk-QOGBOT2M.mjs +0 -328
- package/dist/chunk-QOGBOT2M.mjs.map +0 -1
- package/dist/chunk-QRTABC4Z.js +0 -8
- package/dist/chunk-QRTABC4Z.js.map +0 -1
- package/dist/chunk-QSQGLWNY.mjs +0 -3
- package/dist/chunk-QSQGLWNY.mjs.map +0 -1
- package/dist/chunk-RI6SDMER.mjs +0 -295
- package/dist/chunk-RI6SDMER.mjs.map +0 -1
- package/dist/chunk-RIIVW6TQ.mjs +0 -267
- package/dist/chunk-RIIVW6TQ.mjs.map +0 -1
- package/dist/chunk-RV64M4Q6.mjs +0 -3
- package/dist/chunk-RV64M4Q6.mjs.map +0 -1
- package/dist/chunk-RXUJ4DUB.js +0 -330
- package/dist/chunk-RXUJ4DUB.js.map +0 -1
- package/dist/chunk-SD7BHT2F.mjs +0 -3
- package/dist/chunk-SD7BHT2F.mjs.map +0 -1
- package/dist/chunk-SWWLOD7Q.mjs +0 -6
- package/dist/chunk-SWWLOD7Q.mjs.map +0 -1
- package/dist/chunk-TIGHBA37.js +0 -143
- package/dist/chunk-TIGHBA37.js.map +0 -1
- package/dist/chunk-TLEVIIUE.mjs +0 -34
- package/dist/chunk-TLEVIIUE.mjs.map +0 -1
- package/dist/chunk-U3GOWK6J.mjs +0 -6
- package/dist/chunk-U3GOWK6J.mjs.map +0 -1
- package/dist/chunk-UPVKABAV.js +0 -19
- package/dist/chunk-UPVKABAV.js.map +0 -1
- package/dist/chunk-VCX6FG3E.mjs +0 -318
- package/dist/chunk-VCX6FG3E.mjs.map +0 -1
- package/dist/chunk-VEIVYUYF.js +0 -4
- package/dist/chunk-VEIVYUYF.js.map +0 -1
- package/dist/chunk-VYSOAGRU.mjs +0 -6
- package/dist/chunk-VYSOAGRU.mjs.map +0 -1
- package/dist/chunk-WJBJARLJ.js +0 -38
- package/dist/chunk-WJBJARLJ.js.map +0 -1
- package/dist/chunk-WNUB3UTT.js +0 -241
- package/dist/chunk-WNUB3UTT.js.map +0 -1
- package/dist/chunk-WQHTNL5L.js +0 -4
- package/dist/chunk-WQHTNL5L.js.map +0 -1
- package/dist/chunk-X3UMAHOJ.js +0 -4
- package/dist/chunk-X3UMAHOJ.js.map +0 -1
- package/dist/chunk-XMFOZYNI.js +0 -8
- package/dist/chunk-XMFOZYNI.js.map +0 -1
- package/dist/chunk-XNMXN5SZ.mjs +0 -3
- package/dist/chunk-XNMXN5SZ.mjs.map +0 -1
- package/dist/chunk-XRYLHTVV.mjs +0 -267
- package/dist/chunk-XRYLHTVV.mjs.map +0 -1
- package/dist/chunk-XSJTASPK.js +0 -13
- package/dist/chunk-XSJTASPK.js.map +0 -1
- package/dist/chunk-XT3BAM4H.js +0 -45
- package/dist/chunk-XT3BAM4H.js.map +0 -1
- package/dist/chunk-YBK6EBA5.mjs +0 -239
- package/dist/chunk-YBK6EBA5.mjs.map +0 -1
- package/dist/chunk-YFEPTSI2.js +0 -265
- package/dist/chunk-YFEPTSI2.js.map +0 -1
- package/dist/chunk-YYLD3AJ7.js +0 -61
- package/dist/chunk-YYLD3AJ7.js.map +0 -1
- package/dist/chunk-ZEDJUNC6.mjs +0 -115
- package/dist/chunk-ZEDJUNC6.mjs.map +0 -1
- package/dist/constants.d.mts +0 -91
- package/dist/constants.d.ts +0 -91
- package/dist/constants.js +0 -196
- package/dist/constants.js.map +0 -1
- package/dist/constants.mjs +0 -3
- package/dist/constants.mjs.map +0 -1
- package/dist/deployments.generated.d.mts +0 -267
- package/dist/deployments.generated.d.ts +0 -267
- package/dist/deployments.generated.js +0 -12
- package/dist/deployments.generated.js.map +0 -1
- package/dist/deployments.generated.mjs +0 -3
- package/dist/deployments.generated.mjs.map +0 -1
- package/dist/entities/DopplerFactory.d.mts +0 -266
- package/dist/entities/DopplerFactory.d.ts +0 -266
- package/dist/entities/DopplerFactory.js +0 -33
- package/dist/entities/DopplerFactory.js.map +0 -1
- package/dist/entities/DopplerFactory.mjs +0 -24
- package/dist/entities/DopplerFactory.mjs.map +0 -1
- package/dist/entities/auction/DynamicAuction.d.mts +0 -72
- package/dist/entities/auction/DynamicAuction.d.ts +0 -72
- package/dist/entities/auction/DynamicAuction.js +0 -21
- package/dist/entities/auction/DynamicAuction.js.map +0 -1
- package/dist/entities/auction/DynamicAuction.mjs +0 -12
- package/dist/entities/auction/DynamicAuction.mjs.map +0 -1
- package/dist/entities/auction/MulticurvePool.d.mts +0 -74
- package/dist/entities/auction/MulticurvePool.d.ts +0 -74
- package/dist/entities/auction/MulticurvePool.js +0 -24
- package/dist/entities/auction/MulticurvePool.js.map +0 -1
- package/dist/entities/auction/MulticurvePool.mjs +0 -15
- package/dist/entities/auction/MulticurvePool.mjs.map +0 -1
- package/dist/entities/auction/StaticAuction.d.mts +0 -44
- package/dist/entities/auction/StaticAuction.d.ts +0 -44
- package/dist/entities/auction/StaticAuction.js +0 -21
- package/dist/entities/auction/StaticAuction.js.map +0 -1
- package/dist/entities/auction/StaticAuction.mjs +0 -12
- package/dist/entities/auction/StaticAuction.mjs.map +0 -1
- package/dist/entities/auction/index.d.mts +0 -7
- package/dist/entities/auction/index.d.ts +0 -7
- package/dist/entities/auction/index.js +0 -35
- package/dist/entities/auction/index.js.map +0 -1
- package/dist/entities/auction/index.mjs +0 -18
- package/dist/entities/auction/index.mjs.map +0 -1
- package/dist/entities/quoter/Quoter.d.mts +0 -150
- package/dist/entities/quoter/Quoter.d.ts +0 -150
- package/dist/entities/quoter/Quoter.js +0 -21
- package/dist/entities/quoter/Quoter.js.map +0 -1
- package/dist/entities/quoter/Quoter.mjs +0 -12
- package/dist/entities/quoter/Quoter.mjs.map +0 -1
- package/dist/entities/quoter/index.d.mts +0 -5
- package/dist/entities/quoter/index.d.ts +0 -5
- package/dist/entities/quoter/index.js +0 -22
- package/dist/entities/quoter/index.js.map +0 -1
- package/dist/entities/quoter/index.mjs +0 -13
- package/dist/entities/quoter/index.mjs.map +0 -1
- package/dist/entities/token/derc20/Derc20.d.mts +0 -102
- package/dist/entities/token/derc20/Derc20.d.ts +0 -102
- package/dist/entities/token/derc20/Derc20.js +0 -19
- package/dist/entities/token/derc20/Derc20.js.map +0 -1
- package/dist/entities/token/derc20/Derc20.mjs +0 -10
- package/dist/entities/token/derc20/Derc20.mjs.map +0 -1
- package/dist/entities/token/derc20/index.d.mts +0 -5
- package/dist/entities/token/derc20/index.d.ts +0 -5
- package/dist/entities/token/derc20/index.js +0 -20
- package/dist/entities/token/derc20/index.js.map +0 -1
- package/dist/entities/token/derc20/index.mjs +0 -11
- package/dist/entities/token/derc20/index.mjs.map +0 -1
- package/dist/entities/token/eth/Eth.d.mts +0 -54
- package/dist/entities/token/eth/Eth.d.ts +0 -54
- package/dist/entities/token/eth/Eth.js +0 -12
- package/dist/entities/token/eth/Eth.js.map +0 -1
- package/dist/entities/token/eth/Eth.mjs +0 -3
- package/dist/entities/token/eth/Eth.mjs.map +0 -1
- package/dist/entities/token/eth/index.d.mts +0 -5
- package/dist/entities/token/eth/index.d.ts +0 -5
- package/dist/entities/token/eth/index.js +0 -13
- package/dist/entities/token/eth/index.js.map +0 -1
- package/dist/entities/token/eth/index.mjs +0 -4
- package/dist/entities/token/eth/index.mjs.map +0 -1
- package/dist/entities/token/index.d.mts +0 -6
- package/dist/entities/token/index.d.ts +0 -6
- package/dist/entities/token/index.js +0 -27
- package/dist/entities/token/index.js.map +0 -1
- package/dist/entities/token/index.mjs +0 -14
- package/dist/entities/token/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -37
- package/dist/index.d.ts +0 -37
- package/dist/index.js +0 -565
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -47
- package/dist/index.mjs.map +0 -1
- package/dist/types.d.mts +0 -607
- package/dist/types.d.ts +0 -607
- package/dist/types.js +0 -30
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -5
- package/dist/types.mjs.map +0 -1
- package/dist/utils/airlock.d.mts +0 -11
- package/dist/utils/airlock.d.ts +0 -11
- package/dist/utils/airlock.js +0 -26
- package/dist/utils/airlock.js.map +0 -1
- package/dist/utils/airlock.mjs +0 -5
- package/dist/utils/airlock.mjs.map +0 -1
- package/dist/utils/balanceDelta.d.mts +0 -10
- package/dist/utils/balanceDelta.d.ts +0 -10
- package/dist/utils/balanceDelta.js +0 -12
- package/dist/utils/balanceDelta.js.map +0 -1
- package/dist/utils/balanceDelta.mjs +0 -3
- package/dist/utils/balanceDelta.mjs.map +0 -1
- package/dist/utils/computeOptimalGamma.d.mts +0 -7
- package/dist/utils/computeOptimalGamma.d.ts +0 -7
- package/dist/utils/computeOptimalGamma.js +0 -12
- package/dist/utils/computeOptimalGamma.js.map +0 -1
- package/dist/utils/computeOptimalGamma.mjs +0 -3
- package/dist/utils/computeOptimalGamma.mjs.map +0 -1
- package/dist/utils/dopplerHookMigrator.d.mts +0 -11
- package/dist/utils/dopplerHookMigrator.d.ts +0 -11
- package/dist/utils/dopplerHookMigrator.js +0 -12
- package/dist/utils/dopplerHookMigrator.js.map +0 -1
- package/dist/utils/dopplerHookMigrator.mjs +0 -3
- package/dist/utils/dopplerHookMigrator.mjs.map +0 -1
- package/dist/utils/index.d.mts +0 -14
- package/dist/utils/index.d.ts +0 -14
- package/dist/utils/index.js +0 -195
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/index.mjs +0 -22
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/isToken0Expected.d.mts +0 -13
- package/dist/utils/isToken0Expected.d.ts +0 -13
- package/dist/utils/isToken0Expected.js +0 -12
- package/dist/utils/isToken0Expected.js.map +0 -1
- package/dist/utils/isToken0Expected.mjs +0 -3
- package/dist/utils/isToken0Expected.mjs.map +0 -1
- package/dist/utils/marketCapHelpers.d.mts +0 -259
- package/dist/utils/marketCapHelpers.d.ts +0 -259
- package/dist/utils/marketCapHelpers.js +0 -58
- package/dist/utils/marketCapHelpers.js.map +0 -1
- package/dist/utils/marketCapHelpers.mjs +0 -5
- package/dist/utils/marketCapHelpers.mjs.map +0 -1
- package/dist/utils/poolKey.d.mts +0 -17
- package/dist/utils/poolKey.d.ts +0 -17
- package/dist/utils/poolKey.js +0 -12
- package/dist/utils/poolKey.js.map +0 -1
- package/dist/utils/poolKey.mjs +0 -3
- package/dist/utils/poolKey.mjs.map +0 -1
- package/dist/utils/priceHelpers.d.mts +0 -86
- package/dist/utils/priceHelpers.d.ts +0 -86
- package/dist/utils/priceHelpers.js +0 -41
- package/dist/utils/priceHelpers.js.map +0 -1
- package/dist/utils/priceHelpers.mjs +0 -4
- package/dist/utils/priceHelpers.mjs.map +0 -1
- package/dist/utils/tickMath.d.mts +0 -72
- package/dist/utils/tickMath.d.ts +0 -72
- package/dist/utils/tickMath.js +0 -60
- package/dist/utils/tickMath.js.map +0 -1
- package/dist/utils/tickMath.mjs +0 -3
- package/dist/utils/tickMath.mjs.map +0 -1
- package/dist/utils/tokenAddressMiner.d.mts +0 -37
- package/dist/utils/tokenAddressMiner.d.ts +0 -37
- package/dist/utils/tokenAddressMiner.js +0 -19
- package/dist/utils/tokenAddressMiner.js.map +0 -1
- package/dist/utils/tokenAddressMiner.mjs +0 -10
- package/dist/utils/tokenAddressMiner.mjs.map +0 -1
|
@@ -1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\n encodePacked,\n keccak256,\n getAddress,\n decodeAbiParameters,\n} from 'viem';\nimport {\n DERC20Bytecode,\n DERC2080Bytecode,\n DopplerDN404Bytecode,\n} from '../abis';\n\nconst DEFAULT_MAX_ITERATIONS = 1_000_000;\n\nexport type TokenVariant = 'standard' | 'doppler404';\n\n// TokenFactory80 has the same deterministic CREATE2 address across all chains where it is deployed.\nconst TOKEN_FACTORY_80_ADDRESS =\n '0xf0B5141dD9096254B2ca624dff26024f46087229' as const;\n\nfunction isTokenFactory80(tokenFactory: Address): boolean {\n return tokenFactory.toLowerCase() === TOKEN_FACTORY_80_ADDRESS.toLowerCase();\n}\n\nexport interface TokenAddressHookConfig {\n deployer: Address;\n initCodeHash: Hash;\n prefix?: string;\n suffix?: string;\n}\n\nexport interface TokenAddressMiningParams {\n /**\n * Vanity prefix (hex). Keep as `''` (empty string) if you only want to mine a suffix.\n * Note: this is required for backwards compatibility with older SDK versions.\n */\n prefix: string;\n /** Vanity suffix (hex), useful as an identifier at the end of the address. */\n suffix?: string;\n tokenFactory: Address;\n initialSupply: bigint;\n recipient: Address;\n owner: Address;\n tokenData: Hex;\n tokenVariant?: TokenVariant;\n customBytecode?: Hex;\n maxIterations?: number;\n startSalt?: bigint;\n hook?: TokenAddressHookConfig;\n}\n\nexport interface TokenAddressMiningResult {\n salt: Hash;\n tokenAddress: Address;\n iterations: number;\n hookAddress?: Address;\n}\n\nconst STANDARD_TOKEN_DATA_ABI = [\n { type: 'string' },\n { type: 'string' },\n { type: 'uint256' },\n { type: 'uint256' },\n { type: 'address[]' },\n { type: 'uint256[]' },\n { type: 'string' },\n] as const;\n\nconst DOPPLER404_TOKEN_DATA_ABI = [\n { type: 'string' },\n { type: 'string' },\n { type: 'string' },\n { type: 'uint256' },\n] as const;\n\nfunction normalizeHexFragment(\n value: string,\n label: 'prefix' | 'suffix',\n): string {\n const normalized = value.trim().toLowerCase().replace(/^0x/, '');\n if (normalized.length === 0) {\n throw new Error(\n `TokenAddressMiner: ${label} must contain at least one hex character`,\n );\n }\n if (normalized.length > 40) {\n throw new Error(\n `TokenAddressMiner: ${label} cannot exceed 40 hex characters`,\n );\n }\n if (!/^[0-9a-f]+$/i.test(normalized)) {\n throw new Error(`TokenAddressMiner: ${label} must be a hexadecimal string`);\n }\n return normalized;\n}\n\nfunction computeCreate2Address(\n salt: Hash,\n initCodeHash: Hash,\n deployer: Address,\n): Address {\n const encoded = encodePacked(\n ['bytes1', 'address', 'bytes32', 'bytes32'],\n ['0xff', deployer, salt, initCodeHash],\n );\n return getAddress(`0x${keccak256(encoded).slice(-40)}`);\n}\n\n/**\n * Helper to convert hex string to Uint8Array\n */\nfunction hexToBytes(hex: string): Uint8Array {\n const cleanHex = hex.startsWith('0x') ? hex.slice(2) : hex;\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < bytes.length; i++) {\n bytes[i] = parseInt(cleanHex.substr(i * 2, 2), 16);\n }\n return bytes;\n}\n\n/**\n * Helper to convert Uint8Array to hex string\n */\nfunction bytesToHex(bytes: Uint8Array): string {\n return (\n '0x' +\n Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n );\n}\n\n/**\n * Pre-compute CREATE2 buffer with constant prefix for fast mining\n * Buffer layout: 0xff (1 byte) + deployer (20 bytes) + salt (32 bytes) + initCodeHash (32 bytes) = 85 bytes\n */\nfunction prepareCreate2Buffer(\n deployer: Address,\n initCodeHash: Hash,\n): Uint8Array {\n const buffer = new Uint8Array(85);\n buffer[0] = 0xff;\n const deployerBytes = hexToBytes(deployer);\n buffer.set(deployerBytes, 1);\n const initCodeHashBytes = hexToBytes(initCodeHash);\n buffer.set(initCodeHashBytes, 53); // 1 + 20 + 32 = 53\n return buffer;\n}\n\n/**\n * Update salt in pre-computed CREATE2 buffer (bytes 21-52)\n * Uses direct byte manipulation instead of string conversion\n */\nfunction updateSaltInBuffer(buffer: Uint8Array, salt: bigint): void {\n // Salt is 32 bytes, positioned at offset 21 (after 0xff + 20-byte deployer)\n // Clear salt region first\n for (let i = 21; i < 53; i++) {\n buffer[i] = 0;\n }\n // Write salt bytes from right to left (big-endian)\n let remaining = salt;\n for (let i = 52; remaining > 0n && i >= 21; i--) {\n buffer[i] = Number(remaining & 0xffn);\n remaining >>= 8n;\n }\n}\n\n/**\n * Compute CREATE2 address from pre-computed buffer (fast version for mining)\n * Returns raw lowercase address without checksum for comparison\n */\nfunction computeCreate2AddressFast(buffer: Uint8Array): string {\n const hash = keccak256(bytesToHex(buffer) as Hex);\n // Return last 40 hex chars (20 bytes) as lowercase address\n return '0x' + hash.slice(-40).toLowerCase();\n}\n\nfunction buildTokenInitHash(params: {\n variant: TokenVariant;\n tokenFactory: Address;\n tokenData: Hex;\n initialSupply: bigint;\n recipient: Address;\n owner: Address;\n customBytecode?: Hex;\n}): Hash {\n const {\n variant,\n tokenFactory,\n tokenData,\n initialSupply,\n recipient,\n owner,\n customBytecode,\n } = params;\n\n if (variant === 'doppler404') {\n const [name, symbol, baseURI] = decodeAbiParameters(\n DOPPLER404_TOKEN_DATA_ABI,\n tokenData,\n ) as readonly [string, string, string, bigint | undefined];\n\n const initHashData = encodeAbiParameters(\n [\n { type: 'string' },\n { type: 'string' },\n { type: 'uint256' },\n { type: 'address' },\n { type: 'address' },\n { type: 'string' },\n ],\n [name, symbol, initialSupply, recipient, owner, baseURI],\n );\n\n return keccak256(\n encodePacked(\n ['bytes', 'bytes'],\n [customBytecode ?? (DopplerDN404Bytecode as Hex), initHashData],\n ),\n ) as Hash;\n }\n\n const [\n name,\n symbol,\n yearlyMintRate,\n vestingDuration,\n vestingRecipients,\n vestingAmounts,\n tokenURI,\n ] = decodeAbiParameters(STANDARD_TOKEN_DATA_ABI, tokenData) as readonly [\n string,\n string,\n bigint,\n bigint,\n readonly Address[],\n readonly bigint[],\n string,\n ];\n\n const initHashData = encodeAbiParameters(\n [\n { type: 'string' },\n { type: 'string' },\n { type: 'uint256' },\n { type: 'address' },\n { type: 'address' },\n { type: 'uint256' },\n { type: 'uint256' },\n { type: 'address[]' },\n { type: 'uint256[]' },\n { type: 'string' },\n ],\n [\n name,\n symbol,\n initialSupply,\n recipient,\n owner,\n yearlyMintRate,\n vestingDuration,\n Array.from(vestingRecipients),\n Array.from(vestingAmounts),\n tokenURI,\n ],\n );\n\n const defaultBytecode = isTokenFactory80(tokenFactory)\n ? (DERC2080Bytecode as Hex)\n : (DERC20Bytecode as Hex);\n\n return keccak256(\n encodePacked(\n ['bytes', 'bytes'],\n [customBytecode ?? defaultBytecode, initHashData],\n ),\n ) as Hash;\n}\n\nexport function mineTokenAddress(\n params: TokenAddressMiningParams,\n): TokenAddressMiningResult {\n const {\n prefix,\n suffix,\n tokenFactory,\n initialSupply,\n recipient,\n owner,\n tokenData,\n tokenVariant = 'standard',\n customBytecode,\n maxIterations = DEFAULT_MAX_ITERATIONS,\n startSalt = 0n,\n hook,\n } = params;\n\n if (maxIterations <= 0 || !Number.isFinite(maxIterations)) {\n throw new Error(\n 'TokenAddressMiner: maxIterations must be a positive finite number',\n );\n }\n if (startSalt < 0n) {\n throw new Error('TokenAddressMiner: startSalt cannot be negative');\n }\n\n const prefixTrimmed = prefix.trim();\n const suffixTrimmed = suffix?.trim();\n\n const normalizedPrefix =\n prefixTrimmed.length === 0\n ? undefined\n : normalizeHexFragment(prefixTrimmed, 'prefix');\n const normalizedSuffix =\n !suffixTrimmed || suffixTrimmed.length === 0\n ? undefined\n : normalizeHexFragment(suffixTrimmed, 'suffix');\n\n if (!normalizedPrefix && !normalizedSuffix) {\n throw new Error('TokenAddressMiner: must provide prefix and/or suffix');\n }\n\n const tokenInitHash = buildTokenInitHash({\n variant: tokenVariant,\n tokenFactory,\n tokenData,\n initialSupply,\n recipient,\n owner,\n customBytecode,\n });\n\n const hookConfig = hook\n ? {\n deployer: hook.deployer,\n initCodeHash: hook.initCodeHash,\n prefix:\n hook.prefix && hook.prefix.trim().length > 0\n ? normalizeHexFragment(hook.prefix, 'prefix')\n : undefined,\n suffix:\n hook.suffix && hook.suffix.trim().length > 0\n ? normalizeHexFragment(hook.suffix, 'suffix')\n : undefined,\n }\n : undefined;\n\n const maxSalt = startSalt + BigInt(maxIterations);\n let iterations = 0;\n\n // Pre-allocate CREATE2 buffer with constant parts (optimization)\n const tokenBuffer = prepareCreate2Buffer(tokenFactory, tokenInitHash);\n const hookBuffer = hookConfig\n ? prepareCreate2Buffer(hookConfig.deployer, hookConfig.initCodeHash)\n : null;\n\n for (let salt = startSalt; salt < maxSalt; salt++) {\n // Update salt in pre-computed buffer (avoids string formatting)\n updateSaltInBuffer(tokenBuffer, salt);\n\n // Compute token address using fast method (no checksum)\n const candidateRaw = computeCreate2AddressFast(tokenBuffer);\n const candidateHex = candidateRaw.slice(2);\n iterations++;\n\n if (normalizedPrefix && !candidateHex.startsWith(normalizedPrefix))\n continue;\n if (normalizedSuffix && !candidateHex.endsWith(normalizedSuffix)) continue;\n\n let hookAddressRaw: string | undefined;\n if (hookBuffer) {\n updateSaltInBuffer(hookBuffer, salt);\n hookAddressRaw = computeCreate2AddressFast(hookBuffer);\n const hookHex = hookAddressRaw.slice(2);\n if (hookConfig?.prefix && !hookHex.startsWith(hookConfig.prefix))\n continue;\n if (hookConfig?.suffix && !hookHex.endsWith(hookConfig.suffix)) continue;\n }\n\n // Found a match! Convert to proper format for return\n const saltHex = `0x${salt.toString(16).padStart(64, '0')}` as Hash;\n return {\n salt: saltHex,\n tokenAddress: getAddress(candidateRaw) as Address,\n iterations,\n hookAddress: hookAddressRaw\n ? (getAddress(hookAddressRaw) as Address)\n : undefined,\n };\n }\n\n const constraints: string[] = [];\n if (normalizedPrefix) constraints.push(`prefix ${prefixTrimmed}`);\n if (normalizedSuffix) constraints.push(`suffix ${suffixTrimmed}`);\n\n throw new Error(\n `TokenAddressMiner: could not find salt matching ${constraints.join(\n ' and ',\n )} within ${maxIterations} iterations`,\n );\n}\n"]}
|
package/dist/chunk-YFEPTSI2.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk7CAAI5DL_js = require('./chunk-7CAAI5DL.js');
|
|
4
|
-
var chunk3MVW6UIW_js = require('./chunk-3MVW6UIW.js');
|
|
5
|
-
var viem = require('viem');
|
|
6
|
-
|
|
7
|
-
var Quoter = class {
|
|
8
|
-
get rpc() {
|
|
9
|
-
return this.publicClient;
|
|
10
|
-
}
|
|
11
|
-
constructor(publicClient, chainId) {
|
|
12
|
-
this.publicClient = publicClient;
|
|
13
|
-
this.chainId = chainId;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get a price quote for swapping an exact amount of input tokens on Uniswap V3
|
|
17
|
-
* @param params Parameters for the quote
|
|
18
|
-
* @returns Quote result including output amount and price impact
|
|
19
|
-
*/
|
|
20
|
-
async quoteExactInputV3(params) {
|
|
21
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
22
|
-
try {
|
|
23
|
-
const { result } = await this.rpc.simulateContract({
|
|
24
|
-
address: addresses.v3Quoter,
|
|
25
|
-
abi: chunk3MVW6UIW_js.quoterV2Abi,
|
|
26
|
-
functionName: "quoteExactInputSingle",
|
|
27
|
-
args: [
|
|
28
|
-
{
|
|
29
|
-
tokenIn: params.tokenIn,
|
|
30
|
-
tokenOut: params.tokenOut,
|
|
31
|
-
amountIn: params.amountIn,
|
|
32
|
-
fee: params.fee,
|
|
33
|
-
sqrtPriceLimitX96: params.sqrtPriceLimitX96 ?? BigInt(0)
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
amountOut: result[0],
|
|
39
|
-
sqrtPriceX96After: result[1],
|
|
40
|
-
initializedTicksCrossed: result[2],
|
|
41
|
-
gasEstimate: result[3]
|
|
42
|
-
};
|
|
43
|
-
} catch (err) {
|
|
44
|
-
const revertData = err?.cause?.data || err.data;
|
|
45
|
-
if (revertData && typeof revertData === "string" && revertData.startsWith("0x")) {
|
|
46
|
-
try {
|
|
47
|
-
const [amount, sqrtPriceX96After] = viem.decodeAbiParameters(
|
|
48
|
-
[{ type: "uint256" }, { type: "uint160" }, { type: "int24" }],
|
|
49
|
-
revertData
|
|
50
|
-
);
|
|
51
|
-
return {
|
|
52
|
-
amountOut: amount,
|
|
53
|
-
sqrtPriceX96After,
|
|
54
|
-
initializedTicksCrossed: 0,
|
|
55
|
-
gasEstimate: 0n
|
|
56
|
-
};
|
|
57
|
-
} catch (_) {
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
throw err;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Get a price quote for receiving an exact amount of output tokens on Uniswap V3
|
|
65
|
-
* @param params Parameters for the quote
|
|
66
|
-
* @returns Quote result including required input amount
|
|
67
|
-
*/
|
|
68
|
-
async quoteExactOutputV3(params) {
|
|
69
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
70
|
-
try {
|
|
71
|
-
const { result } = await this.rpc.simulateContract({
|
|
72
|
-
address: addresses.v3Quoter,
|
|
73
|
-
abi: chunk3MVW6UIW_js.quoterV2Abi,
|
|
74
|
-
functionName: "quoteExactOutputSingle",
|
|
75
|
-
args: [
|
|
76
|
-
{
|
|
77
|
-
tokenIn: params.tokenIn,
|
|
78
|
-
tokenOut: params.tokenOut,
|
|
79
|
-
amount: params.amountOut,
|
|
80
|
-
fee: params.fee,
|
|
81
|
-
sqrtPriceLimitX96: params.sqrtPriceLimitX96 ?? BigInt(0)
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
});
|
|
85
|
-
return {
|
|
86
|
-
amountIn: result[0],
|
|
87
|
-
sqrtPriceX96After: result[1],
|
|
88
|
-
initializedTicksCrossed: result[2],
|
|
89
|
-
gasEstimate: result[3]
|
|
90
|
-
};
|
|
91
|
-
} catch (err) {
|
|
92
|
-
const revertData = err?.cause?.data || err.data;
|
|
93
|
-
if (revertData && typeof revertData === "string" && revertData.startsWith("0x")) {
|
|
94
|
-
try {
|
|
95
|
-
const [amount, sqrtPriceX96After] = viem.decodeAbiParameters(
|
|
96
|
-
[{ type: "uint256" }, { type: "uint160" }, { type: "int24" }],
|
|
97
|
-
revertData
|
|
98
|
-
);
|
|
99
|
-
return {
|
|
100
|
-
amountIn: amount,
|
|
101
|
-
sqrtPriceX96After,
|
|
102
|
-
initializedTicksCrossed: 0,
|
|
103
|
-
gasEstimate: 0n
|
|
104
|
-
};
|
|
105
|
-
} catch (_) {
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
throw err;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Get a price quote for swapping an exact amount of input tokens on Uniswap V2
|
|
113
|
-
* @param params Parameters for the quote
|
|
114
|
-
* @returns Array of amounts for each step in the path
|
|
115
|
-
*/
|
|
116
|
-
async quoteExactInputV2(params) {
|
|
117
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
118
|
-
if (!addresses.univ2Router02) {
|
|
119
|
-
throw new Error("Uniswap V2 Router not available on this chain");
|
|
120
|
-
}
|
|
121
|
-
const result = await this.rpc.readContract({
|
|
122
|
-
address: addresses.univ2Router02,
|
|
123
|
-
abi: chunk3MVW6UIW_js.uniswapV2Router02Abi,
|
|
124
|
-
functionName: "getAmountsOut",
|
|
125
|
-
args: [params.amountIn, params.path]
|
|
126
|
-
});
|
|
127
|
-
return [...result];
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Get a price quote for receiving an exact amount of output tokens on Uniswap V2
|
|
131
|
-
* @param params Parameters for the quote
|
|
132
|
-
* @returns Array of amounts for each step in the path
|
|
133
|
-
*/
|
|
134
|
-
async quoteExactOutputV2(params) {
|
|
135
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
136
|
-
if (!addresses.univ2Router02) {
|
|
137
|
-
throw new Error("Uniswap V2 Router not available on this chain");
|
|
138
|
-
}
|
|
139
|
-
const result = await this.rpc.readContract({
|
|
140
|
-
address: addresses.univ2Router02,
|
|
141
|
-
abi: chunk3MVW6UIW_js.uniswapV2Router02Abi,
|
|
142
|
-
functionName: "getAmountsIn",
|
|
143
|
-
args: [params.amountOut, params.path]
|
|
144
|
-
});
|
|
145
|
-
return [...result];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get a price quote for swapping an exact amount of input tokens on Uniswap V4
|
|
149
|
-
* @param params Parameters for the quote
|
|
150
|
-
* @returns Quote result for V4 pools
|
|
151
|
-
*/
|
|
152
|
-
async quoteExactInputV4(params) {
|
|
153
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
154
|
-
const quoterAddress = addresses.uniswapV4Quoter;
|
|
155
|
-
if (!quoterAddress) {
|
|
156
|
-
throw new Error("No V4 quoter available on this chain");
|
|
157
|
-
}
|
|
158
|
-
const { result } = await this.rpc.simulateContract({
|
|
159
|
-
address: quoterAddress,
|
|
160
|
-
abi: chunk3MVW6UIW_js.v4QuoterAbi,
|
|
161
|
-
functionName: "quoteExactInputSingle",
|
|
162
|
-
args: [
|
|
163
|
-
{
|
|
164
|
-
poolKey: params.poolKey,
|
|
165
|
-
zeroForOne: params.zeroForOne,
|
|
166
|
-
exactAmount: params.exactAmount,
|
|
167
|
-
hookData: params.hookData ?? "0x"
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
});
|
|
171
|
-
return {
|
|
172
|
-
amountOut: result[0],
|
|
173
|
-
gasEstimate: result[1]
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Get a price quote for receiving an exact amount of output tokens on Uniswap V4
|
|
178
|
-
* @param params Parameters for the quote
|
|
179
|
-
* @returns Quote result for V4 pools
|
|
180
|
-
*/
|
|
181
|
-
async quoteExactOutputV4(params) {
|
|
182
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
183
|
-
const quoterAddress = addresses.uniswapV4Quoter;
|
|
184
|
-
if (!quoterAddress) {
|
|
185
|
-
throw new Error("Uniswap V4 Quoter address not available on this chain");
|
|
186
|
-
}
|
|
187
|
-
const { result } = await this.rpc.simulateContract({
|
|
188
|
-
address: quoterAddress,
|
|
189
|
-
abi: chunk3MVW6UIW_js.v4QuoterAbi,
|
|
190
|
-
functionName: "quoteExactOutputSingle",
|
|
191
|
-
args: [
|
|
192
|
-
{
|
|
193
|
-
poolKey: params.poolKey,
|
|
194
|
-
zeroForOne: params.zeroForOne,
|
|
195
|
-
exactAmount: params.exactAmount,
|
|
196
|
-
hookData: params.hookData ?? "0x"
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
});
|
|
200
|
-
return {
|
|
201
|
-
amountIn: result[0],
|
|
202
|
-
gasEstimate: result[1]
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Quote a single exact-input trade using the Uniswap V4 Quoter (not Lens)
|
|
207
|
-
* @param params Parameters for the quote
|
|
208
|
-
*/
|
|
209
|
-
async quoteExactInputV4Quoter(params) {
|
|
210
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
211
|
-
const quoterAddress = addresses.uniswapV4Quoter;
|
|
212
|
-
if (!quoterAddress) {
|
|
213
|
-
throw new Error("Uniswap V4 Quoter address not available on this chain");
|
|
214
|
-
}
|
|
215
|
-
const { result } = await this.rpc.simulateContract({
|
|
216
|
-
address: quoterAddress,
|
|
217
|
-
abi: chunk3MVW6UIW_js.v4QuoterAbi,
|
|
218
|
-
functionName: "quoteExactInputSingle",
|
|
219
|
-
args: [
|
|
220
|
-
{
|
|
221
|
-
poolKey: params.poolKey,
|
|
222
|
-
zeroForOne: params.zeroForOne,
|
|
223
|
-
exactAmount: params.exactAmount,
|
|
224
|
-
hookData: params.hookData ?? "0x"
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
});
|
|
228
|
-
return {
|
|
229
|
-
amountOut: result[0],
|
|
230
|
-
gasEstimate: result[1]
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Quote a single exact-output trade using the Uniswap V4 Quoter (not Lens)
|
|
235
|
-
* @param params Parameters for the quote
|
|
236
|
-
*/
|
|
237
|
-
async quoteExactOutputV4Quoter(params) {
|
|
238
|
-
const addresses = chunk7CAAI5DL_js.getAddresses(this.chainId);
|
|
239
|
-
const quoterAddress = addresses.uniswapV4Quoter;
|
|
240
|
-
if (!quoterAddress) {
|
|
241
|
-
throw new Error("Uniswap V4 Quoter address not available on this chain");
|
|
242
|
-
}
|
|
243
|
-
const { result } = await this.rpc.simulateContract({
|
|
244
|
-
address: quoterAddress,
|
|
245
|
-
abi: chunk3MVW6UIW_js.v4QuoterAbi,
|
|
246
|
-
functionName: "quoteExactOutputSingle",
|
|
247
|
-
args: [
|
|
248
|
-
{
|
|
249
|
-
poolKey: params.poolKey,
|
|
250
|
-
zeroForOne: params.zeroForOne,
|
|
251
|
-
exactAmount: params.exactAmount,
|
|
252
|
-
hookData: params.hookData ?? "0x"
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
});
|
|
256
|
-
return {
|
|
257
|
-
amountIn: result[0],
|
|
258
|
-
gasEstimate: result[1]
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
exports.Quoter = Quoter;
|
|
264
|
-
//# sourceMappingURL=chunk-YFEPTSI2.js.map
|
|
265
|
-
//# sourceMappingURL=chunk-YFEPTSI2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/quoter/Quoter.ts"],"names":["getAddresses","quoterV2Abi","decodeAbiParameters","uniswapV2Router02Abi","v4QuoterAbi"],"mappings":";;;;;;AAiBO,IAAM,SAAN,MAAa;AAAA,EAGlB,IAAY,GAAA,GAAoB;AAC9B,IAAA,OAAO,IAAA,CAAK,YAAA;AAAA,EACd;AAAA,EAEA,WAAA,CAAY,cAAqC,OAAA,EAAiB;AAChE,IAAA,IAAA,CAAK,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CAAO,OAAA;AAAA,UAChB,YAAY,MAAA,CAAO,UAAA;AAAA,UACnB,aAAa,MAAA,CAAO,WAAA;AAAA,UACpB,QAAA,EAAW,OAAO,QAAA,IAAY;AAAA;AAChC;AACF,KACD,CAAA;AAED,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,OAAO,CAAC,CAAA;AAAA,MACnB,WAAA,EAAa,OAAO,CAAC;AAAA,KACvB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,yBAAyB,MAAA,EAc5B;AACD,IAAA,MAAM,SAAA,GAAYJ,6BAAA,CAAa,IAAA,CAAK,OAAO,CAAA;AAC3C,IAAA,MAAM,gBAAgB,SAAA,CAAU,eAAA;AAEhC,IAAA,IAAI,CAAC,aAAA,EAAe;AAClB,MAAA,MAAM,IAAI,MAAM,uDAAuD,CAAA;AAAA,IACzE;AAEA,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,MAAM,IAAA,CAAK,IAAI,gBAAA,CAAiB;AAAA,MACjD,OAAA,EAAS,aAAA;AAAA,MACT,GAAA,EAAKI,4BAAA;AAAA,MACL,YAAA,EAAc,wBAAA;AAAA,MACd,IAAA,EAAM;AAAA,QACJ;AAAA,UACE,SAAS,MAAA,CAAO,OAAA;AAAA,UAChB,YAAY,MAAA,CAAO,UAAA;AAAA,UACnB,aAAa,MAAA,CAAO,WAAA;AAAA,UACpB,QAAA,EAAW,OAAO,QAAA,IAAY;AAAA;AAChC;AACF,KACD,CAAA;AAED,IAAA,OAAO;AAAA,MACL,QAAA,EAAU,OAAO,CAAC,CAAA;AAAA,MAClB,WAAA,EAAa,OAAO,CAAC;AAAA,KACvB;AAAA,EACF;AACF","file":"chunk-YFEPTSI2.js","sourcesContent":["import {\n type Address,\n decodeAbiParameters,\n type Hex,\n type PublicClient,\n} from 'viem';\nimport { quoterV2Abi, uniswapV2Router02Abi, v4QuoterAbi } from '../../abis';\nimport { getAddresses } from '../../addresses';\nimport type { SupportedPublicClient } from '../../types';\n\n/**\n * Unified Quoter for getting price quotes across Uniswap V2, V3, and V4\n *\n * This class provides a unified interface for price discovery across all\n * supported Uniswap versions, abstracting away the differences between\n * V2 router, V3 quoter, and V4 quoter contracts.\n */\nexport class Quoter {\n private publicClient: SupportedPublicClient;\n private chainId: number;\n private get rpc(): PublicClient {\n return this.publicClient as PublicClient;\n }\n\n constructor(publicClient: SupportedPublicClient, chainId: number) {\n this.publicClient = publicClient;\n this.chainId = chainId;\n }\n\n /**\n * Get a price quote for swapping an exact amount of input tokens on Uniswap V3\n * @param params Parameters for the quote\n * @returns Quote result including output amount and price impact\n */\n async quoteExactInputV3(params: {\n tokenIn: Address;\n tokenOut: Address;\n amountIn: bigint;\n fee: number;\n sqrtPriceLimitX96?: bigint;\n }): Promise<{\n amountOut: bigint;\n sqrtPriceX96After: bigint;\n initializedTicksCrossed: number;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n\n try {\n const { result } = await this.rpc.simulateContract({\n address: addresses.v3Quoter,\n abi: quoterV2Abi,\n functionName: 'quoteExactInputSingle',\n args: [\n {\n tokenIn: params.tokenIn,\n tokenOut: params.tokenOut,\n amountIn: params.amountIn,\n fee: params.fee,\n sqrtPriceLimitX96: params.sqrtPriceLimitX96 ?? BigInt(0),\n },\n ],\n });\n return {\n amountOut: result[0],\n sqrtPriceX96After: result[1],\n initializedTicksCrossed: result[2],\n gasEstimate: result[3],\n };\n } catch (err: unknown) {\n const revertData: Hex | undefined =\n (err as { cause?: { data?: Hex }; data?: Hex })?.cause?.data ||\n (err as { data?: Hex }).data;\n if (\n revertData &&\n typeof revertData === 'string' &&\n revertData.startsWith('0x')\n ) {\n try {\n // Uniswap V3 QuoterV2 encodes (uint256 amount, uint160 sqrtPriceX96After, int24 tickAfter)\n const [amount, sqrtPriceX96After] = decodeAbiParameters(\n [{ type: 'uint256' }, { type: 'uint160' }, { type: 'int24' }],\n revertData as Hex,\n ) as unknown as [bigint, bigint, number];\n return {\n amountOut: amount,\n sqrtPriceX96After,\n initializedTicksCrossed: 0,\n gasEstimate: 0n,\n };\n } catch (_) {\n // fall through\n }\n }\n throw err;\n }\n }\n\n /**\n * Get a price quote for receiving an exact amount of output tokens on Uniswap V3\n * @param params Parameters for the quote\n * @returns Quote result including required input amount\n */\n async quoteExactOutputV3(params: {\n tokenIn: Address;\n tokenOut: Address;\n amountOut: bigint;\n fee: number;\n sqrtPriceLimitX96?: bigint;\n }): Promise<{\n amountIn: bigint;\n sqrtPriceX96After: bigint;\n initializedTicksCrossed: number;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n\n try {\n const { result } = await this.rpc.simulateContract({\n address: addresses.v3Quoter,\n abi: quoterV2Abi,\n functionName: 'quoteExactOutputSingle',\n args: [\n {\n tokenIn: params.tokenIn,\n tokenOut: params.tokenOut,\n amount: params.amountOut,\n fee: params.fee,\n sqrtPriceLimitX96: params.sqrtPriceLimitX96 ?? BigInt(0),\n },\n ],\n });\n return {\n amountIn: result[0],\n sqrtPriceX96After: result[1],\n initializedTicksCrossed: result[2],\n gasEstimate: result[3],\n };\n } catch (err: unknown) {\n const revertData: Hex | undefined =\n (err as { cause?: { data?: Hex }; data?: Hex })?.cause?.data ||\n (err as { data?: Hex }).data;\n if (\n revertData &&\n typeof revertData === 'string' &&\n revertData.startsWith('0x')\n ) {\n try {\n // Uniswap V3 QuoterV2 encodes (uint256 amount, uint160 sqrtPriceX96After, int24 tickAfter)\n const [amount, sqrtPriceX96After] = decodeAbiParameters(\n [{ type: 'uint256' }, { type: 'uint160' }, { type: 'int24' }],\n revertData as Hex,\n ) as unknown as [bigint, bigint, number];\n return {\n amountIn: amount,\n sqrtPriceX96After,\n initializedTicksCrossed: 0,\n gasEstimate: 0n,\n };\n } catch (_) {\n // fall through\n }\n }\n throw err;\n }\n }\n\n /**\n * Get a price quote for swapping an exact amount of input tokens on Uniswap V2\n * @param params Parameters for the quote\n * @returns Array of amounts for each step in the path\n */\n async quoteExactInputV2(params: {\n amountIn: bigint;\n path: Address[];\n }): Promise<bigint[]> {\n const addresses = getAddresses(this.chainId);\n\n if (!addresses.univ2Router02) {\n throw new Error('Uniswap V2 Router not available on this chain');\n }\n\n const result = await this.rpc.readContract({\n address: addresses.univ2Router02,\n abi: uniswapV2Router02Abi,\n functionName: 'getAmountsOut',\n args: [params.amountIn, params.path],\n });\n\n return [...result]; // Convert readonly array to mutable array\n }\n\n /**\n * Get a price quote for receiving an exact amount of output tokens on Uniswap V2\n * @param params Parameters for the quote\n * @returns Array of amounts for each step in the path\n */\n async quoteExactOutputV2(params: {\n amountOut: bigint;\n path: Address[];\n }): Promise<bigint[]> {\n const addresses = getAddresses(this.chainId);\n\n if (!addresses.univ2Router02) {\n throw new Error('Uniswap V2 Router not available on this chain');\n }\n\n const result = await this.rpc.readContract({\n address: addresses.univ2Router02,\n abi: uniswapV2Router02Abi,\n functionName: 'getAmountsIn',\n args: [params.amountOut, params.path],\n });\n\n return [...result]; // Convert readonly array to mutable array\n }\n\n /**\n * Get a price quote for swapping an exact amount of input tokens on Uniswap V4\n * @param params Parameters for the quote\n * @returns Quote result for V4 pools\n */\n async quoteExactInputV4(params: {\n poolKey: {\n currency0: Address;\n currency1: Address;\n fee: number;\n tickSpacing: number;\n hooks: Address;\n };\n zeroForOne: boolean;\n exactAmount: bigint;\n hookData?: string;\n }): Promise<{\n amountOut: bigint;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n\n const quoterAddress = addresses.uniswapV4Quoter;\n\n if (!quoterAddress) {\n throw new Error('No V4 quoter available on this chain');\n }\n\n const { result } = await this.rpc.simulateContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: 'quoteExactInputSingle',\n args: [\n {\n poolKey: params.poolKey,\n zeroForOne: params.zeroForOne,\n exactAmount: params.exactAmount,\n hookData: (params.hookData ?? '0x') as `0x${string}`,\n },\n ],\n });\n\n return {\n amountOut: result[0],\n gasEstimate: result[1],\n };\n }\n\n /**\n * Get a price quote for receiving an exact amount of output tokens on Uniswap V4\n * @param params Parameters for the quote\n * @returns Quote result for V4 pools\n */\n async quoteExactOutputV4(params: {\n poolKey: {\n currency0: Address;\n currency1: Address;\n fee: number;\n tickSpacing: number;\n hooks: Address;\n };\n zeroForOne: boolean;\n exactAmount: bigint;\n hookData?: string;\n }): Promise<{\n amountIn: bigint;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n\n const quoterAddress = addresses.uniswapV4Quoter;\n\n if (!quoterAddress) {\n throw new Error('Uniswap V4 Quoter address not available on this chain');\n }\n\n const { result } = await this.rpc.simulateContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: 'quoteExactOutputSingle',\n args: [\n {\n poolKey: params.poolKey,\n zeroForOne: params.zeroForOne,\n exactAmount: params.exactAmount,\n hookData: (params.hookData ?? '0x') as `0x${string}`,\n },\n ],\n });\n\n return {\n amountIn: result[0],\n gasEstimate: result[1],\n };\n }\n\n /**\n * Quote a single exact-input trade using the Uniswap V4 Quoter (not Lens)\n * @param params Parameters for the quote\n */\n async quoteExactInputV4Quoter(params: {\n poolKey: {\n currency0: Address;\n currency1: Address;\n fee: number;\n tickSpacing: number;\n hooks: Address;\n };\n zeroForOne: boolean;\n exactAmount: bigint;\n hookData?: string;\n }): Promise<{\n amountOut: bigint;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n const quoterAddress = addresses.uniswapV4Quoter;\n\n if (!quoterAddress) {\n throw new Error('Uniswap V4 Quoter address not available on this chain');\n }\n\n const { result } = await this.rpc.simulateContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: 'quoteExactInputSingle',\n args: [\n {\n poolKey: params.poolKey,\n zeroForOne: params.zeroForOne,\n exactAmount: params.exactAmount,\n hookData: (params.hookData ?? '0x') as `0x${string}`,\n },\n ],\n });\n\n return {\n amountOut: result[0],\n gasEstimate: result[1],\n };\n }\n\n /**\n * Quote a single exact-output trade using the Uniswap V4 Quoter (not Lens)\n * @param params Parameters for the quote\n */\n async quoteExactOutputV4Quoter(params: {\n poolKey: {\n currency0: Address;\n currency1: Address;\n fee: number;\n tickSpacing: number;\n hooks: Address;\n };\n zeroForOne: boolean;\n exactAmount: bigint;\n hookData?: string;\n }): Promise<{\n amountIn: bigint;\n gasEstimate: bigint;\n }> {\n const addresses = getAddresses(this.chainId);\n const quoterAddress = addresses.uniswapV4Quoter;\n\n if (!quoterAddress) {\n throw new Error('Uniswap V4 Quoter address not available on this chain');\n }\n\n const { result } = await this.rpc.simulateContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: 'quoteExactOutputSingle',\n args: [\n {\n poolKey: params.poolKey,\n zeroForOne: params.zeroForOne,\n exactAmount: params.exactAmount,\n hookData: (params.hookData ?? '0x') as `0x${string}`,\n },\n ],\n });\n\n return {\n amountIn: result[0],\n gasEstimate: result[1],\n };\n }\n}\n"]}
|
package/dist/chunk-YYLD3AJ7.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var viem = require('viem');
|
|
4
|
-
|
|
5
|
-
// src/entities/token/eth/Eth.ts
|
|
6
|
-
var Eth = class {
|
|
7
|
-
get rpc() {
|
|
8
|
-
return this.publicClient;
|
|
9
|
-
}
|
|
10
|
-
constructor(publicClient) {
|
|
11
|
-
this.publicClient = publicClient;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get the human-readable name of the token
|
|
15
|
-
* @returns Promise resolving to "Ether" (hardcoded ETH name)
|
|
16
|
-
*/
|
|
17
|
-
async getName() {
|
|
18
|
-
return "Ether";
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get the ticker symbol of the token
|
|
22
|
-
* @returns Promise resolving to "ETH" (hardcoded ETH symbol)
|
|
23
|
-
*/
|
|
24
|
-
async getSymbol() {
|
|
25
|
-
return "ETH";
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get the number of decimal places used by the token
|
|
29
|
-
* @returns Promise resolving to 18 (standard ETH decimals)
|
|
30
|
-
*/
|
|
31
|
-
async getDecimals() {
|
|
32
|
-
return 18;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the allowance granted to a spender (always returns maximum value)
|
|
36
|
-
* @returns Promise resolving to 2^256 - 1 (simulates unlimited ETH allowance)
|
|
37
|
-
*
|
|
38
|
-
* @remarks
|
|
39
|
-
* ETH doesn't have an allowance mechanism, so this returns max uint256 value
|
|
40
|
-
* to represent unlimited approval in systems expecting ERC20-like interfaces
|
|
41
|
-
*/
|
|
42
|
-
async getAllowance() {
|
|
43
|
-
return 2n ** 256n - 1n;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get the ETH balance of a specified account
|
|
47
|
-
* @param account - Address of the account to query
|
|
48
|
-
* @returns Promise resolving to the account's ETH balance in wei
|
|
49
|
-
*/
|
|
50
|
-
async getBalanceOf(account) {
|
|
51
|
-
return await this.rpc.getBalance({
|
|
52
|
-
address: account
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
/** Static ETH address identifier (zero address) */
|
|
57
|
-
Eth.address = viem.zeroAddress;
|
|
58
|
-
|
|
59
|
-
exports.Eth = Eth;
|
|
60
|
-
//# sourceMappingURL=chunk-YYLD3AJ7.js.map
|
|
61
|
-
//# sourceMappingURL=chunk-YYLD3AJ7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/token/eth/Eth.ts"],"names":["zeroAddress"],"mappings":";;;;;AAaO,IAAM,MAAN,MAAU;AAAA,EAEf,IAAY,GAAA,GAAoB;AAC9B,IAAA,OAAO,IAAA,CAAK,YAAA;AAAA,EACd;AAAA,EAKA,YAAY,YAAA,EAAqC;AAC/C,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAA,GAA2B;AAC/B,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,SAAA,GAA6B;AACjC,IAAA,OAAO,KAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAA,GAA+B;AACnC,IAAA,OAAO,EAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,YAAA,GAAgC;AACpC,IAAA,OAAO,MAAM,IAAA,GAAO,EAAA;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,OAAA,EAAmC;AACpD,IAAA,OAAO,MAAM,IAAA,CAAK,GAAA,CAAI,UAAA,CAAW;AAAA,MAC/B,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF;AAAA;AA3Da,GAAA,CAOK,OAAA,GAAUA,gBAAA","file":"chunk-YYLD3AJ7.js","sourcesContent":["import { type Address, zeroAddress, type PublicClient } from 'viem';\nimport { SupportedPublicClient } from '@/types';\n\n/**\n * A class providing read-only access to Ethereum (ETH) token information and balances.\n *\n * @remarks\n * This class implements a consistent interface with other token implementations (like DERC20)\n * but handles ETH-specific behavior such as:\n * - Hardcoded token metadata (name, symbol, decimals)\n * - Simulating unlimited allowance for ETH transfers\n * - Querying native ETH balances through viem\n */\nexport class Eth {\n private publicClient: SupportedPublicClient;\n private get rpc(): PublicClient {\n return this.publicClient as PublicClient;\n }\n\n /** Static ETH address identifier (zero address) */\n static readonly address = zeroAddress;\n\n constructor(publicClient: SupportedPublicClient) {\n this.publicClient = publicClient;\n }\n\n /**\n * Get the human-readable name of the token\n * @returns Promise resolving to \"Ether\" (hardcoded ETH name)\n */\n async getName(): Promise<string> {\n return 'Ether';\n }\n\n /**\n * Get the ticker symbol of the token\n * @returns Promise resolving to \"ETH\" (hardcoded ETH symbol)\n */\n async getSymbol(): Promise<string> {\n return 'ETH';\n }\n\n /**\n * Get the number of decimal places used by the token\n * @returns Promise resolving to 18 (standard ETH decimals)\n */\n async getDecimals(): Promise<number> {\n return 18;\n }\n\n /**\n * Get the allowance granted to a spender (always returns maximum value)\n * @returns Promise resolving to 2^256 - 1 (simulates unlimited ETH allowance)\n *\n * @remarks\n * ETH doesn't have an allowance mechanism, so this returns max uint256 value\n * to represent unlimited approval in systems expecting ERC20-like interfaces\n */\n async getAllowance(): Promise<bigint> {\n return 2n ** 256n - 1n;\n }\n\n /**\n * Get the ETH balance of a specified account\n * @param account - Address of the account to query\n * @returns Promise resolving to the account's ETH balance in wei\n */\n async getBalanceOf(account: Address): Promise<bigint> {\n return await this.rpc.getBalance({\n address: account,\n });\n }\n}\n"]}
|
package/dist/chunk-ZEDJUNC6.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { MIN_TICK, MAX_TICK } from './chunk-25GEBO3B.mjs';
|
|
2
|
-
import { DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_MULTICURVE_LOWER_TICKS, FEE_TIERS, TICK_SPACINGS, WAD } from './chunk-IWJOPXYN.mjs';
|
|
3
|
-
|
|
4
|
-
// src/builders/shared.ts
|
|
5
|
-
function computeTicks(priceRange, tickSpacing) {
|
|
6
|
-
const startTick = Math.floor(
|
|
7
|
-
Math.log(priceRange.startPrice) / Math.log(1.0001) / tickSpacing
|
|
8
|
-
) * tickSpacing;
|
|
9
|
-
const endTick = Math.ceil(Math.log(priceRange.endPrice) / Math.log(1.0001) / tickSpacing) * tickSpacing;
|
|
10
|
-
return { startTick, endTick };
|
|
11
|
-
}
|
|
12
|
-
var MARKET_CAP_PRESET_ORDER = [
|
|
13
|
-
"low",
|
|
14
|
-
"medium",
|
|
15
|
-
"high"
|
|
16
|
-
];
|
|
17
|
-
var MARKET_CAP_PRESETS = {
|
|
18
|
-
low: {
|
|
19
|
-
tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[0],
|
|
20
|
-
tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[0],
|
|
21
|
-
numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[0],
|
|
22
|
-
shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[0]
|
|
23
|
-
},
|
|
24
|
-
medium: {
|
|
25
|
-
tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[1],
|
|
26
|
-
tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[1],
|
|
27
|
-
numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[1],
|
|
28
|
-
shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[1]
|
|
29
|
-
},
|
|
30
|
-
high: {
|
|
31
|
-
tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[2],
|
|
32
|
-
tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[2],
|
|
33
|
-
numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[2],
|
|
34
|
-
shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[2]
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function buildCurvesFromPresets(params) {
|
|
38
|
-
const fee = params?.fee ?? FEE_TIERS.LOW;
|
|
39
|
-
const tickSpacing = params?.tickSpacing ?? TICK_SPACINGS[fee];
|
|
40
|
-
if (tickSpacing === void 0) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
"tickSpacing must be provided when using a custom fee tier"
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
const requestedPresets = params?.presets ?? [...MARKET_CAP_PRESET_ORDER];
|
|
46
|
-
const uniquePresets = [];
|
|
47
|
-
for (const preset of requestedPresets) {
|
|
48
|
-
if (!(preset in MARKET_CAP_PRESETS)) {
|
|
49
|
-
throw new Error(`Unsupported market cap preset: ${preset}`);
|
|
50
|
-
}
|
|
51
|
-
if (!uniquePresets.includes(preset)) {
|
|
52
|
-
uniquePresets.push(preset);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (uniquePresets.length === 0) {
|
|
56
|
-
throw new Error("At least one market cap preset must be provided");
|
|
57
|
-
}
|
|
58
|
-
const presetCurves = uniquePresets.map((preset) => {
|
|
59
|
-
const base = MARKET_CAP_PRESETS[preset];
|
|
60
|
-
const override = params?.overrides?.[preset];
|
|
61
|
-
return {
|
|
62
|
-
tickLower: override?.tickLower ?? base.tickLower,
|
|
63
|
-
tickUpper: override?.tickUpper ?? base.tickUpper,
|
|
64
|
-
numPositions: override?.numPositions ?? base.numPositions,
|
|
65
|
-
shares: override?.shares ?? base.shares
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
let totalShares = presetCurves.reduce((acc, curve) => {
|
|
69
|
-
if (curve.shares <= 0n) {
|
|
70
|
-
throw new Error("Preset shares must be greater than zero");
|
|
71
|
-
}
|
|
72
|
-
return acc + curve.shares;
|
|
73
|
-
}, 0n);
|
|
74
|
-
if (totalShares > WAD) {
|
|
75
|
-
throw new Error("Total preset shares cannot exceed 100% (1e18)");
|
|
76
|
-
}
|
|
77
|
-
const curves = [...presetCurves];
|
|
78
|
-
if (totalShares < WAD) {
|
|
79
|
-
const remainder = WAD - totalShares;
|
|
80
|
-
const lastCurve = curves[curves.length - 1];
|
|
81
|
-
let fillerTickLower = lastCurve?.tickUpper ?? 0;
|
|
82
|
-
let fillerNumPositions = lastCurve?.numPositions ?? 1;
|
|
83
|
-
if (fillerNumPositions <= 0) {
|
|
84
|
-
fillerNumPositions = 1;
|
|
85
|
-
}
|
|
86
|
-
const minTickAllowed = Math.ceil(MIN_TICK / tickSpacing) * tickSpacing;
|
|
87
|
-
const rawMaxTick = Math.floor(MAX_TICK / tickSpacing) * tickSpacing;
|
|
88
|
-
const maxTickAllowed = rawMaxTick - tickSpacing;
|
|
89
|
-
fillerTickLower = Math.max(fillerTickLower, minTickAllowed);
|
|
90
|
-
let fillerTickUpper = fillerTickLower + fillerNumPositions * tickSpacing;
|
|
91
|
-
if (fillerTickUpper > maxTickAllowed) {
|
|
92
|
-
fillerTickUpper = maxTickAllowed;
|
|
93
|
-
fillerTickLower = Math.min(fillerTickLower, maxTickAllowed - tickSpacing);
|
|
94
|
-
}
|
|
95
|
-
if (fillerTickUpper <= fillerTickLower) {
|
|
96
|
-
fillerTickLower = Math.max(minTickAllowed, maxTickAllowed - tickSpacing);
|
|
97
|
-
fillerTickUpper = fillerTickLower + tickSpacing;
|
|
98
|
-
}
|
|
99
|
-
curves.push({
|
|
100
|
-
tickLower: fillerTickLower,
|
|
101
|
-
tickUpper: fillerTickUpper,
|
|
102
|
-
numPositions: fillerNumPositions,
|
|
103
|
-
shares: remainder
|
|
104
|
-
});
|
|
105
|
-
totalShares = WAD;
|
|
106
|
-
}
|
|
107
|
-
if (totalShares !== WAD) {
|
|
108
|
-
throw new Error("Failed to normalize preset shares to 100%");
|
|
109
|
-
}
|
|
110
|
-
return { fee, tickSpacing, curves };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { MARKET_CAP_PRESETS, MARKET_CAP_PRESET_ORDER, buildCurvesFromPresets, computeTicks };
|
|
114
|
-
//# sourceMappingURL=chunk-ZEDJUNC6.mjs.map
|
|
115
|
-
//# sourceMappingURL=chunk-ZEDJUNC6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builders/shared.ts"],"names":[],"mappings":";;;;AAuHO,SAAS,YAAA,CACd,YACA,WAAA,EACW;AACX,EAAA,MAAM,YACJ,IAAA,CAAK,KAAA;AAAA,IACH,IAAA,CAAK,IAAI,UAAA,CAAW,UAAU,IAAI,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,GAAI;AAAA,GACvD,GAAI,WAAA;AACN,EAAA,MAAM,OAAA,GACJ,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,UAAA,CAAW,QAAQ,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,GAAI,WAAW,CAAA,GACxE,WAAA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A;AAAA,MACX,YAAA,EAAc,kBAAA;AAAA,MACd,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,WAAA,GAAc,GAAA;AAAA,EAChB;AAEA,EAAA,IAAI,gBAAgB,GAAA,EAAK;AACvB,IAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,EAC7D;AAEA,EAAA,OAAO,EAAE,GAAA,EAAK,WAAA,EAAa,MAAA,EAAO;AACpC","file":"chunk-ZEDJUNC6.mjs","sourcesContent":["import type { Address } from 'viem';\nimport {\n DEFAULT_MULTICURVE_LOWER_TICKS,\n DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES,\n DEFAULT_MULTICURVE_NUM_POSITIONS,\n DEFAULT_MULTICURVE_UPPER_TICKS,\n FEE_TIERS,\n TICK_SPACINGS,\n WAD,\n} from '../constants';\nimport { MAX_TICK, MIN_TICK } from '../utils';\nimport type {\n PriceRange,\n TickRange,\n MulticurveMarketCapPreset,\n GovernanceOption,\n MigrationConfig,\n} from '../types';\nimport type { SupportedChainId } from '../addresses';\n\n// ============================================================================\n// Common Builder Interface\n// ============================================================================\n\n/**\n * Common interface shared by all auction builders.\n *\n * Defines the methods that all builders (Static, Dynamic, Multicurve) implement.\n * Useful for documentation and ensuring API consistency across builders.\n *\n * @template C - The chain ID type\n */\nexport interface BaseAuctionBuilder<C extends SupportedChainId> {\n /** The chain ID this builder is configured for */\n readonly chainId: C;\n\n /**\n * Configure the token to be created.\n * Supports standard ERC20 or Doppler404 token types.\n */\n tokenConfig(\n params:\n | {\n type?: 'standard';\n name: string;\n symbol: string;\n tokenURI: string;\n yearlyMintRate?: bigint;\n }\n | {\n type: 'doppler404';\n name: string;\n symbol: string;\n baseURI: string;\n unit?: bigint;\n },\n ): this;\n\n /**\n * Configure the token sale parameters.\n * @param params.initialSupply - Total token supply to mint\n * @param params.numTokensToSell - Number of tokens allocated for the bonding curve\n * @param params.numeraire - The quote token address (e.g., WETH)\n */\n saleConfig(params: {\n initialSupply: bigint;\n numTokensToSell: bigint;\n numeraire: Address;\n }): this;\n\n /**\n * Configure token vesting for team/investor allocations.\n * Pass undefined or omit to disable vesting.\n */\n withVesting(params?: {\n duration?: bigint;\n cliffDuration?: number;\n recipients?: Address[];\n amounts?: bigint[];\n }): this;\n\n /**\n * Configure governance for the token.\n * @param params - Use { type: 'default' }, { type: 'noOp' }, { type: 'launchpad', multisig: '0x...' }, or { type: 'custom', ... }\n */\n withGovernance(params: GovernanceOption<C>): this;\n\n /**\n * Configure post-auction liquidity migration.\n * @param migration - Migration target (uniswapV2, uniswapV4, dopplerHook, or noOp)\n */\n withMigration(migration: MigrationConfig): this;\n\n /**\n * Set the user address (token creator/owner).\n * Required for build().\n */\n withUserAddress(address: Address): this;\n\n /**\n * Set the integrator address for fee attribution.\n * Defaults to zero address if not provided.\n */\n withIntegrator(address?: Address): this;\n\n /**\n * Override the default gas limit for the create transaction.\n */\n withGasLimit(gas?: bigint): this;\n\n // Module address overrides\n withTokenFactory(address: Address): this;\n withAirlock(address: Address): this;\n withGovernanceFactory(address: Address): this;\n withV2Migrator(address: Address): this;\n withV4Migrator(address: Address): this;\n withNoOpMigrator(address: Address): this;\n}\n\nexport function computeTicks(\n priceRange: PriceRange,\n tickSpacing: number,\n): TickRange {\n const startTick =\n Math.floor(\n 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\nexport const MARKET_CAP_PRESET_ORDER = [\n 'low',\n 'medium',\n 'high',\n] as const satisfies readonly MulticurveMarketCapPreset[];\n\nexport type MarketCapPresetConfig = {\n tickLower: number;\n tickUpper: number;\n numPositions: number;\n shares: bigint;\n};\n\nexport const MARKET_CAP_PRESETS: Record<\n MulticurveMarketCapPreset,\n MarketCapPresetConfig\n> = {\n low: {\n tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[0],\n tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[0],\n numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[0],\n shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[0],\n },\n medium: {\n tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[1],\n tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[1],\n numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[1],\n shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[1],\n },\n high: {\n tickLower: DEFAULT_MULTICURVE_LOWER_TICKS[2],\n tickUpper: DEFAULT_MULTICURVE_UPPER_TICKS[2],\n numPositions: DEFAULT_MULTICURVE_NUM_POSITIONS[2],\n shares: DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES[2],\n },\n};\n\nexport type MarketCapPresetOverrides = Partial<\n Record<\n MulticurveMarketCapPreset,\n {\n tickLower?: number;\n tickUpper?: number;\n numPositions?: number;\n shares?: bigint;\n }\n >\n>;\n\n/**\n * Helper to build curves from market cap presets with optional filler curve\n */\nexport function buildCurvesFromPresets(params: {\n fee?: number;\n tickSpacing?: number;\n presets?: MulticurveMarketCapPreset[];\n overrides?: MarketCapPresetOverrides;\n}): { fee: number; tickSpacing: number; curves: MarketCapPresetConfig[] } {\n const fee = params?.fee ?? FEE_TIERS.LOW;\n const tickSpacing =\n params?.tickSpacing ?? (TICK_SPACINGS as Record<number, number>)[fee];\n\n if (tickSpacing === undefined) {\n throw new Error(\n 'tickSpacing must be provided when using a custom fee tier',\n );\n }\n\n const requestedPresets = params?.presets ?? [...MARKET_CAP_PRESET_ORDER];\n const uniquePresets: MulticurveMarketCapPreset[] = [];\n for (const preset of requestedPresets) {\n if (!(preset in MARKET_CAP_PRESETS)) {\n throw new Error(`Unsupported market cap preset: ${preset}`);\n }\n if (!uniquePresets.includes(preset)) {\n uniquePresets.push(preset);\n }\n }\n\n if (uniquePresets.length === 0) {\n throw new Error('At least one market cap preset must be provided');\n }\n\n const presetCurves = uniquePresets.map((preset) => {\n const base = MARKET_CAP_PRESETS[preset];\n const override = params?.overrides?.[preset];\n return {\n tickLower: override?.tickLower ?? base.tickLower,\n tickUpper: override?.tickUpper ?? base.tickUpper,\n numPositions: override?.numPositions ?? base.numPositions,\n shares: override?.shares ?? base.shares,\n };\n });\n\n let totalShares = presetCurves.reduce((acc, curve) => {\n if (curve.shares <= 0n) {\n throw new Error('Preset shares must be greater than zero');\n }\n return acc + curve.shares;\n }, 0n);\n\n if (totalShares > WAD) {\n throw new Error('Total preset shares cannot exceed 100% (1e18)');\n }\n\n const curves = [...presetCurves];\n\n // Add filler curve if shares don't sum to 100%\n if (totalShares < WAD) {\n const remainder = WAD - totalShares;\n const lastCurve = curves[curves.length - 1];\n let fillerTickLower = lastCurve?.tickUpper ?? 0;\n let fillerNumPositions = lastCurve?.numPositions ?? 1;\n\n if (fillerNumPositions <= 0) {\n fillerNumPositions = 1;\n }\n\n const minTickAllowed = Math.ceil(MIN_TICK / tickSpacing) * tickSpacing;\n const rawMaxTick = Math.floor(MAX_TICK / tickSpacing) * tickSpacing;\n const maxTickAllowed = rawMaxTick - tickSpacing;\n\n fillerTickLower = Math.max(fillerTickLower, minTickAllowed);\n let fillerTickUpper = fillerTickLower + fillerNumPositions * tickSpacing;\n\n if (fillerTickUpper > maxTickAllowed) {\n fillerTickUpper = maxTickAllowed;\n fillerTickLower = Math.min(fillerTickLower, maxTickAllowed - tickSpacing);\n }\n\n if (fillerTickUpper <= fillerTickLower) {\n fillerTickLower = Math.max(minTickAllowed, maxTickAllowed - tickSpacing);\n fillerTickUpper = fillerTickLower + tickSpacing;\n }\n\n curves.push({\n tickLower: fillerTickLower,\n tickUpper: fillerTickUpper,\n numPositions: fillerNumPositions,\n shares: remainder,\n });\n\n totalShares = WAD;\n }\n\n if (totalShares !== WAD) {\n throw new Error('Failed to normalize preset shares to 100%');\n }\n\n return { fee, tickSpacing, curves };\n}\n"]}
|
package/dist/constants.d.mts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Address } from 'viem';
|
|
2
|
-
|
|
3
|
-
declare const WAD: bigint;
|
|
4
|
-
declare const DEAD_ADDRESS: Address;
|
|
5
|
-
declare const ZERO_ADDRESS: Address;
|
|
6
|
-
/** Standard fee tiers recognized by both Uniswap V3 and V4 */
|
|
7
|
-
declare const FEE_TIERS: {
|
|
8
|
-
readonly LOWEST: 100;
|
|
9
|
-
readonly LOW: 500;
|
|
10
|
-
readonly MEDIUM: 3000;
|
|
11
|
-
readonly HIGH: 10000;
|
|
12
|
-
};
|
|
13
|
-
/** Valid fee tier values (100, 500, 3000, 10000) */
|
|
14
|
-
type FeeTier = (typeof FEE_TIERS)[keyof typeof FEE_TIERS];
|
|
15
|
-
/**
|
|
16
|
-
* Standard fee tiers - REQUIRED for V3 (Static Auctions).
|
|
17
|
-
* V4 pools can use custom fees but these are the recommended defaults.
|
|
18
|
-
*/
|
|
19
|
-
declare const VALID_FEE_TIERS: readonly FeeTier[];
|
|
20
|
-
/**
|
|
21
|
-
* V3 fee tiers - These are the ONLY valid fees for Uniswap V3 pools.
|
|
22
|
-
* Static Auctions use V3 and must use one of these tiers.
|
|
23
|
-
*/
|
|
24
|
-
declare const V3_FEE_TIERS: readonly FeeTier[];
|
|
25
|
-
/**
|
|
26
|
-
* Maximum LP fee for V4 pools (from DopplerHookInitializer.sol).
|
|
27
|
-
* V4 pools can use any fee from 0 to this value.
|
|
28
|
-
* @see DopplerHookInitializer.sol line 171: `uint24 constant MAX_LP_FEE = 100_000`
|
|
29
|
-
*/
|
|
30
|
-
declare const V4_MAX_FEE = 100000;
|
|
31
|
-
/**
|
|
32
|
-
* Maximum allowed start fee for decay multicurve schedules.
|
|
33
|
-
* This is intentionally higher than V4_MAX_FEE to support anti-sniping launches.
|
|
34
|
-
* 800_000 = 80%
|
|
35
|
-
*/
|
|
36
|
-
declare const DECAY_MAX_START_FEE = 800000;
|
|
37
|
-
declare const TICK_SPACINGS: {
|
|
38
|
-
readonly 100: 1;
|
|
39
|
-
readonly 500: 10;
|
|
40
|
-
readonly 3000: 60;
|
|
41
|
-
readonly 10000: 200;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Maximum tick spacing allowed by Doppler.sol for dynamic (Dutch) auctions.
|
|
45
|
-
* @see Doppler.sol line 159: `int24 constant MAX_TICK_SPACING = 30`
|
|
46
|
-
*/
|
|
47
|
-
declare const DOPPLER_MAX_TICK_SPACING = 30;
|
|
48
|
-
declare const SECONDS_PER_DAY = 86400;
|
|
49
|
-
declare const SECONDS_PER_YEAR: number;
|
|
50
|
-
declare const DEFAULT_EPOCH_LENGTH = 43200;
|
|
51
|
-
declare const DEFAULT_AUCTION_DURATION: number;
|
|
52
|
-
declare const DEFAULT_LOCK_DURATION: number;
|
|
53
|
-
declare const DEFAULT_PD_SLUGS = 5;
|
|
54
|
-
declare const DAY_SECONDS = 86400;
|
|
55
|
-
declare const DEFAULT_CREATE_GAS_LIMIT = 13500000n;
|
|
56
|
-
declare const DEFAULT_V3_START_TICK = 175000;
|
|
57
|
-
declare const DEFAULT_V3_END_TICK = 225000;
|
|
58
|
-
declare const DEFAULT_V3_NUM_POSITIONS = 15;
|
|
59
|
-
declare const DEFAULT_V3_FEE = 10000;
|
|
60
|
-
declare const DEFAULT_V3_INITIAL_VOTING_DELAY = 172800;
|
|
61
|
-
declare const DEFAULT_V3_INITIAL_VOTING_PERIOD = 1209600;
|
|
62
|
-
declare const DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD = 0n;
|
|
63
|
-
declare const DEFAULT_V3_VESTING_DURATION: bigint;
|
|
64
|
-
declare const DEFAULT_V3_INITIAL_SUPPLY: bigint;
|
|
65
|
-
declare const DEFAULT_V3_NUM_TOKENS_TO_SELL: bigint;
|
|
66
|
-
declare const DEFAULT_V3_YEARLY_MINT_RATE: bigint;
|
|
67
|
-
declare const DEFAULT_V3_PRE_MINT: bigint;
|
|
68
|
-
declare const DEFAULT_V3_MAX_SHARE_TO_BE_SOLD: bigint;
|
|
69
|
-
declare const DEFAULT_V4_INITIAL_VOTING_DELAY = 7200;
|
|
70
|
-
declare const DEFAULT_V4_INITIAL_VOTING_PERIOD = 50400;
|
|
71
|
-
declare const DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD = 0n;
|
|
72
|
-
declare const DEFAULT_V4_YEARLY_MINT_RATE: bigint;
|
|
73
|
-
declare const DEFAULT_MULTICURVE_LOWER_TICKS: readonly [-202100, -183100, -167000];
|
|
74
|
-
declare const DEFAULT_MULTICURVE_UPPER_TICKS: readonly [-188200, -172100, -156000];
|
|
75
|
-
declare const DEFAULT_MULTICURVE_NUM_POSITIONS: readonly [11, 11, 11];
|
|
76
|
-
declare const DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES: readonly [bigint, bigint, bigint];
|
|
77
|
-
declare const MIN_SQRT_RATIO = 4295128739n;
|
|
78
|
-
declare const MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342n;
|
|
79
|
-
declare const BASIS_POINTS = 10000;
|
|
80
|
-
declare const FLAG_MASK: bigint;
|
|
81
|
-
declare const DOPPLER_FLAGS: bigint;
|
|
82
|
-
declare const DYNAMIC_FEE_FLAG = 8388608;
|
|
83
|
-
declare const FEE_AMOUNT_MASK = 16777215;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Dynamic auctions (V4) support ANY fee 0-100,000 with explicit tickSpacing.
|
|
86
|
-
* This constant is kept for backwards compatibility but is no longer enforced.
|
|
87
|
-
* Standard fee tiers still auto-derive tickSpacing; custom fees require explicit tickSpacing.
|
|
88
|
-
*/
|
|
89
|
-
declare const DYNAMIC_AUCTION_VALID_FEES: readonly [100, 500, 3000, 10000];
|
|
90
|
-
|
|
91
|
-
export { BASIS_POINTS, DAY_SECONDS, DEAD_ADDRESS, DECAY_MAX_START_FEE, DEFAULT_AUCTION_DURATION, DEFAULT_CREATE_GAS_LIMIT, DEFAULT_EPOCH_LENGTH, DEFAULT_LOCK_DURATION, DEFAULT_MULTICURVE_LOWER_TICKS, DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_PD_SLUGS, DEFAULT_V3_END_TICK, DEFAULT_V3_FEE, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_SUPPLY, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V3_NUM_TOKENS_TO_SELL, DEFAULT_V3_PRE_MINT, DEFAULT_V3_START_TICK, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_YEARLY_MINT_RATE, DOPPLER_FLAGS, DOPPLER_MAX_TICK_SPACING, DYNAMIC_AUCTION_VALID_FEES, DYNAMIC_FEE_FLAG, FEE_AMOUNT_MASK, FEE_TIERS, FLAG_MASK, type FeeTier, MAX_SQRT_RATIO, MIN_SQRT_RATIO, SECONDS_PER_DAY, SECONDS_PER_YEAR, TICK_SPACINGS, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, WAD, ZERO_ADDRESS };
|