@paraswap/dex-lib 2.28.9-take-surplus.0 → 2.28.9-take-surplus.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/RamsesV2StateMulticall.abi.json +891 -0
- package/build/abi/aerodrome/aerodrome-pool-factory.json +586 -0
- package/build/abi/algebra/AlgebraFactory-v1_1.abi.json +250 -0
- package/build/abi/api3-proxy.json +53 -0
- package/build/abi/api3-server-v1.json +463 -0
- package/build/abi/nomiswap-v2/nomiswap-v2-pool.json +773 -0
- package/build/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/build/abi/quick-perps/fast-price-events.json +70 -0
- package/build/abi/quick-perps/fast-price-feed.json +741 -0
- package/build/abi/quick-perps/reader.json +313 -0
- package/build/abi/quick-perps/vault-price-feed.json +323 -0
- package/build/abi/quick-perps/vault.json +1953 -0
- package/build/abi/quickPerps/fast-price-events.json +70 -0
- package/build/abi/quickPerps/fast-price-feed.json +748 -0
- package/build/abi/quickPerps/reader.json +313 -0
- package/build/abi/quickPerps/vault-price-feed.json +477 -0
- package/build/abi/quickPerps/vault.json +1953 -0
- package/build/abi/ramses-v2/RamsesV2Pool.abi.json +1599 -0
- package/build/abi/uniswap-v3/UniswapV3Factory.abi.json +148 -0
- package/build/abi/uniswap-v3/UniswapV3QuoterV2.abi.json +155 -0
- package/build/composed-event-subscriber.js +8 -2
- package/build/composed-event-subscriber.js.map +1 -1
- package/build/config.d.ts +0 -1
- package/build/config.js +75 -14
- package/build/config.js.map +1 -1
- package/build/constants.d.ts +2 -1
- package/build/constants.js +1 -0
- package/build/constants.js.map +1 -1
- package/build/dex/algebra/algebra-factory.d.ts +25 -0
- package/build/dex/algebra/algebra-factory.js +43 -0
- package/build/dex/algebra/algebra-factory.js.map +1 -0
- package/build/dex/algebra/algebra-pool-v1_1.d.ts +16 -2
- package/build/dex/algebra/algebra-pool-v1_1.js +166 -4
- package/build/dex/algebra/algebra-pool-v1_1.js.map +1 -1
- package/build/dex/algebra/algebra.d.ts +4 -1
- package/build/dex/algebra/algebra.js +42 -21
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +1 -0
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/algebra/lib/TickTable.js +51 -40
- package/build/dex/algebra/lib/TickTable.js.map +1 -1
- package/build/dex/algebra/types.d.ts +5 -2
- package/build/dex/algebra/utils.d.ts +3 -1
- package/build/dex/algebra/utils.js +59 -1
- package/build/dex/algebra/utils.js.map +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +79 -6
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/config.js +10 -2
- package/build/dex/balancer-v2/config.js.map +1 -1
- package/build/dex/balancer-v2/optimizer.js +38 -51
- package/build/dex/balancer-v2/optimizer.js.map +1 -1
- package/build/dex/balancer-v2/types.d.ts +0 -4
- package/build/dex/balancer-v2/types.js.map +1 -1
- package/build/dex/curve-v1/config.js +40 -38
- package/build/dex/curve-v1/config.js.map +1 -1
- package/build/dex/curve-v1-factory/config.js +17 -9
- package/build/dex/curve-v1-factory/config.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +205 -182
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.d.ts +2 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js +8 -2
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js +2 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js +61 -14
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js +10 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js +11 -4
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.d.ts +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js +2 -2
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/types.d.ts +4 -1
- package/build/dex/curve-v1-factory/types.js +1 -0
- package/build/dex/curve-v1-factory/types.js.map +1 -1
- package/build/dex/generic-rfq/generic-rfq.d.ts +2 -1
- package/build/dex/generic-rfq/generic-rfq.js +9 -5
- package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
- package/build/dex/generic-rfq/rate-fetcher.d.ts +1 -1
- package/build/dex/generic-rfq/rate-fetcher.js +2 -1
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/generic-rfq/types.d.ts +1 -0
- package/build/dex/generic-rfq/types.js.map +1 -1
- package/build/dex/hashflow/hashflow.d.ts +1 -0
- package/build/dex/hashflow/hashflow.js +1 -0
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/idex.d.ts +1 -0
- package/build/dex/index.d.ts +1 -0
- package/build/dex/index.js +21 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/maverick-v1/config.js +9 -0
- package/build/dex/maverick-v1/config.js.map +1 -1
- package/build/dex/maverick-v1/maverick-v1.js +11 -2
- package/build/dex/maverick-v1/maverick-v1.js.map +1 -1
- package/build/dex/maverick-v1/scripts/event-sequence.d.ts +1 -0
- package/build/dex/maverick-v1/scripts/event-sequence.js +110 -0
- package/build/dex/maverick-v1/scripts/event-sequence.js.map +1 -0
- package/build/dex/pancakeswap-v3/config.js +17 -0
- package/build/dex/pancakeswap-v3/config.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.d.ts +26 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js +44 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js.map +1 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +3 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +26 -2
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/quick-perps/config.d.ts +11 -0
- package/build/dex/quick-perps/config.js +27 -0
- package/build/dex/quick-perps/config.js.map +1 -0
- package/build/dex/quick-perps/fast-price-feed.d.ts +26 -0
- package/build/dex/quick-perps/fast-price-feed.js +176 -0
- package/build/dex/quick-perps/fast-price-feed.js.map +1 -0
- package/build/dex/quick-perps/pool.d.ts +21 -0
- package/build/dex/quick-perps/pool.js +225 -0
- package/build/dex/quick-perps/pool.js.map +1 -0
- package/build/dex/quick-perps/quick-perps.d.ts +52 -0
- package/build/dex/quick-perps/quick-perps.js +211 -0
- package/build/dex/quick-perps/quick-perps.js.map +1 -0
- package/build/dex/quick-perps/types.d.ts +98 -0
- package/build/dex/quick-perps/types.js +3 -0
- package/build/dex/quick-perps/types.js.map +1 -0
- package/build/dex/quick-perps/usdq.d.ts +15 -0
- package/build/dex/quick-perps/usdq.js +61 -0
- package/build/dex/quick-perps/usdq.js.map +1 -0
- package/build/dex/quick-perps/vault-price-feed.d.ts +43 -0
- package/build/dex/quick-perps/vault-price-feed.js +194 -0
- package/build/dex/quick-perps/vault-price-feed.js.map +1 -0
- package/build/dex/quick-perps/vault-utils.d.ts +8 -0
- package/build/dex/quick-perps/vault-utils.js +41 -0
- package/build/dex/quick-perps/vault-utils.js.map +1 -0
- package/build/dex/quick-perps/vault.d.ts +46 -0
- package/build/dex/quick-perps/vault.js +166 -0
- package/build/dex/quick-perps/vault.js.map +1 -0
- package/build/dex/solidly/config.js +52 -2
- package/build/dex/solidly/config.js.map +1 -1
- package/build/dex/solidly/forks-override/aerodrome.d.ts +14 -0
- package/build/dex/solidly/forks-override/aerodrome.js +48 -0
- package/build/dex/solidly/forks-override/aerodrome.js.map +1 -0
- package/build/dex/solidly/forks-override/equalizer.d.ts +20 -0
- package/build/dex/solidly/forks-override/equalizer.js +46 -0
- package/build/dex/solidly/forks-override/equalizer.js.map +1 -0
- package/build/dex/solidly/forks-override/ramses.d.ts +44 -0
- package/build/dex/solidly/forks-override/ramses.js +144 -0
- package/build/dex/solidly/forks-override/ramses.js.map +1 -0
- package/build/dex/solidly/forks-override/velodromeV2.d.ts +20 -0
- package/build/dex/solidly/forks-override/velodromeV2.js +50 -0
- package/build/dex/solidly/forks-override/velodromeV2.js.map +1 -0
- package/build/dex/solidly/solidly.js +4 -0
- package/build/dex/solidly/solidly.js.map +1 -1
- package/build/dex/uniswap-v2/nomiswap-v2.d.ts +24 -0
- package/build/dex/uniswap-v2/nomiswap-v2.js +44 -0
- package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -0
- package/build/dex/uniswap-v3/config.js +166 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.d.ts +19 -0
- package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js +99 -0
- package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js.map +1 -0
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.d.ts +4 -0
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.js +63 -0
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.js.map +1 -0
- package/build/dex/uniswap-v3/types.d.ts +10 -1
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-factory.d.ts +26 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js +44 -0
- package/build/dex/uniswap-v3/uniswap-v3-factory.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +8 -6
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +5 -2
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +7 -4
- package/build/dex/uniswap-v3/uniswap-v3.js +51 -10
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/weth/config.js +3 -0
- package/build/dex/weth/config.js.map +1 -1
- package/build/dex/woo-fi-v2/config.js +13 -0
- package/build/dex/woo-fi-v2/config.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.js +7 -1
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/icache.d.ts +1 -0
- package/build/lib/api3-feed.d.ts +30 -0
- package/build/lib/api3-feed.js +100 -0
- package/build/lib/api3-feed.js.map +1 -0
- package/build/lib/decoders.d.ts +3 -0
- package/build/lib/decoders.js +9 -1
- package/build/lib/decoders.js.map +1 -1
- package/build/stateful-event-subscriber.d.ts +1 -0
- package/build/stateful-event-subscriber.js +6 -0
- package/build/stateful-event-subscriber.js.map +1 -1
- package/build/types.d.ts +2 -0
- package/build/workers.d.ts +0 -0
- package/build/workers.js +2 -0
- package/build/workers.js.map +1 -0
- package/package.json +1 -1
- package/src/abi/RamsesV2Pool.abi.json +1554 -0
- package/src/abi/RamsesV2Quoter.abi.json +274 -0
- package/src/abi/RamsesV2StateMulticall.abi.json +891 -0
- package/src/abi/aerodrome/aerodrome-pool-factory.json +586 -0
- package/src/abi/algebra/AlgebraFactory-v1_1.abi.json +250 -0
- package/src/abi/api3-proxy.json +53 -0
- package/src/abi/api3-server-v1.json +463 -0
- package/src/abi/nomiswap-v2/nomiswap-v2-pool.json +773 -0
- package/src/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
- package/src/abi/quick-perps/fast-price-events.json +70 -0
- package/src/abi/quick-perps/fast-price-feed.json +741 -0
- package/src/abi/quick-perps/reader.json +313 -0
- package/src/abi/quick-perps/vault-price-feed.json +323 -0
- package/src/abi/quick-perps/vault.json +1953 -0
- package/src/abi/ramses-v2/RamsesV2Pool.abi.json +1599 -0
- package/src/composed-event-subscriber.ts +16 -11
- package/src/config.ts +80 -14
- package/src/constants.ts +1 -0
- package/src/dex/algebra/algebra-factory.ts +70 -0
- package/src/dex/algebra/algebra-integration.test.ts +316 -16
- package/src/dex/algebra/algebra-pool-v1_1.ts +259 -8
- package/src/dex/algebra/algebra.ts +73 -22
- package/src/dex/algebra/config.ts +1 -0
- package/src/dex/algebra/lib/TickTable.ts +75 -74
- package/src/dex/algebra/types.ts +6 -2
- package/src/dex/algebra/utils.ts +83 -2
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +133 -4
- package/src/dex/balancer-v2/balancer-v2.ts +87 -6
- package/src/dex/balancer-v2/config.ts +11 -2
- package/src/dex/balancer-v2/optimizer.ts +49 -62
- package/src/dex/balancer-v2/types.ts +0 -4
- package/src/dex/curve-v1/config.ts +40 -38
- package/src/dex/curve-v1-factory/config.ts +17 -9
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +19 -0
- package/src/dex/curve-v1-factory/curve-v1-factory-integration.test.ts +165 -45
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +477 -415
- package/src/dex/curve-v1-factory/curve-v1-pool-manager.ts +15 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_rates.ts +2 -1
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp_mem.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.ts +71 -13
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/constants.ts +11 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D.ts +2 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_mem.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y_D.ts +1 -0
- package/src/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.ts +13 -5
- package/src/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.ts +2 -1
- package/src/dex/curve-v1-factory/types.ts +3 -1
- package/src/dex/generic-rfq/example-api.test.ts +1 -1
- package/src/dex/generic-rfq/generic-rfq.ts +12 -4
- package/src/dex/generic-rfq/rate-fetcher.ts +4 -2
- package/src/dex/generic-rfq/types.ts +1 -0
- package/src/dex/hashflow/hashflow-e2e.test.ts +36 -3
- package/src/dex/hashflow/hashflow.ts +2 -1
- package/src/dex/idex.ts +1 -0
- package/src/dex/index.ts +21 -0
- package/src/dex/maverick-v1/config.ts +10 -0
- package/src/dex/maverick-v1/maverick-v1-e2e.test.ts +115 -1
- package/src/dex/maverick-v1/maverick-v1.ts +12 -2
- package/src/dex/pancakeswap-v3/config.ts +19 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +114 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-factory.ts +73 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +50 -2
- package/src/dex/quick-perps/config.ts +31 -0
- package/src/dex/quick-perps/fast-price-feed.ts +279 -0
- package/src/dex/quick-perps/pool.ts +407 -0
- package/src/dex/quick-perps/quick-perps-e2e.test.ts +65 -0
- package/src/dex/quick-perps/quick-perps-events.test.ts +100 -0
- package/src/dex/quick-perps/quick-perps-integration.test.ts +153 -0
- package/src/dex/quick-perps/quick-perps.ts +302 -0
- package/src/dex/quick-perps/types.ts +97 -0
- package/src/dex/quick-perps/usdq.ts +83 -0
- package/src/dex/quick-perps/vault-price-feed.ts +322 -0
- package/src/dex/quick-perps/vault-utils.ts +53 -0
- package/src/dex/quick-perps/vault.ts +290 -0
- package/src/dex/solidly/config.ts +58 -2
- package/src/dex/solidly/forks-override/aerodrome.ts +53 -0
- package/src/dex/solidly/forks-override/equalizer.ts +58 -0
- package/src/dex/solidly/forks-override/ramses.ts +253 -0
- package/src/dex/solidly/forks-override/velodromeV2.ts +63 -0
- package/src/dex/solidly/solidly-e2e.test.ts +313 -1
- package/src/dex/solidly/solidly-integration.test.ts +540 -41
- package/src/dex/solidly/solidly.ts +5 -0
- package/src/dex/uniswap-v2/nomiswap-v2.ts +63 -0
- package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +120 -1
- package/src/dex/uniswap-v3/config.ts +174 -0
- package/src/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.ts +156 -0
- package/src/dex/uniswap-v3/forks/ramses-v2/utils.ts +72 -0
- package/src/dex/uniswap-v3/types.ts +14 -1
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +1071 -346
- package/src/dex/uniswap-v3/uniswap-v3-factory.ts +73 -0
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +787 -14
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +13 -5
- package/src/dex/uniswap-v3/uniswap-v3.ts +87 -20
- package/src/dex/weth/config.ts +3 -0
- package/src/dex/woo-fi-v2/config.ts +13 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +64 -0
- package/src/dex-helper/dummy-dex-helper.ts +8 -1
- package/src/dex-helper/icache.ts +2 -0
- package/src/lib/api3-feed.ts +175 -0
- package/src/lib/decoders.ts +13 -0
- package/src/stateful-event-subscriber.ts +8 -0
- package/src/types.ts +2 -0
- package/tests/constants-e2e.ts +102 -6
- package/tests/tenderly-simulation.ts +48 -4
- package/tests/utils-e2e.ts +21 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import dotenv from 'dotenv';
|
|
2
3
|
dotenv.config();
|
|
3
4
|
|
|
@@ -12,6 +13,10 @@ import solidlyPairABI from '../../abi/solidly/SolidlyPair.json';
|
|
|
12
13
|
import { SpiritSwapV2 } from './forks-override/spiritSwapV2';
|
|
13
14
|
import { Cone } from './forks-override/cone';
|
|
14
15
|
import { Chronos } from './forks-override/chronos';
|
|
16
|
+
import { Ramses } from './forks-override/ramses';
|
|
17
|
+
import * as util from 'util';
|
|
18
|
+
import { VelodromeV2 } from './forks-override/velodromeV2';
|
|
19
|
+
import { Equalizer } from './forks-override/equalizer';
|
|
15
20
|
|
|
16
21
|
const amounts18 = [0n, BI_POWS[18], 2000000000000000000n];
|
|
17
22
|
const amounts6 = [0n, BI_POWS[6], 2000000n];
|
|
@@ -43,7 +48,7 @@ function decodeReaderResult(
|
|
|
43
48
|
const constructCheckOnChainPricing =
|
|
44
49
|
(dexHelper: DummyDexHelper) =>
|
|
45
50
|
async (
|
|
46
|
-
|
|
51
|
+
solidly: Solidly,
|
|
47
52
|
funcName: string,
|
|
48
53
|
blockNumber: number,
|
|
49
54
|
prices: bigint[],
|
|
@@ -60,7 +65,7 @@ const constructCheckOnChainPricing =
|
|
|
60
65
|
funcName,
|
|
61
66
|
tokenIn,
|
|
62
67
|
);
|
|
63
|
-
|
|
68
|
+
|
|
64
69
|
const readerResult = (
|
|
65
70
|
await dexHelper.multiContract.methods
|
|
66
71
|
.aggregate(readerCallData)
|
|
@@ -70,6 +75,8 @@ const constructCheckOnChainPricing =
|
|
|
70
75
|
decodeReaderResult(readerResult, readerIface, funcName),
|
|
71
76
|
);
|
|
72
77
|
|
|
78
|
+
console.log('ON-CHAIN PRICES: ', expectedPrices);
|
|
79
|
+
|
|
73
80
|
expect(prices.map(p => p.toString())).toEqual(
|
|
74
81
|
expectedPrices.map(p => p.toString()),
|
|
75
82
|
);
|
|
@@ -83,7 +90,7 @@ describe('Solidly integration tests', () => {
|
|
|
83
90
|
|
|
84
91
|
describe('Solidly', function () {
|
|
85
92
|
const dexKey = 'Solidly';
|
|
86
|
-
const
|
|
93
|
+
const solidly = new Solidly(network, dexKey, dexHelper);
|
|
87
94
|
|
|
88
95
|
describe('UniswapV2 like pool', function () {
|
|
89
96
|
const TokenASymbol = 'WFTM';
|
|
@@ -95,7 +102,7 @@ describe('Solidly integration tests', () => {
|
|
|
95
102
|
|
|
96
103
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
97
104
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
98
|
-
const pools = await
|
|
105
|
+
const pools = await solidly.getPoolIdentifiers(
|
|
99
106
|
tokenA,
|
|
100
107
|
tokenB,
|
|
101
108
|
SwapSide.SELL,
|
|
@@ -108,7 +115,7 @@ describe('Solidly integration tests', () => {
|
|
|
108
115
|
|
|
109
116
|
expect(pools.length).toBeGreaterThan(0);
|
|
110
117
|
|
|
111
|
-
const poolPrices = await
|
|
118
|
+
const poolPrices = await solidly.getPricesVolume(
|
|
112
119
|
tokenA,
|
|
113
120
|
tokenB,
|
|
114
121
|
amounts,
|
|
@@ -126,13 +133,13 @@ describe('Solidly integration tests', () => {
|
|
|
126
133
|
|
|
127
134
|
// Check if onchain pricing equals to calculated ones
|
|
128
135
|
|
|
129
|
-
for (const
|
|
136
|
+
for (const poolPrice of poolPrices || []) {
|
|
130
137
|
await checkOnChainPricing(
|
|
131
|
-
|
|
138
|
+
solidly,
|
|
132
139
|
'getAmountOut',
|
|
133
140
|
blocknumber,
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
poolPrice.prices,
|
|
142
|
+
poolPrice.poolAddresses![0],
|
|
136
143
|
tokenA.address,
|
|
137
144
|
amounts,
|
|
138
145
|
);
|
|
@@ -140,7 +147,7 @@ describe('Solidly integration tests', () => {
|
|
|
140
147
|
});
|
|
141
148
|
|
|
142
149
|
it('getTopPoolsForToken', async function () {
|
|
143
|
-
const poolLiquidity = await
|
|
150
|
+
const poolLiquidity = await solidly.getTopPoolsForToken(
|
|
144
151
|
tokenA.address,
|
|
145
152
|
10,
|
|
146
153
|
);
|
|
@@ -160,7 +167,7 @@ describe('Solidly integration tests', () => {
|
|
|
160
167
|
|
|
161
168
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
162
169
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
163
|
-
const pools = await
|
|
170
|
+
const pools = await solidly.getPoolIdentifiers(
|
|
164
171
|
tokenA,
|
|
165
172
|
tokenB,
|
|
166
173
|
SwapSide.SELL,
|
|
@@ -173,7 +180,7 @@ describe('Solidly integration tests', () => {
|
|
|
173
180
|
|
|
174
181
|
expect(pools.length).toBeGreaterThan(0);
|
|
175
182
|
|
|
176
|
-
const poolPrices = await
|
|
183
|
+
const poolPrices = await solidly.getPricesVolume(
|
|
177
184
|
tokenA,
|
|
178
185
|
tokenB,
|
|
179
186
|
amounts,
|
|
@@ -190,13 +197,13 @@ describe('Solidly integration tests', () => {
|
|
|
190
197
|
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
191
198
|
|
|
192
199
|
// Check if onchain pricing equals to calculated ones
|
|
193
|
-
for (const
|
|
200
|
+
for (const poolPrice of poolPrices || []) {
|
|
194
201
|
await checkOnChainPricing(
|
|
195
|
-
|
|
202
|
+
solidly,
|
|
196
203
|
'getAmountOut',
|
|
197
204
|
blocknumber,
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
poolPrice.prices,
|
|
206
|
+
poolPrice.poolAddresses![0],
|
|
200
207
|
tokenA.address,
|
|
201
208
|
amounts,
|
|
202
209
|
);
|
|
@@ -204,7 +211,7 @@ describe('Solidly integration tests', () => {
|
|
|
204
211
|
});
|
|
205
212
|
|
|
206
213
|
it('getTopPoolsForToken', async function () {
|
|
207
|
-
const poolLiquidity = await
|
|
214
|
+
const poolLiquidity = await solidly.getTopPoolsForToken(
|
|
208
215
|
tokenA.address,
|
|
209
216
|
10,
|
|
210
217
|
);
|
|
@@ -260,13 +267,13 @@ describe('Solidly integration tests', () => {
|
|
|
260
267
|
|
|
261
268
|
// Check if onchain pricing equals to calculated ones
|
|
262
269
|
|
|
263
|
-
for (const
|
|
270
|
+
for (const poolPrice of poolPrices || []) {
|
|
264
271
|
await checkOnChainPricing(
|
|
265
272
|
spiritSwapV2,
|
|
266
273
|
'getAmountOut',
|
|
267
274
|
blocknumber,
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
poolPrice.prices,
|
|
276
|
+
poolPrice.poolAddresses![0],
|
|
270
277
|
tokenA.address,
|
|
271
278
|
amounts,
|
|
272
279
|
);
|
|
@@ -324,13 +331,13 @@ describe('Solidly integration tests', () => {
|
|
|
324
331
|
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
325
332
|
|
|
326
333
|
// Check if onchain pricing equals to calculated ones
|
|
327
|
-
for (const
|
|
334
|
+
for (const poolPrice of poolPrices || []) {
|
|
328
335
|
await checkOnChainPricing(
|
|
329
336
|
spiritSwapV2,
|
|
330
337
|
'getAmountOut',
|
|
331
338
|
blocknumber,
|
|
332
|
-
|
|
333
|
-
|
|
339
|
+
poolPrice.prices,
|
|
340
|
+
poolPrice.poolAddresses![0],
|
|
334
341
|
tokenA.address,
|
|
335
342
|
amounts,
|
|
336
343
|
);
|
|
@@ -348,6 +355,176 @@ describe('Solidly integration tests', () => {
|
|
|
348
355
|
});
|
|
349
356
|
});
|
|
350
357
|
});
|
|
358
|
+
|
|
359
|
+
describe('Equalizer', () => {
|
|
360
|
+
const dexKey = 'Equalizer';
|
|
361
|
+
const equalizer = new Equalizer(network, dexKey, dexHelper);
|
|
362
|
+
|
|
363
|
+
describe('UniswapV2 like pool', function () {
|
|
364
|
+
const TokenASymbol = 'WFTM';
|
|
365
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
366
|
+
const TokenBSymbol = 'FUSDT';
|
|
367
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
368
|
+
|
|
369
|
+
const amounts = amounts18;
|
|
370
|
+
|
|
371
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
372
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
373
|
+
const pools = await equalizer.getPoolIdentifiers(
|
|
374
|
+
tokenA,
|
|
375
|
+
tokenB,
|
|
376
|
+
SwapSide.SELL,
|
|
377
|
+
blocknumber,
|
|
378
|
+
);
|
|
379
|
+
console.log(
|
|
380
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
381
|
+
pools,
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
385
|
+
|
|
386
|
+
const poolPrices = await equalizer.getPricesVolume(
|
|
387
|
+
tokenA,
|
|
388
|
+
tokenB,
|
|
389
|
+
amounts,
|
|
390
|
+
SwapSide.SELL,
|
|
391
|
+
blocknumber,
|
|
392
|
+
pools,
|
|
393
|
+
);
|
|
394
|
+
console.log(
|
|
395
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
396
|
+
poolPrices,
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
expect(poolPrices).not.toBeNull();
|
|
400
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
401
|
+
|
|
402
|
+
// Check if onchain pricing equals to calculated ones
|
|
403
|
+
|
|
404
|
+
for (const poolPrice of poolPrices || []) {
|
|
405
|
+
await checkOnChainPricing(
|
|
406
|
+
equalizer,
|
|
407
|
+
'getAmountOut',
|
|
408
|
+
blocknumber,
|
|
409
|
+
poolPrice.prices,
|
|
410
|
+
poolPrice.poolAddresses![0],
|
|
411
|
+
tokenA.address,
|
|
412
|
+
amounts,
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
describe('Curve like stable pool', function () {
|
|
419
|
+
const TokenASymbol = 'FUSDT';
|
|
420
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
421
|
+
const TokenBSymbol = 'USDC';
|
|
422
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
423
|
+
|
|
424
|
+
const amounts = amounts6; // amounts6;
|
|
425
|
+
|
|
426
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
427
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
428
|
+
const pools = await equalizer.getPoolIdentifiers(
|
|
429
|
+
tokenA,
|
|
430
|
+
tokenB,
|
|
431
|
+
SwapSide.SELL,
|
|
432
|
+
blocknumber,
|
|
433
|
+
);
|
|
434
|
+
console.log(
|
|
435
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
436
|
+
pools,
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
440
|
+
|
|
441
|
+
const poolPrices = await equalizer.getPricesVolume(
|
|
442
|
+
tokenA,
|
|
443
|
+
tokenB,
|
|
444
|
+
amounts,
|
|
445
|
+
SwapSide.SELL,
|
|
446
|
+
blocknumber,
|
|
447
|
+
pools,
|
|
448
|
+
);
|
|
449
|
+
console.log(
|
|
450
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
451
|
+
poolPrices,
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
expect(poolPrices).not.toBeNull();
|
|
455
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
456
|
+
|
|
457
|
+
// Check if onchain pricing equals to calculated ones
|
|
458
|
+
for (const poolPrice of poolPrices || []) {
|
|
459
|
+
await checkOnChainPricing(
|
|
460
|
+
equalizer,
|
|
461
|
+
'getAmountOut',
|
|
462
|
+
blocknumber,
|
|
463
|
+
poolPrice.prices,
|
|
464
|
+
poolPrice.poolAddresses![0],
|
|
465
|
+
tokenA.address,
|
|
466
|
+
amounts,
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
describe('FTM -> EQUAL', () => {
|
|
473
|
+
const TokenASymbol = 'WFTM';
|
|
474
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
475
|
+
const TokenBSymbol = 'EQUAL';
|
|
476
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
477
|
+
|
|
478
|
+
const amounts = [0n, 10000000n];
|
|
479
|
+
|
|
480
|
+
console.log('AMOUNTS: ', amounts);
|
|
481
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
482
|
+
// const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
483
|
+
const blocknumber = 67666611;
|
|
484
|
+
const pools = await equalizer.getPoolIdentifiers(
|
|
485
|
+
tokenA,
|
|
486
|
+
tokenB,
|
|
487
|
+
SwapSide.SELL,
|
|
488
|
+
blocknumber,
|
|
489
|
+
);
|
|
490
|
+
console.log(
|
|
491
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
492
|
+
pools,
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
496
|
+
|
|
497
|
+
const poolPrices = await equalizer.getPricesVolume(
|
|
498
|
+
tokenA,
|
|
499
|
+
tokenB,
|
|
500
|
+
amounts,
|
|
501
|
+
SwapSide.SELL,
|
|
502
|
+
blocknumber,
|
|
503
|
+
pools,
|
|
504
|
+
);
|
|
505
|
+
console.log(
|
|
506
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
507
|
+
poolPrices,
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
expect(poolPrices).not.toBeNull();
|
|
511
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
512
|
+
|
|
513
|
+
// Check if onchain pricing equals to calculated ones
|
|
514
|
+
for (const poolPrice of poolPrices || []) {
|
|
515
|
+
await checkOnChainPricing(
|
|
516
|
+
equalizer,
|
|
517
|
+
'getAmountOut',
|
|
518
|
+
blocknumber,
|
|
519
|
+
poolPrice.prices,
|
|
520
|
+
poolPrice.poolAddresses![0],
|
|
521
|
+
tokenA.address,
|
|
522
|
+
amounts,
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
});
|
|
351
528
|
});
|
|
352
529
|
|
|
353
530
|
describe('Polygon', () => {
|
|
@@ -400,13 +577,13 @@ describe('Solidly integration tests', () => {
|
|
|
400
577
|
|
|
401
578
|
// Check if onchain pricing equals to calculated ones
|
|
402
579
|
|
|
403
|
-
for (const
|
|
580
|
+
for (const poolPrice of poolPrices || []) {
|
|
404
581
|
await checkOnChainPricing(
|
|
405
582
|
dystopia,
|
|
406
583
|
'getAmountOut',
|
|
407
584
|
blocknumber,
|
|
408
|
-
|
|
409
|
-
|
|
585
|
+
poolPrice.prices,
|
|
586
|
+
poolPrice.poolAddresses![0],
|
|
410
587
|
tokenA.address,
|
|
411
588
|
amounts,
|
|
412
589
|
);
|
|
@@ -464,13 +641,13 @@ describe('Solidly integration tests', () => {
|
|
|
464
641
|
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
465
642
|
|
|
466
643
|
// Check if onchain pricing equals to calculated ones
|
|
467
|
-
for (const
|
|
644
|
+
for (const poolPrice of poolPrices || []) {
|
|
468
645
|
await checkOnChainPricing(
|
|
469
646
|
dystopia,
|
|
470
647
|
'getAmountOut',
|
|
471
648
|
blocknumber,
|
|
472
|
-
|
|
473
|
-
|
|
649
|
+
poolPrice.prices,
|
|
650
|
+
poolPrice.poolAddresses![0],
|
|
474
651
|
tokenA.address,
|
|
475
652
|
amounts,
|
|
476
653
|
);
|
|
@@ -540,13 +717,13 @@ describe('Solidly integration tests', () => {
|
|
|
540
717
|
|
|
541
718
|
// Check if onchain pricing equals to calculated ones
|
|
542
719
|
|
|
543
|
-
for (const
|
|
720
|
+
for (const poolPrice of poolPrices || []) {
|
|
544
721
|
await checkOnChainPricing(
|
|
545
722
|
cone,
|
|
546
723
|
'getAmountOut',
|
|
547
724
|
blocknumber,
|
|
548
|
-
|
|
549
|
-
|
|
725
|
+
poolPrice.prices,
|
|
726
|
+
poolPrice.poolAddresses![0],
|
|
550
727
|
tokenA.address,
|
|
551
728
|
amounts,
|
|
552
729
|
);
|
|
@@ -604,13 +781,13 @@ describe('Solidly integration tests', () => {
|
|
|
604
781
|
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
605
782
|
|
|
606
783
|
// Check if onchain pricing equals to calculated ones
|
|
607
|
-
for (const
|
|
784
|
+
for (const poolPrice of poolPrices || []) {
|
|
608
785
|
await checkOnChainPricing(
|
|
609
786
|
cone,
|
|
610
787
|
'getAmountOut',
|
|
611
788
|
blocknumber,
|
|
612
|
-
|
|
613
|
-
|
|
789
|
+
poolPrice.prices,
|
|
790
|
+
poolPrice.poolAddresses![0],
|
|
614
791
|
tokenA.address,
|
|
615
792
|
amounts,
|
|
616
793
|
);
|
|
@@ -680,13 +857,13 @@ describe('Solidly integration tests', () => {
|
|
|
680
857
|
|
|
681
858
|
// Check if onchain pricing equals to calculated ones
|
|
682
859
|
|
|
683
|
-
for (const
|
|
860
|
+
for (const poolPrice of poolPrices || []) {
|
|
684
861
|
await checkOnChainPricing(
|
|
685
862
|
chronos,
|
|
686
863
|
'getAmountOut',
|
|
687
864
|
blocknumber,
|
|
688
|
-
|
|
689
|
-
|
|
865
|
+
poolPrice.prices,
|
|
866
|
+
poolPrice.poolAddresses![0],
|
|
690
867
|
tokenA.address,
|
|
691
868
|
amounts,
|
|
692
869
|
);
|
|
@@ -744,13 +921,13 @@ describe('Solidly integration tests', () => {
|
|
|
744
921
|
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
745
922
|
|
|
746
923
|
// Check if onchain pricing equals to calculated ones
|
|
747
|
-
for (const
|
|
924
|
+
for (const poolPrice of poolPrices || []) {
|
|
748
925
|
await checkOnChainPricing(
|
|
749
926
|
chronos,
|
|
750
927
|
'getAmountOut',
|
|
751
928
|
blocknumber,
|
|
752
|
-
|
|
753
|
-
|
|
929
|
+
poolPrice.prices,
|
|
930
|
+
poolPrice.poolAddresses![0],
|
|
754
931
|
tokenA.address,
|
|
755
932
|
amounts,
|
|
756
933
|
);
|
|
@@ -768,5 +945,327 @@ describe('Solidly integration tests', () => {
|
|
|
768
945
|
});
|
|
769
946
|
});
|
|
770
947
|
});
|
|
948
|
+
|
|
949
|
+
describe('Ramses', function () {
|
|
950
|
+
const dexKey = 'Ramses';
|
|
951
|
+
const ramses = new Ramses(network, dexKey, dexHelper);
|
|
952
|
+
|
|
953
|
+
describe('UniswapV2 like pool', function () {
|
|
954
|
+
const TokenASymbol = 'USDCe';
|
|
955
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
956
|
+
const TokenBSymbol = 'WETH';
|
|
957
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
958
|
+
|
|
959
|
+
const amounts = amounts18;
|
|
960
|
+
|
|
961
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
962
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
963
|
+
const pools = await ramses.getPoolIdentifiers(
|
|
964
|
+
tokenA,
|
|
965
|
+
tokenB,
|
|
966
|
+
SwapSide.SELL,
|
|
967
|
+
blocknumber,
|
|
968
|
+
);
|
|
969
|
+
console.log(
|
|
970
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
971
|
+
pools,
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
975
|
+
|
|
976
|
+
console.log('AMOUNTS: ', amounts);
|
|
977
|
+
|
|
978
|
+
const poolPrices = await ramses.getPricesVolume(
|
|
979
|
+
tokenA,
|
|
980
|
+
tokenB,
|
|
981
|
+
amounts,
|
|
982
|
+
SwapSide.SELL,
|
|
983
|
+
blocknumber,
|
|
984
|
+
pools,
|
|
985
|
+
);
|
|
986
|
+
console.log(
|
|
987
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
988
|
+
util.inspect(poolPrices, false, null, true),
|
|
989
|
+
);
|
|
990
|
+
|
|
991
|
+
expect(poolPrices).not.toBeNull();
|
|
992
|
+
// checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
993
|
+
|
|
994
|
+
// Check if onchain pricing equals to calculated ones
|
|
995
|
+
|
|
996
|
+
for (const poolPrice of poolPrices || []) {
|
|
997
|
+
await checkOnChainPricing(
|
|
998
|
+
ramses,
|
|
999
|
+
'getAmountOut',
|
|
1000
|
+
blocknumber,
|
|
1001
|
+
poolPrice.prices,
|
|
1002
|
+
poolPrice.poolAddresses![0],
|
|
1003
|
+
tokenA.address,
|
|
1004
|
+
amounts,
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
it('getTopPoolsForToken', async function () {
|
|
1010
|
+
const poolLiquidity = await ramses.getTopPoolsForToken(
|
|
1011
|
+
tokenA.address,
|
|
1012
|
+
10,
|
|
1013
|
+
);
|
|
1014
|
+
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
|
|
1015
|
+
|
|
1016
|
+
checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
|
|
1017
|
+
});
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
describe('Curve like stable pool', function () {
|
|
1021
|
+
const TokenASymbol = 'USDT';
|
|
1022
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
1023
|
+
const TokenBSymbol = 'USDCe';
|
|
1024
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
1025
|
+
|
|
1026
|
+
const amounts = amounts6;
|
|
1027
|
+
|
|
1028
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
1029
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1030
|
+
const pools = await ramses.getPoolIdentifiers(
|
|
1031
|
+
tokenA,
|
|
1032
|
+
tokenB,
|
|
1033
|
+
SwapSide.SELL,
|
|
1034
|
+
blocknumber,
|
|
1035
|
+
);
|
|
1036
|
+
console.log(
|
|
1037
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1038
|
+
pools,
|
|
1039
|
+
);
|
|
1040
|
+
|
|
1041
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1042
|
+
|
|
1043
|
+
const poolPrices = await ramses.getPricesVolume(
|
|
1044
|
+
tokenA,
|
|
1045
|
+
tokenB,
|
|
1046
|
+
amounts,
|
|
1047
|
+
SwapSide.SELL,
|
|
1048
|
+
blocknumber,
|
|
1049
|
+
pools,
|
|
1050
|
+
);
|
|
1051
|
+
console.log(
|
|
1052
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1053
|
+
poolPrices,
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
expect(poolPrices).not.toBeNull();
|
|
1057
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1058
|
+
|
|
1059
|
+
// Check if onchain pricing equals to calculated ones
|
|
1060
|
+
for (const poolPrice of poolPrices || []) {
|
|
1061
|
+
await checkOnChainPricing(
|
|
1062
|
+
ramses,
|
|
1063
|
+
'getAmountOut',
|
|
1064
|
+
blocknumber,
|
|
1065
|
+
poolPrice.prices,
|
|
1066
|
+
poolPrice.poolAddresses![0],
|
|
1067
|
+
tokenA.address,
|
|
1068
|
+
amounts,
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
it('getTopPoolsForToken', async function () {
|
|
1074
|
+
const poolLiquidity = await ramses.getTopPoolsForToken(
|
|
1075
|
+
tokenA.address,
|
|
1076
|
+
10,
|
|
1077
|
+
);
|
|
1078
|
+
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
|
|
1079
|
+
|
|
1080
|
+
checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
describe('Optimism', () => {
|
|
1087
|
+
const network = Network.OPTIMISM;
|
|
1088
|
+
const dexHelper = new DummyDexHelper(network);
|
|
1089
|
+
const checkOnChainPricing = constructCheckOnChainPricing(dexHelper);
|
|
1090
|
+
|
|
1091
|
+
describe('VelodromeV2', () => {
|
|
1092
|
+
const dexKey = 'VelodromeV2';
|
|
1093
|
+
const velodromeV2 = new VelodromeV2(network, dexKey, dexHelper);
|
|
1094
|
+
|
|
1095
|
+
describe('UniswapV2 like pool', function () {
|
|
1096
|
+
const TokenASymbol = 'USDC';
|
|
1097
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
1098
|
+
const TokenBSymbol = 'WETH';
|
|
1099
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
1100
|
+
|
|
1101
|
+
const amounts = amounts18;
|
|
1102
|
+
|
|
1103
|
+
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
1104
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1105
|
+
const pools = await velodromeV2.getPoolIdentifiers(
|
|
1106
|
+
tokenA,
|
|
1107
|
+
tokenB,
|
|
1108
|
+
SwapSide.SELL,
|
|
1109
|
+
blocknumber,
|
|
1110
|
+
);
|
|
1111
|
+
console.log(
|
|
1112
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1113
|
+
pools,
|
|
1114
|
+
);
|
|
1115
|
+
|
|
1116
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1117
|
+
|
|
1118
|
+
const poolPrices = await velodromeV2.getPricesVolume(
|
|
1119
|
+
tokenA,
|
|
1120
|
+
tokenB,
|
|
1121
|
+
amounts,
|
|
1122
|
+
SwapSide.SELL,
|
|
1123
|
+
blocknumber,
|
|
1124
|
+
pools,
|
|
1125
|
+
);
|
|
1126
|
+
console.log(
|
|
1127
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1128
|
+
poolPrices,
|
|
1129
|
+
);
|
|
1130
|
+
|
|
1131
|
+
expect(poolPrices).not.toBeNull();
|
|
1132
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1133
|
+
|
|
1134
|
+
// Check if onchain pricing equals to calculated ones
|
|
1135
|
+
|
|
1136
|
+
for (const poolPrice of poolPrices || []) {
|
|
1137
|
+
await checkOnChainPricing(
|
|
1138
|
+
velodromeV2,
|
|
1139
|
+
'getAmountOut',
|
|
1140
|
+
blocknumber,
|
|
1141
|
+
poolPrice.prices,
|
|
1142
|
+
poolPrice.poolAddresses![0],
|
|
1143
|
+
tokenA.address,
|
|
1144
|
+
amounts,
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
describe('Curve like stable pool', function () {
|
|
1151
|
+
const TokenASymbol = 'USDT';
|
|
1152
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
1153
|
+
const TokenBSymbol = 'USDC';
|
|
1154
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
1155
|
+
|
|
1156
|
+
const amounts = amounts6;
|
|
1157
|
+
|
|
1158
|
+
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
1159
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1160
|
+
const pools = await velodromeV2.getPoolIdentifiers(
|
|
1161
|
+
tokenA,
|
|
1162
|
+
tokenB,
|
|
1163
|
+
SwapSide.SELL,
|
|
1164
|
+
blocknumber,
|
|
1165
|
+
);
|
|
1166
|
+
console.log(
|
|
1167
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1168
|
+
pools,
|
|
1169
|
+
);
|
|
1170
|
+
|
|
1171
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1172
|
+
|
|
1173
|
+
const poolPrices = await velodromeV2.getPricesVolume(
|
|
1174
|
+
tokenA,
|
|
1175
|
+
tokenB,
|
|
1176
|
+
amounts,
|
|
1177
|
+
SwapSide.SELL,
|
|
1178
|
+
blocknumber,
|
|
1179
|
+
pools,
|
|
1180
|
+
);
|
|
1181
|
+
console.log(
|
|
1182
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1183
|
+
poolPrices,
|
|
1184
|
+
);
|
|
1185
|
+
|
|
1186
|
+
expect(poolPrices).not.toBeNull();
|
|
1187
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1188
|
+
|
|
1189
|
+
// Check if onchain pricing equals to calculated ones
|
|
1190
|
+
for (const poolPrice of poolPrices || []) {
|
|
1191
|
+
await checkOnChainPricing(
|
|
1192
|
+
velodromeV2,
|
|
1193
|
+
'getAmountOut',
|
|
1194
|
+
blocknumber,
|
|
1195
|
+
poolPrice.prices,
|
|
1196
|
+
poolPrice.poolAddresses![0],
|
|
1197
|
+
tokenA.address,
|
|
1198
|
+
amounts,
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
describe('Base', () => {
|
|
1207
|
+
const network = Network.BASE;
|
|
1208
|
+
const dexHelper = new DummyDexHelper(network);
|
|
1209
|
+
const checkOnChainPricing = constructCheckOnChainPricing(dexHelper);
|
|
1210
|
+
|
|
1211
|
+
describe('Equalizer', () => {
|
|
1212
|
+
const dexKey = 'Equalizer';
|
|
1213
|
+
const equalizer = new Equalizer(network, dexKey, dexHelper);
|
|
1214
|
+
|
|
1215
|
+
describe('UniswapV2 like pool', function () {
|
|
1216
|
+
const TokenASymbol = 'USDbC';
|
|
1217
|
+
const tokenA = Tokens[network][TokenASymbol];
|
|
1218
|
+
const TokenBSymbol = 'ETH';
|
|
1219
|
+
const tokenB = Tokens[network][TokenBSymbol];
|
|
1220
|
+
|
|
1221
|
+
const amounts = amounts18;
|
|
1222
|
+
|
|
1223
|
+
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
1224
|
+
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1225
|
+
const pools = await equalizer.getPoolIdentifiers(
|
|
1226
|
+
tokenA,
|
|
1227
|
+
tokenB,
|
|
1228
|
+
SwapSide.SELL,
|
|
1229
|
+
blocknumber,
|
|
1230
|
+
);
|
|
1231
|
+
console.log(
|
|
1232
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1233
|
+
pools,
|
|
1234
|
+
);
|
|
1235
|
+
|
|
1236
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1237
|
+
|
|
1238
|
+
const poolPrices = await equalizer.getPricesVolume(
|
|
1239
|
+
tokenA,
|
|
1240
|
+
tokenB,
|
|
1241
|
+
amounts,
|
|
1242
|
+
SwapSide.SELL,
|
|
1243
|
+
blocknumber,
|
|
1244
|
+
pools,
|
|
1245
|
+
);
|
|
1246
|
+
console.log(
|
|
1247
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1248
|
+
poolPrices,
|
|
1249
|
+
);
|
|
1250
|
+
|
|
1251
|
+
expect(poolPrices).not.toBeNull();
|
|
1252
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
1253
|
+
|
|
1254
|
+
// Check if onchain pricing equals to calculated ones
|
|
1255
|
+
|
|
1256
|
+
for (const poolPrice of poolPrices || []) {
|
|
1257
|
+
await checkOnChainPricing(
|
|
1258
|
+
equalizer,
|
|
1259
|
+
'getAmountOut',
|
|
1260
|
+
blocknumber,
|
|
1261
|
+
poolPrice.prices,
|
|
1262
|
+
poolPrice.poolAddresses![0],
|
|
1263
|
+
tokenA.address,
|
|
1264
|
+
amounts,
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
});
|
|
1269
|
+
});
|
|
771
1270
|
});
|
|
772
1271
|
});
|