@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
|
@@ -17,28 +17,28 @@ import {
|
|
|
17
17
|
export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
18
18
|
AaveV3Stata: {
|
|
19
19
|
[Network.MAINNET]: {
|
|
20
|
-
factoryAddress: AaveV3Ethereum.
|
|
20
|
+
factoryAddress: AaveV3Ethereum.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
21
21
|
},
|
|
22
22
|
[Network.POLYGON]: {
|
|
23
|
-
factoryAddress: AaveV3Polygon.
|
|
23
|
+
factoryAddress: AaveV3Polygon.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
24
24
|
},
|
|
25
25
|
[Network.AVALANCHE]: {
|
|
26
|
-
factoryAddress: AaveV3Avalanche.
|
|
26
|
+
factoryAddress: AaveV3Avalanche.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
27
27
|
},
|
|
28
28
|
[Network.ARBITRUM]: {
|
|
29
|
-
factoryAddress: AaveV3Arbitrum.
|
|
29
|
+
factoryAddress: AaveV3Arbitrum.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
30
30
|
},
|
|
31
31
|
[Network.OPTIMISM]: {
|
|
32
|
-
factoryAddress: AaveV3Optimism.
|
|
32
|
+
factoryAddress: AaveV3Optimism.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
33
33
|
},
|
|
34
34
|
[Network.BASE]: {
|
|
35
|
-
factoryAddress: AaveV3Base.
|
|
35
|
+
factoryAddress: AaveV3Base.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
36
36
|
},
|
|
37
37
|
[Network.BSC]: {
|
|
38
|
-
factoryAddress: AaveV3BNB.
|
|
38
|
+
factoryAddress: AaveV3BNB.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
39
39
|
},
|
|
40
40
|
[Network.GNOSIS]: {
|
|
41
|
-
factoryAddress: AaveV3Gnosis.
|
|
41
|
+
factoryAddress: AaveV3Gnosis.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
42
42
|
},
|
|
43
43
|
// [Network.Scroll]: {
|
|
44
44
|
// factoryAddress: AaveV3Scroll.STATIC_A_TOKEN_FACTORY,
|
|
@@ -264,28 +264,28 @@ describe('AaveV3Stata E2E', () => {
|
|
|
264
264
|
});
|
|
265
265
|
|
|
266
266
|
// no tokens yet deployed
|
|
267
|
-
describe
|
|
267
|
+
describe('Optimism', () => {
|
|
268
268
|
const network = Network.OPTIMISM;
|
|
269
269
|
|
|
270
270
|
const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [
|
|
271
271
|
[
|
|
272
272
|
{
|
|
273
|
-
name: '
|
|
273
|
+
name: 'USDC',
|
|
274
274
|
amount: '100000',
|
|
275
275
|
},
|
|
276
276
|
{
|
|
277
|
-
name: '
|
|
277
|
+
name: 'stataUSDC',
|
|
278
278
|
amount: '100000',
|
|
279
279
|
},
|
|
280
280
|
],
|
|
281
281
|
[
|
|
282
282
|
{
|
|
283
|
-
name: '
|
|
283
|
+
name: 'aOptUSDCn',
|
|
284
284
|
amount: '100000',
|
|
285
285
|
skipBuy: true,
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
|
-
name: '
|
|
288
|
+
name: 'stataUSDC', // no holders
|
|
289
289
|
amount: '100000',
|
|
290
290
|
},
|
|
291
291
|
],
|
|
@@ -103,7 +103,7 @@ export class AaveV3StataV2
|
|
|
103
103
|
|
|
104
104
|
let tokenList = await fetchTokenList(
|
|
105
105
|
this.dexHelper.web3Provider,
|
|
106
|
-
this.config
|
|
106
|
+
this.config,
|
|
107
107
|
this.dexHelper.multiWrapper,
|
|
108
108
|
blockNumber,
|
|
109
109
|
);
|
|
@@ -216,7 +216,7 @@ export class AaveV3StataV2
|
|
|
216
216
|
true,
|
|
217
217
|
[
|
|
218
218
|
{
|
|
219
|
-
target:
|
|
219
|
+
target: stataToken.pool,
|
|
220
220
|
callData: AaveV3StataV2.pool.encodeFunctionData(
|
|
221
221
|
'getReserveNormalizedIncome',
|
|
222
222
|
[stataToken.underlying],
|
|
@@ -12,29 +12,36 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
14
14
|
AaveV3StataV2: {
|
|
15
|
-
[Network.MAINNET]:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
AaveV3EthereumLido.STATA_FACTORY,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[Network.GNOSIS]:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
[Network.MAINNET]: [
|
|
16
|
+
{ factory: AaveV3Ethereum.STATA_FACTORY, pool: AaveV3Ethereum.POOL },
|
|
17
|
+
{
|
|
18
|
+
factory: AaveV3EthereumLido.STATA_FACTORY,
|
|
19
|
+
pool: AaveV3EthereumLido.POOL,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
[Network.GNOSIS]: [
|
|
23
|
+
{
|
|
24
|
+
factory: AaveV3Gnosis.STATA_FACTORY,
|
|
25
|
+
pool: AaveV3Gnosis.POOL,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
[Network.OPTIMISM]: [
|
|
29
|
+
{
|
|
30
|
+
factory: AaveV3Optimism.STATA_FACTORY,
|
|
31
|
+
pool: AaveV3Optimism.POOL,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
[Network.ARBITRUM]: [
|
|
35
|
+
{
|
|
36
|
+
factory: AaveV3Arbitrum.STATA_FACTORY,
|
|
37
|
+
pool: AaveV3Arbitrum.POOL,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
[Network.BASE]: [
|
|
41
|
+
{
|
|
42
|
+
factory: AaveV3Base.STATA_FACTORY,
|
|
43
|
+
pool: AaveV3Base.POOL,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
39
46
|
},
|
|
40
47
|
};
|
|
@@ -8,9 +8,9 @@ export enum TokenType {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export type DexParams = {
|
|
11
|
-
|
|
11
|
+
factory: string;
|
|
12
12
|
pool: string;
|
|
13
|
-
};
|
|
13
|
+
}[];
|
|
14
14
|
|
|
15
15
|
export type AaveV3StataV2Data = {
|
|
16
16
|
exchange: Address;
|
|
@@ -24,6 +24,7 @@ export type StataToken = {
|
|
|
24
24
|
underlyingAToken: string;
|
|
25
25
|
stataSymbol: string;
|
|
26
26
|
decimals: number;
|
|
27
|
+
pool: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export enum StataFunctions {
|
|
@@ -6,21 +6,26 @@ import { Interface } from '@ethersproject/abi';
|
|
|
6
6
|
import Web3 from 'web3';
|
|
7
7
|
import { MultiCallParams, MultiWrapper } from '../../lib/multi-wrapper';
|
|
8
8
|
import { stringDecode, uint8ToNumber, addressDecode } from '../../lib/decoders';
|
|
9
|
-
import { StataToken } from './types';
|
|
9
|
+
import { StataToken, DexParams } from './types';
|
|
10
10
|
import FactoryABI from '../../abi/aavev3statav2/Factory.json';
|
|
11
11
|
import TokenABI from '../../abi/aavev3statav2/Token.json';
|
|
12
12
|
import { AbiItem } from 'web3-utils';
|
|
13
13
|
|
|
14
|
+
type PoolAndToken = {
|
|
15
|
+
token: string;
|
|
16
|
+
pool: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
// const stataInterface = new Interface(IStaticATokenLM_ABI);
|
|
15
20
|
const statav2Interface = new Interface(TokenABI);
|
|
16
21
|
|
|
17
22
|
async function getTokenMetaData(
|
|
18
|
-
stataTokens:
|
|
23
|
+
stataTokens: PoolAndToken[],
|
|
19
24
|
multiWrapper: MultiWrapper,
|
|
20
25
|
blockNumber?: number,
|
|
21
26
|
): Promise<StataToken[]> {
|
|
22
27
|
const calls: MultiCallParams<any>[] = stataTokens
|
|
23
|
-
.map(token => {
|
|
28
|
+
.map(({ token }) => {
|
|
24
29
|
return [
|
|
25
30
|
{
|
|
26
31
|
target: token,
|
|
@@ -54,7 +59,8 @@ async function getTokenMetaData(
|
|
|
54
59
|
let tokenList: StataToken[] = [];
|
|
55
60
|
for (let i = 0, x = 0; i < stataTokens.length; ++i, x += 4) {
|
|
56
61
|
tokenList.push({
|
|
57
|
-
address: stataTokens[i].toLowerCase(),
|
|
62
|
+
address: stataTokens[i].token.toLowerCase(),
|
|
63
|
+
pool: stataTokens[i].pool.toLowerCase(),
|
|
58
64
|
stataSymbol: results[x] as string,
|
|
59
65
|
decimals: results[x + 1] as number,
|
|
60
66
|
underlying: (results[x + 2] as string).toLowerCase(),
|
|
@@ -66,22 +72,24 @@ async function getTokenMetaData(
|
|
|
66
72
|
|
|
67
73
|
export const fetchTokenList = async (
|
|
68
74
|
web3Provider: Web3,
|
|
69
|
-
|
|
75
|
+
config: DexParams,
|
|
70
76
|
multiWrapper: MultiWrapper,
|
|
71
77
|
blockNumber?: number,
|
|
72
78
|
): Promise<StataToken[]> => {
|
|
73
|
-
let stataList:
|
|
79
|
+
let stataList: PoolAndToken[] = (
|
|
74
80
|
(await Promise.all(
|
|
75
|
-
|
|
81
|
+
config.map(async ({ factory, pool }) => {
|
|
76
82
|
let factoryContract = new web3Provider.eth.Contract(
|
|
77
83
|
FactoryABI as AbiItem[],
|
|
78
84
|
// IStaticATokenFactory_ABI as any,
|
|
79
|
-
|
|
85
|
+
factory,
|
|
80
86
|
);
|
|
81
87
|
|
|
82
|
-
return
|
|
88
|
+
return (
|
|
89
|
+
(await factoryContract.methods.getStataTokens().call()) as string[]
|
|
90
|
+
).map(address => ({ token: address, pool }));
|
|
83
91
|
}),
|
|
84
|
-
)) as
|
|
92
|
+
)) as PoolAndToken[][]
|
|
85
93
|
).flat();
|
|
86
94
|
|
|
87
95
|
return getTokenMetaData(stataList, multiWrapper, blockNumber);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DexParams } from './types';
|
|
2
|
+
import { DexConfigMap } from '../../types';
|
|
3
|
+
import { Network } from '../../constants';
|
|
4
|
+
|
|
5
|
+
export const EkuboConfig: DexConfigMap<DexParams> = {
|
|
6
|
+
Ekubo: {
|
|
7
|
+
[Network.MAINNET]: {
|
|
8
|
+
apiUrl: 'https://eth-mainnet-api.ekubo.org',
|
|
9
|
+
core: '0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444',
|
|
10
|
+
oracle: '0x51d02a5948496a67827242eabc5725531342527c',
|
|
11
|
+
dataFetcher: '0x91cB8a896cAF5e60b1F7C4818730543f849B408c',
|
|
12
|
+
router: '0x9995855C00494d039aB6792f18e368e530DFf931',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { testE2E } from '../../../tests/utils-e2e';
|
|
6
|
+
import {
|
|
7
|
+
Tokens,
|
|
8
|
+
Holders,
|
|
9
|
+
NativeTokenSymbols,
|
|
10
|
+
} from '../../../tests/constants-e2e';
|
|
11
|
+
import { Network, ContractMethod, SwapSide } from '../../constants';
|
|
12
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
13
|
+
import { generateConfig } from '../../config';
|
|
14
|
+
|
|
15
|
+
function testForNetwork(
|
|
16
|
+
network: Network,
|
|
17
|
+
dexKey: string,
|
|
18
|
+
tokenASymbol: string,
|
|
19
|
+
tokenBSymbol: string,
|
|
20
|
+
tokenAAmount: string,
|
|
21
|
+
tokenBAmount: string,
|
|
22
|
+
nativeTokenAmount: string,
|
|
23
|
+
) {
|
|
24
|
+
const provider = new StaticJsonRpcProvider(
|
|
25
|
+
generateConfig(network).privateHttpProvider,
|
|
26
|
+
network,
|
|
27
|
+
);
|
|
28
|
+
const tokens = Tokens[network];
|
|
29
|
+
const holders = Holders[network];
|
|
30
|
+
const nativeTokenSymbol = NativeTokenSymbols[network];
|
|
31
|
+
|
|
32
|
+
const sideToContractMethods = new Map([
|
|
33
|
+
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
34
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
describe(`${network}`, () => {
|
|
38
|
+
sideToContractMethods.forEach((contractMethods, side) =>
|
|
39
|
+
describe(`${side}`, () => {
|
|
40
|
+
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
41
|
+
describe(`${contractMethod}`, () => {
|
|
42
|
+
it(`${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
|
|
43
|
+
await testE2E(
|
|
44
|
+
tokens[nativeTokenSymbol],
|
|
45
|
+
tokens[tokenASymbol],
|
|
46
|
+
holders[nativeTokenSymbol],
|
|
47
|
+
side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
|
|
48
|
+
side,
|
|
49
|
+
dexKey,
|
|
50
|
+
contractMethod,
|
|
51
|
+
network,
|
|
52
|
+
provider,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
|
|
56
|
+
await testE2E(
|
|
57
|
+
tokens[tokenASymbol],
|
|
58
|
+
tokens[nativeTokenSymbol],
|
|
59
|
+
holders[tokenASymbol],
|
|
60
|
+
side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
|
|
61
|
+
side,
|
|
62
|
+
dexKey,
|
|
63
|
+
contractMethod,
|
|
64
|
+
network,
|
|
65
|
+
provider,
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
69
|
+
await testE2E(
|
|
70
|
+
tokens[tokenASymbol],
|
|
71
|
+
tokens[tokenBSymbol],
|
|
72
|
+
holders[tokenASymbol],
|
|
73
|
+
side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
|
|
74
|
+
side,
|
|
75
|
+
dexKey,
|
|
76
|
+
contractMethod,
|
|
77
|
+
network,
|
|
78
|
+
provider,
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
|
|
82
|
+
await testE2E(
|
|
83
|
+
tokens[tokenBSymbol],
|
|
84
|
+
tokens[tokenASymbol],
|
|
85
|
+
holders[tokenBSymbol],
|
|
86
|
+
side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
|
|
87
|
+
side,
|
|
88
|
+
dexKey,
|
|
89
|
+
contractMethod,
|
|
90
|
+
network,
|
|
91
|
+
provider,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
describe('Ekubo E2E', () => {
|
|
102
|
+
const dexKey = 'Ekubo';
|
|
103
|
+
|
|
104
|
+
describe('Mainnet', () => {
|
|
105
|
+
const network = Network.MAINNET;
|
|
106
|
+
|
|
107
|
+
const tokenASymbol: string = 'USDC';
|
|
108
|
+
const tokenBSymbol: string = 'USDT';
|
|
109
|
+
|
|
110
|
+
const tokenAAmount: string = '10000000';
|
|
111
|
+
const tokenBAmount: string = '10000000';
|
|
112
|
+
const nativeTokenAmount = '1000000000000000';
|
|
113
|
+
|
|
114
|
+
testForNetwork(
|
|
115
|
+
network,
|
|
116
|
+
dexKey,
|
|
117
|
+
tokenASymbol,
|
|
118
|
+
tokenBSymbol,
|
|
119
|
+
tokenAAmount,
|
|
120
|
+
tokenBAmount,
|
|
121
|
+
nativeTokenAmount,
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { Network } from '../../constants';
|
|
6
|
+
import { DummyDexHelper } from '../../dex-helper/index';
|
|
7
|
+
import { testEventSubscriber } from '../../../tests/utils-events';
|
|
8
|
+
import {
|
|
9
|
+
findNearestInitializedTickIndex,
|
|
10
|
+
PoolConfig,
|
|
11
|
+
PoolKey,
|
|
12
|
+
PoolState,
|
|
13
|
+
} from './types';
|
|
14
|
+
import { EkuboConfig } from './config';
|
|
15
|
+
import { Contract } from 'ethers';
|
|
16
|
+
import CoreABI from '../../abi/ekubo/core.json';
|
|
17
|
+
import DataFetcherABI from '../../abi/ekubo/data-fetcher.json';
|
|
18
|
+
import { Interface } from '@ethersproject/abi';
|
|
19
|
+
import { BasePool } from './pools/base-pool';
|
|
20
|
+
import { OraclePool } from './pools/oracle-pool';
|
|
21
|
+
|
|
22
|
+
jest.setTimeout(50 * 1000);
|
|
23
|
+
|
|
24
|
+
async function fetchPoolState(
|
|
25
|
+
pool: BasePool,
|
|
26
|
+
blockNumber: number,
|
|
27
|
+
): Promise<PoolState.Object> {
|
|
28
|
+
return pool.generateState(blockNumber) as Promise<PoolState.Object>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type EventMappings = Record<
|
|
32
|
+
string,
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
pool: typeof BasePool;
|
|
36
|
+
key: PoolKey;
|
|
37
|
+
}[],
|
|
38
|
+
number,
|
|
39
|
+
][]
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
function stateCompare(actual: PoolState.Object, expected: PoolState.Object) {
|
|
43
|
+
const [lowCheckedTickActual, highCheckedTickActual] =
|
|
44
|
+
actual.checkedTicksBounds;
|
|
45
|
+
const [lowCheckedTickExpected, highCheckedTickExpected] =
|
|
46
|
+
expected.checkedTicksBounds;
|
|
47
|
+
|
|
48
|
+
const [sameLowCheckedTicks, sameHighCheckedTicks] = [
|
|
49
|
+
lowCheckedTickActual === lowCheckedTickExpected,
|
|
50
|
+
highCheckedTickActual === highCheckedTickExpected,
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
if (sameLowCheckedTicks && sameHighCheckedTicks) {
|
|
54
|
+
expect(actual).toStrictEqual(expected);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
expect(actual.sqrtRatio).toStrictEqual(expected.sqrtRatio);
|
|
59
|
+
expect(actual.activeTick).toStrictEqual(expected.activeTick);
|
|
60
|
+
expect(actual.liquidity).toStrictEqual(expected.liquidity);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The checked tick ranges differ between the two states at this point.
|
|
64
|
+
* In order to still compare the tick arrays, we thus have to exclude the liquidity cutoff ticks
|
|
65
|
+
* from the comparison (if they differ), as well as any other ticks that could've only
|
|
66
|
+
* been discovered in one of the two checked tick ranges.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
let lowTickIndexActual: number, lowTickIndexExpected: number;
|
|
70
|
+
|
|
71
|
+
if (sameLowCheckedTicks) {
|
|
72
|
+
[lowTickIndexActual, lowTickIndexExpected] = [0, 0];
|
|
73
|
+
} else if (lowCheckedTickActual > lowCheckedTickExpected) {
|
|
74
|
+
lowTickIndexActual = 1;
|
|
75
|
+
lowTickIndexExpected =
|
|
76
|
+
findNearestInitializedTickIndex(
|
|
77
|
+
expected.sortedTicks,
|
|
78
|
+
lowCheckedTickActual,
|
|
79
|
+
)! + 1;
|
|
80
|
+
} else {
|
|
81
|
+
lowTickIndexExpected = 1;
|
|
82
|
+
lowTickIndexActual =
|
|
83
|
+
findNearestInitializedTickIndex(
|
|
84
|
+
actual.sortedTicks,
|
|
85
|
+
lowCheckedTickExpected,
|
|
86
|
+
)! + 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let highTickIndexActual: number, highTickIndexExpected: number;
|
|
90
|
+
|
|
91
|
+
if (sameHighCheckedTicks) {
|
|
92
|
+
[highTickIndexActual, highTickIndexExpected] = [
|
|
93
|
+
actual.sortedTicks.length,
|
|
94
|
+
expected.sortedTicks.length,
|
|
95
|
+
];
|
|
96
|
+
} else if (highCheckedTickActual > highCheckedTickExpected) {
|
|
97
|
+
highTickIndexExpected = expected.sortedTicks.length - 1;
|
|
98
|
+
|
|
99
|
+
let tickIndex = findNearestInitializedTickIndex(
|
|
100
|
+
actual.sortedTicks,
|
|
101
|
+
highCheckedTickExpected,
|
|
102
|
+
)!;
|
|
103
|
+
highTickIndexActual =
|
|
104
|
+
actual.sortedTicks[tickIndex].number === highCheckedTickExpected
|
|
105
|
+
? tickIndex
|
|
106
|
+
: tickIndex + 1;
|
|
107
|
+
} else {
|
|
108
|
+
highTickIndexActual = actual.sortedTicks.length - 1;
|
|
109
|
+
|
|
110
|
+
let tickIndex = findNearestInitializedTickIndex(
|
|
111
|
+
expected.sortedTicks,
|
|
112
|
+
highCheckedTickActual,
|
|
113
|
+
)!;
|
|
114
|
+
highTickIndexExpected =
|
|
115
|
+
expected.sortedTicks[tickIndex].number === highCheckedTickActual
|
|
116
|
+
? tickIndex
|
|
117
|
+
: tickIndex + 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
expect(
|
|
121
|
+
actual.sortedTicks.slice(lowTickIndexActual, highTickIndexActual),
|
|
122
|
+
).toStrictEqual(
|
|
123
|
+
expected.sortedTicks.slice(lowTickIndexExpected, highTickIndexExpected),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const dexKey = 'Ekubo';
|
|
128
|
+
|
|
129
|
+
describe('Ekubo Mainnet', function () {
|
|
130
|
+
const network = Network.MAINNET;
|
|
131
|
+
const config = EkuboConfig[dexKey][network];
|
|
132
|
+
const dexHelper = new DummyDexHelper(network);
|
|
133
|
+
const core = new Contract(config.core, CoreABI, dexHelper.provider);
|
|
134
|
+
const coreIface = new Interface(CoreABI);
|
|
135
|
+
const dataFetcher = new Contract(
|
|
136
|
+
config.dataFetcher,
|
|
137
|
+
DataFetcherABI,
|
|
138
|
+
dexHelper.provider,
|
|
139
|
+
);
|
|
140
|
+
const logger = dexHelper.getLogger(dexKey);
|
|
141
|
+
|
|
142
|
+
const baseEthUsdcPoolKey = new PoolKey(
|
|
143
|
+
0n,
|
|
144
|
+
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48n,
|
|
145
|
+
new PoolConfig(5982, 55340232221128654n, 0n),
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const oracleUsdcPoolKey = new PoolKey(
|
|
149
|
+
0n,
|
|
150
|
+
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48n,
|
|
151
|
+
new PoolConfig(0, 0n, BigInt(config.oracle)),
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const eventsToTest: EventMappings = {
|
|
155
|
+
Swapped: [
|
|
156
|
+
[
|
|
157
|
+
[
|
|
158
|
+
{
|
|
159
|
+
pool: BasePool,
|
|
160
|
+
key: baseEthUsdcPoolKey,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
22048500, // https://etherscan.io/tx/0xc401cc3007a2c0efd705c4c0dee5690ce8592858476b32cda8a4b000ceda0f24
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
[
|
|
167
|
+
{
|
|
168
|
+
pool: OraclePool,
|
|
169
|
+
key: oracleUsdcPoolKey,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
22063200, // https://etherscan.io/tx/0xe689fb49b9627504d014a9b4663a6f0ec38ebfdc5642e261bb4bcd229d58206d
|
|
173
|
+
],
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
Object.entries(eventsToTest).forEach(([eventName, eventDetails]) => {
|
|
178
|
+
describe(eventName, () => {
|
|
179
|
+
for (const [pools, blockNumber] of eventDetails) {
|
|
180
|
+
describe(blockNumber, () => {
|
|
181
|
+
for (const { pool: constructor, key } of pools) {
|
|
182
|
+
it(`State of ${key.string_id}`, async function () {
|
|
183
|
+
const pool = new constructor(
|
|
184
|
+
dexKey,
|
|
185
|
+
network,
|
|
186
|
+
dexHelper,
|
|
187
|
+
logger,
|
|
188
|
+
coreIface,
|
|
189
|
+
dataFetcher,
|
|
190
|
+
key,
|
|
191
|
+
core,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
await testEventSubscriber(
|
|
195
|
+
pool,
|
|
196
|
+
pool.addressesSubscribed,
|
|
197
|
+
(blockNumber: number) => fetchPoolState(pool, blockNumber),
|
|
198
|
+
blockNumber,
|
|
199
|
+
`${dexKey}_${pool.key.string_id}`,
|
|
200
|
+
dexHelper.provider,
|
|
201
|
+
stateCompare,
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|