@paraswap/dex-lib 2.50.4 → 2.50.5
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/{dex/lighter-v1/abi/erc20.json → abi/angle-transmuter/MorphoOracle.json} +97 -126
- package/build/abi/angle-transmuter/MorphoVault.json +2506 -0
- package/build/abi/angle-transmuter/Pyth.json +1534 -0
- package/build/abi/angle-transmuter/Transmuter.json +1711 -0
- package/build/abi/pharaoh/PharaohPool.abi.json +1582 -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/{integral/relayer.json → wombat/pool.json} +587 -446
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.d.ts +55 -0
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.js +183 -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 +50 -0
- package/build/dex/angle-staked-stable/angle-staked-stable.js +228 -0
- package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -0
- package/build/dex/{woo-fi → angle-staked-stable}/config.d.ts +1 -1
- package/build/dex/angle-staked-stable/config.js +139 -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 +61 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js +415 -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} +31 -17
- package/build/dex/angle-transmuter/angle-transmuter.js +262 -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/{ramses-v2 → angle-transmuter}/config.d.ts +1 -1
- package/build/dex/angle-transmuter/config.js +30 -0
- package/build/dex/angle-transmuter/config.js.map +1 -0
- package/build/dex/angle-transmuter/constants.d.ts +77 -0
- package/build/dex/angle-transmuter/constants.js +94 -0
- package/build/dex/angle-transmuter/constants.js.map +1 -0
- package/build/dex/{integral/integral-pool.d.ts → angle-transmuter/morphoOracle.d.ts} +15 -12
- package/build/dex/angle-transmuter/morphoOracle.js +179 -0
- package/build/dex/angle-transmuter/morphoOracle.js.map +1 -0
- package/build/dex/angle-transmuter/morphoVault.d.ts +19 -0
- package/build/dex/angle-transmuter/morphoVault.js +78 -0
- package/build/dex/angle-transmuter/morphoVault.js.map +1 -0
- package/build/dex/angle-transmuter/pyth.d.ts +19 -0
- package/build/dex/angle-transmuter/pyth.js +70 -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 +52 -0
- package/build/dex/angle-transmuter/transmuter.js +374 -0
- package/build/dex/angle-transmuter/transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/types.d.ts +188 -0
- package/build/dex/angle-transmuter/types.js +33 -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 +252 -0
- package/build/dex/angle-transmuter/utils.js.map +1 -0
- package/build/dex/hashflow/constants.d.ts +27 -0
- package/build/dex/hashflow/constants.js +29 -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 +69 -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/idex.d.ts +1 -1
- package/build/dex/index.d.ts +2 -2
- package/build/dex/pancakeswap-v3/config.js +15 -0
- package/build/dex/pancakeswap-v3/config.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.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/{integral → 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/{lighter-v1 → 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/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/build/dex-helper/Cache.d.ts +31 -0
- package/build/dex-helper/Cache.js +106 -0
- package/build/dex-helper/Cache.js.map +1 -0
- package/build/dex-helper/RedisBatcher.d.ts +20 -0
- package/build/dex-helper/RedisBatcher.js +75 -0
- package/build/dex-helper/RedisBatcher.js.map +1 -0
- package/build/dex-helper/RedisWrapper.d.ts +37 -0
- package/build/dex-helper/RedisWrapper.js +165 -0
- package/build/dex-helper/RedisWrapper.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/hashflow/constants.ts +32 -0
- package/src/dex/hashflow/hashflow.ts +121 -19
- package/src/dex/hashflow/types.ts +20 -2
- package/src/dex/idex.ts +1 -1
- package/src/dex/index.ts +2 -2
- package/src/dex/pancakeswap-v3/config.ts +16 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +3 -1
- 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/integral/config.js +0 -18
- package/build/dex/integral/config.js.map +0 -1
- package/build/dex/integral/integral-pool.js +0 -67
- package/build/dex/integral/integral-pool.js.map +0 -1
- package/build/dex/integral/integral.d.ts +0 -48
- package/build/dex/integral/integral.js +0 -402
- package/build/dex/integral/integral.js.map +0 -1
- package/build/dex/integral/types.d.ts +0 -25
- package/build/dex/integral/types.js +0 -9
- package/build/dex/integral/types.js.map +0 -1
- 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.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.d.ts +0 -4
- 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 +0 -3
- 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/src/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- /package/build/dex/{lighter-v1 → angle-staked-stable}/types.js +0 -0
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addFee = exports.subtractFee = exports._calcTokensOutGivenExactBptIn = exports._calcTokenOutGivenExactBptIn = exports._calcBptInGivenExactTokensOut = exports._calcBptOutGivenExactTokensIn = exports._calcInGivenOut = exports._calcOutGivenIn = exports._calculateInvariant = void 0;
|
|
4
|
-
const bigint_constants_1 = require("../../bigint-constants");
|
|
5
|
-
const balancer_v2_math_1 = require("./balancer-v2-math");
|
|
6
|
-
const AMP_PRECISION = bigint_constants_1.BI_POWS[3];
|
|
7
|
-
function _calculateInvariant(amp, balances, roundUp) {
|
|
8
|
-
/**********************************************************************************************
|
|
9
|
-
// invariant //
|
|
10
|
-
// D = invariant D^(n+1) //
|
|
11
|
-
// A = amplification coefficient A n^n S + D = A D n^n + ----------- //
|
|
12
|
-
// S = sum of balances n^n P //
|
|
13
|
-
// P = product of balances //
|
|
14
|
-
// n = number of tokens //
|
|
15
|
-
*********x************************************************************************************/
|
|
16
|
-
// We support rounding up or down.
|
|
17
|
-
let sum = 0n;
|
|
18
|
-
const numTokens = balances.length;
|
|
19
|
-
for (let i = 0; i < numTokens; i++) {
|
|
20
|
-
sum = sum + balances[i];
|
|
21
|
-
}
|
|
22
|
-
if (sum == 0n) {
|
|
23
|
-
return 0n;
|
|
24
|
-
}
|
|
25
|
-
let prevInvariant = 0n;
|
|
26
|
-
let invariant = sum;
|
|
27
|
-
const ampTimesTotal = amp * BigInt(numTokens);
|
|
28
|
-
for (let i = 0; i < 255; i++) {
|
|
29
|
-
let P_D = balances[0] * BigInt(numTokens);
|
|
30
|
-
for (let j = 1; j < numTokens; j++) {
|
|
31
|
-
P_D = balancer_v2_math_1.MathSol.div(balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.mul(P_D, balances[j]), BigInt(numTokens)), invariant, roundUp);
|
|
32
|
-
}
|
|
33
|
-
prevInvariant = invariant;
|
|
34
|
-
invariant = balancer_v2_math_1.MathSol.div(balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.mul(BigInt(numTokens), invariant), invariant) +
|
|
35
|
-
balancer_v2_math_1.MathSol.div(balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.mul(ampTimesTotal, sum), P_D), AMP_PRECISION, roundUp), balancer_v2_math_1.MathSol.mul(BigInt(numTokens + 1), invariant) +
|
|
36
|
-
// No need to use checked arithmetic for the amp precision, the amp is guaranteed to be at least 1
|
|
37
|
-
balancer_v2_math_1.MathSol.div(balancer_v2_math_1.MathSol.mul(ampTimesTotal - AMP_PRECISION, P_D), AMP_PRECISION, !roundUp), roundUp);
|
|
38
|
-
if (invariant > prevInvariant) {
|
|
39
|
-
if (invariant - prevInvariant <= 1) {
|
|
40
|
-
return invariant;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else if (prevInvariant - invariant <= 1) {
|
|
44
|
-
return invariant;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
throw new Error('Errors.STABLE_INVARIANT_DIDNT_CONVERGE');
|
|
48
|
-
}
|
|
49
|
-
exports._calculateInvariant = _calculateInvariant;
|
|
50
|
-
// PairType = 'token->token'
|
|
51
|
-
// SwapType = 'swapExactIn'
|
|
52
|
-
function _calcOutGivenIn(amp, balances, tokenIndexIn, tokenIndexOut, amountIn, invariant) {
|
|
53
|
-
balances = [...balances];
|
|
54
|
-
// Given that we need to have a greater final balance out, the invariant needs to be rounded up
|
|
55
|
-
if (!invariant)
|
|
56
|
-
invariant = _calculateInvariant(amp, balances, true);
|
|
57
|
-
const initBalance = balances[tokenIndexIn];
|
|
58
|
-
balances[tokenIndexIn] = initBalance + amountIn;
|
|
59
|
-
const finalBalanceOut = _getTokenBalanceGivenInvariantAndAllOtherBalances(amp, balances, invariant, tokenIndexOut);
|
|
60
|
-
return balances[tokenIndexOut] - finalBalanceOut - 1n;
|
|
61
|
-
}
|
|
62
|
-
exports._calcOutGivenIn = _calcOutGivenIn;
|
|
63
|
-
function _calcInGivenOut(amp, balances, tokenIndexIn, tokenIndexOut, amountOut, fee, invariant) {
|
|
64
|
-
balances = [...balances];
|
|
65
|
-
if (!invariant)
|
|
66
|
-
invariant = _calculateInvariant(amp, balances, true);
|
|
67
|
-
balances[tokenIndexOut] = balancer_v2_math_1.MathSol.sub(balances[tokenIndexOut], amountOut);
|
|
68
|
-
const finalBalanceIn = _getTokenBalanceGivenInvariantAndAllOtherBalances(amp, balances, invariant, tokenIndexIn);
|
|
69
|
-
let amountIn = balancer_v2_math_1.MathSol.add(balancer_v2_math_1.MathSol.sub(finalBalanceIn, balances[tokenIndexIn]), 1n);
|
|
70
|
-
amountIn = addFee(amountIn, fee);
|
|
71
|
-
return amountIn;
|
|
72
|
-
}
|
|
73
|
-
exports._calcInGivenOut = _calcInGivenOut;
|
|
74
|
-
function _calcBptOutGivenExactTokensIn(amp, balances, amountsIn, bptTotalSupply, invariant) {
|
|
75
|
-
if (!invariant)
|
|
76
|
-
invariant = _calculateInvariant(amp, balances, true);
|
|
77
|
-
// BPT out, so we round down overall.
|
|
78
|
-
// First loop calculates the sum of all token balances, which will be used to calculate
|
|
79
|
-
// the current weights of each token, relative to this sum
|
|
80
|
-
let sumBalances = 0n;
|
|
81
|
-
for (let i = 0; i < balances.length; i++) {
|
|
82
|
-
sumBalances = sumBalances + balances[i];
|
|
83
|
-
}
|
|
84
|
-
// Calculate the weighted balance ratio without considering fees
|
|
85
|
-
const balanceRatiosWithFee = new Array(amountsIn.length);
|
|
86
|
-
// The weighted sum of token balance ratios with fee
|
|
87
|
-
let invariantRatioWithFees = 0n;
|
|
88
|
-
for (let i = 0; i < balances.length; i++) {
|
|
89
|
-
const currentWeight = balancer_v2_math_1.MathSol.divDownFixed(balances[i], sumBalances);
|
|
90
|
-
balanceRatiosWithFee[i] = balancer_v2_math_1.MathSol.divDownFixed(balances[i] + amountsIn[i], balances[i]);
|
|
91
|
-
invariantRatioWithFees =
|
|
92
|
-
invariantRatioWithFees +
|
|
93
|
-
balancer_v2_math_1.MathSol.mulDownFixed(balanceRatiosWithFee[i], currentWeight);
|
|
94
|
-
}
|
|
95
|
-
// Second loop calculates new amounts in, taking into account the fee on the percentage excess
|
|
96
|
-
const newBalances = new Array(balances.length);
|
|
97
|
-
for (let i = 0; i < balances.length; i++) {
|
|
98
|
-
let amountInWithoutFee;
|
|
99
|
-
// Check if the balance ratio is greater than the ideal ratio to charge fees or not
|
|
100
|
-
if (balanceRatiosWithFee[i] > invariantRatioWithFees) {
|
|
101
|
-
const nonTaxableAmount = balancer_v2_math_1.MathSol.mulDownFixed(balances[i], invariantRatioWithFees - balancer_v2_math_1.MathSol.ONE);
|
|
102
|
-
const taxableAmount = amountsIn[i] - nonTaxableAmount;
|
|
103
|
-
// No need to use checked arithmetic for the swap fee, it is guaranteed to be lower than 50%
|
|
104
|
-
// amountInWithoutFee =
|
|
105
|
-
// nonTaxableAmount +
|
|
106
|
-
// MathSol.mulDownFixed(
|
|
107
|
-
// taxableAmount,
|
|
108
|
-
// MathSol.ONE - swapFeePercentage
|
|
109
|
-
// );
|
|
110
|
-
amountInWithoutFee = nonTaxableAmount + taxableAmount;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
amountInWithoutFee = amountsIn[i];
|
|
114
|
-
}
|
|
115
|
-
newBalances[i] = balances[i] + amountInWithoutFee;
|
|
116
|
-
}
|
|
117
|
-
// Get current and new invariants, taking swap fees into account
|
|
118
|
-
const currentInvariant = _calculateInvariant(amp, balances, true);
|
|
119
|
-
const newInvariant = _calculateInvariant(amp, newBalances, false);
|
|
120
|
-
const invariantRatio = balancer_v2_math_1.MathSol.divDownFixed(newInvariant, currentInvariant);
|
|
121
|
-
// If the invariant didn't increase for any reason, we simply don't mint BPT
|
|
122
|
-
if (invariantRatio > balancer_v2_math_1.MathSol.ONE) {
|
|
123
|
-
return balancer_v2_math_1.MathSol.mulDownFixed(bptTotalSupply, invariantRatio - balancer_v2_math_1.MathSol.ONE);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return 0n;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports._calcBptOutGivenExactTokensIn = _calcBptOutGivenExactTokensIn;
|
|
130
|
-
/*
|
|
131
|
-
Flow of calculations:
|
|
132
|
-
amountsTokenOut -> amountsOutProportional ->
|
|
133
|
-
amountOutPercentageExcess -> amountOutBeforeFee -> newInvariant -> amountBPTIn
|
|
134
|
-
*/
|
|
135
|
-
function _calcBptInGivenExactTokensOut(amp, balances, amountsOut, bptTotalSupply, swapFeePercentage, invariant) {
|
|
136
|
-
if (!invariant)
|
|
137
|
-
invariant = _calculateInvariant(amp, balances, true);
|
|
138
|
-
// BPT in, so we round up overall.
|
|
139
|
-
// First loop calculates the sum of all token balances, which will be used to calculate
|
|
140
|
-
// the current weights of each token relative to this sum
|
|
141
|
-
let sumBalances = 0n;
|
|
142
|
-
for (let i = 0; i < balances.length; i++) {
|
|
143
|
-
sumBalances = sumBalances + balances[i];
|
|
144
|
-
}
|
|
145
|
-
// Calculate the weighted balance ratio without considering fees
|
|
146
|
-
const balanceRatiosWithoutFee = new Array(amountsOut.length);
|
|
147
|
-
let invariantRatioWithoutFees = 0n;
|
|
148
|
-
for (let i = 0; i < balances.length; i++) {
|
|
149
|
-
const currentWeight = balancer_v2_math_1.MathSol.divUpFixed(balances[i], sumBalances);
|
|
150
|
-
balanceRatiosWithoutFee[i] = balancer_v2_math_1.MathSol.divUpFixed(balances[i] - amountsOut[i], balances[i]);
|
|
151
|
-
invariantRatioWithoutFees =
|
|
152
|
-
invariantRatioWithoutFees +
|
|
153
|
-
balancer_v2_math_1.MathSol.mulUpFixed(balanceRatiosWithoutFee[i], currentWeight);
|
|
154
|
-
}
|
|
155
|
-
// Second loop calculates new amounts in, taking into account the fee on the percentage excess
|
|
156
|
-
const newBalances = new Array(balances.length);
|
|
157
|
-
for (let i = 0; i < balances.length; i++) {
|
|
158
|
-
// Swap fees are typically charged on 'token in', but there is no 'token in' here, so we apply it to
|
|
159
|
-
// 'token out'. This results in slightly larger price impact.
|
|
160
|
-
let amountOutWithFee;
|
|
161
|
-
if (invariantRatioWithoutFees > balanceRatiosWithoutFee[i]) {
|
|
162
|
-
const nonTaxableAmount = balancer_v2_math_1.MathSol.mulDownFixed(balances[i], balancer_v2_math_1.MathSol.complementFixed(invariantRatioWithoutFees));
|
|
163
|
-
const taxableAmount = amountsOut[i] - nonTaxableAmount;
|
|
164
|
-
// No need to use checked arithmetic for the swap fee, it is guaranteed to be lower than 50%
|
|
165
|
-
amountOutWithFee =
|
|
166
|
-
nonTaxableAmount +
|
|
167
|
-
balancer_v2_math_1.MathSol.divUpFixed(taxableAmount, balancer_v2_math_1.MathSol.ONE - swapFeePercentage);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
amountOutWithFee = amountsOut[i];
|
|
171
|
-
}
|
|
172
|
-
newBalances[i] = balances[i] - amountOutWithFee;
|
|
173
|
-
}
|
|
174
|
-
// Get current and new invariants, taking into account swap fees
|
|
175
|
-
const currentInvariant = _calculateInvariant(amp, balances, true);
|
|
176
|
-
const newInvariant = _calculateInvariant(amp, newBalances, false);
|
|
177
|
-
const invariantRatio = balancer_v2_math_1.MathSol.divDownFixed(newInvariant, currentInvariant);
|
|
178
|
-
// return amountBPTIn
|
|
179
|
-
return balancer_v2_math_1.MathSol.mulUpFixed(bptTotalSupply, balancer_v2_math_1.MathSol.complementFixed(invariantRatio));
|
|
180
|
-
}
|
|
181
|
-
exports._calcBptInGivenExactTokensOut = _calcBptInGivenExactTokensOut;
|
|
182
|
-
function _calcTokenOutGivenExactBptIn(amp, balances, tokenIndex, bptAmountIn, bptTotalSupply, invariant) {
|
|
183
|
-
if (!invariant)
|
|
184
|
-
invariant = _calculateInvariant(amp, balances, true);
|
|
185
|
-
// Token out, so we round down overall.
|
|
186
|
-
// Get the current and new invariants. Since we need a bigger new invariant, we round the current one up.
|
|
187
|
-
const currentInvariant = _calculateInvariant(amp, balances, true);
|
|
188
|
-
const newInvariant = balancer_v2_math_1.MathSol.mulUpFixed(balancer_v2_math_1.MathSol.divUpFixed(bptTotalSupply - bptAmountIn, bptTotalSupply), currentInvariant);
|
|
189
|
-
// Calculate amount out without fee
|
|
190
|
-
const newBalanceTokenIndex = _getTokenBalanceGivenInvariantAndAllOtherBalances(amp, balances, newInvariant, tokenIndex);
|
|
191
|
-
const amountOutWithoutFee = balances[tokenIndex] - newBalanceTokenIndex;
|
|
192
|
-
// First calculate the sum of all token balances, which will be used to calculate
|
|
193
|
-
// the current weight of each token
|
|
194
|
-
let sumBalances = 0n;
|
|
195
|
-
for (let i = 0; i < balances.length; i++) {
|
|
196
|
-
sumBalances = sumBalances + balances[i];
|
|
197
|
-
}
|
|
198
|
-
// We can now compute how much excess balance is being withdrawn as a result of the virtual swaps, which result
|
|
199
|
-
// in swap fees.
|
|
200
|
-
const currentWeight = balancer_v2_math_1.MathSol.divDownFixed(balances[tokenIndex], sumBalances);
|
|
201
|
-
const taxablePercentage = balancer_v2_math_1.MathSol.complementFixed(currentWeight);
|
|
202
|
-
// Swap fees are typically charged on 'token in', but there is no 'token in' here, so we apply it
|
|
203
|
-
// to 'token out'. This results in slightly larger price impact. Fees are rounded up.
|
|
204
|
-
const taxableAmount = balancer_v2_math_1.MathSol.mulUpFixed(amountOutWithoutFee, taxablePercentage);
|
|
205
|
-
const nonTaxableAmount = amountOutWithoutFee - taxableAmount;
|
|
206
|
-
// No need to use checked arithmetic for the swap fee, it is guaranteed to be lower than 50%
|
|
207
|
-
return nonTaxableAmount + taxableAmount;
|
|
208
|
-
}
|
|
209
|
-
exports._calcTokenOutGivenExactBptIn = _calcTokenOutGivenExactBptIn;
|
|
210
|
-
function _calcTokensOutGivenExactBptIn(balances, bptAmountIn, bptTotalSupply) {
|
|
211
|
-
/**********************************************************************************************
|
|
212
|
-
// exactBPTInForTokensOut //
|
|
213
|
-
// (per token) //
|
|
214
|
-
// aO = tokenAmountOut / bptIn \ //
|
|
215
|
-
// b = tokenBalance a0 = b * | --------------------- | //
|
|
216
|
-
// bptIn = bptAmountIn \ bptTotalSupply / //
|
|
217
|
-
// bpt = bptTotalSupply //
|
|
218
|
-
**********************************************************************************************/
|
|
219
|
-
// Since we're computing an amount out, we round down overall. This means rounding down on both the
|
|
220
|
-
// multiplication and division.
|
|
221
|
-
const bptRatio = balancer_v2_math_1.MathSol.divDownFixed(bptAmountIn, bptTotalSupply);
|
|
222
|
-
const amountsOut = new Array(balances.length);
|
|
223
|
-
for (let i = 0; i < balances.length; i++) {
|
|
224
|
-
amountsOut[i] = balancer_v2_math_1.MathSol.mulDownFixed(balances[i], bptRatio);
|
|
225
|
-
}
|
|
226
|
-
return amountsOut;
|
|
227
|
-
}
|
|
228
|
-
exports._calcTokensOutGivenExactBptIn = _calcTokensOutGivenExactBptIn;
|
|
229
|
-
function _getTokenBalanceGivenInvariantAndAllOtherBalances(amp, balances, invariant, tokenIndex) {
|
|
230
|
-
// Rounds result up overall
|
|
231
|
-
const ampTimesTotal = amp * BigInt(balances.length);
|
|
232
|
-
let sum = balances[0];
|
|
233
|
-
let P_D = balances[0] * BigInt(balances.length);
|
|
234
|
-
for (let j = 1; j < balances.length; j++) {
|
|
235
|
-
P_D = balancer_v2_math_1.MathSol.divDown(balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.mul(P_D, balances[j]), BigInt(balances.length)), invariant);
|
|
236
|
-
sum = sum + balances[j];
|
|
237
|
-
}
|
|
238
|
-
// No need to use safe math, based on the loop above `sum` is greater than or equal to `balances[tokenIndex]`
|
|
239
|
-
sum = sum - balances[tokenIndex];
|
|
240
|
-
const inv2 = balancer_v2_math_1.MathSol.mul(invariant, invariant);
|
|
241
|
-
// We remove the balance fromm c by multiplying it
|
|
242
|
-
const c = balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.divUp(inv2, balancer_v2_math_1.MathSol.mul(ampTimesTotal, P_D)), AMP_PRECISION), balances[tokenIndex]);
|
|
243
|
-
const b = sum + balancer_v2_math_1.MathSol.mul(balancer_v2_math_1.MathSol.divDown(invariant, ampTimesTotal), AMP_PRECISION);
|
|
244
|
-
// We iterate to find the balance
|
|
245
|
-
let prevTokenBalance = 0n;
|
|
246
|
-
// We multiply the first iteration outside the loop with the invariant to set the value of the
|
|
247
|
-
// initial approximation.
|
|
248
|
-
let tokenBalance = balancer_v2_math_1.MathSol.divUp(inv2 + c, invariant + b);
|
|
249
|
-
for (let i = 0; i < 255; i++) {
|
|
250
|
-
prevTokenBalance = tokenBalance;
|
|
251
|
-
tokenBalance = balancer_v2_math_1.MathSol.divUp(balancer_v2_math_1.MathSol.mul(tokenBalance, tokenBalance) + c, balancer_v2_math_1.MathSol.mul(tokenBalance, 2n) + b - invariant);
|
|
252
|
-
if (tokenBalance > prevTokenBalance) {
|
|
253
|
-
if (tokenBalance - prevTokenBalance <= 1) {
|
|
254
|
-
return tokenBalance;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else if (prevTokenBalance - tokenBalance <= 1) {
|
|
258
|
-
return tokenBalance;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
throw new Error('Errors.STABLE_GET_BALANCE_DIDNT_CONVERGE');
|
|
262
|
-
}
|
|
263
|
-
function subtractFee(amount, fee) {
|
|
264
|
-
const feeAmount = balancer_v2_math_1.MathSol.mulUpFixed(amount, fee);
|
|
265
|
-
return amount - feeAmount;
|
|
266
|
-
}
|
|
267
|
-
exports.subtractFee = subtractFee;
|
|
268
|
-
function addFee(amount, fee) {
|
|
269
|
-
return balancer_v2_math_1.MathSol.divUpFixed(amount, balancer_v2_math_1.MathSol.complementFixed(fee));
|
|
270
|
-
}
|
|
271
|
-
exports.addFee = addFee;
|
|
272
|
-
//# sourceMappingURL=StableMath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StableMath.js","sourceRoot":"","sources":["../../../src/dex/balancer-v2/StableMath.ts"],"names":[],"mappings":";;;AAAA,6DAAiD;AACjD,yDAA6C;AAE7C,MAAM,aAAa,GAAG,0BAAO,CAAC,CAAC,CAAC,CAAC;AAEjC,SAAgB,mBAAmB,CACjC,GAAW,EACX,QAAkB,EAClB,OAAgB;IAEhB;;;;;;;uGAOmG;IAEnG,kCAAkC;IAElC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EA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,gBAAgB,EAAE;YACnC,IAAI,YAAY,GAAG,gBAAgB,IAAI,CAAC,EAAE;gBACxC,OAAO,YAAY,CAAC;aACrB;SACF;aAAM,IAAI,gBAAgB,GAAG,YAAY,IAAI,CAAC,EAAE;YAC/C,OAAO,YAAY,CAAC;SACrB;KACF;IACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC9D,CAAC;AAED,SAAgB,WAAW,CAAC,MAAc,EAAE,GAAW;IACrD,MAAM,SAAS,GAAG,0BAAO,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClD,OAAO,MAAM,GAAG,SAAS,CAAC;AAC5B,CAAC;AAHD,kCAGC;AAED,SAAgB,MAAM,CAAC,MAAc,EAAE,GAAW;IAChD,OAAO,0BAAO,CAAC,UAAU,CAAC,MAAM,EAAE,0BAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wBAEC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { SwapSide } from '../../constants';
|
|
3
|
-
import { callData, SubgraphPoolBase, PoolState } from './types';
|
|
4
|
-
export declare class BasePool {
|
|
5
|
-
_subtractSwapFeeAmount(amount: bigint, _swapFeePercentage: bigint): bigint;
|
|
6
|
-
_upscaleArray(amounts: bigint[], scalingFactors: bigint[]): bigint[];
|
|
7
|
-
_upscale(amount: bigint, scalingFactor: bigint): bigint;
|
|
8
|
-
_downscaleDown(amount: bigint, scalingFactor: bigint): bigint;
|
|
9
|
-
_nullifyIfMaxAmountExceeded(amountToTrade: bigint, swapMax: bigint): bigint;
|
|
10
|
-
}
|
|
11
|
-
declare type WeightedPoolPairData = {
|
|
12
|
-
tokenInBalance: bigint;
|
|
13
|
-
tokenOutBalance: bigint;
|
|
14
|
-
tokenInScalingFactor: bigint;
|
|
15
|
-
tokenOutScalingFactor: bigint;
|
|
16
|
-
tokenInWeight: bigint;
|
|
17
|
-
tokenOutWeight: bigint;
|
|
18
|
-
swapFee: bigint;
|
|
19
|
-
};
|
|
20
|
-
declare type StablePoolPairData = {
|
|
21
|
-
balances: bigint[];
|
|
22
|
-
indexIn: number;
|
|
23
|
-
indexOut: number;
|
|
24
|
-
scalingFactors: bigint[];
|
|
25
|
-
swapFee: bigint;
|
|
26
|
-
amp: bigint;
|
|
27
|
-
};
|
|
28
|
-
declare abstract class BaseGeneralPool extends BasePool {
|
|
29
|
-
onSell(amounts: bigint[], poolPairData: StablePoolPairData): bigint[];
|
|
30
|
-
_swapGivenIn(
|
|
31
|
-
tokenAmountsIn: bigint[],
|
|
32
|
-
balances: bigint[],
|
|
33
|
-
indexIn: number,
|
|
34
|
-
indexOut: number,
|
|
35
|
-
scalingFactors: bigint[],
|
|
36
|
-
_swapFeePercentage: bigint,
|
|
37
|
-
_amplificationParameter: bigint,
|
|
38
|
-
): bigint[];
|
|
39
|
-
abstract _onSwapGivenIn(
|
|
40
|
-
tokenAmountsIn: bigint[],
|
|
41
|
-
balances: bigint[],
|
|
42
|
-
indexIn: number,
|
|
43
|
-
indexOut: number,
|
|
44
|
-
_amplificationParameter: bigint,
|
|
45
|
-
): bigint[];
|
|
46
|
-
}
|
|
47
|
-
declare abstract class BaseMinimalSwapInfoPool extends BasePool {
|
|
48
|
-
onSell(
|
|
49
|
-
tokenAmountsIn: bigint[],
|
|
50
|
-
poolPairData: WeightedPoolPairData,
|
|
51
|
-
): bigint[];
|
|
52
|
-
abstract _onSwapGivenIn(
|
|
53
|
-
tokenAmountsIn: bigint[],
|
|
54
|
-
currentBalanceTokenIn: bigint,
|
|
55
|
-
currentBalanceTokenOut: bigint,
|
|
56
|
-
_weightIn: bigint,
|
|
57
|
-
_weightOut: bigint,
|
|
58
|
-
): bigint[];
|
|
59
|
-
}
|
|
60
|
-
export declare class StablePool extends BaseGeneralPool {
|
|
61
|
-
vaultAddress: string;
|
|
62
|
-
vaultInterface: Interface;
|
|
63
|
-
poolInterface: Interface;
|
|
64
|
-
metaPoolInterface: Interface;
|
|
65
|
-
constructor(vaultAddress: string, vaultInterface: Interface);
|
|
66
|
-
_onSwapGivenIn(
|
|
67
|
-
tokenAmountsIn: bigint[],
|
|
68
|
-
balances: bigint[],
|
|
69
|
-
indexIn: number,
|
|
70
|
-
indexOut: number,
|
|
71
|
-
_amplificationParameter: bigint,
|
|
72
|
-
): bigint[];
|
|
73
|
-
parsePoolPairData(
|
|
74
|
-
pool: SubgraphPoolBase,
|
|
75
|
-
poolState: PoolState,
|
|
76
|
-
tokenIn: string,
|
|
77
|
-
tokenOut: string,
|
|
78
|
-
): StablePoolPairData;
|
|
79
|
-
getOnChainCalls(pool: SubgraphPoolBase): callData[];
|
|
80
|
-
decodeOnChainCalls(
|
|
81
|
-
pool: SubgraphPoolBase,
|
|
82
|
-
data: {
|
|
83
|
-
success: boolean;
|
|
84
|
-
returnData: any;
|
|
85
|
-
}[],
|
|
86
|
-
startIndex: number,
|
|
87
|
-
): [
|
|
88
|
-
{
|
|
89
|
-
[address: string]: PoolState;
|
|
90
|
-
},
|
|
91
|
-
number,
|
|
92
|
-
];
|
|
93
|
-
getSwapMaxAmount(poolPairData: StablePoolPairData, side: SwapSide): bigint;
|
|
94
|
-
}
|
|
95
|
-
export declare class WeightedMath {
|
|
96
|
-
static _MAX_IN_RATIO: bigint;
|
|
97
|
-
static _MAX_OUT_RATIO: bigint;
|
|
98
|
-
static _calcOutGivenIn(
|
|
99
|
-
balanceIn: bigint,
|
|
100
|
-
weightIn: bigint,
|
|
101
|
-
balanceOut: bigint,
|
|
102
|
-
weightOut: bigint,
|
|
103
|
-
amountsIn: bigint[],
|
|
104
|
-
): bigint[];
|
|
105
|
-
}
|
|
106
|
-
export declare class WeightedPool extends BaseMinimalSwapInfoPool {
|
|
107
|
-
vaultAddress: string;
|
|
108
|
-
vaultInterface: Interface;
|
|
109
|
-
poolInterface: Interface;
|
|
110
|
-
constructor(vaultAddress: string, vaultInterface: Interface);
|
|
111
|
-
_onSwapGivenIn(
|
|
112
|
-
tokenAmountsIn: bigint[],
|
|
113
|
-
currentBalanceTokenIn: bigint,
|
|
114
|
-
currentBalanceTokenOut: bigint,
|
|
115
|
-
_weightIn: bigint,
|
|
116
|
-
_weightOut: bigint,
|
|
117
|
-
): bigint[];
|
|
118
|
-
parsePoolPairData(
|
|
119
|
-
pool: SubgraphPoolBase,
|
|
120
|
-
poolState: PoolState,
|
|
121
|
-
tokenIn: string,
|
|
122
|
-
tokenOut: string,
|
|
123
|
-
): WeightedPoolPairData;
|
|
124
|
-
getOnChainCalls(pool: SubgraphPoolBase): callData[];
|
|
125
|
-
decodeOnChainCalls(
|
|
126
|
-
pool: SubgraphPoolBase,
|
|
127
|
-
data: {
|
|
128
|
-
success: boolean;
|
|
129
|
-
returnData: any;
|
|
130
|
-
}[],
|
|
131
|
-
startIndex: number,
|
|
132
|
-
): [
|
|
133
|
-
{
|
|
134
|
-
[address: string]: PoolState;
|
|
135
|
-
},
|
|
136
|
-
number,
|
|
137
|
-
];
|
|
138
|
-
getSwapMaxAmount(poolPairData: WeightedPoolPairData, side: SwapSide): bigint;
|
|
139
|
-
}
|
|
140
|
-
export {};
|