@paraswap/dex-lib 4.0.17 → 4.0.19
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/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/aavev3statav2/Factory.json +131 -0
- package/build/abi/aavev3statav2/Pool.json +1459 -0
- package/build/abi/aavev3statav2/Token.json +997 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/usual-m-smart-m/usualM.abi.json +483 -0
- package/build/abi/{USDM.json → usual-pp/abi.json} +269 -326
- package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
- package/build/dex/aave-gsm/config.js +2 -2
- package/build/dex/aave-gsm/config.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.js +1 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokenlist.json +904 -0
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/aave-v2/tokens.js +6 -4
- package/build/dex/aave-v2/tokens.js.map +1 -1
- package/build/dex/aave-v3/config.js +6 -6
- package/build/dex/aave-v3/config.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.d.ts +49 -0
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js +377 -0
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js.map +1 -0
- package/build/dex/aave-v3-stata-v2/config.d.ts +3 -0
- package/build/dex/aave-v3-stata-v2/config.js +21 -0
- package/build/dex/aave-v3-stata-v2/config.js.map +1 -0
- package/build/dex/aave-v3-stata-v2/tokens.d.ts +10 -0
- package/build/dex/aave-v3-stata-v2/tokens.js +43 -0
- package/build/dex/aave-v3-stata-v2/tokens.js.map +1 -0
- package/build/dex/aave-v3-stata-v2/types.d.ts +35 -0
- package/build/dex/aave-v3-stata-v2/types.js +25 -0
- package/build/dex/aave-v3-stata-v2/types.js.map +1 -0
- package/build/dex/aave-v3-stata-v2/utils.d.ts +4 -0
- package/build/dex/aave-v3-stata-v2/utils.js +67 -0
- package/build/dex/aave-v3-stata-v2/utils.js.map +1 -0
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +34 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +406 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +4 -4
- package/build/dex/inception/inception-event-pool.js +7 -9
- package/build/dex/inception/inception-event-pool.js.map +1 -1
- package/build/dex/inception/inception.d.ts +6 -6
- package/build/dex/inception/inception.js +16 -40
- package/build/dex/inception/inception.js.map +1 -1
- package/build/dex/inception/utils.d.ts +1 -0
- package/build/dex/inception/utils.js +22 -1
- package/build/dex/inception/utils.js.map +1 -1
- package/build/dex/index.js +4 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/platypus/platypus.js +17 -3
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +55 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/stkgho/config.js +2 -2
- package/build/dex/stkgho/config.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.js +4 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
- package/build/dex/usual/usual-m-smart-m.d.ts +17 -0
- package/build/dex/usual/usual-m-smart-m.js +50 -0
- package/build/dex/usual/usual-m-smart-m.js.map +1 -0
- package/build/dex/usual/usual.js +1 -1
- package/build/dex/usual/usual.js.map +1 -1
- package/build/dex/usual-m-smart-m/config.d.ts +3 -0
- package/build/dex/usual-m-smart-m/config.js +13 -0
- package/build/dex/usual-m-smart-m/config.js.map +1 -0
- package/build/dex/usual-m-smart-m/types.d.ts +7 -0
- package/build/dex/usual-m-smart-m/types.js +3 -0
- package/build/dex/usual-m-smart-m/types.js.map +1 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +35 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js +161 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +1 -0
- package/build/dex/usual-m-usd0/config.d.ts +3 -0
- package/build/dex/usual-m-usd0/config.js +14 -0
- package/build/dex/usual-m-usd0/config.js.map +1 -0
- package/build/dex/usual-m-usd0/types.d.ts +8 -0
- package/build/dex/usual-m-usd0/types.js +3 -0
- package/build/dex/usual-m-usd0/types.js.map +1 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +35 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.js +159 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.js.map +1 -0
- package/build/dex/usual-pp/config.d.ts +3 -0
- package/build/dex/usual-pp/config.js +19 -0
- package/build/dex/usual-pp/config.js.map +1 -0
- package/build/dex/usual-pp/pool.d.ts +17 -0
- package/build/dex/usual-pp/pool.js +57 -0
- package/build/dex/usual-pp/pool.js.map +1 -0
- package/build/dex/usual-pp/types.d.ts +15 -0
- package/build/dex/usual-pp/types.js +3 -0
- package/build/dex/usual-pp/types.js.map +1 -0
- package/build/dex/usual-pp/usual-pp.d.ts +35 -0
- package/build/dex/usual-pp/usual-pp.js +167 -0
- package/build/dex/usual-pp/usual-pp.js.map +1 -0
- package/build/dex/usual-pp/utils.d.ts +4 -0
- package/build/dex/usual-pp/utils.js +18 -0
- package/build/dex/usual-pp/utils.js.map +1 -0
- package/package.json +2 -2
- package/src/abi/aavev3statav2/Factory.json +131 -0
- package/src/abi/aavev3statav2/Pool.json +1459 -0
- package/src/abi/aavev3statav2/Token.json +997 -0
- package/src/abi/usual-pp/abi.json +750 -0
- package/src/dex/aave-gsm/config.ts +3 -3
- package/src/dex/aave-v2/tokenlist.json +904 -0
- package/src/dex/aave-v2/tokens.ts +3 -4
- package/src/dex/aave-v3/config.ts +6 -7
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts +397 -0
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-integration.test.ts +600 -0
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts +477 -0
- package/src/dex/aave-v3-stata-v2/config.ts +24 -0
- package/src/dex/aave-v3-stata-v2/tokens.ts +48 -0
- package/src/dex/aave-v3-stata-v2/types.ts +41 -0
- package/src/dex/aave-v3-stata-v2/utils.ts +88 -0
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +0 -10
- package/src/dex/index.ts +4 -0
- package/src/dex/stkgho/config.ts +3 -3
- package/src/dex/usual/usual.ts +1 -1
- package/src/dex/usual-pp/config.ts +18 -0
- package/src/dex/usual-pp/pool.ts +77 -0
- package/src/dex/usual-pp/types.ts +12 -0
- package/src/dex/usual-pp/usual-events.test.ts +70 -0
- package/src/dex/usual-pp/usual-integration.test.ts +143 -0
- package/src/dex/usual-pp/usual-pp.e2e.test.ts +76 -0
- package/src/dex/usual-pp/usual-pp.ts +207 -0
- package/src/dex/usual-pp/utils.ts +27 -0
- package/tests/constants-e2e.ts +11 -1
- package/build/abi/Aave_GSM.json +0 -751
- package/build/abi/Balancer.json +0 -257
- package/build/abi/BalancerV2.json +0 -1179
- package/build/abi/RamsesV2Pool.abi.json +0 -1554
- package/build/abi/RamsesV2Quoter.abi.json +0 -274
- package/build/abi/UniswapV2Router.json +0 -397
- package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
- package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
- package/build/abi/curve-v1/CurveTokenV1.json +0 -305
- package/build/abi/curve-v1/CurveTokenV2.json +0 -318
- package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
- package/build/abi/curve-v1/CurveV2Swap.json +0 -700
- package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
- package/build/abi/curve-v1/FactoryRegistry.json +0 -508
- package/build/abi/curve-v1/StableSwapAave.json +0 -1152
- package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
- package/build/abi/curve-v1/StableSwapCompound.json +0 -814
- package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
- package/build/abi/curve-v1/StableSwapPax.json +0 -865
- package/build/abi/curve-v1/StableSwapSnow.json +0 -900
- package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
- package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
- package/build/abi/curve-v1/StableSwapY.json +0 -814
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
- package/build/abi/kyberdmm.abi.json +0 -1148
- package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
- package/build/abi/nerve/nerve-metapool.json +0 -790
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
- package/build/dex/balancer-v1/balancer-pools.json +0 -33333
- package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
- package/build/dex/bebop/websocket-fetcher.js +0 -87
- package/build/dex/bebop/websocket-fetcher.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/inception-native.d.ts +0 -43
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { Interface, Result } from '@ethersproject/abi';
|
|
6
|
+
import { DummyDexHelper } from '../../dex-helper/index';
|
|
7
|
+
import { Network, SwapSide } from '../../constants';
|
|
8
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
9
|
+
import { AaveV3StataV2 } from './aave-v3-stata-v2';
|
|
10
|
+
import {
|
|
11
|
+
checkPoolPrices,
|
|
12
|
+
checkPoolsLiquidity,
|
|
13
|
+
checkConstantPoolPrices,
|
|
14
|
+
} from '../../../tests/utils';
|
|
15
|
+
import { Tokens } from '../../../tests/constants-e2e';
|
|
16
|
+
|
|
17
|
+
function getReaderCalldata(
|
|
18
|
+
exchangeAddress: string,
|
|
19
|
+
readerIface: Interface,
|
|
20
|
+
amounts: bigint[],
|
|
21
|
+
funcName: string,
|
|
22
|
+
) {
|
|
23
|
+
return amounts.map(amount => ({
|
|
24
|
+
target: exchangeAddress,
|
|
25
|
+
callData: readerIface.encodeFunctionData(funcName, [amount]),
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function decodeReaderResult(
|
|
30
|
+
results: Result,
|
|
31
|
+
readerIface: Interface,
|
|
32
|
+
funcName: string,
|
|
33
|
+
) {
|
|
34
|
+
return results.map(result => {
|
|
35
|
+
const parsed = readerIface.decodeFunctionResult(funcName, result);
|
|
36
|
+
return BigInt(parsed[0]._hex);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function checkOnChainPricing(
|
|
41
|
+
aaveV3Statav2: AaveV3StataV2,
|
|
42
|
+
exchangeAddress: string,
|
|
43
|
+
funcName: string,
|
|
44
|
+
blockNumber: number,
|
|
45
|
+
prices: bigint[],
|
|
46
|
+
amounts: bigint[],
|
|
47
|
+
) {
|
|
48
|
+
const readerIface = AaveV3StataV2.stata;
|
|
49
|
+
|
|
50
|
+
const readerCallData = getReaderCalldata(
|
|
51
|
+
exchangeAddress,
|
|
52
|
+
readerIface,
|
|
53
|
+
amounts.slice(1),
|
|
54
|
+
funcName,
|
|
55
|
+
);
|
|
56
|
+
const readerResult = (
|
|
57
|
+
await aaveV3Statav2.dexHelper.multiContract.methods
|
|
58
|
+
.aggregate(readerCallData)
|
|
59
|
+
.call({}, blockNumber)
|
|
60
|
+
).returnData;
|
|
61
|
+
|
|
62
|
+
const expectedPrices = [0n].concat(
|
|
63
|
+
decodeReaderResult(readerResult, readerIface, funcName),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
expect(prices).toEqual(expectedPrices);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function testPricingOnNetwork(
|
|
70
|
+
aaveV3Statav2: AaveV3StataV2,
|
|
71
|
+
network: Network,
|
|
72
|
+
dexKey: string,
|
|
73
|
+
blockNumber: number,
|
|
74
|
+
srcTokenSymbol: string,
|
|
75
|
+
destTokenSymbol: string,
|
|
76
|
+
side: SwapSide,
|
|
77
|
+
amounts: bigint[],
|
|
78
|
+
exchangeAddress: string,
|
|
79
|
+
funcNameToCheck: string,
|
|
80
|
+
) {
|
|
81
|
+
const networkTokens = Tokens[network];
|
|
82
|
+
|
|
83
|
+
const pools = await aaveV3Statav2.getPoolIdentifiers(
|
|
84
|
+
networkTokens[srcTokenSymbol],
|
|
85
|
+
networkTokens[destTokenSymbol],
|
|
86
|
+
side,
|
|
87
|
+
blockNumber,
|
|
88
|
+
);
|
|
89
|
+
console.log(
|
|
90
|
+
`${srcTokenSymbol} <> ${destTokenSymbol} Pool Identifiers: `,
|
|
91
|
+
pools,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
95
|
+
|
|
96
|
+
const poolPrices = await aaveV3Statav2.getPricesVolume(
|
|
97
|
+
networkTokens[srcTokenSymbol],
|
|
98
|
+
networkTokens[destTokenSymbol],
|
|
99
|
+
amounts,
|
|
100
|
+
side,
|
|
101
|
+
blockNumber,
|
|
102
|
+
pools,
|
|
103
|
+
);
|
|
104
|
+
console.log(
|
|
105
|
+
`${srcTokenSymbol} <> ${destTokenSymbol} Pool Prices: `,
|
|
106
|
+
poolPrices,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
expect(poolPrices).not.toBeNull();
|
|
110
|
+
if (aaveV3Statav2.hasConstantPriceLargeAmounts) {
|
|
111
|
+
checkConstantPoolPrices(poolPrices!, amounts, dexKey);
|
|
112
|
+
} else {
|
|
113
|
+
checkPoolPrices(poolPrices!, amounts, side, dexKey);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Check if onchain pricing equals to calculated ones
|
|
117
|
+
await checkOnChainPricing(
|
|
118
|
+
aaveV3Statav2,
|
|
119
|
+
exchangeAddress,
|
|
120
|
+
funcNameToCheck,
|
|
121
|
+
blockNumber,
|
|
122
|
+
poolPrices![0].prices,
|
|
123
|
+
amounts,
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
describe('AaveV3StataV2', function () {
|
|
128
|
+
const dexKey = 'AaveV3StataV2';
|
|
129
|
+
let blockNumber: number;
|
|
130
|
+
let aaveV3Statav2: AaveV3StataV2;
|
|
131
|
+
|
|
132
|
+
describe('Mainnet', () => {
|
|
133
|
+
const network = Network.MAINNET;
|
|
134
|
+
const dexHelper = new DummyDexHelper(network);
|
|
135
|
+
|
|
136
|
+
const tokens = Tokens[network];
|
|
137
|
+
|
|
138
|
+
const srcTokenSymbol = 'USDT';
|
|
139
|
+
const destTokenSymbol = 'waEthUSDT';
|
|
140
|
+
|
|
141
|
+
const amountsForSell = [
|
|
142
|
+
0n,
|
|
143
|
+
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
144
|
+
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
145
|
+
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
146
|
+
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
147
|
+
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
148
|
+
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
149
|
+
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
150
|
+
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
151
|
+
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
152
|
+
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const amountsForBuy = [
|
|
156
|
+
0n,
|
|
157
|
+
1n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
158
|
+
2n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
159
|
+
3n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
160
|
+
4n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
161
|
+
5n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
162
|
+
6n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
163
|
+
7n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
164
|
+
8n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
165
|
+
9n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
166
|
+
10n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
beforeAll(async () => {
|
|
170
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
171
|
+
aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
172
|
+
if (aaveV3Statav2.initializePricing) {
|
|
173
|
+
await aaveV3Statav2.initializePricing(blockNumber);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('getPoolIdentifiers and getPricesVolume SELL USDT -> waEthUSDT', async function () {
|
|
178
|
+
await testPricingOnNetwork(
|
|
179
|
+
aaveV3Statav2,
|
|
180
|
+
network,
|
|
181
|
+
dexKey,
|
|
182
|
+
blockNumber,
|
|
183
|
+
srcTokenSymbol,
|
|
184
|
+
destTokenSymbol,
|
|
185
|
+
SwapSide.SELL,
|
|
186
|
+
amountsForSell,
|
|
187
|
+
'0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
|
|
188
|
+
'previewDeposit',
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('getPoolIdentifiers and getPricesVolume SELL waEthUSDT -> USDT ', async function () {
|
|
193
|
+
await testPricingOnNetwork(
|
|
194
|
+
aaveV3Statav2,
|
|
195
|
+
network,
|
|
196
|
+
dexKey,
|
|
197
|
+
blockNumber,
|
|
198
|
+
destTokenSymbol,
|
|
199
|
+
srcTokenSymbol,
|
|
200
|
+
SwapSide.SELL,
|
|
201
|
+
amountsForSell,
|
|
202
|
+
'0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
|
|
203
|
+
'previewRedeem',
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('getPoolIdentifiers and getPricesVolume BUY USDT -> waEthUSDT', async function () {
|
|
208
|
+
await testPricingOnNetwork(
|
|
209
|
+
aaveV3Statav2,
|
|
210
|
+
network,
|
|
211
|
+
dexKey,
|
|
212
|
+
blockNumber,
|
|
213
|
+
srcTokenSymbol,
|
|
214
|
+
destTokenSymbol,
|
|
215
|
+
SwapSide.BUY,
|
|
216
|
+
amountsForBuy,
|
|
217
|
+
'0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
|
|
218
|
+
'previewMint',
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('getPoolIdentifiers and getPricesVolume BUY waEthUSDT -> USDT', async function () {
|
|
223
|
+
await testPricingOnNetwork(
|
|
224
|
+
aaveV3Statav2,
|
|
225
|
+
network,
|
|
226
|
+
dexKey,
|
|
227
|
+
blockNumber,
|
|
228
|
+
destTokenSymbol,
|
|
229
|
+
srcTokenSymbol,
|
|
230
|
+
SwapSide.BUY,
|
|
231
|
+
amountsForBuy,
|
|
232
|
+
'0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
|
|
233
|
+
'previewWithdraw',
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
|
|
238
|
+
// We have to check without calling initializePricing, because
|
|
239
|
+
// pool-tracker is not calling that function
|
|
240
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
241
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
242
|
+
await newAaveV3Stata.updatePoolState();
|
|
243
|
+
}
|
|
244
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
245
|
+
tokens[srcTokenSymbol].address,
|
|
246
|
+
10,
|
|
247
|
+
);
|
|
248
|
+
console.log(
|
|
249
|
+
`${srcTokenSymbol} Top Pools:`,
|
|
250
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
254
|
+
checkPoolsLiquidity(
|
|
255
|
+
poolLiquidity,
|
|
256
|
+
Tokens[network][srcTokenSymbol].address,
|
|
257
|
+
dexKey,
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
|
|
263
|
+
// We have to check without calling initializePricing, because
|
|
264
|
+
// pool-tracker is not calling that function
|
|
265
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
266
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
267
|
+
await newAaveV3Stata.updatePoolState();
|
|
268
|
+
}
|
|
269
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
270
|
+
tokens[destTokenSymbol].address,
|
|
271
|
+
10,
|
|
272
|
+
);
|
|
273
|
+
console.log(
|
|
274
|
+
`${destTokenSymbol} Top Pools:`,
|
|
275
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
279
|
+
checkPoolsLiquidity(
|
|
280
|
+
poolLiquidity,
|
|
281
|
+
Tokens[network][destTokenSymbol].address,
|
|
282
|
+
dexKey,
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
describe('Gnosis', () => {
|
|
289
|
+
const network = Network.GNOSIS;
|
|
290
|
+
const dexHelper = new DummyDexHelper(network);
|
|
291
|
+
|
|
292
|
+
const tokens = Tokens[network];
|
|
293
|
+
|
|
294
|
+
const srcTokenSymbol = 'wstETH';
|
|
295
|
+
const destTokenSymbol = 'waGnowstETH';
|
|
296
|
+
|
|
297
|
+
const amountsForSell = [
|
|
298
|
+
0n,
|
|
299
|
+
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
300
|
+
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
301
|
+
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
302
|
+
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
303
|
+
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
304
|
+
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
305
|
+
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
306
|
+
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
307
|
+
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
308
|
+
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
const amountsForBuy = [
|
|
312
|
+
0n,
|
|
313
|
+
1n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
314
|
+
2n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
315
|
+
3n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
316
|
+
4n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
317
|
+
5n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
318
|
+
6n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
319
|
+
7n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
320
|
+
8n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
321
|
+
9n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
322
|
+
10n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
beforeAll(async () => {
|
|
326
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
327
|
+
aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
328
|
+
if (aaveV3Statav2.initializePricing) {
|
|
329
|
+
await aaveV3Statav2.initializePricing(blockNumber);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it('getPoolIdentifiers and getPricesVolume SELL wstETH -> waGnowstETH', async function () {
|
|
334
|
+
await testPricingOnNetwork(
|
|
335
|
+
aaveV3Statav2,
|
|
336
|
+
network,
|
|
337
|
+
dexKey,
|
|
338
|
+
blockNumber,
|
|
339
|
+
srcTokenSymbol,
|
|
340
|
+
destTokenSymbol,
|
|
341
|
+
SwapSide.SELL,
|
|
342
|
+
amountsForSell,
|
|
343
|
+
'0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
|
|
344
|
+
'previewDeposit',
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('getPoolIdentifiers and getPricesVolume SELL waGnowstETH -> wstETH', async function () {
|
|
349
|
+
await testPricingOnNetwork(
|
|
350
|
+
aaveV3Statav2,
|
|
351
|
+
network,
|
|
352
|
+
dexKey,
|
|
353
|
+
blockNumber,
|
|
354
|
+
destTokenSymbol,
|
|
355
|
+
srcTokenSymbol,
|
|
356
|
+
SwapSide.SELL,
|
|
357
|
+
amountsForSell,
|
|
358
|
+
'0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
|
|
359
|
+
'previewRedeem',
|
|
360
|
+
);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('getPoolIdentifiers and getPricesVolume BUY wstETH -> waGnowstETH', async function () {
|
|
364
|
+
await testPricingOnNetwork(
|
|
365
|
+
aaveV3Statav2,
|
|
366
|
+
network,
|
|
367
|
+
dexKey,
|
|
368
|
+
blockNumber,
|
|
369
|
+
srcTokenSymbol,
|
|
370
|
+
destTokenSymbol,
|
|
371
|
+
SwapSide.BUY,
|
|
372
|
+
amountsForBuy,
|
|
373
|
+
'0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
|
|
374
|
+
'previewMint',
|
|
375
|
+
);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it('getPoolIdentifiers and getPricesVolume BUY waGnowstETH -> wstETH', async function () {
|
|
379
|
+
await testPricingOnNetwork(
|
|
380
|
+
aaveV3Statav2,
|
|
381
|
+
network,
|
|
382
|
+
dexKey,
|
|
383
|
+
blockNumber,
|
|
384
|
+
destTokenSymbol,
|
|
385
|
+
srcTokenSymbol,
|
|
386
|
+
SwapSide.BUY,
|
|
387
|
+
amountsForBuy,
|
|
388
|
+
'0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
|
|
389
|
+
'previewWithdraw',
|
|
390
|
+
);
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
|
|
394
|
+
// We have to check without calling initializePricing, because
|
|
395
|
+
// pool-tracker is not calling that function
|
|
396
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
397
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
398
|
+
await newAaveV3Stata.updatePoolState();
|
|
399
|
+
}
|
|
400
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
401
|
+
tokens[srcTokenSymbol].address,
|
|
402
|
+
10,
|
|
403
|
+
);
|
|
404
|
+
console.log(
|
|
405
|
+
`${srcTokenSymbol} Top Pools:`,
|
|
406
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
410
|
+
checkPoolsLiquidity(
|
|
411
|
+
poolLiquidity,
|
|
412
|
+
Tokens[network][srcTokenSymbol].address,
|
|
413
|
+
dexKey,
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
|
|
419
|
+
// We have to check without calling initializePricing, because
|
|
420
|
+
// pool-tracker is not calling that function
|
|
421
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
422
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
423
|
+
await newAaveV3Stata.updatePoolState();
|
|
424
|
+
}
|
|
425
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
426
|
+
tokens[destTokenSymbol].address,
|
|
427
|
+
10,
|
|
428
|
+
);
|
|
429
|
+
console.log(
|
|
430
|
+
`${destTokenSymbol} Top Pools:`,
|
|
431
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
435
|
+
checkPoolsLiquidity(
|
|
436
|
+
poolLiquidity,
|
|
437
|
+
Tokens[network][destTokenSymbol].address,
|
|
438
|
+
dexKey,
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
// polygon is not yet live
|
|
445
|
+
describe.skip('Polygon', () => {
|
|
446
|
+
const network = Network.POLYGON;
|
|
447
|
+
const dexHelper = new DummyDexHelper(network);
|
|
448
|
+
|
|
449
|
+
const tokens = Tokens[network];
|
|
450
|
+
|
|
451
|
+
const srcTokenSymbol = 'USDCn';
|
|
452
|
+
const destTokenSymbol = 'stataUSDCn';
|
|
453
|
+
|
|
454
|
+
const amountsForSell = [
|
|
455
|
+
0n,
|
|
456
|
+
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
457
|
+
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
458
|
+
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
459
|
+
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
460
|
+
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
461
|
+
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
462
|
+
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
463
|
+
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
464
|
+
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
465
|
+
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
466
|
+
];
|
|
467
|
+
|
|
468
|
+
const amountsForBuy = [
|
|
469
|
+
0n,
|
|
470
|
+
1n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
471
|
+
2n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
472
|
+
3n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
473
|
+
4n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
474
|
+
5n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
475
|
+
6n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
476
|
+
7n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
477
|
+
8n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
478
|
+
9n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
479
|
+
10n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
480
|
+
];
|
|
481
|
+
|
|
482
|
+
beforeAll(async () => {
|
|
483
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
484
|
+
aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
485
|
+
if (aaveV3Statav2.initializePricing) {
|
|
486
|
+
await aaveV3Statav2.initializePricing(blockNumber);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it('getPoolIdentifiers and getPricesVolume SELL USDCn -> stataUSDCn', async function () {
|
|
491
|
+
await testPricingOnNetwork(
|
|
492
|
+
aaveV3Statav2,
|
|
493
|
+
network,
|
|
494
|
+
dexKey,
|
|
495
|
+
blockNumber,
|
|
496
|
+
srcTokenSymbol,
|
|
497
|
+
destTokenSymbol,
|
|
498
|
+
SwapSide.SELL,
|
|
499
|
+
amountsForSell,
|
|
500
|
+
'0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
|
|
501
|
+
'previewDeposit',
|
|
502
|
+
);
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it('getPoolIdentifiers and getPricesVolume SELL stataUSDCn -> USDCn ', async function () {
|
|
506
|
+
await testPricingOnNetwork(
|
|
507
|
+
aaveV3Statav2,
|
|
508
|
+
network,
|
|
509
|
+
dexKey,
|
|
510
|
+
blockNumber,
|
|
511
|
+
destTokenSymbol,
|
|
512
|
+
srcTokenSymbol,
|
|
513
|
+
SwapSide.SELL,
|
|
514
|
+
amountsForSell,
|
|
515
|
+
'0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
|
|
516
|
+
'previewRedeem',
|
|
517
|
+
);
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('getPoolIdentifiers and getPricesVolume BUY USDC -> stataUSDCn', async function () {
|
|
521
|
+
await testPricingOnNetwork(
|
|
522
|
+
aaveV3Statav2,
|
|
523
|
+
network,
|
|
524
|
+
dexKey,
|
|
525
|
+
blockNumber,
|
|
526
|
+
srcTokenSymbol,
|
|
527
|
+
destTokenSymbol,
|
|
528
|
+
SwapSide.BUY,
|
|
529
|
+
amountsForBuy,
|
|
530
|
+
'0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
|
|
531
|
+
'previewMint',
|
|
532
|
+
);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it('getPoolIdentifiers and getPricesVolume BUY stataUSDCn -> USDC', async function () {
|
|
536
|
+
await testPricingOnNetwork(
|
|
537
|
+
aaveV3Statav2,
|
|
538
|
+
network,
|
|
539
|
+
dexKey,
|
|
540
|
+
blockNumber,
|
|
541
|
+
destTokenSymbol,
|
|
542
|
+
srcTokenSymbol,
|
|
543
|
+
SwapSide.BUY,
|
|
544
|
+
amountsForBuy,
|
|
545
|
+
'0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
|
|
546
|
+
'previewWithdraw',
|
|
547
|
+
);
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
|
|
551
|
+
// We have to check without calling initializePricing, because
|
|
552
|
+
// pool-tracker is not calling that function
|
|
553
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
554
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
555
|
+
await newAaveV3Stata.updatePoolState();
|
|
556
|
+
}
|
|
557
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
558
|
+
tokens[srcTokenSymbol].address,
|
|
559
|
+
10,
|
|
560
|
+
);
|
|
561
|
+
console.log(
|
|
562
|
+
`${srcTokenSymbol} Top Pools:`,
|
|
563
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
567
|
+
checkPoolsLiquidity(
|
|
568
|
+
poolLiquidity,
|
|
569
|
+
Tokens[network][srcTokenSymbol].address,
|
|
570
|
+
dexKey,
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
|
|
576
|
+
// We have to check without calling initializePricing, because
|
|
577
|
+
// pool-tracker is not calling that function
|
|
578
|
+
const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
|
|
579
|
+
if (newAaveV3Stata.updatePoolState) {
|
|
580
|
+
await newAaveV3Stata.updatePoolState();
|
|
581
|
+
}
|
|
582
|
+
const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
|
|
583
|
+
tokens[destTokenSymbol].address,
|
|
584
|
+
10,
|
|
585
|
+
);
|
|
586
|
+
console.log(
|
|
587
|
+
`${destTokenSymbol} Top Pools:`,
|
|
588
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
|
|
592
|
+
checkPoolsLiquidity(
|
|
593
|
+
poolLiquidity,
|
|
594
|
+
Tokens[network][destTokenSymbol].address,
|
|
595
|
+
dexKey,
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
});
|