@paraswap/dex-lib 2.48.0 → 2.48.1-hashflow-impr
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/Redstone.json +739 -0
- package/build/abi/angle/stagToken.json +963 -0
- package/build/abi/angle-transmuter/Pyth.json +1534 -0
- package/build/abi/angle-transmuter/Transmuter.json +1719 -0
- package/build/abi/smardex/smardex-factory.json +185 -0
- package/build/abi/smardex/smardex-pool.json +578 -0
- package/build/abi/smardex/smardex-router.json +648 -0
- package/build/abi/trader-joe-v2_1/FactoryABI.json +1208 -0
- package/build/abi/trader-joe-v2_1/PairABI.json +1493 -0
- package/build/abi/trader-joe-v2_1/RouterABI.json +1489 -0
- package/build/abi/trader-joe-v2_1/StateMulticall.json +193 -0
- package/build/abi/wombat/pool.json +1289 -0
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.d.ts +53 -0
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.js +175 -0
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.js.map +1 -0
- package/build/dex/angle-staked-stable/angle-staked-stable.d.ts +42 -0
- package/build/dex/angle-staked-stable/angle-staked-stable.js +232 -0
- package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -0
- package/build/dex/{sushiswap-v3 → angle-staked-stable}/config.d.ts +2 -2
- package/build/dex/angle-staked-stable/config.js +26 -0
- package/build/dex/angle-staked-stable/config.js.map +1 -0
- package/build/dex/angle-staked-stable/types.d.ts +15 -0
- package/build/dex/angle-staked-stable/types.js.map +1 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +43 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js +309 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
- package/build/dex/{lighter-v1/lighter-v1.d.ts → angle-transmuter/angle-transmuter.d.ts} +18 -17
- package/build/dex/angle-transmuter/angle-transmuter.js +233 -0
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
- package/build/dex/angle-transmuter/backedOracle.js +56 -0
- package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
- package/build/dex/{woo-fi → angle-transmuter}/config.d.ts +1 -1
- package/build/dex/angle-transmuter/config.js +20 -0
- package/build/dex/angle-transmuter/config.js.map +1 -0
- package/build/dex/angle-transmuter/constants.d.ts +4 -0
- package/build/dex/angle-transmuter/constants.js +8 -0
- package/build/dex/angle-transmuter/constants.js.map +1 -0
- package/build/dex/angle-transmuter/pyth.d.ts +19 -0
- package/build/dex/angle-transmuter/pyth.js +71 -0
- package/build/dex/angle-transmuter/pyth.js.map +1 -0
- package/build/dex/angle-transmuter/redstone.d.ts +20 -0
- package/build/dex/angle-transmuter/redstone.js +73 -0
- package/build/dex/angle-transmuter/redstone.js.map +1 -0
- package/build/dex/angle-transmuter/transmuter.d.ts +50 -0
- package/build/dex/angle-transmuter/transmuter.js +314 -0
- package/build/dex/angle-transmuter/transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/types.d.ts +144 -0
- package/build/dex/angle-transmuter/types.js +31 -0
- package/build/dex/angle-transmuter/types.js.map +1 -0
- package/build/dex/angle-transmuter/utils.d.ts +9 -0
- package/build/dex/angle-transmuter/utils.js +264 -0
- package/build/dex/angle-transmuter/utils.js.map +1 -0
- package/build/dex/hashflow/constants.d.ts +28 -0
- package/build/dex/hashflow/constants.js +31 -1
- package/build/dex/hashflow/constants.js.map +1 -1
- package/build/dex/hashflow/hashflow.d.ts +3 -2
- package/build/dex/hashflow/hashflow.js +87 -12
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/hashflow/types.d.ts +11 -0
- package/build/dex/hashflow/types.js +9 -0
- package/build/dex/hashflow/types.js.map +1 -1
- package/build/dex/smardex/subgraph-queries.d.ts +1 -0
- package/build/dex/smardex/subgraph-queries.js +17 -0
- package/build/dex/smardex/subgraph-queries.js.map +1 -0
- package/build/dex/smardex/usd-reserves.d.ts +23 -0
- package/build/dex/smardex/usd-reserves.js +86 -0
- package/build/dex/smardex/usd-reserves.js.map +1 -0
- package/build/dex/{lighter-v1 → trader-joe-v2-1-2}/config.d.ts +1 -1
- package/build/dex/trader-joe-v2-1-2/config.js +47 -0
- package/build/dex/trader-joe-v2-1-2/config.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/constants.d.ts +20 -0
- package/build/dex/trader-joe-v2-1-2/constants.js +22 -0
- package/build/dex/trader-joe-v2-1-2/constants.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/math/index.d.ts +37 -0
- package/build/dex/trader-joe-v2-1-2/math/index.js +291 -0
- package/build/dex/trader-joe-v2-1-2/math/index.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.d.ts +60 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js +248 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.d.ts +53 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js +307 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/types.d.ts +82 -0
- package/build/dex/trader-joe-v2-1-2/types.js +9 -0
- package/build/dex/trader-joe-v2-1-2/types.js.map +1 -0
- package/build/dex/{ramses-v2 → trader-joe-v2_1}/config.d.ts +1 -1
- package/build/dex/trader-joe-v2_1/config.js +47 -0
- package/build/dex/trader-joe-v2_1/config.js.map +1 -0
- package/build/dex/trader-joe-v2_1/constants.d.ts +20 -0
- package/build/dex/trader-joe-v2_1/constants.js +22 -0
- package/build/dex/trader-joe-v2_1/constants.js.map +1 -0
- package/build/dex/trader-joe-v2_1/math/index.d.ts +37 -0
- package/build/dex/trader-joe-v2_1/math/index.js +291 -0
- package/build/dex/trader-joe-v2_1/math/index.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.d.ts +0 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js +384 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.d.ts +60 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js +247 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.d.ts +53 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js +307 -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 +82 -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/uniswap-v3/config.js +14 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -0
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/wombat/wombat-pool-poller.d.ts +22 -0
- package/build/dex/wombat/wombat-pool-poller.js +164 -0
- package/build/dex/wombat/wombat-pool-poller.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/hashflow/constants.ts +34 -0
- package/src/dex/hashflow/hashflow.ts +146 -19
- package/src/dex/hashflow/types.ts +20 -2
- package/src/dex/uniswap-v3/config.ts +16 -0
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +27 -3
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +296 -3
- package/src/dex/uniswap-v3/uniswap-v3.ts +1 -0
- package/tests/constants-e2e.ts +5 -0
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/build/abi/AugustusV6.abi.json +0 -395
- package/build/abi/algebra/AlgebraPool.abi.json +0 -727
- package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
- package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
- package/build/abi/sushiswap-v3/QuoterV2.json +0 -267
- package/build/abi/sushiswap-v3/RouterProcessor3.json +0 -289
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
- package/build/abi/wBETH.json +0 -1527
- package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/build/abi/woo-fi/WooPP.abi.json +0 -548
- package/build/abi/woo-fi/Wooracle.abi.json +0 -260
- package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
- package/build/dex/aave-v3/tokens/avalanche.json +0 -74
- package/build/dex/aave-v3/tokens/fantom.json +0 -62
- package/build/dex/aave-v3/tokens/optimism.json +0 -50
- package/build/dex/aave-v3/tokens/polygon.json +0 -116
- package/build/dex/algebra/algebra-pool.d.ts +0 -114
- package/build/dex/algebra/algebra-pool.js +0 -448
- package/build/dex/algebra/algebra-pool.js.map +0 -1
- package/build/dex/balancer-v2/Gyro3Pool.d.ts +0 -43
- package/build/dex/balancer-v2/Gyro3Pool.js +0 -160
- package/build/dex/balancer-v2/Gyro3Pool.js.map +0 -1
- package/build/dex/balancer-v2/LinearMath.d.ts +0 -88
- package/build/dex/balancer-v2/LinearMath.js +0 -285
- package/build/dex/balancer-v2/LinearMath.js.map +0 -1
- package/build/dex/balancer-v2/LinearPool.d.ts +0 -81
- package/build/dex/balancer-v2/LinearPool.js +0 -444
- package/build/dex/balancer-v2/LinearPool.js.map +0 -1
- package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -90
- package/build/dex/balancer-v2/PhantomStablePool.js +0 -418
- package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
- package/build/dex/balancer-v2/StableMath.d.ts +0 -9
- package/build/dex/balancer-v2/StableMath.js +0 -272
- package/build/dex/balancer-v2/StableMath.js.map +0 -1
- package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -140
- package/build/dex/balancer-v2/balancer-v2-pool.js +0 -647
- package/build/dex/balancer-v2/balancer-v2-pool.js.map +0 -1
- package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
- package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
- package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
- package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
- package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
- package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
- package/build/dex/lighter-v1/abi/erc20.json +0 -222
- package/build/dex/lighter-v1/abi/factory.json +0 -291
- package/build/dex/lighter-v1/abi/order_book.json +0 -594
- package/build/dex/lighter-v1/abi/order_book_helper.json +0 -176
- package/build/dex/lighter-v1/abi/router.json +0 -488
- package/build/dex/lighter-v1/config.js +0 -17
- package/build/dex/lighter-v1/config.js.map +0 -1
- package/build/dex/lighter-v1/constants.d.ts +0 -2
- package/build/dex/lighter-v1/constants.js +0 -13
- package/build/dex/lighter-v1/constants.js.map +0 -1
- package/build/dex/lighter-v1/lighter-v1-pool.d.ts +0 -57
- package/build/dex/lighter-v1/lighter-v1-pool.js +0 -310
- package/build/dex/lighter-v1/lighter-v1-pool.js.map +0 -1
- package/build/dex/lighter-v1/lighter-v1.js +0 -331
- package/build/dex/lighter-v1/lighter-v1.js.map +0 -1
- package/build/dex/lighter-v1/types.d.ts +0 -40
- package/build/dex/lighter-v1/types.js +0 -3
- package/build/dex/lighter-v1/types.js.map +0 -1
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- package/build/dex/pancakeswap-v3/types.js +0 -3
- package/build/dex/pancakeswap-v3/types.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/quickswap-v3.d.ts +0 -21
- package/build/dex/quickswap-v3.js +0 -40
- package/build/dex/quickswap-v3.js.map +0 -1
- package/build/dex/ramses-v2/config.js +0 -28
- package/build/dex/ramses-v2/config.js.map +0 -1
- package/build/dex/ramses-v2/constants.d.ts +0 -28
- package/build/dex/ramses-v2/constants.js +0 -35
- package/build/dex/ramses-v2/constants.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
- package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
- package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
- package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
- package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
- package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
- package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
- package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
- package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/utils.js +0 -16
- package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
- package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
- package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
- package/build/dex/ramses-v2/ramses-v2.js +0 -690
- package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
- package/build/dex/ramses-v2/types.d.ts +0 -154
- package/build/dex/ramses-v2/types.js +0 -9
- package/build/dex/ramses-v2/types.js.map +0 -1
- package/build/dex/ramses-v2/utils.d.ts +0 -6
- package/build/dex/ramses-v2/utils.js +0 -71
- package/build/dex/ramses-v2/utils.js.map +0 -1
- package/build/dex/solidly/forks-override/fvm.d.ts +0 -20
- package/build/dex/solidly/forks-override/fvm.js +0 -42
- package/build/dex/solidly/forks-override/fvm.js.map +0 -1
- package/build/dex/sushiswap-v3/config.js +0 -132
- package/build/dex/sushiswap-v3/config.js.map +0 -1
- package/build/dex/sushiswap-v3/constants.d.ts +0 -4
- package/build/dex/sushiswap-v3/constants.js +0 -32
- package/build/dex/sushiswap-v3/constants.js.map +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +0 -56
- package/build/dex/sushiswap-v3/sushiswap-v3-original.js +0 -598
- package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +0 -6
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +0 -21
- package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -58
- package/build/dex/sushiswap-v3/sushiswap-v3.js.map +0 -1
- package/build/dex/sushiswap-v3/token.d.ts +0 -6
- package/build/dex/sushiswap-v3/token.js +0 -23
- package/build/dex/sushiswap-v3/token.js.map +0 -1
- package/build/dex/sushiswap-v3/types.d.ts +0 -15
- package/build/dex/sushiswap-v3/types.js +0 -18
- package/build/dex/sushiswap-v3/types.js.map +0 -1
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
- package/build/dex/woo-fi/config.js +0 -141
- package/build/dex/woo-fi/config.js.map +0 -1
- package/build/dex/woo-fi/constants.d.ts +0 -5
- package/build/dex/woo-fi/constants.js +0 -20
- package/build/dex/woo-fi/constants.js.map +0 -1
- package/build/dex/woo-fi/types.d.ts +0 -48
- package/build/dex/woo-fi/types.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
- package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
- package/build/dex/woo-fi/woo-fi-math.js +0 -300
- package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi.d.ts +0 -65
- package/build/dex/woo-fi/woo-fi.js +0 -480
- package/build/dex/woo-fi/woo-fi.js.map +0 -1
- package/build/executor/Executor01BytecodeBuilder.d.ts +0 -77
- package/build/executor/Executor01BytecodeBuilder.js +0 -359
- package/build/executor/Executor01BytecodeBuilder.js.map +0 -1
- package/build/executor/Executor02BytecodeBuilder.d.ts +0 -12
- package/build/executor/Executor02BytecodeBuilder.js +0 -14
- package/build/executor/Executor02BytecodeBuilder.js.map +0 -1
- package/build/executor/ExecutorDetector.d.ts +0 -28
- package/build/executor/ExecutorDetector.js +0 -89
- package/build/executor/ExecutorDetector.js.map +0 -1
- package/build/executor/IExecutorBytecodeBuilder.d.ts +0 -6
- package/build/executor/IExecutorBytecodeBuilder.js +0 -3
- package/build/executor/IExecutorBytecodeBuilder.js.map +0 -1
- package/build/generic-swap-transaction-builder.d.ts +0 -39
- package/build/generic-swap-transaction-builder.js +0 -156
- package/build/generic-swap-transaction-builder.js.map +0 -1
- /package/build/dex/{woo-fi → angle-staked-stable}/types.js +0 -0
|
@@ -33,11 +33,14 @@ import {
|
|
|
33
33
|
SimpleExchangeParam,
|
|
34
34
|
Token,
|
|
35
35
|
} from '../../types';
|
|
36
|
-
import { getDexKeysWithNetwork } from '../../utils';
|
|
36
|
+
import { getDexKeysWithNetwork, Utils } from '../../utils';
|
|
37
37
|
import { TooStrictSlippageCheckError } from '../generic-rfq/types';
|
|
38
38
|
import { SimpleExchange } from '../simple-exchange';
|
|
39
39
|
import { Adapters, HashflowConfig } from './config';
|
|
40
40
|
import {
|
|
41
|
+
CONSECUTIVE_ERROR_THRESHOLD,
|
|
42
|
+
CONSECUTIVE_ERROR_TIMESPAN_MS,
|
|
43
|
+
ERROR_CODE_TO_RESTRICT_TTL,
|
|
41
44
|
HASHFLOW_API_CLIENT_NAME,
|
|
42
45
|
HASHFLOW_API_MARKET_MAKERS_POLLING_INTERVAL_MS,
|
|
43
46
|
HASHFLOW_API_PRICES_POLLING_INTERVAL_MS,
|
|
@@ -48,9 +51,12 @@ import {
|
|
|
48
51
|
HASHFLOW_MIN_SLIPPAGE_FACTOR_THRESHOLD_FOR_RESTRICTION,
|
|
49
52
|
HASHFLOW_MM_RESTRICT_TTL_S,
|
|
50
53
|
HASHFLOW_PRICES_CACHES_TTL_S,
|
|
54
|
+
UNKNOWN_ERROR_CODE,
|
|
51
55
|
} from './constants';
|
|
52
56
|
import { RateFetcher } from './rate-fetcher';
|
|
53
57
|
import {
|
|
58
|
+
CacheErrorCodesData,
|
|
59
|
+
ErrorCode,
|
|
54
60
|
HashflowData,
|
|
55
61
|
PriceLevel,
|
|
56
62
|
RfqError,
|
|
@@ -69,6 +75,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
69
75
|
private hashFlowAuthToken: string;
|
|
70
76
|
private disabledMMs: Set<string>;
|
|
71
77
|
private runtimeMMsRestrictHashMapKey: string;
|
|
78
|
+
private runtimeMMsRestrictHashMapErrorCodesKey: string;
|
|
72
79
|
|
|
73
80
|
private pricesCacheKey: string;
|
|
74
81
|
private marketMakersCacheKey: string;
|
|
@@ -108,6 +115,8 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
108
115
|
this.disabledMMs = new Set(dexHelper.config.data.hashFlowDisabledMMs);
|
|
109
116
|
this.runtimeMMsRestrictHashMapKey =
|
|
110
117
|
`${CACHE_PREFIX}_${this.dexKey}_${this.network}_restricted_mms`.toLowerCase();
|
|
118
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey =
|
|
119
|
+
`${CACHE_PREFIX}_${this.dexKey}_${this.network}_restricted_mms_error_codes`.toLowerCase();
|
|
111
120
|
|
|
112
121
|
this.rateFetcher = new RateFetcher(
|
|
113
122
|
this.dexHelper,
|
|
@@ -595,7 +604,8 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
595
604
|
normalizedDestToken.address,
|
|
596
605
|
)}: ${JSON.stringify(rfq)}`;
|
|
597
606
|
this.logger.warn(message);
|
|
598
|
-
|
|
607
|
+
// TODO: Fix types
|
|
608
|
+
throw new RfqError(message, `${rfq?.error?.code}` as ErrorCode);
|
|
599
609
|
} else if (!rfq.quotes[0].quoteData) {
|
|
600
610
|
const message = `${this.dexKey}-${
|
|
601
611
|
this.network
|
|
@@ -604,7 +614,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
604
614
|
normalizedDestToken.address,
|
|
605
615
|
)}. Missing quote data`;
|
|
606
616
|
this.logger.warn(message);
|
|
607
|
-
throw new RfqError(message);
|
|
617
|
+
throw new RfqError(message, 'MISSING_QUOTE_DATA');
|
|
608
618
|
} else if (!rfq.quotes[0].signature) {
|
|
609
619
|
const message = `${this.dexKey}-${
|
|
610
620
|
this.network
|
|
@@ -613,7 +623,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
613
623
|
normalizedDestToken.address,
|
|
614
624
|
)}. Missing signature`;
|
|
615
625
|
this.logger.warn(message);
|
|
616
|
-
throw new RfqError(message);
|
|
626
|
+
throw new RfqError(message, 'MISSING_SIGNATURE_DATA');
|
|
617
627
|
}
|
|
618
628
|
|
|
619
629
|
assert(
|
|
@@ -729,7 +739,13 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
729
739
|
this.logger.warn(
|
|
730
740
|
`${this.dexKey}-${this.network} MM unknown preprocess transaction error: ${e}`,
|
|
731
741
|
);
|
|
732
|
-
|
|
742
|
+
const code =
|
|
743
|
+
e instanceof RfqError || e instanceof SlippageCheckError
|
|
744
|
+
? e.code
|
|
745
|
+
: UNKNOWN_ERROR_CODE;
|
|
746
|
+
await this.restrictMM(mm, code).catch(err =>
|
|
747
|
+
this.logger.warn(`Failed to restrict MM ${mm}: ${err}`),
|
|
748
|
+
);
|
|
733
749
|
}
|
|
734
750
|
}
|
|
735
751
|
|
|
@@ -737,24 +753,135 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
737
753
|
}
|
|
738
754
|
}
|
|
739
755
|
|
|
740
|
-
async restrictMM(mm: string): Promise<void> {
|
|
741
|
-
this.
|
|
742
|
-
|
|
743
|
-
);
|
|
744
|
-
|
|
745
|
-
// We use timestamp for creation date to later discern if it already expired or not
|
|
746
|
-
await this.dexHelper.cache.hset(
|
|
747
|
-
this.runtimeMMsRestrictHashMapKey,
|
|
756
|
+
async restrictMM(mm: string, errorCode: ErrorCode): Promise<void> {
|
|
757
|
+
const errorCodesRaw = await this.dexHelper.cache.hget(
|
|
758
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey,
|
|
748
759
|
mm,
|
|
749
|
-
Date.now().toString(),
|
|
750
760
|
);
|
|
751
761
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
762
|
+
const errorCodes: CacheErrorCodesData = Utils.Parse(errorCodesRaw);
|
|
763
|
+
|
|
764
|
+
const error = errorCodes[errorCode];
|
|
765
|
+
|
|
766
|
+
if (!error) {
|
|
767
|
+
this.logger.warn(
|
|
768
|
+
`First encounter of ${errorCode} for ${mm}, setting up counter`,
|
|
756
769
|
);
|
|
757
|
-
|
|
770
|
+
const data: CacheErrorCodesData = {
|
|
771
|
+
...errorCodes,
|
|
772
|
+
[errorCode]: {
|
|
773
|
+
count: 1,
|
|
774
|
+
addedDatetimeMS: Date.now(),
|
|
775
|
+
},
|
|
776
|
+
};
|
|
777
|
+
await this.dexHelper.cache.hset(
|
|
778
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey,
|
|
779
|
+
mm,
|
|
780
|
+
Utils.Serialize(data),
|
|
781
|
+
);
|
|
782
|
+
return;
|
|
783
|
+
} else {
|
|
784
|
+
const restrictTTLMs =
|
|
785
|
+
ERROR_CODE_TO_RESTRICT_TTL[errorCode] ||
|
|
786
|
+
ERROR_CODE_TO_RESTRICT_TTL[UNKNOWN_ERROR_CODE];
|
|
787
|
+
|
|
788
|
+
if (error.addedDatetimeMS + CONSECUTIVE_ERROR_TIMESPAN_MS < Date.now()) {
|
|
789
|
+
this.logger.warn(
|
|
790
|
+
`Error: ${errorCode} for ${mm} occured not within threshold timespan for restriction. Resetting counter`,
|
|
791
|
+
);
|
|
792
|
+
// Clear counter, this error code appeared after CONSECUTIVE_ERROR_TIMESPAN_MS
|
|
793
|
+
const data: CacheErrorCodesData = {
|
|
794
|
+
...errorCodes,
|
|
795
|
+
[errorCode]: {
|
|
796
|
+
count: 1,
|
|
797
|
+
addedDatetimeMS: Date.now(),
|
|
798
|
+
},
|
|
799
|
+
};
|
|
800
|
+
await this.dexHelper.cache.hset(
|
|
801
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey,
|
|
802
|
+
mm,
|
|
803
|
+
Utils.Serialize(data),
|
|
804
|
+
);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
if (error.count + 1 > CONSECUTIVE_ERROR_THRESHOLD) {
|
|
809
|
+
this.logger.warn(
|
|
810
|
+
`${this.dexKey}-${this.network}: ${mm} was restricted for ${
|
|
811
|
+
restrictTTLMs / 1000
|
|
812
|
+
} sec. due to ${errorCode} happening ${
|
|
813
|
+
error.count + 1
|
|
814
|
+
} within last ${Math.floor(
|
|
815
|
+
CONSECUTIVE_ERROR_TIMESPAN_MS / 1000 / 60,
|
|
816
|
+
)} minutes`,
|
|
817
|
+
);
|
|
818
|
+
|
|
819
|
+
// date added is checked against HASHFLOW_MM_RESTRICT_TTL_S, as a hack we set a date so that it's checked against specific ttls based on error type to not change & increase time for parsing restricted mms during pricing request
|
|
820
|
+
// Example: ttl for a particular error is 20 minutes (< default 60 minutes)
|
|
821
|
+
//
|
|
822
|
+
// Meaning we need to set dateAdded for restrict hash as Date.now() + 40 minutes (diff between default restrict ttl=1h and particular error restrict ttl = 20 minutes). So the dateAdded is in the future, and after 20 minutes in pricing we'll clear that restriction
|
|
823
|
+
//
|
|
824
|
+
//
|
|
825
|
+
// Example 2: ttl for a particular error is 80 minutes (> default 60 minutes)
|
|
826
|
+
//
|
|
827
|
+
// Meaning we need to set dateAdded for restrict hash as Date.now() - 20 minutes, then after an hour (default) it'll still be 20 minutes left for restriction to be cleared
|
|
828
|
+
|
|
829
|
+
const defaultRestrictTTLMS = Math.floor(
|
|
830
|
+
HASHFLOW_MM_RESTRICT_TTL_S / 1000,
|
|
831
|
+
);
|
|
832
|
+
const dateModifierMS =
|
|
833
|
+
defaultRestrictTTLMS > restrictTTLMs
|
|
834
|
+
? defaultRestrictTTLMS - restrictTTLMs
|
|
835
|
+
: -(restrictTTLMs - defaultRestrictTTLMS);
|
|
836
|
+
|
|
837
|
+
const date = (Date.now() + dateModifierMS).toString();
|
|
838
|
+
|
|
839
|
+
// We use timestamp for creation date to later discern if it already expired or not
|
|
840
|
+
await this.dexHelper.cache.hset(
|
|
841
|
+
this.runtimeMMsRestrictHashMapKey,
|
|
842
|
+
mm,
|
|
843
|
+
date,
|
|
844
|
+
);
|
|
845
|
+
|
|
846
|
+
// resetting error count
|
|
847
|
+
const data: CacheErrorCodesData = {
|
|
848
|
+
...errorCodes,
|
|
849
|
+
[errorCode]: null,
|
|
850
|
+
};
|
|
851
|
+
await this.dexHelper.cache.hset(
|
|
852
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey,
|
|
853
|
+
mm,
|
|
854
|
+
Utils.Serialize(data),
|
|
855
|
+
);
|
|
856
|
+
|
|
857
|
+
// Expiry cache because it has levels for blacklisted MM
|
|
858
|
+
await this.dexHelper.cache
|
|
859
|
+
.del(this.dexKey, this.network, 'levels')
|
|
860
|
+
.catch(e => {
|
|
861
|
+
this.logger.error(
|
|
862
|
+
`${this.dexKey}-${this.network}: Failed to delete levels cache: ${e.message}`,
|
|
863
|
+
);
|
|
864
|
+
});
|
|
865
|
+
return;
|
|
866
|
+
} else {
|
|
867
|
+
const newCount = +error.count + 1;
|
|
868
|
+
this.logger.warn(
|
|
869
|
+
`${this.dexKey}-${this.network}: ${mm} Error with code: ${errorCode} happenned ${newCount} (below limit: ${CONSECUTIVE_ERROR_THRESHOLD}), updating counter`,
|
|
870
|
+
);
|
|
871
|
+
const data: CacheErrorCodesData = {
|
|
872
|
+
...errorCodes,
|
|
873
|
+
[errorCode]: {
|
|
874
|
+
count: newCount,
|
|
875
|
+
addedDatetimeMS: error.addedDatetimeMS, // initial date stays
|
|
876
|
+
},
|
|
877
|
+
};
|
|
878
|
+
await this.dexHelper.cache.hset(
|
|
879
|
+
this.runtimeMMsRestrictHashMapErrorCodesKey,
|
|
880
|
+
mm,
|
|
881
|
+
Utils.Serialize(data),
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
758
885
|
}
|
|
759
886
|
|
|
760
887
|
getCalldataGasCost(poolPrices: PoolPrices<HashflowData>): number | number[] {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Chain, QuoteData } from '@hashflow/taker-js/dist/types/common';
|
|
2
2
|
import { RequestHeaders } from '../../dex-helper';
|
|
3
|
+
import { ERROR_CODE_TO_RESTRICT_TTL, UNKNOWN_ERROR_CODE } from './constants';
|
|
3
4
|
|
|
4
5
|
export type HashflowData = {
|
|
5
6
|
mm: string;
|
|
@@ -16,14 +17,22 @@ export interface PriceLevel {
|
|
|
16
17
|
p: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export class RfqError extends Error {
|
|
20
|
+
export class RfqError extends Error {
|
|
21
|
+
code: ErrorCode;
|
|
22
|
+
constructor(message: string, code: ErrorCode = UNKNOWN_ERROR_CODE) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
export enum RFQType {
|
|
22
29
|
RFQT = 0,
|
|
23
30
|
RFQM = 1,
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
export class SlippageCheckError extends Error {
|
|
33
|
+
export class SlippageCheckError extends Error {
|
|
34
|
+
code: ErrorCode = 'SLIPPAGE';
|
|
35
|
+
}
|
|
27
36
|
|
|
28
37
|
export type HashflowRatesLevel = {
|
|
29
38
|
pair: Record<string, string>;
|
|
@@ -63,3 +72,12 @@ export type HashflowRateFetcherConfig = {
|
|
|
63
72
|
marketMakersCacheTTLSecs: number;
|
|
64
73
|
};
|
|
65
74
|
};
|
|
75
|
+
|
|
76
|
+
export type ErrorCode = keyof typeof ERROR_CODE_TO_RESTRICT_TTL;
|
|
77
|
+
|
|
78
|
+
export type CacheErrorCodesData = {
|
|
79
|
+
[code in ErrorCode]: {
|
|
80
|
+
addedDatetimeMS: number;
|
|
81
|
+
count: number;
|
|
82
|
+
} | null;
|
|
83
|
+
};
|
|
@@ -275,6 +275,22 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
|
|
|
275
275
|
'https://api.studio.thegraph.com/query/44554/uniswap-v3/version/latest',
|
|
276
276
|
},
|
|
277
277
|
},
|
|
278
|
+
SpookySwapV3: {
|
|
279
|
+
[Network.FANTOM]: {
|
|
280
|
+
factory: '0x7928a2c48754501f3a8064765ECaE541daE5c3E6',
|
|
281
|
+
quoter: '0xB9507f2ED171D52c5c2EFaeAbdE440d264504A92',
|
|
282
|
+
router: '0x765132A0630Cd4401b971706Bb21c0FB5Ab547ad',
|
|
283
|
+
supportedFees: SUPPORTED_FEES,
|
|
284
|
+
stateMulticall: '0x2cc482a66dd677ad33900018f774052717c533fb',
|
|
285
|
+
uniswapMulticall: '0x96a7F0E4905F39508b17Faef5aC456C72a4E1319',
|
|
286
|
+
chunksCount: 5,
|
|
287
|
+
initRetryFrequency: 30,
|
|
288
|
+
initHash:
|
|
289
|
+
'0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54',
|
|
290
|
+
subgraphURL:
|
|
291
|
+
'https://api.thegraph.com/subgraphs/name/0xalucard/ftm-spooky-v3',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
278
294
|
Retro: {
|
|
279
295
|
[Network.POLYGON]: {
|
|
280
296
|
factory: '0x91e1B99072f238352f59e58de875691e20Dc19c1',
|
|
@@ -608,7 +608,7 @@ describe('UniswapV3 E2E', () => {
|
|
|
608
608
|
});
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
-
describe('RamsesV2', () => {
|
|
611
|
+
describe('RamsesV2 E2E', () => {
|
|
612
612
|
const dexKey = 'RamsesV2';
|
|
613
613
|
|
|
614
614
|
describe('Arbitrum', () => {
|
|
@@ -696,7 +696,7 @@ describe('UniswapV3 E2E', () => {
|
|
|
696
696
|
});
|
|
697
697
|
});
|
|
698
698
|
|
|
699
|
-
describe('ChronosV3', () => {
|
|
699
|
+
describe('ChronosV3 E2E', () => {
|
|
700
700
|
const dexKey = 'ChronosV3';
|
|
701
701
|
describe('Arbitrum', () => {
|
|
702
702
|
const network = Network.ARBITRUM;
|
|
@@ -1111,7 +1111,7 @@ describe('UniswapV3 E2E', () => {
|
|
|
1111
1111
|
});
|
|
1112
1112
|
});
|
|
1113
1113
|
|
|
1114
|
-
describe('Retro', () => {
|
|
1114
|
+
describe('Retro E2E', () => {
|
|
1115
1115
|
const dexKey = 'Retro';
|
|
1116
1116
|
|
|
1117
1117
|
describe('POLYGON', () => {
|
|
@@ -1159,4 +1159,28 @@ describe('UniswapV3 E2E', () => {
|
|
|
1159
1159
|
);
|
|
1160
1160
|
});
|
|
1161
1161
|
});
|
|
1162
|
+
|
|
1163
|
+
describe('SpookySwapV3 E2E', () => {
|
|
1164
|
+
const dexKey = 'SpookySwapV3';
|
|
1165
|
+
describe('Fantom', () => {
|
|
1166
|
+
const network = Network.FANTOM;
|
|
1167
|
+
|
|
1168
|
+
const tokenASymbol: string = 'axlUSDC';
|
|
1169
|
+
const tokenBSymbol: string = 'MIM';
|
|
1170
|
+
|
|
1171
|
+
const tokenAAmount: string = '100000000';
|
|
1172
|
+
const tokenBAmount: string = '2023063319850617015';
|
|
1173
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
1174
|
+
|
|
1175
|
+
testForNetwork(
|
|
1176
|
+
network,
|
|
1177
|
+
dexKey,
|
|
1178
|
+
tokenASymbol,
|
|
1179
|
+
tokenBSymbol,
|
|
1180
|
+
tokenAAmount,
|
|
1181
|
+
tokenBAmount,
|
|
1182
|
+
nativeTokenAmount,
|
|
1183
|
+
);
|
|
1184
|
+
});
|
|
1185
|
+
});
|
|
1162
1186
|
});
|
|
@@ -127,7 +127,7 @@ async function checkOnChainPricing(
|
|
|
127
127
|
return true;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
describe('UniswapV3',
|
|
130
|
+
describe('UniswapV3', () => {
|
|
131
131
|
const dexHelper = new DummyDexHelper(network);
|
|
132
132
|
const dexKey = 'UniswapV3';
|
|
133
133
|
|
|
@@ -1241,10 +1241,10 @@ describe('Retro', () => {
|
|
|
1241
1241
|
});
|
|
1242
1242
|
});
|
|
1243
1243
|
|
|
1244
|
-
describe('BaseswapV3',
|
|
1244
|
+
describe('BaseswapV3', () => {
|
|
1245
1245
|
const dexKey = 'BaseswapV3';
|
|
1246
1246
|
|
|
1247
|
-
describe('Base',
|
|
1247
|
+
describe('Base', () => {
|
|
1248
1248
|
const network = Network.BASE;
|
|
1249
1249
|
const dexHelper = new DummyDexHelper(network);
|
|
1250
1250
|
|
|
@@ -1570,3 +1570,296 @@ describe('BaseswapV3', function () {
|
|
|
1570
1570
|
});
|
|
1571
1571
|
});
|
|
1572
1572
|
});
|
|
1573
|
+
|
|
1574
|
+
describe('SpookySwapV3', () => {
|
|
1575
|
+
const dexKey = 'SpookySwapV3';
|
|
1576
|
+
|
|
1577
|
+
describe('Fantom', () => {
|
|
1578
|
+
const network = Network.FANTOM;
|
|
1579
|
+
const dexHelper = new DummyDexHelper(network);
|
|
1580
|
+
|
|
1581
|
+
let blockNumber: number;
|
|
1582
|
+
let baseswapV3: UniswapV3;
|
|
1583
|
+
|
|
1584
|
+
const TokenASymbol = 'axlUSDC';
|
|
1585
|
+
const TokenA = Tokens[network][TokenASymbol];
|
|
1586
|
+
|
|
1587
|
+
const TokenBSymbol = 'MIM';
|
|
1588
|
+
const TokenB = Tokens[network][TokenBSymbol];
|
|
1589
|
+
|
|
1590
|
+
const QuoterV2 = UniswapV3Config[dexKey][network].quoter;
|
|
1591
|
+
|
|
1592
|
+
beforeEach(async () => {
|
|
1593
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1594
|
+
baseswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
1595
|
+
});
|
|
1596
|
+
|
|
1597
|
+
it('getPoolIdentifiers and getPricesVolume SELL', async () => {
|
|
1598
|
+
const amounts = [
|
|
1599
|
+
0n,
|
|
1600
|
+
1n * BI_POWS[6],
|
|
1601
|
+
20n * BI_POWS[6],
|
|
1602
|
+
1000n * BI_POWS[6],
|
|
1603
|
+
];
|
|
1604
|
+
|
|
1605
|
+
const pools = await baseswapV3.getPoolIdentifiers(
|
|
1606
|
+
TokenA,
|
|
1607
|
+
TokenB,
|
|
1608
|
+
SwapSide.SELL,
|
|
1609
|
+
blockNumber,
|
|
1610
|
+
);
|
|
1611
|
+
console.log(
|
|
1612
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1613
|
+
pools,
|
|
1614
|
+
);
|
|
1615
|
+
|
|
1616
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1617
|
+
|
|
1618
|
+
const poolPrices = await baseswapV3.getPricesVolume(
|
|
1619
|
+
TokenA,
|
|
1620
|
+
TokenB,
|
|
1621
|
+
amounts,
|
|
1622
|
+
SwapSide.SELL,
|
|
1623
|
+
blockNumber,
|
|
1624
|
+
pools,
|
|
1625
|
+
);
|
|
1626
|
+
console.log(
|
|
1627
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1628
|
+
poolPrices,
|
|
1629
|
+
);
|
|
1630
|
+
|
|
1631
|
+
expect(poolPrices).not.toBeNull();
|
|
1632
|
+
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey, false);
|
|
1633
|
+
|
|
1634
|
+
let falseChecksCounter = 0;
|
|
1635
|
+
await Promise.all(
|
|
1636
|
+
poolPrices!.map(async price => {
|
|
1637
|
+
const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1638
|
+
const res = await checkOnChainPricing(
|
|
1639
|
+
dexHelper,
|
|
1640
|
+
baseswapV3,
|
|
1641
|
+
'quoteExactInputSingle',
|
|
1642
|
+
blockNumber,
|
|
1643
|
+
QuoterV2,
|
|
1644
|
+
price.prices,
|
|
1645
|
+
TokenA.address,
|
|
1646
|
+
TokenB.address,
|
|
1647
|
+
fee,
|
|
1648
|
+
amounts,
|
|
1649
|
+
);
|
|
1650
|
+
if (res === false) falseChecksCounter++;
|
|
1651
|
+
}),
|
|
1652
|
+
);
|
|
1653
|
+
|
|
1654
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
it('getPoolIdentifiers and getPricesVolume BUY', async () => {
|
|
1658
|
+
const amountsBuy = [
|
|
1659
|
+
0n,
|
|
1660
|
+
1n * BI_POWS[18],
|
|
1661
|
+
2n * BI_POWS[18],
|
|
1662
|
+
3n * BI_POWS[18],
|
|
1663
|
+
];
|
|
1664
|
+
|
|
1665
|
+
const pools = await baseswapV3.getPoolIdentifiers(
|
|
1666
|
+
TokenA,
|
|
1667
|
+
TokenB,
|
|
1668
|
+
SwapSide.BUY,
|
|
1669
|
+
blockNumber,
|
|
1670
|
+
);
|
|
1671
|
+
console.log(
|
|
1672
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1673
|
+
pools,
|
|
1674
|
+
);
|
|
1675
|
+
|
|
1676
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1677
|
+
|
|
1678
|
+
const poolPrices = await baseswapV3.getPricesVolume(
|
|
1679
|
+
TokenA,
|
|
1680
|
+
TokenB,
|
|
1681
|
+
amountsBuy,
|
|
1682
|
+
SwapSide.BUY,
|
|
1683
|
+
blockNumber,
|
|
1684
|
+
pools,
|
|
1685
|
+
);
|
|
1686
|
+
console.log(
|
|
1687
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1688
|
+
poolPrices,
|
|
1689
|
+
);
|
|
1690
|
+
|
|
1691
|
+
expect(poolPrices).not.toBeNull();
|
|
1692
|
+
checkPoolPrices(poolPrices!, amountsBuy, SwapSide.BUY, dexKey);
|
|
1693
|
+
|
|
1694
|
+
// Check if onchain pricing equals to calculated ones
|
|
1695
|
+
let falseChecksCounter = 0;
|
|
1696
|
+
await Promise.all(
|
|
1697
|
+
poolPrices!.map(async price => {
|
|
1698
|
+
const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1699
|
+
const res = await checkOnChainPricing(
|
|
1700
|
+
dexHelper,
|
|
1701
|
+
baseswapV3,
|
|
1702
|
+
'quoteExactOutputSingle',
|
|
1703
|
+
blockNumber,
|
|
1704
|
+
QuoterV2,
|
|
1705
|
+
price.prices,
|
|
1706
|
+
TokenA.address,
|
|
1707
|
+
TokenB.address,
|
|
1708
|
+
fee,
|
|
1709
|
+
amountsBuy,
|
|
1710
|
+
);
|
|
1711
|
+
if (res === false) falseChecksCounter++;
|
|
1712
|
+
}),
|
|
1713
|
+
);
|
|
1714
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
it('getPoolIdentifiers and getPricesVolume SELL stable pairs', async () => {
|
|
1718
|
+
const amounts = [0n, 1n * BI_POWS[6], 4n * BI_POWS[6]];
|
|
1719
|
+
|
|
1720
|
+
const TokenASymbol = 'axlUSDC';
|
|
1721
|
+
const TokenA = Tokens[network][TokenASymbol];
|
|
1722
|
+
|
|
1723
|
+
const TokenBSymbol = 'USDCe';
|
|
1724
|
+
const TokenB = Tokens[network][TokenBSymbol];
|
|
1725
|
+
|
|
1726
|
+
const pools = await baseswapV3.getPoolIdentifiers(
|
|
1727
|
+
TokenA,
|
|
1728
|
+
TokenB,
|
|
1729
|
+
SwapSide.SELL,
|
|
1730
|
+
blockNumber,
|
|
1731
|
+
);
|
|
1732
|
+
console.log(
|
|
1733
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1734
|
+
pools,
|
|
1735
|
+
);
|
|
1736
|
+
|
|
1737
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1738
|
+
|
|
1739
|
+
const poolPrices = await baseswapV3.getPricesVolume(
|
|
1740
|
+
TokenA,
|
|
1741
|
+
TokenB,
|
|
1742
|
+
amounts,
|
|
1743
|
+
SwapSide.SELL,
|
|
1744
|
+
blockNumber,
|
|
1745
|
+
pools,
|
|
1746
|
+
);
|
|
1747
|
+
console.log(
|
|
1748
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1749
|
+
poolPrices,
|
|
1750
|
+
);
|
|
1751
|
+
|
|
1752
|
+
expect(poolPrices).not.toBeNull();
|
|
1753
|
+
checkPoolPrices(
|
|
1754
|
+
poolPrices!.filter(pp => pp.unit !== 0n),
|
|
1755
|
+
amounts,
|
|
1756
|
+
SwapSide.SELL,
|
|
1757
|
+
dexKey,
|
|
1758
|
+
false,
|
|
1759
|
+
);
|
|
1760
|
+
|
|
1761
|
+
// Check if onchain pricing equals to calculated ones
|
|
1762
|
+
let falseChecksCounter = 0;
|
|
1763
|
+
await Promise.all(
|
|
1764
|
+
poolPrices!.map(async price => {
|
|
1765
|
+
const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1766
|
+
const res = await checkOnChainPricing(
|
|
1767
|
+
dexHelper,
|
|
1768
|
+
baseswapV3,
|
|
1769
|
+
'quoteExactInputSingle',
|
|
1770
|
+
blockNumber,
|
|
1771
|
+
QuoterV2,
|
|
1772
|
+
price.prices,
|
|
1773
|
+
TokenA.address,
|
|
1774
|
+
TokenB.address,
|
|
1775
|
+
fee,
|
|
1776
|
+
amounts,
|
|
1777
|
+
);
|
|
1778
|
+
if (res === false) falseChecksCounter++;
|
|
1779
|
+
}),
|
|
1780
|
+
);
|
|
1781
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
it('getPoolIdentifiers and getPricesVolume BUY stable pairs', async () => {
|
|
1785
|
+
const amountsBuy = [
|
|
1786
|
+
0n,
|
|
1787
|
+
1n * BI_POWS[6],
|
|
1788
|
+
2n * BI_POWS[6],
|
|
1789
|
+
3n * BI_POWS[6],
|
|
1790
|
+
];
|
|
1791
|
+
|
|
1792
|
+
const TokenASymbol = 'axlUSDC';
|
|
1793
|
+
const TokenA = Tokens[network][TokenASymbol];
|
|
1794
|
+
|
|
1795
|
+
const TokenBSymbol = 'USDCe';
|
|
1796
|
+
const TokenB = Tokens[network][TokenBSymbol];
|
|
1797
|
+
|
|
1798
|
+
const pools = await baseswapV3.getPoolIdentifiers(
|
|
1799
|
+
TokenA,
|
|
1800
|
+
TokenB,
|
|
1801
|
+
SwapSide.BUY,
|
|
1802
|
+
blockNumber,
|
|
1803
|
+
);
|
|
1804
|
+
console.log(
|
|
1805
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
|
|
1806
|
+
pools,
|
|
1807
|
+
);
|
|
1808
|
+
|
|
1809
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
1810
|
+
|
|
1811
|
+
const poolPrices = await baseswapV3.getPricesVolume(
|
|
1812
|
+
TokenA,
|
|
1813
|
+
TokenB,
|
|
1814
|
+
amountsBuy,
|
|
1815
|
+
SwapSide.BUY,
|
|
1816
|
+
blockNumber,
|
|
1817
|
+
pools,
|
|
1818
|
+
);
|
|
1819
|
+
console.log(
|
|
1820
|
+
`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
|
|
1821
|
+
poolPrices,
|
|
1822
|
+
);
|
|
1823
|
+
|
|
1824
|
+
expect(poolPrices).not.toBeNull();
|
|
1825
|
+
checkPoolPrices(
|
|
1826
|
+
poolPrices!.filter(pp => pp.unit !== 0n),
|
|
1827
|
+
amountsBuy,
|
|
1828
|
+
SwapSide.BUY,
|
|
1829
|
+
dexKey,
|
|
1830
|
+
);
|
|
1831
|
+
|
|
1832
|
+
// Check if onchain pricing equals to calculated ones
|
|
1833
|
+
let falseChecksCounter = 0;
|
|
1834
|
+
await Promise.all(
|
|
1835
|
+
poolPrices!.map(async price => {
|
|
1836
|
+
const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
1837
|
+
const res = await checkOnChainPricing(
|
|
1838
|
+
dexHelper,
|
|
1839
|
+
baseswapV3,
|
|
1840
|
+
'quoteExactOutputSingle',
|
|
1841
|
+
blockNumber,
|
|
1842
|
+
QuoterV2,
|
|
1843
|
+
price.prices,
|
|
1844
|
+
TokenA.address,
|
|
1845
|
+
TokenB.address,
|
|
1846
|
+
fee,
|
|
1847
|
+
amountsBuy,
|
|
1848
|
+
);
|
|
1849
|
+
if (res === false) falseChecksCounter++;
|
|
1850
|
+
}),
|
|
1851
|
+
);
|
|
1852
|
+
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
it('getTopPoolsForToken', async () => {
|
|
1856
|
+
const poolLiquidity = await baseswapV3.getTopPoolsForToken(
|
|
1857
|
+
TokenB.address,
|
|
1858
|
+
10,
|
|
1859
|
+
);
|
|
1860
|
+
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
|
|
1861
|
+
|
|
1862
|
+
checkPoolsLiquidity(poolLiquidity, TokenB.address, dexKey);
|
|
1863
|
+
});
|
|
1864
|
+
});
|
|
1865
|
+
});
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -580,6 +580,10 @@ export const Tokens: {
|
|
|
580
580
|
address: '0x07BB65fAaC502d4996532F834A1B7ba5dC32Ff96',
|
|
581
581
|
decimals: 18,
|
|
582
582
|
},
|
|
583
|
+
USDCe: {
|
|
584
|
+
address: '0x2f733095b80a04b38b0d10cc884524a3d09b836a',
|
|
585
|
+
decimals: 6,
|
|
586
|
+
},
|
|
583
587
|
},
|
|
584
588
|
[Network.BSC]: {
|
|
585
589
|
POPS: {
|
|
@@ -1153,6 +1157,7 @@ export const Holders: {
|
|
|
1153
1157
|
FTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
|
|
1154
1158
|
WFTM: '0xB7D0fB518a5b7bf8dc7ea19A715E8FD8BD983e27',
|
|
1155
1159
|
USDC: '0xf53feaeb035361c046e5669745695e450ebb4028',
|
|
1160
|
+
USDCe: '0x305fa2FB5AF034D490A9C9be8bcd9b01902480BF',
|
|
1156
1161
|
FUSDT: '0x9ade1c17d25246c405604344f89E8F23F8c1c632',
|
|
1157
1162
|
POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
|
|
1158
1163
|
aFanUSDT: '0x8EBc96fF91A30059E447bFC7C0a7394f8A5793E6',
|