@paraswap/dex-lib 2.45.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release-package.yml +32 -0
- package/.vscode/launch.json +72 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/AugustusV6.abi.json +1454 -0
- package/build/abi/augustus-v6/ABI.json +1075 -0
- package/build/config.d.ts +1 -0
- package/build/config.js +53 -1
- package/build/config.js.map +1 -1
- package/build/constants.d.ts +6 -0
- package/build/constants.js +9 -2
- package/build/constants.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +22 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/aave-v2.d.ts +2 -1
- package/build/dex/aave-v2/aave-v2.js +80 -0
- package/build/dex/aave-v2/aave-v2.js.map +1 -1
- package/build/dex/aave-v3/aave-v3.d.ts +3 -1
- package/build/dex/aave-v3/aave-v3.js +39 -0
- package/build/dex/aave-v3/aave-v3.js.map +1 -1
- package/build/dex/algebra/algebra.d.ts +2 -1
- package/build/dex/algebra/algebra.js +52 -1
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/scripts/validate-state-v1-1.d.ts +1 -0
- package/build/dex/algebra/scripts/validate-state-v1-1.js +206 -0
- package/build/dex/algebra/scripts/validate-state-v1-1.js.map +1 -0
- package/build/dex/augustus-approvals-helper.d.ts +22 -0
- package/build/dex/augustus-approvals-helper.js +110 -0
- package/build/dex/augustus-approvals-helper.js.map +1 -0
- package/build/dex/augustus-approvals.d.ts +24 -0
- package/build/dex/augustus-approvals.js +106 -0
- package/build/dex/augustus-approvals.js.map +1 -0
- package/build/dex/bProtocol/bProtocol.d.ts +15 -0
- package/build/dex/bProtocol/bProtocol.js +51 -0
- package/build/dex/bProtocol/bProtocol.js.map +1 -0
- package/build/dex/bProtocol/types.d.ts +11 -0
- package/build/dex/bProtocol/types.js +8 -0
- package/build/dex/bProtocol/types.js.map +1 -0
- package/build/dex/bProtocol.d.ts +2 -1
- package/build/dex/bProtocol.js +15 -0
- package/build/dex/bProtocol.js.map +1 -1
- package/build/dex/balancer-v1/balancer-v1.d.ts +5 -3
- package/build/dex/balancer-v1/balancer-v1.js +72 -3
- package/build/dex/balancer-v1/balancer-v1.js.map +1 -1
- package/build/dex/balancer-v2/balancer-v2.d.ts +16 -4
- package/build/dex/balancer-v2/balancer-v2.js +154 -7
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/constants.d.ts +4 -0
- package/build/dex/balancer-v2/constants.js +6 -1
- package/build/dex/balancer-v2/constants.js.map +1 -1
- package/build/dex/balancer-v2/types.d.ts +11 -0
- package/build/dex/bancor/bancor.d.ts +15 -0
- package/build/dex/bancor/bancor.js +69 -0
- package/build/dex/bancor/bancor.js.map +1 -0
- package/build/dex/bancor/config.d.ts +6 -0
- package/build/dex/bancor/config.js +11 -0
- package/build/dex/bancor/config.js.map +1 -0
- package/build/dex/bancor/types.d.ts +16 -0
- package/build/dex/bancor/types.js +8 -0
- package/build/dex/bancor/types.js.map +1 -0
- package/build/dex/bancor.d.ts +2 -1
- package/build/dex/bancor.js +19 -0
- package/build/dex/bancor.js.map +1 -1
- package/build/dex/camelot/camelot.d.ts +3 -1
- package/build/dex/camelot/camelot.js +31 -0
- package/build/dex/camelot/camelot.js.map +1 -1
- package/build/dex/camelot/scripts/validate-state.d.ts +1 -0
- package/build/dex/camelot/scripts/validate-state.js +84 -0
- package/build/dex/camelot/scripts/validate-state.js.map +1 -0
- package/build/dex/compound/compound.d.ts +15 -0
- package/build/dex/compound/compound.js +54 -0
- package/build/dex/compound/compound.js.map +1 -0
- package/build/dex/compound/types.d.ts +8 -0
- package/build/dex/compound/types.js +9 -0
- package/build/dex/compound/types.js.map +1 -0
- package/build/dex/compound.d.ts +2 -1
- package/build/dex/compound.js +12 -0
- package/build/dex/compound.js.map +1 -1
- package/build/dex/curve-v1/constants.d.ts +1 -0
- package/build/dex/curve-v1/constants.js +2 -1
- package/build/dex/curve-v1/constants.js.map +1 -1
- package/build/dex/curve-v1/curve-v1.d.ts +10 -3
- package/build/dex/curve-v1/curve-v1.js +57 -7
- package/build/dex/curve-v1/curve-v1.js.map +1 -1
- package/build/dex/curve-v1/packer.d.ts +2 -0
- package/build/dex/curve-v1/packer.js +18 -0
- package/build/dex/curve-v1/packer.js.map +1 -0
- package/build/dex/curve-v1/types.d.ts +16 -0
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +2 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +19 -7
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/polling-manager.js +3 -1
- package/build/dex/curve-v1-factory/state-polling-pools/polling-manager.js.map +1 -1
- package/build/dex/curve-v2/constants.d.ts +1 -0
- package/build/dex/curve-v2/constants.js +5 -0
- package/build/dex/curve-v2/constants.js.map +1 -0
- package/build/dex/curve-v2/curve-v2.d.ts +61 -0
- package/build/dex/curve-v2/curve-v2.js +245 -0
- package/build/dex/curve-v2/curve-v2.js.map +1 -0
- package/build/dex/curve-v2/types.d.ts +24 -0
- package/build/dex/curve-v2/types.js +10 -0
- package/build/dex/curve-v2/types.js.map +1 -0
- package/build/dex/dexalot/dexalot.d.ts +2 -1
- package/build/dex/dexalot/dexalot.js +25 -0
- package/build/dex/dexalot/dexalot.js.map +1 -1
- package/build/dex/dodo-v1/config.d.ts +7 -0
- package/build/dex/dodo-v1/config.js +16 -0
- package/build/dex/dodo-v1/config.js.map +1 -0
- package/build/dex/dodo-v1/dodo-v1.d.ts +16 -0
- package/build/dex/dodo-v1/dodo-v1.js +71 -0
- package/build/dex/dodo-v1/dodo-v1.js.map +1 -0
- package/build/dex/dodo-v1/types.d.ts +22 -0
- package/build/dex/dodo-v1/types.js +8 -0
- package/build/dex/dodo-v1/types.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +2 -1
- package/build/dex/dodo-v1.js +20 -0
- package/build/dex/dodo-v1.js.map +1 -1
- package/build/dex/dodo-v2.d.ts +2 -1
- package/build/dex/dodo-v2.js +54 -0
- package/build/dex/dodo-v2.js.map +1 -1
- package/build/dex/generic-rfq/e2e-test-config.js +50 -6
- package/build/dex/generic-rfq/e2e-test-config.js.map +1 -1
- package/build/dex/generic-rfq/fetch-mm-api.js +2 -2
- package/build/dex/generic-rfq/fetch-mm-api.js.map +1 -1
- package/build/dex/generic-rfq/generic-rfq.d.ts +10 -3
- package/build/dex/generic-rfq/generic-rfq.js +68 -10
- package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
- package/build/dex/generic-rfq/rate-fetcher.js +2 -2
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/generic-rfq/test-v6/constants.d.ts +1 -0
- package/build/dex/generic-rfq/test-v6/constants.js +5 -0
- package/build/dex/generic-rfq/test-v6/constants.js.map +1 -0
- package/build/dex/generic-rfq/test-v6/get-config.d.ts +1 -0
- package/build/dex/generic-rfq/test-v6/get-config.js +63 -0
- package/build/dex/generic-rfq/test-v6/get-config.js.map +1 -0
- package/build/dex/generic-rfq/test-v6/types.d.ts +14 -0
- package/build/dex/generic-rfq/test-v6/types.js +3 -0
- package/build/dex/generic-rfq/test-v6/types.js.map +1 -0
- package/build/dex/generic-rfq/tokens.json +570 -0
- package/build/dex/generic-rfq/types.d.ts +14 -2
- package/build/dex/generic-rfq/types.js.map +1 -1
- package/build/dex/generic-rfq/utils.d.ts +1 -1
- package/build/dex/generic-rfq/utils.js +4 -7
- package/build/dex/generic-rfq/utils.js.map +1 -1
- package/build/dex/generic-rfq/validators.d.ts +1 -0
- package/build/dex/generic-rfq/validators.js +9 -12
- package/build/dex/generic-rfq/validators.js.map +1 -1
- package/build/dex/gmx/gmx.d.ts +2 -1
- package/build/dex/gmx/gmx.js +15 -0
- package/build/dex/gmx/gmx.js.map +1 -1
- package/build/dex/hashflow/hashflow.d.ts +2 -1
- package/build/dex/hashflow/hashflow.js +31 -1
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/idex.d.ts +7 -1
- package/build/dex/index.d.ts +2 -0
- package/build/dex/index.js +23 -10
- package/build/dex/index.js.map +1 -1
- package/build/dex/jarvis-v6/jarvis-v6.d.ts +2 -1
- package/build/dex/jarvis-v6/jarvis-v6.js +24 -0
- package/build/dex/jarvis-v6/jarvis-v6.js.map +1 -1
- package/build/dex/jarvis.d.ts +2 -1
- package/build/dex/jarvis.js +50 -0
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/kyberdmm/kyberdmm.d.ts +2 -1
- package/build/dex/kyberdmm/kyberdmm.js +20 -0
- package/build/dex/kyberdmm/kyberdmm.js.map +1 -1
- package/build/dex/lido/config.d.ts +1 -0
- package/build/dex/lido/config.js +8 -0
- package/build/dex/lido/config.js.map +1 -0
- package/build/dex/lido/lido.d.ts +16 -0
- package/build/dex/lido/lido.js +46 -0
- package/build/dex/lido/lido.js.map +1 -0
- package/build/dex/lido/types.d.ts +4 -0
- package/build/dex/lido/types.js +8 -0
- package/build/dex/lido/types.js.map +1 -0
- package/build/dex/lido.d.ts +2 -1
- package/build/dex/lido.js +9 -0
- package/build/dex/lido.js.map +1 -1
- package/build/dex/maker-psm/maker-psm.d.ts +2 -1
- package/build/dex/maker-psm/maker-psm.js +27 -0
- package/build/dex/maker-psm/maker-psm.js.map +1 -1
- package/build/dex/maverick-v1/maverick-v1.d.ts +3 -1
- package/build/dex/maverick-v1/maverick-v1.js +35 -0
- package/build/dex/maverick-v1/maverick-v1.js.map +1 -1
- package/build/dex/nerve/nerve.d.ts +2 -1
- package/build/dex/nerve/nerve.js +19 -0
- package/build/dex/nerve/nerve.js.map +1 -1
- package/build/dex/onebit/onebit.d.ts +16 -0
- package/build/dex/onebit/onebit.js +56 -0
- package/build/dex/onebit/onebit.js.map +1 -0
- package/build/dex/onebit/types.d.ts +14 -0
- package/build/dex/onebit/types.js +8 -0
- package/build/dex/onebit/types.js.map +1 -0
- package/build/dex/onebit.d.ts +2 -1
- package/build/dex/onebit.js +17 -0
- package/build/dex/onebit.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +2 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +30 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/paraswap-limit-orders/paraswap-limit-orders.d.ts +2 -1
- package/build/dex/paraswap-limit-orders/paraswap-limit-orders.js +15 -0
- package/build/dex/paraswap-limit-orders/paraswap-limit-orders.js.map +1 -1
- package/build/dex/paraswap-limit-orders/types.d.ts +1 -0
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +31 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/polygon-migrator/polygon-migrator.d.ts +2 -1
- package/build/dex/polygon-migrator/polygon-migrator.js +11 -0
- package/build/dex/polygon-migrator/polygon-migrator.js.map +1 -1
- package/build/dex/quick-perps/quick-perps.d.ts +2 -1
- package/build/dex/quick-perps/quick-perps.js +15 -0
- package/build/dex/quick-perps/quick-perps.js.map +1 -1
- package/build/dex/simple-exchange.d.ts +2 -5
- package/build/dex/simple-exchange.js +4 -32
- package/build/dex/simple-exchange.js.map +1 -1
- package/build/dex/smoothy/smoothy.d.ts +16 -0
- package/build/dex/smoothy/smoothy.js +58 -0
- package/build/dex/smoothy/smoothy.js.map +1 -0
- package/build/dex/smoothy/types.d.ts +15 -0
- package/build/dex/smoothy/types.js +8 -0
- package/build/dex/smoothy/types.js.map +1 -0
- package/build/dex/smoothy.d.ts +2 -1
- package/build/dex/smoothy.js +13 -0
- package/build/dex/smoothy.js.map +1 -1
- package/build/dex/solidly/solidly.d.ts +2 -1
- package/build/dex/solidly/solidly.js +30 -0
- package/build/dex/solidly/solidly.js.map +1 -1
- package/build/dex/solidly-v3/contract-math/Tick.js.map +1 -1
- package/build/dex/solidly-v3/contract-math/uniswap-v3-math.js +4 -4
- package/build/dex/solidly-v3/contract-math/uniswap-v3-math.js.map +1 -1
- package/build/dex/solidly-v3/solidly-v3.d.ts +2 -3
- package/build/dex/solidly-v3/solidly-v3.js +25 -37
- package/build/dex/solidly-v3/solidly-v3.js.map +1 -1
- package/build/dex/stable-pool/stable-pool.d.ts +16 -0
- package/build/dex/stable-pool/stable-pool.js +78 -0
- package/build/dex/stable-pool/stable-pool.js.map +1 -0
- package/build/dex/stable-pool/types.d.ts +17 -0
- package/build/dex/stable-pool/types.js +8 -0
- package/build/dex/stable-pool/types.js.map +1 -0
- package/build/dex/stable-pool.d.ts +2 -1
- package/build/dex/stable-pool.js +19 -0
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +10 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/swaap-v2/rate-fetcher.d.ts +1 -1
- package/build/dex/swaap-v2/rate-fetcher.js +4 -4
- package/build/dex/swaap-v2/rate-fetcher.js.map +1 -1
- package/build/dex/swaap-v2/swaap-v2.d.ts +3 -1
- package/build/dex/swaap-v2/swaap-v2.js +17 -1
- package/build/dex/swaap-v2/swaap-v2.js.map +1 -1
- package/build/dex/swaap-v2/validators.d.ts +1 -0
- package/build/dex/swaap-v2/validators.js +9 -12
- package/build/dex/swaap-v2/validators.js.map +1 -1
- package/build/dex/swell/swell.d.ts +2 -1
- package/build/dex/swell/swell.js +12 -2
- package/build/dex/swell/swell.js.map +1 -1
- package/build/dex/synthetix/synthetix.d.ts +2 -1
- package/build/dex/synthetix/synthetix.js +24 -0
- package/build/dex/synthetix/synthetix.js.map +1 -1
- package/build/dex/trader-joe-v2.1/config.d.ts +4 -0
- package/build/dex/trader-joe-v2.1/config.js +11 -0
- package/build/dex/trader-joe-v2.1/config.js.map +1 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1.d.ts +19 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1.js +98 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1.js.map +1 -0
- package/build/dex/trader-joe-v2.1/types.d.ts +31 -0
- package/build/dex/trader-joe-v2.1/types.js +9 -0
- package/build/dex/trader-joe-v2.1/types.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +2 -1
- package/build/dex/trader-joe-v2.1.js +28 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -1
- package/build/dex/uniswap-v2/config.js +36 -0
- package/build/dex/uniswap-v2/config.js.map +1 -1
- package/build/dex/uniswap-v2/constants.js +7 -6
- package/build/dex/uniswap-v2/constants.js.map +1 -1
- package/build/dex/uniswap-v2/dfyn.d.ts +4 -2
- package/build/dex/uniswap-v2/dfyn.js +13 -0
- package/build/dex/uniswap-v2/dfyn.js.map +1 -1
- package/build/dex/uniswap-v2/types.d.ts +19 -0
- package/build/dex/uniswap-v2/types.js +6 -1
- package/build/dex/uniswap-v2/types.js.map +1 -1
- package/build/dex/uniswap-v2/uniswap-v2-optimizer.d.ts +2 -0
- package/build/dex/uniswap-v2/uniswap-v2-optimizer.js +75 -0
- package/build/dex/uniswap-v2/uniswap-v2-optimizer.js.map +1 -0
- package/build/dex/uniswap-v2/uniswap-v2.d.ts +15 -4
- package/build/dex/uniswap-v2/uniswap-v2.js +124 -1
- package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/constants.d.ts +4 -0
- package/build/dex/uniswap-v3/constants.js +6 -1
- package/build/dex/uniswap-v3/constants.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +15 -0
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +13 -4
- package/build/dex/uniswap-v3/uniswap-v3.js +130 -27
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/uniswap-v3.d.ts +2 -1
- package/build/dex/uniswap-v3.js +28 -0
- package/build/dex/uniswap-v3.js.map +1 -1
- package/build/dex/weth/weth.d.ts +3 -1
- package/build/dex/weth/weth.js +17 -2
- package/build/dex/weth/weth.js.map +1 -1
- package/build/dex/wombat/wombat.d.ts +3 -2
- package/build/dex/wombat/wombat.js +20 -0
- package/build/dex/wombat/wombat.js.map +1 -1
- package/build/dex/woo-fi-v2/woo-fi-v2.d.ts +2 -1
- package/build/dex/woo-fi-v2/woo-fi-v2.js +27 -0
- package/build/dex/woo-fi-v2/woo-fi-v2.js.map +1 -1
- package/build/dex/wsteth/wsteth.d.ts +2 -1
- package/build/dex/wsteth/wsteth.js +9 -0
- package/build/dex/wsteth/wsteth.js.map +1 -1
- package/build/dex/zerox/config.d.ts +2 -0
- package/build/dex/zerox/config.js +33 -0
- package/build/dex/zerox/config.js.map +1 -0
- package/build/dex/zerox/index.d.ts +3 -25
- package/build/dex/zerox/index.js +49 -42
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +29 -0
- package/build/dex/zerox/types.js +8 -1
- package/build/dex/zerox/types.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.d.ts +2 -0
- package/build/dex-helper/dummy-dex-helper.js +20 -1
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/icache.d.ts +2 -0
- package/build/dex-helper/idex-helper.d.ts +2 -0
- package/build/executor/Executor01BytecodeBuilder.d.ts +53 -0
- package/build/executor/Executor01BytecodeBuilder.js +253 -0
- package/build/executor/Executor01BytecodeBuilder.js.map +1 -0
- package/build/executor/Executor02BytecodeBuilder.d.ts +77 -0
- package/build/executor/Executor02BytecodeBuilder.js +717 -0
- package/build/executor/Executor02BytecodeBuilder.js.map +1 -0
- package/build/executor/Executor03BytecodeBuilder.d.ts +41 -0
- package/build/executor/Executor03BytecodeBuilder.js +226 -0
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -0
- package/build/executor/ExecutorBytecodeBuilder.d.ts +42 -0
- package/build/executor/ExecutorBytecodeBuilder.js +150 -0
- package/build/executor/ExecutorBytecodeBuilder.js.map +1 -0
- package/build/executor/ExecutorDetector.d.ts +16 -0
- package/build/executor/ExecutorDetector.js +93 -0
- package/build/executor/ExecutorDetector.js.map +1 -0
- package/build/executor/IExecutorBytecodeBuilder.d.ts +6 -0
- package/build/executor/IExecutorBytecodeBuilder.js +3 -0
- package/build/executor/IExecutorBytecodeBuilder.js.map +1 -0
- package/build/executor/constants.d.ts +18 -0
- package/build/executor/constants.js +49 -0
- package/build/executor/constants.js.map +1 -0
- package/build/executor/tests/utils-e2e-v6.d.ts +8 -0
- package/build/executor/tests/utils-e2e-v6.js +175 -0
- package/build/executor/tests/utils-e2e-v6.js.map +1 -0
- package/build/executor/types.d.ts +37 -0
- package/build/executor/types.js +46 -0
- package/build/executor/types.js.map +1 -0
- package/build/generic-swap-transaction-builder.d.ts +56 -0
- package/build/generic-swap-transaction-builder.js +306 -0
- package/build/generic-swap-transaction-builder.js.map +1 -0
- package/build/implementations/local-paraswap-sdk.d.ts +15 -9
- package/build/implementations/local-paraswap-sdk.js +43 -27
- package/build/implementations/local-paraswap-sdk.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/lib/curve/encoder.d.ts +5 -0
- package/build/lib/curve/encoder.js +13 -0
- package/build/lib/curve/encoder.js.map +1 -0
- package/build/transaction-builder.d.ts +13 -1
- package/build/transaction-builder.js +17 -0
- package/build/transaction-builder.js.map +1 -1
- package/build/types.d.ts +34 -1
- package/jest.config.js +1 -1
- package/package.json +2 -2
- package/src/abi/augustus-v6/ABI.json +1075 -0
- package/src/config.ts +59 -3
- package/src/constants.ts +10 -1
- package/src/dex/aave-v1/aave-v1-e2e.test.ts +4 -8
- package/src/dex/aave-v1/aave-v1.ts +44 -0
- package/src/dex/aave-v2/aave-v2-e2e.test.ts +8 -5
- package/src/dex/aave-v2/aave-v2.ts +104 -0
- package/src/dex/aave-v3/aave-v3-e2e.test.ts +7 -5
- package/src/dex/aave-v3/aave-v3.ts +63 -0
- package/src/dex/algebra/algebra-e2e.test.ts +42 -72
- package/src/dex/algebra/algebra.ts +70 -3
- package/src/dex/augustus-approvals.ts +175 -0
- package/src/dex/bProtocol/bProtocol-e2e.test.ts +93 -0
- package/src/dex/{bProtocol.ts → bProtocol/bProtocol.ts} +40 -14
- package/src/dex/bProtocol/types.ts +13 -0
- package/src/dex/balancer-v1/balancer-v1-e2e.test.ts +7 -5
- package/src/dex/balancer-v1/balancer-v1.ts +116 -14
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +303 -267
- package/src/dex/balancer-v2/balancer-v2.ts +295 -15
- package/src/dex/balancer-v2/constants.ts +5 -0
- package/src/dex/balancer-v2/types.ts +13 -0
- package/src/dex/bancor/bancor-e2e.test.ts +91 -0
- package/src/dex/{bancor.ts → bancor/bancor.ts} +46 -33
- package/src/dex/bancor/config.ts +9 -0
- package/src/dex/bancor/types.ts +19 -0
- package/src/dex/camelot/camelot-e2e.test.ts +72 -4
- package/src/dex/camelot/camelot.ts +50 -0
- package/src/dex/compound/compound-e2e.test.ts +91 -0
- package/src/dex/{compound.ts → compound/compound.ts} +39 -17
- package/src/dex/compound/types.ts +10 -0
- package/src/dex/curve-v1/constants.ts +1 -0
- package/src/dex/curve-v1/curve-v1-e2e.test.ts +124 -64
- package/src/dex/curve-v1/curve-v1.ts +108 -9
- package/src/dex/curve-v1/packer.ts +17 -0
- package/src/dex/curve-v1/types.ts +18 -0
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +9 -8
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +37 -7
- package/src/dex/curve-v1-factory/state-polling-pools/polling-manager.ts +3 -3
- package/src/dex/curve-v2/constants.ts +1 -0
- package/src/dex/curve-v2/curve-v2-e2e.test.ts +104 -0
- package/src/dex/{curve-v2.ts → curve-v2/curve-v2.ts} +143 -23
- package/src/dex/curve-v2/types.ts +27 -0
- package/src/dex/dexalot/dexalot-e2e.test.ts +8 -6
- package/src/dex/dexalot/dexalot.ts +46 -0
- package/src/dex/dodo-v1/config.ts +15 -0
- package/src/dex/dodo-v1/dodo-v1-e2e.test.ts +101 -0
- package/src/dex/{dodo-v1.ts → dodo-v1/dodo-v1.ts} +52 -48
- package/src/dex/dodo-v1/types.ts +25 -0
- package/src/dex/dodo-v2.ts +80 -1
- package/src/dex/generic-rfq/e2e-test-config.ts +50 -6
- package/src/dex/generic-rfq/fetch-mm-api.ts +2 -4
- package/src/dex/generic-rfq/generic-rfq-e2e.test.ts +3 -3
- package/src/dex/generic-rfq/generic-rfq.ts +128 -11
- package/src/dex/generic-rfq/rate-fetcher.ts +2 -3
- package/src/dex/generic-rfq/types.ts +19 -2
- package/src/dex/generic-rfq/utils.ts +3 -9
- package/src/dex/generic-rfq/validators.ts +12 -15
- package/src/dex/gmx/gmx-e2e.test.ts +11 -8
- package/src/dex/gmx/gmx.ts +27 -0
- package/src/dex/hashflow/hashflow-e2e.test.ts +7 -5
- package/src/dex/hashflow/hashflow.ts +48 -1
- package/src/dex/idex.ts +34 -0
- package/src/dex/index.ts +27 -10
- package/src/dex/jarvis-v6/jarvis-v6-e2e.test.ts +5 -4
- package/src/dex/jarvis-v6/jarvis-v6.ts +37 -0
- package/src/dex/jarvis.ts +68 -1
- package/src/dex/kyberdmm/kyberdmm-e2e.test.ts +8 -5
- package/src/dex/kyberdmm/kyberdmm.ts +36 -0
- package/src/dex/lido/config.ts +5 -0
- package/src/dex/lido/lido-e2e.test.ts +71 -0
- package/src/dex/{lido.ts → lido/lido.ts} +34 -16
- package/src/dex/lido/types.ts +5 -0
- package/src/dex/maker-psm/maker-psm-e2e.test.ts +37 -7
- package/src/dex/maker-psm/maker-psm.ts +52 -0
- package/src/dex/maverick-v1/maverick-v1-e2e.test.ts +108 -0
- package/src/dex/maverick-v1/maverick-v1.ts +51 -0
- package/src/dex/nerve/nerve-e2e.test.ts +114 -57
- package/src/dex/nerve/nerve.ts +36 -0
- package/src/dex/{onebit.ts → onebit/onebit.ts} +43 -21
- package/src/dex/onebit/types.ts +17 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +19 -5
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +46 -0
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders.ts +34 -0
- package/src/dex/paraswap-limit-orders/types.ts +1 -0
- package/src/dex/platypus/platypus-e2e.test.ts +5 -4
- package/src/dex/platypus/platypus.ts +43 -0
- package/src/dex/polygon-migrator/polygon-migrator-e2e.test.ts +7 -5
- package/src/dex/polygon-migrator/polygon-migrator.ts +26 -0
- package/src/dex/quick-perps/quick-perps-e2e.test.ts +4 -3
- package/src/dex/quick-perps/quick-perps.ts +28 -0
- package/src/dex/quickswap/quickswap-e2e.test.ts +7 -5
- package/src/dex/simple-exchange.ts +16 -60
- package/src/dex/smoothy/smoothy-e2e.test.ts +81 -0
- package/src/dex/{smoothy.ts → smoothy/smoothy.ts} +34 -24
- package/src/dex/smoothy/types.ts +18 -0
- package/src/dex/solidly/solidly-e2e.test.ts +122 -0
- package/src/dex/solidly/solidly.ts +49 -0
- package/src/dex/solidly-v3/contract-math/Tick.ts +1 -4
- package/src/dex/solidly-v3/contract-math/uniswap-v3-math.ts +6 -14
- package/src/dex/solidly-v3/solidly-v3-e2e.test.ts +7 -5
- package/src/dex/solidly-v3/solidly-v3-events.test.ts +9 -7
- package/src/dex/solidly-v3/solidly-v3.ts +40 -52
- package/src/dex/{stable-pool.ts → stable-pool/stable-pool.ts} +45 -32
- package/src/dex/stable-pool/stablepool-e2e.test.ts +73 -0
- package/src/dex/stable-pool/types.ts +20 -0
- package/src/dex/swaap-v1/swaap-v1-e2e.test.ts +7 -5
- package/src/dex/swaap-v1/swaap-v1.ts +32 -0
- package/src/dex/swaap-v2/rate-fetcher.ts +6 -4
- package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +7 -5
- package/src/dex/swaap-v2/swaap-v2.ts +39 -2
- package/src/dex/swaap-v2/validators.ts +12 -15
- package/src/dex/swell/swell-e2e.test.ts +4 -3
- package/src/dex/swell/swell.ts +27 -2
- package/src/dex/synthetix/synthetix-e2e.test.ts +5 -4
- package/src/dex/synthetix/synthetix.ts +38 -0
- package/src/dex/trader-joe-v2.1/config.ts +9 -0
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1-e2e.test.ts +101 -0
- package/src/dex/{trader-joe-v2.1.ts → trader-joe-v2.1/trader-joe-v2.1.ts} +63 -48
- package/src/dex/trader-joe-v2.1/types.ts +38 -0
- package/src/dex/uniswap-v2/config.ts +42 -0
- package/src/dex/uniswap-v2/constants.ts +8 -6
- package/src/dex/uniswap-v2/dfyn.ts +44 -3
- package/src/dex/uniswap-v2/types.ts +22 -0
- package/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +16 -13
- package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +33 -17
- package/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts +424 -5
- package/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts +145 -46
- package/src/dex/uniswap-v2/uniswap-v2-optimizer.ts +114 -0
- package/src/dex/uniswap-v2/uniswap-v2.ts +206 -2
- package/src/dex/uniswap-v3/constants.ts +5 -0
- package/src/dex/uniswap-v3/types.ts +17 -0
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +460 -402
- package/src/dex/uniswap-v3/uniswap-v3.ts +217 -43
- package/src/dex/uniswap-v3.ts +52 -1
- package/src/dex/weth/weth-e2e.test.ts +69 -38
- package/src/dex/weth/weth.ts +29 -5
- package/src/dex/wombat/wombat-e2e.test.ts +5 -4
- package/src/dex/wombat/wombat.ts +32 -1
- package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +5 -4
- package/src/dex/woo-fi-v2/woo-fi-v2.ts +42 -0
- package/src/dex/wsteth/wsteth-e2e.test.ts +4 -3
- package/src/dex/wsteth/wsteth.ts +24 -0
- package/src/dex/zerox/config.ts +31 -0
- package/src/dex/zerox/index.ts +63 -67
- package/src/dex/zerox/types.ts +34 -0
- package/src/dex/zerox/zerox-e2e.test.ts +110 -0
- package/src/dex-helper/dummy-dex-helper.ts +28 -1
- package/src/dex-helper/icache.ts +4 -0
- package/src/dex-helper/idex-helper.ts +2 -0
- package/src/executor/Executor01BytecodeBuilder.ts +433 -0
- package/src/executor/Executor02BytecodeBuilder.ts +1329 -0
- package/src/executor/Executor03BytecodeBuilder.ts +419 -0
- package/src/executor/ExecutorBytecodeBuilder.ts +350 -0
- package/src/executor/ExecutorDetector.ts +117 -0
- package/src/executor/__snapshots__/executor01-bytecode-builder-snapshot.test.ts.snap +35 -0
- package/src/executor/__snapshots__/executor02-bytecode-builder-snapshot.test.ts.snap +23 -0
- package/src/executor/constants.ts +59 -0
- package/src/executor/executor01-bytecode-builder-e2e.test.ts +1439 -0
- package/src/executor/executor01-bytecode-builder-snapshot.test.ts +271 -0
- package/src/executor/executor02-bytecode-builder-e2e.test.ts +1489 -0
- package/src/executor/executor02-bytecode-builder-snapshot.test.ts +188 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
- package/src/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
- package/src/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
- package/src/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
- package/src/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
- package/src/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
- package/src/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
- package/src/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
- package/src/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
- package/src/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
- package/src/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
- package/src/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
- package/src/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
- package/src/executor/types.ts +41 -0
- package/src/generic-swap-transaction-builder.ts +679 -0
- package/src/implementations/local-paraswap-sdk.ts +70 -29
- package/src/index.ts +1 -0
- package/src/lib/curve/encoder.ts +19 -0
- package/src/transaction-builder.ts +45 -1
- package/src/types.ts +35 -1
- package/tests/augustus-approvals.test.ts +628 -0
- package/tests/constants-e2e.ts +167 -35
- package/tests/debug-price-route.json +68 -0
- package/tests/debug-price-route.test.ts +55 -0
- package/tests/tenderly-simulation.ts +54 -5
- package/tests/utils-e2e.ts +347 -53
- package/tests/v6/executors.test.ts +110 -0
- package/tests/v6/price-routes/arbitrum/sell-0.1-ETH-USDC.json +104 -0
- package/tests/v6/price-routes/arbitrum/sell-1_000-ETH-DAI.json +294 -0
- package/tests/v6/price-routes/arbitrum/sell-1_000-WETH-wstETH.json +121 -0
- package/tests/v6/price-routes/arbitrum/sell-1_000_000-ARB-DAI.json +270 -0
- package/tests/v6/price-routes/arbitrum/sell-1_000_000-ARB-ETH.json +326 -0
- package/tests/v6/price-routes/arbitrum/sell-1_000_000-DAI-ARB.json +434 -0
- package/tests/v6/price-routes/arbitrum/sell-250_000-LINK-USDC.json +182 -0
- package/tests/v6/price-routes/arbitrum/sell-3_000-BAL-UNI.json +154 -0
- package/tests/v6/price-routes/avalanche/sell-100_000-WAVAX-USDC.json +315 -0
- package/tests/v6/price-routes/avalanche/sell-40-BTC-AVAX.json +207 -0
- package/tests/v6/price-routes/fantom/test.json +161 -0
- package/tests/v6/price-routes/mainnet/buy-3200-ETH-DAI.json +228 -0
- package/tests/v6/price-routes/mainnet/buy-usdc.json +233 -0
- package/tests/v6/price-routes/mainnet/executor-01.json +93 -0
- package/tests/v6/price-routes/mainnet/executor01-test copy.json +88 -0
- package/tests/v6/price-routes/mainnet/executor01-test.json +88 -0
- package/tests/v6/price-routes/mainnet/sell-1-USDC-USDT.json +78 -0
- package/tests/v6/price-routes/mainnet/sell-1-WBTC-BAL.json +158 -0
- package/tests/v6/price-routes/mainnet/sell-100-tBTC-WBTC.json +100 -0
- package/tests/v6/price-routes/mainnet/sell-1000-eth-dai.json +340 -0
- package/tests/v6/price-routes/mainnet/sell-1000-wbtc-eth-uniswapv3-balancerv2.json +162 -0
- package/tests/v6/price-routes/mainnet/sell-100_000-USDC-USDT-2-univ2-pools.json +86 -0
- package/tests/v6/price-routes/mainnet/sell-10_000-ETH-USDC-balancer.json +383 -0
- package/tests/v6/price-routes/mainnet/sell-10_000-ETH-stETH.json +168 -0
- package/tests/v6/price-routes/mainnet/sell-10_000-USDC-USDT-BalancerV2.json +68 -0
- package/tests/v6/price-routes/mainnet/sell-10_000-eth-usdc-uniswapv3-balancerv2.json +348 -0
- package/tests/v6/price-routes/mainnet/sell-1_000-stETH-ETH.json +100 -0
- package/tests/v6/price-routes/mainnet/sell-50-eth-usdc.json +153 -0
- package/tests/v6/price-routes/polygon/sell-100-WBTC-MATIC-1.json +571 -0
- package/tests/v6/price-routes/polygon/sell-100-WBTC-MATIC.json +559 -0
- package/tests/v6/price-routes/polygon/sell-1_000_000-DAI-MATIC-2.json +447 -0
- package/tests/v6/price-routes/polygon/sell-1_000_000-DAI-MATIC-3.json +472 -0
- package/tests/v6/price-routes/polygon/sell-1_000_000-DAI-MATIC.json +628 -0
- package/tests/v6/price-routes/polygon/test.json +109 -0
- package/tests/v6/utils-e2e-v6.ts +177 -0
- package/build/abi/algebra/AlgebraPool.abi.json +0 -727
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/wombat/pool.json +0 -1289
- package/build/dex/algebra/algebra-pool.d.ts +0 -46
- package/build/dex/algebra/algebra-pool.js +0 -336
- package/build/dex/algebra/algebra-pool.js.map +0 -1
- package/build/dex/quickswap/camelot-v3.d.ts +0 -6
- package/build/dex/quickswap/camelot-v3.js +0 -19
- package/build/dex/quickswap/camelot-v3.js.map +0 -1
- package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
- package/build/dex/quickswap/zyberswap-v3.js +0 -19
- package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
- package/build/dex/uniswap-v2/rebase-tokens.json +0 -7
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
PoolLiquidity,
|
|
8
8
|
Logger,
|
|
9
9
|
PoolPrices,
|
|
10
|
+
NumberAsString,
|
|
11
|
+
DexExchangeParam,
|
|
10
12
|
} from '../../types';
|
|
11
13
|
import { SwapSide, Network } from '../../constants';
|
|
12
14
|
import { getDexKeysWithNetwork, getBigIntPow } from '../../utils';
|
|
@@ -449,6 +451,41 @@ export class JarvisV6
|
|
|
449
451
|
);
|
|
450
452
|
}
|
|
451
453
|
|
|
454
|
+
getDexParam(
|
|
455
|
+
srcToken: Address,
|
|
456
|
+
destToken: Address,
|
|
457
|
+
srcAmount: NumberAsString,
|
|
458
|
+
destAmount: NumberAsString,
|
|
459
|
+
recipient: Address,
|
|
460
|
+
data: JarvisV6Data,
|
|
461
|
+
side: SwapSide,
|
|
462
|
+
): DexExchangeParam {
|
|
463
|
+
const { swapFunction } = data;
|
|
464
|
+
const timestamp = (Date.now() / 1000 + THIRTY_MINUTES).toFixed(0);
|
|
465
|
+
|
|
466
|
+
let swapFunctionParams: JarvisV6Params;
|
|
467
|
+
switch (swapFunction) {
|
|
468
|
+
case JarvisSwapFunctions.MINT:
|
|
469
|
+
swapFunctionParams = ['1', srcAmount, timestamp, recipient];
|
|
470
|
+
break;
|
|
471
|
+
case JarvisSwapFunctions.REDEEM:
|
|
472
|
+
swapFunctionParams = [srcAmount, '1', timestamp, recipient];
|
|
473
|
+
break;
|
|
474
|
+
default:
|
|
475
|
+
throw new Error(`Unknown function ${swapFunction}`);
|
|
476
|
+
}
|
|
477
|
+
const exchangeData = this.poolInterface.encodeFunctionData(swapFunction, [
|
|
478
|
+
swapFunctionParams,
|
|
479
|
+
]);
|
|
480
|
+
|
|
481
|
+
return {
|
|
482
|
+
needWrapNative: this.needWrapNative,
|
|
483
|
+
dexFuncHasRecipient: true,
|
|
484
|
+
exchangeData,
|
|
485
|
+
targetExchange: data.poolAddress.toLowerCase(),
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
452
489
|
// Returns list of top pools based on liquidity. Max
|
|
453
490
|
// limit number pools should be returned.
|
|
454
491
|
async getTopPoolsForToken(
|
package/src/dex/jarvis.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
2
2
|
import { NULL_ADDRESS, SwapSide } from '../constants';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AdapterExchangeParam,
|
|
5
|
+
Address,
|
|
6
|
+
DexExchangeParam,
|
|
7
|
+
NumberAsString,
|
|
8
|
+
SimpleExchangeParam,
|
|
9
|
+
} from '../types';
|
|
4
10
|
import { IDexTxBuilder } from './idex';
|
|
5
11
|
import { SimpleExchange } from './simple-exchange';
|
|
6
12
|
import JarvisABI from '../abi/Jarvis.json';
|
|
@@ -178,4 +184,65 @@ export class Jarvis
|
|
|
178
184
|
data.pools[0],
|
|
179
185
|
);
|
|
180
186
|
}
|
|
187
|
+
|
|
188
|
+
getDexParam(
|
|
189
|
+
srcToken: Address,
|
|
190
|
+
destToken: Address,
|
|
191
|
+
srcAmount: NumberAsString,
|
|
192
|
+
destAmount: NumberAsString,
|
|
193
|
+
recipient: Address,
|
|
194
|
+
data: JarvisData,
|
|
195
|
+
side: SwapSide,
|
|
196
|
+
): DexExchangeParam {
|
|
197
|
+
const swapFunction = data.method;
|
|
198
|
+
const timestamp = (Date.now() / 1000 + THIRTY_MINUTES).toFixed(0);
|
|
199
|
+
let swapFunctionParams: JarvisParam;
|
|
200
|
+
switch (swapFunction) {
|
|
201
|
+
case JarvisFunctions.mint:
|
|
202
|
+
swapFunctionParams = [
|
|
203
|
+
data.derivatives,
|
|
204
|
+
destAmount,
|
|
205
|
+
srcAmount,
|
|
206
|
+
data.fee,
|
|
207
|
+
timestamp,
|
|
208
|
+
recipient,
|
|
209
|
+
];
|
|
210
|
+
break;
|
|
211
|
+
case JarvisFunctions.redeem:
|
|
212
|
+
swapFunctionParams = [
|
|
213
|
+
data.derivatives,
|
|
214
|
+
srcAmount,
|
|
215
|
+
destAmount,
|
|
216
|
+
data.fee,
|
|
217
|
+
timestamp,
|
|
218
|
+
recipient,
|
|
219
|
+
];
|
|
220
|
+
break;
|
|
221
|
+
case JarvisFunctions.exchange:
|
|
222
|
+
swapFunctionParams = [
|
|
223
|
+
data.derivatives,
|
|
224
|
+
data.pools[1],
|
|
225
|
+
data.destDerivatives!,
|
|
226
|
+
srcAmount,
|
|
227
|
+
destAmount,
|
|
228
|
+
data.fee,
|
|
229
|
+
timestamp,
|
|
230
|
+
recipient,
|
|
231
|
+
];
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
throw new Error(`Unknown function ${swapFunction}`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const swapData = this.poolInterface.encodeFunctionData(swapFunction, [
|
|
238
|
+
swapFunctionParams,
|
|
239
|
+
]);
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
needWrapNative: this.needWrapNative,
|
|
243
|
+
dexFuncHasRecipient: true,
|
|
244
|
+
exchangeData: swapData,
|
|
245
|
+
targetExchange: data.pools[0],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
181
248
|
}
|
|
@@ -92,7 +92,7 @@ describe('KyberDmm E2E', () => {
|
|
|
92
92
|
);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
describe('KyberDmm
|
|
95
|
+
describe('KyberDmm POLYGON_V6', () => {
|
|
96
96
|
const network = Network.POLYGON;
|
|
97
97
|
const tokens = Tokens[network];
|
|
98
98
|
const holders = Holders[network];
|
|
@@ -113,12 +113,15 @@ describe('KyberDmm E2E', () => {
|
|
|
113
113
|
[
|
|
114
114
|
SwapSide.SELL,
|
|
115
115
|
[
|
|
116
|
-
ContractMethod.
|
|
117
|
-
ContractMethod.
|
|
118
|
-
ContractMethod.
|
|
116
|
+
// ContractMethod.swapExactAmountIn,
|
|
117
|
+
// ContractMethod.simpleSwap,
|
|
118
|
+
// ContractMethod.multiSwap,
|
|
119
|
+
// ContractMethod.megaSwap,
|
|
120
|
+
ContractMethod.swapExactAmountIn,
|
|
119
121
|
],
|
|
120
122
|
],
|
|
121
|
-
[SwapSide.BUY, [ContractMethod.simpleBuy]],
|
|
123
|
+
// [SwapSide.BUY, [ContractMethod.simpleBuy]],
|
|
124
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
122
125
|
]);
|
|
123
126
|
|
|
124
127
|
sideToContractMethods.forEach((contractMethods, side) =>
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
PoolLiquidity,
|
|
20
20
|
SimpleExchangeParam,
|
|
21
21
|
Token,
|
|
22
|
+
NumberAsString,
|
|
23
|
+
Address,
|
|
24
|
+
DexExchangeParam,
|
|
22
25
|
} from '../../types';
|
|
23
26
|
import {
|
|
24
27
|
KyberDmmData,
|
|
@@ -229,6 +232,39 @@ export class KyberDmm
|
|
|
229
232
|
);
|
|
230
233
|
}
|
|
231
234
|
|
|
235
|
+
getDexParam(
|
|
236
|
+
srcToken: Address,
|
|
237
|
+
destToken: Address,
|
|
238
|
+
srcAmount: NumberAsString,
|
|
239
|
+
destAmount: NumberAsString,
|
|
240
|
+
recipient: Address,
|
|
241
|
+
data: KyberDmmData,
|
|
242
|
+
side: SwapSide,
|
|
243
|
+
): DexExchangeParam {
|
|
244
|
+
const isSell = side === SwapSide.SELL;
|
|
245
|
+
const swapFunctionParams: KyberDmmParam = [
|
|
246
|
+
isSell ? srcAmount : destAmount,
|
|
247
|
+
isSell ? destAmount : srcAmount,
|
|
248
|
+
data.pools.map(p => p.address),
|
|
249
|
+
data.path,
|
|
250
|
+
recipient,
|
|
251
|
+
Number.MAX_SAFE_INTEGER.toString(),
|
|
252
|
+
];
|
|
253
|
+
const exchangeData = this.exchangeRouterInterface.encodeFunctionData(
|
|
254
|
+
isSell
|
|
255
|
+
? KyberDMMFunctions.swapExactTokensForTokens
|
|
256
|
+
: KyberDMMFunctions.swapTokensForExactTokens,
|
|
257
|
+
swapFunctionParams,
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
needWrapNative: this.needWrapNative,
|
|
262
|
+
dexFuncHasRecipient: true,
|
|
263
|
+
exchangeData,
|
|
264
|
+
targetExchange: data.router,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
232
268
|
private async addPool(
|
|
233
269
|
pair: KyberDmmPair,
|
|
234
270
|
poolAddress: string,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
dotenv.config();
|
|
3
|
+
|
|
4
|
+
import { testE2E } from '../../../tests/utils-e2e';
|
|
5
|
+
import { Tokens, Holders } from '../../../tests/constants-e2e';
|
|
6
|
+
|
|
7
|
+
import { ContractMethod, Network, SwapSide } from '../../constants';
|
|
8
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
9
|
+
import { generateConfig } from '../../config';
|
|
10
|
+
|
|
11
|
+
const dexKey = 'lido';
|
|
12
|
+
|
|
13
|
+
const testForNetwork = (
|
|
14
|
+
network: Network,
|
|
15
|
+
swapMap: Map<SwapSide, ContractMethod[]>,
|
|
16
|
+
) => {
|
|
17
|
+
const tokens = Tokens[network];
|
|
18
|
+
const holders = Holders[network];
|
|
19
|
+
|
|
20
|
+
const provider = new StaticJsonRpcProvider(
|
|
21
|
+
generateConfig(network).privateHttpProvider,
|
|
22
|
+
network,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const tokensToTest = [
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
symbol: 'ETH',
|
|
29
|
+
amount: '100000000000000000000',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
symbol: 'STETH',
|
|
33
|
+
amount: '100000000000000000000',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
swapMap.forEach((contractMethods, side) =>
|
|
39
|
+
contractMethods.forEach((contractMethod: string) => {
|
|
40
|
+
tokensToTest.forEach(pair => {
|
|
41
|
+
describe(`${contractMethod}`, () => {
|
|
42
|
+
it(`${pair[0].symbol} -> ${pair[1].symbol}`, async () => {
|
|
43
|
+
await testE2E(
|
|
44
|
+
tokens[pair[0].symbol],
|
|
45
|
+
tokens[pair[1].symbol],
|
|
46
|
+
holders[pair[0].symbol],
|
|
47
|
+
side === SwapSide.SELL ? pair[0].amount : pair[1].amount,
|
|
48
|
+
side,
|
|
49
|
+
dexKey,
|
|
50
|
+
contractMethod as any,
|
|
51
|
+
network,
|
|
52
|
+
provider,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Ensure you have the E2E_ENDPOINT_URL env variable set.
|
|
62
|
+
|
|
63
|
+
describe('Lido (stETH) E2E', () => {
|
|
64
|
+
describe('Mainnet V6', () => {
|
|
65
|
+
const swapMap = new Map<SwapSide, ContractMethod[]>([
|
|
66
|
+
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
testForNetwork(Network.MAINNET, swapMap);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
2
2
|
import { NumberAsString, SwapSide } from '@paraswap/core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
submit = 'submit',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type LidoData = {};
|
|
3
|
+
import {
|
|
4
|
+
AdapterExchangeParam,
|
|
5
|
+
Address,
|
|
6
|
+
DexExchangeParam,
|
|
7
|
+
SimpleExchangeParam,
|
|
8
|
+
} from '../../types';
|
|
9
|
+
import { IDexTxBuilder } from '../idex';
|
|
10
|
+
import stETHAbi from '../../abi/stETH.json';
|
|
11
|
+
import { NULL_ADDRESS } from '../../constants';
|
|
12
|
+
import { IDexHelper } from '../../dex-helper';
|
|
13
|
+
import { LidoData, stETHFunctions } from './types';
|
|
14
|
+
import { stETH } from './config';
|
|
19
15
|
|
|
20
16
|
export class Lido implements IDexTxBuilder<LidoData, any> {
|
|
21
17
|
static dexKeys = ['lido'];
|
|
@@ -66,4 +62,26 @@ export class Lido implements IDexTxBuilder<LidoData, any> {
|
|
|
66
62
|
networkFee: '0',
|
|
67
63
|
};
|
|
68
64
|
}
|
|
65
|
+
|
|
66
|
+
getDexParam(
|
|
67
|
+
_srcToken: Address,
|
|
68
|
+
_destToken: Address,
|
|
69
|
+
_srcAmount: NumberAsString,
|
|
70
|
+
_destAmount: NumberAsString,
|
|
71
|
+
_recipient: Address,
|
|
72
|
+
_data: LidoData,
|
|
73
|
+
_side: SwapSide,
|
|
74
|
+
): DexExchangeParam {
|
|
75
|
+
const swapData = this.stETHInterface.encodeFunctionData(
|
|
76
|
+
stETHFunctions.submit,
|
|
77
|
+
[NULL_ADDRESS],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
needWrapNative: this.needWrapNative,
|
|
82
|
+
dexFuncHasRecipient: false,
|
|
83
|
+
exchangeData: swapData,
|
|
84
|
+
targetExchange: stETH[this.network],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
69
87
|
}
|
|
@@ -14,7 +14,7 @@ import { generateConfig } from '../../config';
|
|
|
14
14
|
describe('MakerPsm E2E', () => {
|
|
15
15
|
const dexKey = 'MakerPsm';
|
|
16
16
|
|
|
17
|
-
describe('MakerPsm
|
|
17
|
+
describe('MakerPsm MAINNET_V6', () => {
|
|
18
18
|
const network = Network.MAINNET;
|
|
19
19
|
const tokens = Tokens[network];
|
|
20
20
|
const holders = Holders[network];
|
|
@@ -25,20 +25,24 @@ describe('MakerPsm E2E', () => {
|
|
|
25
25
|
|
|
26
26
|
const tokenASymbol: string = 'USDC';
|
|
27
27
|
const tokenBSymbol: string = 'DAI';
|
|
28
|
+
const nativeTokenSymbol = 'ETH';
|
|
28
29
|
|
|
29
|
-
const tokenAAmount: string = '
|
|
30
|
-
const tokenBAmount: string = '
|
|
30
|
+
const tokenAAmount: string = '10000000';
|
|
31
|
+
const tokenBAmount: string = '10000000000000000';
|
|
32
|
+
const nativeTokenAmount: string = '10000000000000000';
|
|
31
33
|
|
|
32
34
|
const sideToContractMethods = new Map([
|
|
33
35
|
[
|
|
34
36
|
SwapSide.SELL,
|
|
35
37
|
[
|
|
36
|
-
ContractMethod.
|
|
37
|
-
ContractMethod.
|
|
38
|
-
ContractMethod.
|
|
38
|
+
ContractMethod.swapExactAmountIn,
|
|
39
|
+
// ContractMethod.simpleSwap,
|
|
40
|
+
// ContractMethod.multiSwap,
|
|
41
|
+
// ContractMethod.megaSwap,
|
|
39
42
|
],
|
|
40
43
|
],
|
|
41
|
-
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
44
|
+
// [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
45
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
42
46
|
]);
|
|
43
47
|
|
|
44
48
|
sideToContractMethods.forEach((contractMethods, side) =>
|
|
@@ -71,6 +75,32 @@ describe('MakerPsm E2E', () => {
|
|
|
71
75
|
provider,
|
|
72
76
|
);
|
|
73
77
|
});
|
|
78
|
+
// it(`${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
|
|
79
|
+
// await testE2E(
|
|
80
|
+
// tokens[nativeTokenSymbol],
|
|
81
|
+
// tokens[tokenASymbol],
|
|
82
|
+
// holders[nativeTokenSymbol],
|
|
83
|
+
// side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
|
|
84
|
+
// side,
|
|
85
|
+
// dexKey,
|
|
86
|
+
// contractMethod,
|
|
87
|
+
// network,
|
|
88
|
+
// provider,
|
|
89
|
+
// );
|
|
90
|
+
// });
|
|
91
|
+
// it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
|
|
92
|
+
// await testE2E(
|
|
93
|
+
// tokens[tokenASymbol],
|
|
94
|
+
// tokens[nativeTokenSymbol],
|
|
95
|
+
// holders[tokenASymbol],
|
|
96
|
+
// side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
|
|
97
|
+
// side,
|
|
98
|
+
// dexKey,
|
|
99
|
+
// contractMethod,
|
|
100
|
+
// network,
|
|
101
|
+
// provider,
|
|
102
|
+
// );
|
|
103
|
+
// });
|
|
74
104
|
});
|
|
75
105
|
}),
|
|
76
106
|
);
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
SimpleExchangeParam,
|
|
12
12
|
PoolLiquidity,
|
|
13
13
|
Logger,
|
|
14
|
+
NumberAsString,
|
|
15
|
+
DexExchangeParam,
|
|
14
16
|
} from '../../types';
|
|
15
17
|
import { SwapSide, Network } from '../../constants';
|
|
16
18
|
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
@@ -24,6 +26,9 @@ import { MakerPsmConfig, Adapters } from './config';
|
|
|
24
26
|
import PsmABI from '../../abi/maker-psm/psm.json';
|
|
25
27
|
import VatABI from '../../abi/maker-psm/vat.json';
|
|
26
28
|
import { BI_POWS } from '../../bigint-constants';
|
|
29
|
+
import { SpecialDex } from '../../executor/types';
|
|
30
|
+
import { hexConcat, hexZeroPad, hexlify } from '@ethersproject/bytes';
|
|
31
|
+
import { ZEROS_12_BYTES } from '../../executor/constants';
|
|
27
32
|
|
|
28
33
|
const vatInterface = new Interface(VatABI);
|
|
29
34
|
const psmInterface = new Interface(PsmABI);
|
|
@@ -491,6 +496,53 @@ export class MakerPsm extends SimpleExchange implements IDex<MakerPsmData> {
|
|
|
491
496
|
);
|
|
492
497
|
}
|
|
493
498
|
|
|
499
|
+
getDexParam(
|
|
500
|
+
srcToken: Address,
|
|
501
|
+
destToken: Address,
|
|
502
|
+
srcAmount: NumberAsString,
|
|
503
|
+
destAmount: NumberAsString,
|
|
504
|
+
recipient: Address,
|
|
505
|
+
data: MakerPsmData,
|
|
506
|
+
side: SwapSide,
|
|
507
|
+
): DexExchangeParam {
|
|
508
|
+
const { isGemSell, gemAmount } = this.getPsmParams(
|
|
509
|
+
srcToken,
|
|
510
|
+
srcAmount,
|
|
511
|
+
destAmount,
|
|
512
|
+
data,
|
|
513
|
+
side,
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
let exchangeData = psmInterface.encodeFunctionData(
|
|
517
|
+
isGemSell ? 'sellGem' : 'buyGem',
|
|
518
|
+
[recipient, gemAmount],
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
// append toll and to18ConversionFactor & set specialDexFlag = SWAP_ON_MAKER_PSM to
|
|
522
|
+
// - `buyGem` on Ex1 & Ex2
|
|
523
|
+
// - `sellGem` on Ex3
|
|
524
|
+
let specialDexFlag = SpecialDex.DEFAULT;
|
|
525
|
+
if (
|
|
526
|
+
(side === SwapSide.SELL && !isGemSell) ||
|
|
527
|
+
(side === SwapSide.BUY && isGemSell)
|
|
528
|
+
) {
|
|
529
|
+
exchangeData = hexConcat([
|
|
530
|
+
exchangeData,
|
|
531
|
+
hexZeroPad(hexlify(BigInt(data.toll)), 32),
|
|
532
|
+
hexZeroPad(hexlify(getBigIntPow(18 - data.gemDecimals)), 32),
|
|
533
|
+
]);
|
|
534
|
+
specialDexFlag = SpecialDex.SWAP_ON_MAKER_PSM;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return {
|
|
538
|
+
needWrapNative: this.needWrapNative,
|
|
539
|
+
dexFuncHasRecipient: true,
|
|
540
|
+
exchangeData,
|
|
541
|
+
targetExchange: data.psmAddress,
|
|
542
|
+
specialDexFlag,
|
|
543
|
+
spender: isGemSell ? data.gemJoinAddress : data.psmAddress,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
494
546
|
// Returns list of top pools based on liquidity. Max
|
|
495
547
|
// limit number pools should be returned.
|
|
496
548
|
async getTopPoolsForToken(
|
|
@@ -215,6 +215,114 @@ describe('MaverickV1 E2E', () => {
|
|
|
215
215
|
});
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
+
describe('MAINNET_V6', () => {
|
|
219
|
+
const network = Network.MAINNET;
|
|
220
|
+
const tokens = Tokens[network];
|
|
221
|
+
const holders = Holders[network];
|
|
222
|
+
const provider = new StaticJsonRpcProvider(
|
|
223
|
+
generateConfig(network).privateHttpProvider,
|
|
224
|
+
network,
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
it('swapExactAmountOut USDT -> USDC', async () => {
|
|
228
|
+
await testE2E(
|
|
229
|
+
tokens['USDT'],
|
|
230
|
+
tokens['USDC'],
|
|
231
|
+
holders['USDT'],
|
|
232
|
+
'1000',
|
|
233
|
+
SwapSide.BUY,
|
|
234
|
+
dexKey,
|
|
235
|
+
ContractMethod.swapExactAmountOut,
|
|
236
|
+
network,
|
|
237
|
+
provider,
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('swapExactAmountOut WETH -> USDC', async () => {
|
|
242
|
+
await testE2E(
|
|
243
|
+
tokens['WETH'],
|
|
244
|
+
tokens['USDC'],
|
|
245
|
+
holders['WETH'],
|
|
246
|
+
'1700000000',
|
|
247
|
+
SwapSide.BUY,
|
|
248
|
+
dexKey,
|
|
249
|
+
ContractMethod.swapExactAmountOut,
|
|
250
|
+
network,
|
|
251
|
+
provider,
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('swapExactAmountOut WETH -> USDC', async () => {
|
|
256
|
+
await testE2E(
|
|
257
|
+
tokens['WETH'],
|
|
258
|
+
tokens['USDC'],
|
|
259
|
+
holders['WETH'],
|
|
260
|
+
'100000000',
|
|
261
|
+
SwapSide.BUY,
|
|
262
|
+
dexKey,
|
|
263
|
+
ContractMethod.swapExactAmountOut,
|
|
264
|
+
network,
|
|
265
|
+
provider,
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('swapExactAmountIn USDC -> USDT', async () => {
|
|
270
|
+
await testE2E(
|
|
271
|
+
tokens['USDC'],
|
|
272
|
+
tokens['USDT'],
|
|
273
|
+
holders['USDC'],
|
|
274
|
+
'1000',
|
|
275
|
+
SwapSide.SELL,
|
|
276
|
+
dexKey,
|
|
277
|
+
ContractMethod.swapExactAmountIn,
|
|
278
|
+
network,
|
|
279
|
+
provider,
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('swapExactAmountIn WETH -> USDC', async () => {
|
|
284
|
+
await testE2E(
|
|
285
|
+
tokens['WETH'],
|
|
286
|
+
tokens['USDC'],
|
|
287
|
+
holders['WETH'],
|
|
288
|
+
'1000000000000000000',
|
|
289
|
+
SwapSide.SELL,
|
|
290
|
+
dexKey,
|
|
291
|
+
ContractMethod.swapExactAmountIn,
|
|
292
|
+
network,
|
|
293
|
+
provider,
|
|
294
|
+
);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('swapExactAmountIn WETH -> USDC', async () => {
|
|
298
|
+
await testE2E(
|
|
299
|
+
tokens['WETH'],
|
|
300
|
+
tokens['USDC'],
|
|
301
|
+
holders['WETH'],
|
|
302
|
+
'1000000000000000000',
|
|
303
|
+
SwapSide.SELL,
|
|
304
|
+
dexKey,
|
|
305
|
+
ContractMethod.swapExactAmountIn,
|
|
306
|
+
network,
|
|
307
|
+
provider,
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it('swapExactAmountIn USDT -> ETH', async () => {
|
|
312
|
+
await testE2E(
|
|
313
|
+
tokens['USDT'],
|
|
314
|
+
tokens['USDC'],
|
|
315
|
+
holders['USDT'],
|
|
316
|
+
'100000000',
|
|
317
|
+
SwapSide.SELL,
|
|
318
|
+
dexKey,
|
|
319
|
+
ContractMethod.swapExactAmountIn,
|
|
320
|
+
network,
|
|
321
|
+
provider,
|
|
322
|
+
);
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
|
|
218
326
|
describe('BASE', () => {
|
|
219
327
|
const network = Network.BASE;
|
|
220
328
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
SimpleExchangeParam,
|
|
10
10
|
PoolLiquidity,
|
|
11
11
|
Logger,
|
|
12
|
+
DexExchangeParam,
|
|
12
13
|
} from '../../types';
|
|
13
14
|
import { SwapSide, Network } from '../../constants';
|
|
14
15
|
import { getDexKeysWithNetwork, getBigIntPow, isTruthy } from '../../utils';
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
} from './subgraph-queries';
|
|
40
41
|
import { SUBGRAPH_TIMEOUT } from '../../constants';
|
|
41
42
|
import RouterABI from '../../abi/maverick-v1/router.json';
|
|
43
|
+
import { NumberAsString } from '@paraswap/core';
|
|
42
44
|
|
|
43
45
|
const MAX_POOL_CNT = 1000;
|
|
44
46
|
|
|
@@ -354,6 +356,55 @@ export class MaverickV1
|
|
|
354
356
|
};
|
|
355
357
|
}
|
|
356
358
|
|
|
359
|
+
getDexParam(
|
|
360
|
+
srcToken: Address,
|
|
361
|
+
destToken: Address,
|
|
362
|
+
srcAmount: NumberAsString,
|
|
363
|
+
destAmount: NumberAsString,
|
|
364
|
+
recipient: Address,
|
|
365
|
+
data: MaverickV1Data,
|
|
366
|
+
side: SwapSide,
|
|
367
|
+
): DexExchangeParam {
|
|
368
|
+
const swapFunction =
|
|
369
|
+
side === SwapSide.SELL
|
|
370
|
+
? MaverickV1Functions.exactInputSingle
|
|
371
|
+
: MaverickV1Functions.exactOutputSingle;
|
|
372
|
+
|
|
373
|
+
const swapFunctionParams: MaverickV1Param =
|
|
374
|
+
side === SwapSide.SELL
|
|
375
|
+
? {
|
|
376
|
+
recipient,
|
|
377
|
+
deadline: getLocalDeadlineAsFriendlyPlaceholder(),
|
|
378
|
+
amountIn: srcAmount,
|
|
379
|
+
amountOutMinimum: destAmount,
|
|
380
|
+
tokenIn: srcToken,
|
|
381
|
+
tokenOut: destToken,
|
|
382
|
+
pool: data.pool,
|
|
383
|
+
sqrtPriceLimitD18: '0',
|
|
384
|
+
}
|
|
385
|
+
: {
|
|
386
|
+
recipient,
|
|
387
|
+
deadline: getLocalDeadlineAsFriendlyPlaceholder(),
|
|
388
|
+
amountOut: destAmount,
|
|
389
|
+
amountInMaximum: srcAmount,
|
|
390
|
+
tokenIn: srcToken,
|
|
391
|
+
tokenOut: destToken,
|
|
392
|
+
pool: data.pool,
|
|
393
|
+
sqrtPriceLimitD18: '0',
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const exchangeData = this.routerIface.encodeFunctionData(swapFunction, [
|
|
397
|
+
swapFunctionParams,
|
|
398
|
+
]);
|
|
399
|
+
|
|
400
|
+
return {
|
|
401
|
+
needWrapNative: this.needWrapNative,
|
|
402
|
+
dexFuncHasRecipient: true,
|
|
403
|
+
exchangeData,
|
|
404
|
+
targetExchange: this.config.routerAddress,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
|
|
357
408
|
async getSimpleParam(
|
|
358
409
|
srcToken: string,
|
|
359
410
|
destToken: string,
|