@paraswap/dex-lib 4.1.9 → 4.1.10-ekubo
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/build/abi/AaveV1_lending_pool.json +27 -0
- package/build/abi/Aave_GSM.json +751 -0
- package/build/abi/Balancer.json +257 -0
- package/build/abi/BalancerV2.json +1179 -0
- package/build/abi/RamsesV2Pool.abi.json +1554 -0
- package/build/abi/RamsesV2Quoter.abi.json +274 -0
- package/build/abi/USDM.json +807 -0
- package/build/abi/UniswapV2Router.json +397 -0
- package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
- package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
- package/build/abi/curve-v1/CurveBUSDv2.abi.json +1356 -0
- package/build/abi/curve-v1/CurveTokenV1.json +305 -0
- package/build/abi/curve-v1/CurveTokenV2.json +318 -0
- package/build/abi/curve-v1/CurveV1StableNg.json +1452 -0
- package/build/abi/curve-v1/CurveV2Swap.json +700 -0
- package/build/abi/curve-v1/FactoryCryptoRegistry.json +316 -0
- package/build/abi/curve-v1/FactoryRegistry.json +508 -0
- package/build/abi/curve-v1/StableSwapAave.json +1152 -0
- package/build/abi/curve-v1/StableSwapBUSD.json +814 -0
- package/build/abi/curve-v1/StableSwapCompound.json +814 -0
- package/build/abi/curve-v1/StableSwapIDLE.json +1253 -0
- package/build/abi/curve-v1/StableSwapPax.json +865 -0
- package/build/abi/curve-v1/StableSwapSnow.json +900 -0
- package/build/abi/curve-v1/StableSwapUSDN.json +1004 -0
- package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
- package/build/abi/curve-v1/StableSwapY.json +814 -0
- package/build/abi/ekubo/core.json +1266 -0
- package/build/abi/ekubo/data-fetcher.json +161 -0
- package/build/abi/ekubo/router.json +803 -0
- package/build/abi/inception/inception-ineth-pool.json +1062 -0
- package/build/abi/inception/inception-ineth.json +609 -0
- package/build/abi/inception/inception-ratio-feed.json +329 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/kyberdmm/kyber-storage.abi.json +824 -0
- package/build/abi/kyberdmm.abi.json +1148 -0
- package/build/abi/maverick-v2/MaverickV2Quoter.json +278 -0
- package/build/abi/nerve/nerve-metapool.json +790 -0
- package/build/abi/platypus/asset.json +490 -0
- package/build/abi/platypus/avax-pool.json +820 -0
- package/build/abi/platypus/oracle.json +119 -0
- package/build/abi/platypus/pool.json +677 -0
- package/build/abi/smardex/all/smardex-router.json +648 -0
- package/build/abi/smardex/layer-1/smardex-factory.json +242 -0
- package/build/abi/smardex/layer-1/smardex-pool.json +506 -0
- package/build/abi/smardex/layer-2/smardex-factory.json +185 -0
- package/build/abi/smardex/layer-2/smardex-pool.json +578 -0
- package/build/abi/swaap-v1/pool.json +1346 -0
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
- package/build/dex/aave-v1/aave-v1.d.ts +34 -0
- package/build/dex/aave-v1/aave-v1.js +180 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -0
- package/build/dex/aave-v1/config.d.ts +11 -0
- package/build/dex/aave-v1/config.js +20 -0
- package/build/dex/aave-v1/config.js.map +1 -0
- package/build/dex/aave-v1/tokens-mainnet.json +134 -0
- package/build/dex/aave-v1/tokens.d.ts +3 -0
- package/build/dex/aave-v1/tokens.js +50 -0
- package/build/dex/aave-v1/tokens.js.map +1 -0
- package/build/dex/aave-v1/types.d.ts +12 -0
- package/build/dex/aave-v1/types.js +3 -0
- package/build/dex/aave-v1/types.js.map +1 -0
- package/build/dex/aave-v3-stata/config.js +8 -8
- package/build/dex/aave-v3-stata/config.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js +2 -2
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/config.js +31 -24
- package/build/dex/aave-v3-stata-v2/config.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/types.d.ts +3 -2
- package/build/dex/aave-v3-stata-v2/types.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/utils.d.ts +2 -2
- package/build/dex/aave-v3-stata-v2/utils.js +7 -6
- package/build/dex/aave-v3-stata-v2/utils.js.map +1 -1
- package/build/dex/balancer-v1/balancer-pools.json +33333 -0
- package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
- package/build/dex/bebop/websocket-fetcher.js +87 -0
- package/build/dex/bebop/websocket-fetcher.js.map +1 -0
- package/build/dex/ekubo/config.d.ts +3 -0
- package/build/dex/ekubo/config.js +16 -0
- package/build/dex/ekubo/config.js.map +1 -0
- package/build/dex/ekubo/ekubo.d.ts +49 -0
- package/build/dex/ekubo/ekubo.js +419 -0
- package/build/dex/ekubo/ekubo.js.map +1 -0
- package/build/dex/ekubo/pools/base-pool.d.ts +47 -0
- package/build/dex/ekubo/pools/base-pool.js +184 -0
- package/build/dex/ekubo/pools/base-pool.js.map +1 -0
- package/build/dex/ekubo/pools/math/constants.d.ts +3 -0
- package/build/dex/ekubo/pools/math/constants.js +7 -0
- package/build/dex/ekubo/pools/math/constants.js.map +1 -0
- package/build/dex/ekubo/pools/math/delta.d.ts +2 -0
- package/build/dex/ekubo/pools/math/delta.js +51 -0
- package/build/dex/ekubo/pools/math/delta.js.map +1 -0
- package/build/dex/ekubo/pools/math/price.d.ts +7 -0
- package/build/dex/ekubo/pools/math/price.js +116 -0
- package/build/dex/ekubo/pools/math/price.js.map +1 -0
- package/build/dex/ekubo/pools/math/swap.d.ts +18 -0
- package/build/dex/ekubo/pools/math/swap.js +128 -0
- package/build/dex/ekubo/pools/math/swap.js.map +1 -0
- package/build/dex/ekubo/pools/math/tick.d.ts +7 -0
- package/build/dex/ekubo/pools/math/tick.js +112 -0
- package/build/dex/ekubo/pools/math/tick.js.map +1 -0
- package/build/dex/ekubo/pools/oracle-pool.d.ts +10 -0
- package/build/dex/ekubo/pools/oracle-pool.js +19 -0
- package/build/dex/ekubo/pools/oracle-pool.js.map +1 -0
- package/build/dex/ekubo/types.d.ts +88 -0
- package/build/dex/ekubo/types.js +238 -0
- package/build/dex/ekubo/types.js.map +1 -0
- package/build/dex/ekubo/utils.d.ts +6 -0
- package/build/dex/ekubo/utils.js +30 -0
- package/build/dex/ekubo/utils.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/inception/config.d.ts +4 -0
- package/build/dex/inception/config.js +109 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +16 -0
- package/build/dex/inception/inception-event-pool.js +51 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/inception/inception-native.d.ts +43 -0
- package/build/dex/inception/inception-native.js +131 -0
- package/build/dex/inception/inception-native.js.map +1 -0
- package/build/dex/inception/inception-pool.d.ts +18 -0
- package/build/dex/inception/inception-pool.js +32 -0
- package/build/dex/inception/inception-pool.js.map +1 -0
- package/build/dex/inception/inception-price-feed.d.ts +19 -0
- package/build/dex/inception/inception-price-feed.js +51 -0
- package/build/dex/inception/inception-price-feed.js.map +1 -0
- package/build/dex/inception/inception.d.ts +43 -0
- package/build/dex/inception/inception.js +204 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/inception/types.js +3 -0
- package/build/dex/inception/types.js.map +1 -0
- package/build/dex/inception/utils.d.ts +6 -0
- package/build/dex/inception/utils.js +37 -0
- package/build/dex/inception/utils.js.map +1 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/platypus/asset.d.ts +14 -0
- package/build/dex/platypus/asset.js +97 -0
- package/build/dex/platypus/asset.js.map +1 -0
- package/build/dex/platypus/config.d.ts +11 -0
- package/build/dex/platypus/config.js +69 -0
- package/build/dex/platypus/config.js.map +1 -0
- package/build/dex/platypus/platypus.d.ts +63 -0
- package/build/dex/platypus/platypus.js +473 -0
- package/build/dex/platypus/platypus.js.map +1 -0
- package/build/dex/platypus/pool-avax.d.ts +8 -0
- package/build/dex/platypus/pool-avax.js +54 -0
- package/build/dex/platypus/pool-avax.js.map +1 -0
- package/build/dex/platypus/pool-base.d.ts +19 -0
- package/build/dex/platypus/pool-base.js +86 -0
- package/build/dex/platypus/pool-base.js.map +1 -0
- package/build/dex/platypus/pool-pure.d.ts +8 -0
- package/build/dex/platypus/pool-pure.js +37 -0
- package/build/dex/platypus/pool-pure.js.map +1 -0
- package/build/dex/platypus/pool-subscriber.d.ts +14 -0
- package/build/dex/platypus/pool-subscriber.js +167 -0
- package/build/dex/platypus/pool-subscriber.js.map +1 -0
- package/build/dex/platypus/pool.d.ts +8 -0
- package/build/dex/platypus/pool.js +58 -0
- package/build/dex/platypus/pool.js.map +1 -0
- package/build/dex/platypus/types.d.ts +92 -0
- package/build/dex/platypus/types.js +10 -0
- package/build/dex/platypus/types.js.map +1 -0
- package/build/dex/quickswap/spiritswap-v3.d.ts +6 -0
- package/build/dex/quickswap/spiritswap-v3.js +19 -0
- package/build/dex/quickswap/spiritswap-v3.js.map +1 -0
- package/build/dex/smardex/config.d.ts +4 -0
- package/build/dex/smardex/config.js +64 -0
- package/build/dex/smardex/config.js.map +1 -0
- package/build/dex/smardex/constants.d.ts +18 -0
- package/build/dex/smardex/constants.js +33 -0
- package/build/dex/smardex/constants.js.map +1 -0
- package/build/dex/smardex/sdk/constants.d.ts +6 -0
- package/build/dex/smardex/sdk/constants.js +13 -0
- package/build/dex/smardex/sdk/constants.js.map +1 -0
- package/build/dex/smardex/sdk/core.d.ts +113 -0
- package/build/dex/smardex/sdk/core.js +499 -0
- package/build/dex/smardex/sdk/core.js.map +1 -0
- package/build/dex/smardex/sdk/errors.d.ts +15 -0
- package/build/dex/smardex/sdk/errors.js +22 -0
- package/build/dex/smardex/sdk/errors.js.map +1 -0
- package/build/dex/smardex/sdk/types.d.ts +62 -0
- package/build/dex/smardex/sdk/types.js +3 -0
- package/build/dex/smardex/sdk/types.js.map +1 -0
- package/build/dex/smardex/sdk/utils.d.ts +44 -0
- package/build/dex/smardex/sdk/utils.js +133 -0
- package/build/dex/smardex/sdk/utils.js.map +1 -0
- package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
- package/build/dex/smardex/smardex-event-pool.js +119 -0
- package/build/dex/smardex/smardex-event-pool.js.map +1 -0
- package/build/dex/smardex/smardex.d.ts +65 -0
- package/build/dex/smardex/smardex.js +519 -0
- package/build/dex/smardex/smardex.js.map +1 -0
- package/build/dex/smardex/types.d.ts +55 -0
- package/build/dex/smardex/types.js +3 -0
- package/build/dex/smardex/types.js.map +1 -0
- package/build/dex/solidly/forks-override/cone.d.ts +22 -0
- package/build/dex/solidly/forks-override/cone.js +53 -0
- package/build/dex/solidly/forks-override/cone.js.map +1 -0
- package/build/dex/solidly/forks-override/solisnek.d.ts +8 -0
- package/build/dex/solidly/forks-override/solisnek.js +15 -0
- package/build/dex/solidly/forks-override/solisnek.js.map +1 -0
- package/build/dex/swaap-v1/config.d.ts +17 -0
- package/build/dex/swaap-v1/config.js +56 -0
- package/build/dex/swaap-v1/config.js.map +1 -0
- package/build/dex/swaap-v1/constants.d.ts +6 -0
- package/build/dex/swaap-v1/constants.js +17 -0
- package/build/dex/swaap-v1/constants.js.map +1 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +25 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +62 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Const.d.ts +18 -0
- package/build/dex/swaap-v1/libraries/Const.js +26 -0
- package/build/dex/swaap-v1/libraries/Const.js.map +1 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +77 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +316 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +1 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +75 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.js +418 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +1 -0
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +185 -0
- package/build/dex/swaap-v1/libraries/MathMMM.js +453 -0
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Num.d.ts +31 -0
- package/build/dex/swaap-v1/libraries/Num.js +167 -0
- package/build/dex/swaap-v1/libraries/Num.js.map +1 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +23 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +131 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Struct.d.ts +56 -0
- package/build/dex/swaap-v1/libraries/Struct.js +3 -0
- package/build/dex/swaap-v1/libraries/Struct.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +45 -0
- package/build/dex/swaap-v1/swaap-v1-pool.js +656 -0
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +62 -0
- package/build/dex/swaap-v1/swaap-v1.js +379 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -0
- package/build/dex/swaap-v1/types.d.ts +106 -0
- package/build/dex/swaap-v1/types.js +9 -0
- package/build/dex/swaap-v1/types.js.map +1 -0
- package/build/dex/zerox/index.d.ts +1 -1
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.js +3 -0
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
- package/package.json +2 -2
- package/src/abi/ekubo/core.json +1266 -0
- package/src/abi/ekubo/data-fetcher.json +161 -0
- package/src/abi/ekubo/router.json +803 -0
- package/src/dex/aave-v3-stata/config.ts +8 -8
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts +5 -5
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts +2 -2
- package/src/dex/aave-v3-stata-v2/config.ts +31 -24
- package/src/dex/aave-v3-stata-v2/types.ts +3 -2
- package/src/dex/aave-v3-stata-v2/utils.ts +18 -10
- package/src/dex/ekubo/config.ts +15 -0
- package/src/dex/ekubo/ekubo-e2e.test.ts +124 -0
- package/src/dex/ekubo/ekubo-events.test.ts +209 -0
- package/src/dex/ekubo/ekubo-integration.test.ts +243 -0
- package/src/dex/ekubo/ekubo.ts +657 -0
- package/src/dex/ekubo/pools/base-pool.ts +267 -0
- package/src/dex/ekubo/pools/math/constants.ts +5 -0
- package/src/dex/ekubo/pools/math/delta.test.ts +131 -0
- package/src/dex/ekubo/pools/math/delta.ts +68 -0
- package/src/dex/ekubo/pools/math/price.test.ts +54 -0
- package/src/dex/ekubo/pools/math/price.ts +129 -0
- package/src/dex/ekubo/pools/math/swap.test.ts +215 -0
- package/src/dex/ekubo/pools/math/swap.ts +161 -0
- package/src/dex/ekubo/pools/math/tick.test.ts +72 -0
- package/src/dex/ekubo/pools/math/tick.ts +120 -0
- package/src/dex/ekubo/pools/oracle-pool.ts +46 -0
- package/src/dex/ekubo/types.test.ts +552 -0
- package/src/dex/ekubo/types.ts +408 -0
- package/src/dex/ekubo/utils.ts +34 -0
- package/src/dex/index.ts +2 -0
- package/src/dex-helper/dummy-dex-helper.ts +10 -0
- package/tests/constants-e2e.ts +15 -0
- package/tests/utils-e2e.ts +0 -1
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -12
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/scripts/get-uniswap-v3-dexes.ts +0 -64
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import {
|
|
3
|
+
defaultAbiCoder,
|
|
4
|
+
hexlify,
|
|
5
|
+
hexZeroPad,
|
|
6
|
+
keccak256,
|
|
7
|
+
} from 'ethers/lib/utils';
|
|
8
|
+
import _ from 'lodash';
|
|
9
|
+
import { DeepReadonly, DeepWritable } from 'ts-essentials';
|
|
10
|
+
import { hexStringTokenPair } from './utils';
|
|
11
|
+
import { floatSqrtRatioToFixed } from './pools/math/price';
|
|
12
|
+
import {
|
|
13
|
+
MAX_TICK,
|
|
14
|
+
MIN_SQRT_RATIO,
|
|
15
|
+
MIN_TICK,
|
|
16
|
+
toSqrtRatio,
|
|
17
|
+
} from './pools/math/tick';
|
|
18
|
+
import { amount0Delta, amount1Delta } from './pools/math/delta';
|
|
19
|
+
|
|
20
|
+
export type Pool = {
|
|
21
|
+
key: PoolKey;
|
|
22
|
+
activeTick: number;
|
|
23
|
+
liquidity: bigint;
|
|
24
|
+
sqrtRatio: bigint;
|
|
25
|
+
ticks: bigint[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface Tick {
|
|
29
|
+
readonly number: number;
|
|
30
|
+
liquidityDelta: bigint;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns the index in the sorted tick array that has the greatest value of tick that is not greater than the given tick
|
|
35
|
+
* @param sortedTicks the sorted list of ticks to search in
|
|
36
|
+
* @param tick the tick to search for
|
|
37
|
+
*/
|
|
38
|
+
export function findNearestInitializedTickIndex(
|
|
39
|
+
sortedTicks: Tick[],
|
|
40
|
+
tick: number,
|
|
41
|
+
): number | null {
|
|
42
|
+
let l = 0,
|
|
43
|
+
r = sortedTicks.length;
|
|
44
|
+
|
|
45
|
+
while (l < r) {
|
|
46
|
+
const mid = Math.floor((l + r) / 2);
|
|
47
|
+
const midTick = sortedTicks[mid].number;
|
|
48
|
+
if (midTick <= tick) {
|
|
49
|
+
// if it's the last index, or the next tick is greater, we've found our index
|
|
50
|
+
if (
|
|
51
|
+
mid === sortedTicks.length - 1 ||
|
|
52
|
+
sortedTicks[mid + 1].number > tick
|
|
53
|
+
) {
|
|
54
|
+
return mid;
|
|
55
|
+
} else {
|
|
56
|
+
// otherwise our value is to the right of this one
|
|
57
|
+
l = mid;
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
// the mid tick is greater than the one we want, so we know it's not mid
|
|
61
|
+
r = mid;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type QuoteData = {
|
|
69
|
+
tick: number;
|
|
70
|
+
sqrtRatio: BigNumber;
|
|
71
|
+
liquidity: BigNumber;
|
|
72
|
+
minTick: number;
|
|
73
|
+
maxTick: number;
|
|
74
|
+
ticks: {
|
|
75
|
+
number: number;
|
|
76
|
+
liquidityDelta: BigNumber;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type GetQuoteDataResponse = QuoteData[];
|
|
81
|
+
|
|
82
|
+
export namespace PoolState {
|
|
83
|
+
// Needs to be serializiable, therefore can't make it a class
|
|
84
|
+
export type Object = {
|
|
85
|
+
sqrtRatio: bigint;
|
|
86
|
+
liquidity: bigint;
|
|
87
|
+
activeTick: number;
|
|
88
|
+
readonly sortedTicks: Tick[];
|
|
89
|
+
activeTickIndex: number | null;
|
|
90
|
+
readonly checkedTicksBounds: readonly [number, number];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export function fromQuoter(data: QuoteData, isFullRange: boolean): Object {
|
|
94
|
+
const sortedTicks = data.ticks.map(({ number, liquidityDelta }) => ({
|
|
95
|
+
number,
|
|
96
|
+
liquidityDelta: liquidityDelta.toBigInt(),
|
|
97
|
+
}));
|
|
98
|
+
const liquidity = data.liquidity.toBigInt();
|
|
99
|
+
|
|
100
|
+
const sqrtRatioFloat = data.sqrtRatio.toBigInt();
|
|
101
|
+
|
|
102
|
+
const checkedTicksBounds: [number, number] = isFullRange
|
|
103
|
+
? [MIN_TICK, MAX_TICK]
|
|
104
|
+
: [data.minTick, data.maxTick];
|
|
105
|
+
|
|
106
|
+
const state: Object = {
|
|
107
|
+
sqrtRatio:
|
|
108
|
+
sqrtRatioFloat === 0n
|
|
109
|
+
? 2n ** 128n
|
|
110
|
+
: floatSqrtRatioToFixed(sqrtRatioFloat),
|
|
111
|
+
liquidity,
|
|
112
|
+
activeTick: data.tick,
|
|
113
|
+
sortedTicks,
|
|
114
|
+
activeTickIndex: null, // This will be filled in
|
|
115
|
+
checkedTicksBounds,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
addLiquidityCutoffs(state);
|
|
119
|
+
|
|
120
|
+
return state;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function fromSwappedEvent(
|
|
124
|
+
oldState: DeepReadonly<Object>,
|
|
125
|
+
sqrtRatioAfter: bigint,
|
|
126
|
+
liquidityAfter: bigint,
|
|
127
|
+
tickAfter: number,
|
|
128
|
+
): Object {
|
|
129
|
+
const sortedTicks = oldState.sortedTicks;
|
|
130
|
+
|
|
131
|
+
const clonedTicks = _.cloneDeep(sortedTicks) as DeepWritable<
|
|
132
|
+
typeof sortedTicks
|
|
133
|
+
>;
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
sqrtRatio: sqrtRatioAfter,
|
|
137
|
+
liquidity: liquidityAfter,
|
|
138
|
+
activeTick: tickAfter,
|
|
139
|
+
sortedTicks: clonedTicks,
|
|
140
|
+
activeTickIndex: findNearestInitializedTickIndex(clonedTicks, tickAfter),
|
|
141
|
+
checkedTicksBounds: oldState.checkedTicksBounds,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function fromPositionUpdatedEvent(
|
|
146
|
+
oldState: DeepReadonly<Object>,
|
|
147
|
+
[lowTick, highTick]: [number, number],
|
|
148
|
+
liquidityDelta: bigint,
|
|
149
|
+
): Object | null {
|
|
150
|
+
if (liquidityDelta === 0n) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const clonedState = _.cloneDeep(oldState) as DeepWritable<typeof oldState>;
|
|
155
|
+
|
|
156
|
+
updateTick(clonedState, lowTick, liquidityDelta, false, false);
|
|
157
|
+
updateTick(clonedState, highTick, liquidityDelta, true, false);
|
|
158
|
+
|
|
159
|
+
if (
|
|
160
|
+
clonedState.activeTick >= lowTick &&
|
|
161
|
+
clonedState.activeTick < highTick
|
|
162
|
+
) {
|
|
163
|
+
clonedState.liquidity += liquidityDelta;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return clonedState;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function addLiquidityCutoffs(state: PoolState.Object) {
|
|
170
|
+
const { sortedTicks, liquidity, activeTick } = state;
|
|
171
|
+
|
|
172
|
+
let activeTickIndex = undefined;
|
|
173
|
+
let currentLiquidity = 0n;
|
|
174
|
+
|
|
175
|
+
// The liquidity added/removed by out-of-range initialized ticks (i.e. lower than minCheckedTickNumber)
|
|
176
|
+
let liquidityDeltaMin = 0n;
|
|
177
|
+
|
|
178
|
+
for (let i = 0; i < sortedTicks.length; i++) {
|
|
179
|
+
const tick = sortedTicks[i];
|
|
180
|
+
|
|
181
|
+
if (typeof activeTickIndex === 'undefined' && activeTick < tick.number) {
|
|
182
|
+
activeTickIndex = i === 0 ? null : i - 1;
|
|
183
|
+
|
|
184
|
+
liquidityDeltaMin = liquidity - currentLiquidity;
|
|
185
|
+
|
|
186
|
+
// We now need to switch to tracking the liquidity that needs to be cut off at maxCheckedTickNumber, therefore reset to the actual liquidity
|
|
187
|
+
currentLiquidity = liquidity;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
currentLiquidity += tick.liquidityDelta;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (typeof activeTickIndex === 'undefined') {
|
|
194
|
+
activeTickIndex = sortedTicks.length > 0 ? sortedTicks.length - 1 : null;
|
|
195
|
+
liquidityDeltaMin = liquidity - currentLiquidity;
|
|
196
|
+
currentLiquidity = liquidity;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
state.activeTickIndex = activeTickIndex;
|
|
200
|
+
|
|
201
|
+
PoolState.updateTick(
|
|
202
|
+
state,
|
|
203
|
+
state.checkedTicksBounds[0],
|
|
204
|
+
liquidityDeltaMin,
|
|
205
|
+
false,
|
|
206
|
+
true,
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
PoolState.updateTick(
|
|
210
|
+
state,
|
|
211
|
+
state.checkedTicksBounds[1],
|
|
212
|
+
currentLiquidity,
|
|
213
|
+
true,
|
|
214
|
+
true,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function updateTick(
|
|
219
|
+
state: Object,
|
|
220
|
+
updatedTickNumber: number,
|
|
221
|
+
liquidityDelta: bigint,
|
|
222
|
+
upper: boolean,
|
|
223
|
+
forceInsert: boolean,
|
|
224
|
+
) {
|
|
225
|
+
const sortedTicks = state.sortedTicks;
|
|
226
|
+
|
|
227
|
+
if (upper) {
|
|
228
|
+
liquidityDelta = -liquidityDelta;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const nearestTickIndex = findNearestInitializedTickIndex(
|
|
232
|
+
sortedTicks,
|
|
233
|
+
updatedTickNumber,
|
|
234
|
+
);
|
|
235
|
+
const nearestTick =
|
|
236
|
+
nearestTickIndex === null ? null : sortedTicks[nearestTickIndex];
|
|
237
|
+
const nearestTickNumber = nearestTick?.number;
|
|
238
|
+
const newTickReferenced = nearestTickNumber !== updatedTickNumber;
|
|
239
|
+
|
|
240
|
+
if (newTickReferenced) {
|
|
241
|
+
if (!forceInsert && nearestTickIndex === null) {
|
|
242
|
+
sortedTicks[0].liquidityDelta += liquidityDelta;
|
|
243
|
+
} else if (!forceInsert && nearestTickIndex === sortedTicks.length - 1) {
|
|
244
|
+
sortedTicks[sortedTicks.length - 1].liquidityDelta += liquidityDelta;
|
|
245
|
+
} else {
|
|
246
|
+
sortedTicks.splice(
|
|
247
|
+
nearestTickIndex === null ? 0 : nearestTickIndex + 1,
|
|
248
|
+
0,
|
|
249
|
+
{
|
|
250
|
+
number: updatedTickNumber,
|
|
251
|
+
liquidityDelta,
|
|
252
|
+
},
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
if (state.activeTick >= updatedTickNumber) {
|
|
256
|
+
state.activeTickIndex =
|
|
257
|
+
state.activeTickIndex === null ? 0 : state.activeTickIndex + 1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
const newDelta = nearestTick!.liquidityDelta + liquidityDelta;
|
|
262
|
+
|
|
263
|
+
if (
|
|
264
|
+
newDelta === 0n &&
|
|
265
|
+
!state.checkedTicksBounds.includes(nearestTickNumber)
|
|
266
|
+
) {
|
|
267
|
+
sortedTicks.splice(nearestTickIndex!, 1);
|
|
268
|
+
|
|
269
|
+
if (state.activeTick >= updatedTickNumber) {
|
|
270
|
+
state.activeTickIndex!--;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
nearestTick!.liquidityDelta = newDelta;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function computeTvl(state: DeepReadonly<Object>): [bigint, bigint] {
|
|
279
|
+
const stateSqrtRatio = state.sqrtRatio;
|
|
280
|
+
|
|
281
|
+
let [tvl0, tvl1] = [0n, 0n];
|
|
282
|
+
let liquidity = 0n;
|
|
283
|
+
let sqrtRatio = MIN_SQRT_RATIO;
|
|
284
|
+
|
|
285
|
+
for (const tick of state.sortedTicks) {
|
|
286
|
+
const tickSqrtRatio = toSqrtRatio(tick.number);
|
|
287
|
+
|
|
288
|
+
const minAmount1SqrtRatio =
|
|
289
|
+
stateSqrtRatio > tickSqrtRatio ? tickSqrtRatio : stateSqrtRatio;
|
|
290
|
+
const maxAmount0SqrtRatio =
|
|
291
|
+
stateSqrtRatio > sqrtRatio ? stateSqrtRatio : sqrtRatio;
|
|
292
|
+
|
|
293
|
+
if (sqrtRatio < minAmount1SqrtRatio) {
|
|
294
|
+
tvl1 += amount1Delta(sqrtRatio, minAmount1SqrtRatio, liquidity, false);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (maxAmount0SqrtRatio < tickSqrtRatio) {
|
|
298
|
+
tvl0 += amount0Delta(
|
|
299
|
+
maxAmount0SqrtRatio,
|
|
300
|
+
tickSqrtRatio,
|
|
301
|
+
liquidity,
|
|
302
|
+
false,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
sqrtRatio = tickSqrtRatio;
|
|
307
|
+
liquidity += tick.liquidityDelta;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return [tvl0, tvl1];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export type EkuboData = {
|
|
315
|
+
poolKeyAbi: AbiPoolKey;
|
|
316
|
+
isToken1: boolean;
|
|
317
|
+
skipAhead: Record<string, number>;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export type DexParams = {
|
|
321
|
+
apiUrl: string;
|
|
322
|
+
core: string;
|
|
323
|
+
oracle: string;
|
|
324
|
+
dataFetcher: string;
|
|
325
|
+
router: string;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export class PoolKey {
|
|
329
|
+
private _string_id?: string;
|
|
330
|
+
private _num_id?: bigint;
|
|
331
|
+
|
|
332
|
+
public constructor(
|
|
333
|
+
public readonly token0: bigint,
|
|
334
|
+
public readonly token1: bigint,
|
|
335
|
+
public readonly config: PoolConfig,
|
|
336
|
+
) {}
|
|
337
|
+
|
|
338
|
+
public get string_id(): string {
|
|
339
|
+
this._string_id ??= `${hexStringTokenPair(this.token0, this.token1)}_${
|
|
340
|
+
this.config.fee
|
|
341
|
+
}_${this.config.tickSpacing}_${hexZeroPad(
|
|
342
|
+
hexlify(this.config.extension),
|
|
343
|
+
20,
|
|
344
|
+
)}`;
|
|
345
|
+
|
|
346
|
+
return this._string_id;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
public get num_id(): bigint {
|
|
350
|
+
this._num_id ??= BigInt(
|
|
351
|
+
keccak256(
|
|
352
|
+
defaultAbiCoder.encode(
|
|
353
|
+
['address', 'address', 'bytes32'],
|
|
354
|
+
[
|
|
355
|
+
hexZeroPad(hexlify(this.token0), 20),
|
|
356
|
+
hexZeroPad(hexlify(this.token1), 20),
|
|
357
|
+
hexZeroPad(hexlify(this.config.compressed), 32),
|
|
358
|
+
],
|
|
359
|
+
),
|
|
360
|
+
),
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
return this._num_id;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
public toAbi(): AbiPoolKey {
|
|
367
|
+
return {
|
|
368
|
+
token0: hexZeroPad(hexlify(this.token0), 20),
|
|
369
|
+
token1: hexZeroPad(hexlify(this.token1), 20),
|
|
370
|
+
config: hexZeroPad(hexlify(this.config.compressed), 32),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export class PoolConfig {
|
|
376
|
+
public constructor(
|
|
377
|
+
public readonly tickSpacing: number,
|
|
378
|
+
public readonly fee: bigint,
|
|
379
|
+
public readonly extension: bigint,
|
|
380
|
+
private _compressed?: bigint,
|
|
381
|
+
) {}
|
|
382
|
+
|
|
383
|
+
public get compressed(): bigint {
|
|
384
|
+
this._compressed ??=
|
|
385
|
+
BigInt(this.tickSpacing) + (this.fee << 32n) + (this.extension << 96n);
|
|
386
|
+
return this._compressed;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
public static fromCompressed(compressed: bigint) {
|
|
390
|
+
return new this(
|
|
391
|
+
Number(compressed % 2n ** 32n),
|
|
392
|
+
(compressed >> 32n) % 2n ** 64n,
|
|
393
|
+
compressed >> 96n,
|
|
394
|
+
compressed,
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export type AbiPoolKey = {
|
|
400
|
+
token0: string;
|
|
401
|
+
token1: string;
|
|
402
|
+
config: string;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export type VanillaPoolParameters = {
|
|
406
|
+
fee: bigint;
|
|
407
|
+
tickSpacing: number;
|
|
408
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { hexlify, hexZeroPad } from 'ethers/lib/utils';
|
|
2
|
+
import { Token } from '../../types';
|
|
3
|
+
import { isETHAddress } from '../../utils';
|
|
4
|
+
import { ETHER_ADDRESS } from '../../constants';
|
|
5
|
+
|
|
6
|
+
export const NATIVE_TOKEN_ADDRESS = 0x0000000000000000000000000000000000000000n;
|
|
7
|
+
|
|
8
|
+
export function convertParaSwapToEkubo(address: string): bigint {
|
|
9
|
+
return isETHAddress(address) ? NATIVE_TOKEN_ADDRESS : BigInt(address);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function convertEkuboToParaSwap(address: bigint): string {
|
|
13
|
+
return address === NATIVE_TOKEN_ADDRESS
|
|
14
|
+
? ETHER_ADDRESS
|
|
15
|
+
: hexZeroPad(hexlify(address), 20);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function sortAndConvertTokens(
|
|
19
|
+
tokenA: Token,
|
|
20
|
+
tokenB: Token,
|
|
21
|
+
): [bigint, bigint] {
|
|
22
|
+
const [a, b] = [
|
|
23
|
+
convertParaSwapToEkubo(tokenA.address),
|
|
24
|
+
convertParaSwapToEkubo(tokenB.address),
|
|
25
|
+
];
|
|
26
|
+
return a > b ? [b, a] : [a, b];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function hexStringTokenPair(token0: bigint, token1: bigint): string {
|
|
30
|
+
return `${hexZeroPad(hexlify(token0), 20)}/${hexZeroPad(
|
|
31
|
+
hexlify(token1),
|
|
32
|
+
20,
|
|
33
|
+
)}`;
|
|
34
|
+
}
|
package/src/dex/index.ts
CHANGED
|
@@ -104,6 +104,7 @@ import { UsualMUsd0 } from './usual/usual-m-usd0';
|
|
|
104
104
|
import { MWrappedM } from './usual/m-wrapped-m';
|
|
105
105
|
import { WrappedMM } from './usual/wrapped-m-m';
|
|
106
106
|
import { UsualPP } from './usual-pp/usual-pp';
|
|
107
|
+
import { Ekubo } from './ekubo/ekubo';
|
|
107
108
|
|
|
108
109
|
const LegacyDexes = [
|
|
109
110
|
CurveV2,
|
|
@@ -202,6 +203,7 @@ const Dexes = [
|
|
|
202
203
|
WrappedMM,
|
|
203
204
|
UsualMUsd0,
|
|
204
205
|
UsualPP,
|
|
206
|
+
Ekubo,
|
|
205
207
|
];
|
|
206
208
|
|
|
207
209
|
export type LegacyDexConstructor = new (dexHelper: IDexHelper) => IDexTxBuilder<
|
|
@@ -329,6 +329,7 @@ export class DummyDexHelper implements IDexHelper {
|
|
|
329
329
|
rpcUrl ? rpcUrl : this.config.data.privateHttpProvider,
|
|
330
330
|
network,
|
|
331
331
|
);
|
|
332
|
+
|
|
332
333
|
this.web3Provider = new Web3(
|
|
333
334
|
rpcUrl ? rpcUrl : this.config.data.privateHttpProvider,
|
|
334
335
|
);
|
|
@@ -365,5 +366,14 @@ export class DummyDexHelper implements IDexHelper {
|
|
|
365
366
|
|
|
366
367
|
replaceProviderWithRPC(rpcUrl: string) {
|
|
367
368
|
this.provider = new StaticJsonRpcProvider(rpcUrl, this.config.data.network);
|
|
369
|
+
this.web3Provider = new Web3(rpcUrl);
|
|
370
|
+
this.multiContract = new this.web3Provider.eth.Contract(
|
|
371
|
+
multiABIV2 as any,
|
|
372
|
+
this.config.data.multicallV2Address,
|
|
373
|
+
);
|
|
374
|
+
this.multiWrapper = new MultiWrapper(
|
|
375
|
+
this.multiContract,
|
|
376
|
+
this.getLogger(`MultiWrapper-${this.config.data.network}`),
|
|
377
|
+
);
|
|
368
378
|
}
|
|
369
379
|
}
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -88,6 +88,10 @@ export const Tokens: {
|
|
|
88
88
|
address: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
|
|
89
89
|
decimals: 18,
|
|
90
90
|
},
|
|
91
|
+
EKUBO: {
|
|
92
|
+
address: '0x04C46E830Bb56ce22735d5d8Fc9CB90309317d0f',
|
|
93
|
+
decimals: 18,
|
|
94
|
+
},
|
|
91
95
|
ETH: {
|
|
92
96
|
address: ETHER_ADDRESS,
|
|
93
97
|
decimals: 18,
|
|
@@ -1411,6 +1415,14 @@ export const Tokens: {
|
|
|
1411
1415
|
address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
|
|
1412
1416
|
decimals: 6,
|
|
1413
1417
|
},
|
|
1418
|
+
stataUSDC: {
|
|
1419
|
+
address: '0x41B334E9F2C0ED1f30fD7c351874a6071C53a78E',
|
|
1420
|
+
decimals: 6,
|
|
1421
|
+
},
|
|
1422
|
+
aOptUSDCn: {
|
|
1423
|
+
address: '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5',
|
|
1424
|
+
decimals: 6,
|
|
1425
|
+
},
|
|
1414
1426
|
USDT: {
|
|
1415
1427
|
address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
1416
1428
|
decimals: 6,
|
|
@@ -1900,6 +1912,7 @@ export const Holders: {
|
|
|
1900
1912
|
USDL: '0xAb96AA0ee764924f49fbB372f3B4db9c2cB24Ea2',
|
|
1901
1913
|
wUSDL: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb',
|
|
1902
1914
|
UsualM: '0xE3f7A0c4a44b740328157A5152A85c3bCB54DA09',
|
|
1915
|
+
EKUBO: '0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb',
|
|
1903
1916
|
},
|
|
1904
1917
|
[Network.POLYGON]: {
|
|
1905
1918
|
jGBP: '0x02aa0B826c7BA6386DdBE04C0a8715A1c0A16B24',
|
|
@@ -2093,6 +2106,7 @@ export const Holders: {
|
|
|
2093
2106
|
POPS: '0x3cbd9044aaabef08ce93a68448e093cff405ad76',
|
|
2094
2107
|
USDCe: '0xdecc0c09c3b5f6e92ef4184125d5648a66e35298',
|
|
2095
2108
|
USDC: '0x8aF3827a41c26C7F32C81E93bb66e837e0210D5c',
|
|
2109
|
+
aOptUSDCn: '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5',
|
|
2096
2110
|
USDT: '0xf977814e90da44bfa03b6295a0616a897441acec',
|
|
2097
2111
|
OP: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466',
|
|
2098
2112
|
aOptWETH: '0x7B7D80C40415F744864f051B806b466e2fbB8E68',
|
|
@@ -2112,6 +2126,7 @@ export const Holders: {
|
|
|
2112
2126
|
LUSD: '0xf0a9abb11958a071e168f2ee5bcbacf1abbde9cf',
|
|
2113
2127
|
GRAI: '0x92b051204816DC4fbA7AC1A68a2cf319A9a387CB',
|
|
2114
2128
|
stataUSDT: '0xd55263b84685Ced7e10a77607C7fFD763D495B6e',
|
|
2129
|
+
stataUSDC: '0x450C01300B83bE379113256038b4Dd3b45d23B5e',
|
|
2115
2130
|
aaveUSDT: '0x1Fd458C52fEb7Bb35097ebd9566DB6C269341FDD',
|
|
2116
2131
|
tBTC: '0xf7b4531e52211CC44379102F719cad29411dB053',
|
|
2117
2132
|
PSTAKE: '0xc45398444B83183b2018e0224B3D332b42D492Af',
|
package/tests/utils-e2e.ts
CHANGED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
-
</JSCodeStyleSettings>
|
|
15
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
16
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
17
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
18
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
19
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
20
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
21
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
22
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
23
|
-
</TypeScriptCodeStyleSettings>
|
|
24
|
-
<VueCodeStyleSettings>
|
|
25
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
26
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
27
|
-
</VueCodeStyleSettings>
|
|
28
|
-
<codeStyleSettings language="HTML">
|
|
29
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
30
|
-
<indentOptions>
|
|
31
|
-
<option name="INDENT_SIZE" value="2" />
|
|
32
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
33
|
-
<option name="TAB_SIZE" value="2" />
|
|
34
|
-
</indentOptions>
|
|
35
|
-
</codeStyleSettings>
|
|
36
|
-
<codeStyleSettings language="JavaScript">
|
|
37
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
38
|
-
<indentOptions>
|
|
39
|
-
<option name="INDENT_SIZE" value="2" />
|
|
40
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
41
|
-
<option name="TAB_SIZE" value="2" />
|
|
42
|
-
</indentOptions>
|
|
43
|
-
</codeStyleSettings>
|
|
44
|
-
<codeStyleSettings language="TypeScript">
|
|
45
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
46
|
-
<indentOptions>
|
|
47
|
-
<option name="INDENT_SIZE" value="2" />
|
|
48
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
49
|
-
<option name="TAB_SIZE" value="2" />
|
|
50
|
-
</indentOptions>
|
|
51
|
-
</codeStyleSettings>
|
|
52
|
-
<codeStyleSettings language="Vue">
|
|
53
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
54
|
-
<indentOptions>
|
|
55
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
56
|
-
</indentOptions>
|
|
57
|
-
</codeStyleSettings>
|
|
58
|
-
</code_scheme>
|
|
59
|
-
</component>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/prettier.xml
DELETED