@paraswap/dex-lib 4.1.21 → 4.1.22
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/dex/angle-transmuter/angle-transmuter.d.ts +3 -4
- package/build/dex/angle-transmuter/angle-transmuter.js +7 -5
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
- package/build/dex/cables/cables.js +4 -0
- package/build/dex/cables/cables.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +94 -0
- package/build/dex/uniswap-v3/uniswap-v3-new.js +923 -0
- package/build/dex/uniswap-v3/uniswap-v3-new.js.map +1 -0
- package/build/dex/zerox/index.d.ts +1 -1
- package/build/dex/zerox/index.js.map +1 -1
- package/package.json +1 -1
- package/build/abi/AaveV1_lending_pool.json +0 -27
- package/build/abi/Aave_GSM.json +0 -751
- package/build/abi/Balancer.json +0 -257
- package/build/abi/BalancerV2.json +0 -1179
- package/build/abi/RamsesV2Pool.abi.json +0 -1554
- package/build/abi/RamsesV2Quoter.abi.json +0 -274
- package/build/abi/USDM.json +0 -807
- package/build/abi/UniswapV2Router.json +0 -397
- package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +0 -1246
- package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
- package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
- package/build/abi/curve-v1/CurveTokenV1.json +0 -305
- package/build/abi/curve-v1/CurveTokenV2.json +0 -318
- package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
- package/build/abi/curve-v1/CurveV2Swap.json +0 -700
- package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
- package/build/abi/curve-v1/FactoryRegistry.json +0 -508
- package/build/abi/curve-v1/StableSwapAave.json +0 -1152
- package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
- package/build/abi/curve-v1/StableSwapCompound.json +0 -814
- package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
- package/build/abi/curve-v1/StableSwapPax.json +0 -865
- package/build/abi/curve-v1/StableSwapSnow.json +0 -900
- package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
- package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
- package/build/abi/curve-v1/StableSwapY.json +0 -814
- package/build/abi/inception/inception-ineth-pool.json +0 -1062
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-ratio-feed.json +0 -329
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
- package/build/abi/kyberdmm.abi.json +0 -1148
- package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
- package/build/abi/nerve/nerve-metapool.json +0 -790
- package/build/abi/platypus/asset.json +0 -490
- package/build/abi/platypus/avax-pool.json +0 -820
- package/build/abi/platypus/oracle.json +0 -119
- package/build/abi/platypus/pool.json +0 -677
- package/build/abi/smardex/all/smardex-router.json +0 -648
- package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
- package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
- package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
- package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
- package/build/abi/swaap-v1/pool.json +0 -1346
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
- package/build/dex/aave-v1/aave-v1.d.ts +0 -34
- package/build/dex/aave-v1/aave-v1.js +0 -180
- package/build/dex/aave-v1/aave-v1.js.map +0 -1
- package/build/dex/aave-v1/config.d.ts +0 -11
- package/build/dex/aave-v1/config.js +0 -20
- package/build/dex/aave-v1/config.js.map +0 -1
- package/build/dex/aave-v1/tokens-mainnet.json +0 -134
- package/build/dex/aave-v1/tokens.d.ts +0 -3
- package/build/dex/aave-v1/tokens.js +0 -50
- package/build/dex/aave-v1/tokens.js.map +0 -1
- package/build/dex/aave-v1/types.d.ts +0 -12
- package/build/dex/aave-v1/types.js +0 -3
- package/build/dex/aave-v1/types.js.map +0 -1
- package/build/dex/balancer-v1/balancer-pools.json +0 -33333
- package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
- package/build/dex/bebop/websocket-fetcher.js +0 -87
- package/build/dex/bebop/websocket-fetcher.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -4
- package/build/dex/inception/config.js +0 -109
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -16
- package/build/dex/inception/inception-event-pool.js +0 -51
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.d.ts +0 -43
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -43
- package/build/dex/inception/inception.js +0 -204
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- package/build/dex/inception/utils.d.ts +0 -6
- package/build/dex/inception/utils.js +0 -37
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/platypus/asset.d.ts +0 -14
- package/build/dex/platypus/asset.js +0 -97
- package/build/dex/platypus/asset.js.map +0 -1
- package/build/dex/platypus/config.d.ts +0 -11
- package/build/dex/platypus/config.js +0 -69
- package/build/dex/platypus/config.js.map +0 -1
- package/build/dex/platypus/platypus.d.ts +0 -63
- package/build/dex/platypus/platypus.js +0 -473
- package/build/dex/platypus/platypus.js.map +0 -1
- package/build/dex/platypus/pool-avax.d.ts +0 -8
- package/build/dex/platypus/pool-avax.js +0 -54
- package/build/dex/platypus/pool-avax.js.map +0 -1
- package/build/dex/platypus/pool-base.d.ts +0 -19
- package/build/dex/platypus/pool-base.js +0 -86
- package/build/dex/platypus/pool-base.js.map +0 -1
- package/build/dex/platypus/pool-pure.d.ts +0 -8
- package/build/dex/platypus/pool-pure.js +0 -37
- package/build/dex/platypus/pool-pure.js.map +0 -1
- package/build/dex/platypus/pool-subscriber.d.ts +0 -14
- package/build/dex/platypus/pool-subscriber.js +0 -167
- package/build/dex/platypus/pool-subscriber.js.map +0 -1
- package/build/dex/platypus/pool.d.ts +0 -8
- package/build/dex/platypus/pool.js +0 -58
- package/build/dex/platypus/pool.js.map +0 -1
- package/build/dex/platypus/types.d.ts +0 -92
- package/build/dex/platypus/types.js +0 -10
- package/build/dex/platypus/types.js.map +0 -1
- package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
- package/build/dex/quickswap/spiritswap-v3.js +0 -19
- package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
- package/build/dex/smardex/config.d.ts +0 -4
- package/build/dex/smardex/config.js +0 -64
- package/build/dex/smardex/config.js.map +0 -1
- package/build/dex/smardex/constants.d.ts +0 -18
- package/build/dex/smardex/constants.js +0 -33
- package/build/dex/smardex/constants.js.map +0 -1
- package/build/dex/smardex/sdk/constants.d.ts +0 -6
- package/build/dex/smardex/sdk/constants.js +0 -13
- package/build/dex/smardex/sdk/constants.js.map +0 -1
- package/build/dex/smardex/sdk/core.d.ts +0 -113
- package/build/dex/smardex/sdk/core.js +0 -499
- package/build/dex/smardex/sdk/core.js.map +0 -1
- package/build/dex/smardex/sdk/errors.d.ts +0 -15
- package/build/dex/smardex/sdk/errors.js +0 -22
- package/build/dex/smardex/sdk/errors.js.map +0 -1
- package/build/dex/smardex/sdk/types.d.ts +0 -62
- package/build/dex/smardex/sdk/types.js +0 -3
- package/build/dex/smardex/sdk/types.js.map +0 -1
- package/build/dex/smardex/sdk/utils.d.ts +0 -44
- package/build/dex/smardex/sdk/utils.js +0 -133
- package/build/dex/smardex/sdk/utils.js.map +0 -1
- package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
- package/build/dex/smardex/smardex-event-pool.js +0 -119
- package/build/dex/smardex/smardex-event-pool.js.map +0 -1
- package/build/dex/smardex/smardex.d.ts +0 -65
- package/build/dex/smardex/smardex.js +0 -519
- package/build/dex/smardex/smardex.js.map +0 -1
- package/build/dex/smardex/types.d.ts +0 -55
- package/build/dex/smardex/types.js +0 -3
- package/build/dex/smardex/types.js.map +0 -1
- package/build/dex/solidly/forks-override/cone.d.ts +0 -22
- package/build/dex/solidly/forks-override/cone.js +0 -53
- package/build/dex/solidly/forks-override/cone.js.map +0 -1
- package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
- package/build/dex/solidly/forks-override/solisnek.js +0 -15
- package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
- package/build/dex/swaap-v1/config.d.ts +0 -17
- package/build/dex/swaap-v1/config.js +0 -56
- package/build/dex/swaap-v1/config.js.map +0 -1
- package/build/dex/swaap-v1/constants.d.ts +0 -6
- package/build/dex/swaap-v1/constants.js +0 -17
- package/build/dex/swaap-v1/constants.js.map +0 -1
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
- package/build/dex/swaap-v1/libraries/Const.js +0 -26
- package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
- package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
- package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
- package/build/dex/swaap-v1/libraries/Num.js +0 -167
- package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
- package/build/dex/swaap-v1/libraries/Struct.js +0 -3
- package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
- package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +0 -62
- package/build/dex/swaap-v1/swaap-v1.js +0 -379
- package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
- package/build/dex/swaap-v1/types.d.ts +0 -106
- package/build/dex/swaap-v1/types.js +0 -9
- package/build/dex/swaap-v1/types.js.map +0 -1
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Platypus = void 0;
|
|
30
|
-
const abi_1 = require("@ethersproject/abi");
|
|
31
|
-
const constants_1 = require("../../constants");
|
|
32
|
-
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
33
|
-
const utils_1 = require("../../utils");
|
|
34
|
-
const types_1 = require("./types");
|
|
35
|
-
const simple_exchange_1 = require("../simple-exchange");
|
|
36
|
-
const config_1 = require("./config");
|
|
37
|
-
const chainlink_1 = require("../../lib/chainlink");
|
|
38
|
-
const pool_1 = require("./pool");
|
|
39
|
-
const pool_pure_1 = require("./pool-pure");
|
|
40
|
-
const pool_avax_1 = require("./pool-avax");
|
|
41
|
-
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
42
|
-
const pool_json_1 = __importDefault(require("../../abi/platypus/pool.json"));
|
|
43
|
-
const avax_pool_json_1 = __importDefault(require("../../abi/platypus/avax-pool.json"));
|
|
44
|
-
const asset_json_1 = __importDefault(require("../../abi/platypus/asset.json"));
|
|
45
|
-
const oracle_json_1 = __importDefault(require("../../abi/platypus/oracle.json"));
|
|
46
|
-
class Platypus extends simple_exchange_1.SimpleExchange {
|
|
47
|
-
constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network]) {
|
|
48
|
-
super(dexHelper, dexKey);
|
|
49
|
-
this.network = network;
|
|
50
|
-
this.dexHelper = dexHelper;
|
|
51
|
-
this.adapters = adapters;
|
|
52
|
-
this.hasConstantPriceLargeAmounts = false;
|
|
53
|
-
this.isFeeOnTransferSupported = false;
|
|
54
|
-
this.config = config_1.PlatypusConfig[dexKey][network];
|
|
55
|
-
this.logger = dexHelper.getLogger(`${dexKey}-${network}`);
|
|
56
|
-
}
|
|
57
|
-
async generateConfigInfo(blockNumber) {
|
|
58
|
-
const cfgInfo = {
|
|
59
|
-
poolAddresses: [],
|
|
60
|
-
pools: {},
|
|
61
|
-
};
|
|
62
|
-
// Need to filter pools in case we are testing against an old block where the pool didn't exist!
|
|
63
|
-
for (const p of this.config.pools) {
|
|
64
|
-
// When there's no code, getCode should return '0x' but could return '0x0' instead
|
|
65
|
-
if ((await this.dexHelper.web3Provider.eth.getCode(p.address, blockNumber))
|
|
66
|
-
.length > 3) {
|
|
67
|
-
const poolAddress = p.address.toLowerCase();
|
|
68
|
-
cfgInfo.poolAddresses.push(poolAddress);
|
|
69
|
-
if (p.oracleType === types_1.PlatypusOracleType.None) {
|
|
70
|
-
cfgInfo.pools[poolAddress] = {
|
|
71
|
-
oracleType: types_1.PlatypusOracleType.None,
|
|
72
|
-
tokenAddresses: [],
|
|
73
|
-
tokens: {},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
else if (p.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
77
|
-
cfgInfo.pools[poolAddress] = {
|
|
78
|
-
oracleType: types_1.PlatypusOracleType.ChainLink,
|
|
79
|
-
priceOracleAddress: '',
|
|
80
|
-
tokenAddresses: [],
|
|
81
|
-
tokens: {},
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else if (p.oracleType === types_1.PlatypusOracleType.StakedAvax) {
|
|
85
|
-
cfgInfo.pools[poolAddress] = {
|
|
86
|
-
oracleType: types_1.PlatypusOracleType.StakedAvax,
|
|
87
|
-
priceOracleAddress: '',
|
|
88
|
-
tokenAddresses: [],
|
|
89
|
-
tokens: {},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
throw new Error(`Invalid pool oracle type in ${this.dexKey}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
let inputs = [];
|
|
98
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
99
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
100
|
-
if (pool.oracleType !== types_1.PlatypusOracleType.None) {
|
|
101
|
-
inputs.push({
|
|
102
|
-
target: poolAddress,
|
|
103
|
-
callData: Platypus.poolInterface.encodeFunctionData('getPriceOracle'),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
inputs.push({
|
|
107
|
-
target: poolAddress,
|
|
108
|
-
callData: Platypus.poolInterface.encodeFunctionData('getTokenAddresses'),
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
let returnData = (await this.dexHelper.multiContract.methods
|
|
112
|
-
.aggregate(inputs)
|
|
113
|
-
.call({}, blockNumber)).returnData;
|
|
114
|
-
let i = 0;
|
|
115
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
116
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
117
|
-
if (pool.oracleType !== types_1.PlatypusOracleType.None) {
|
|
118
|
-
pool.priceOracleAddress = Platypus.poolInterface
|
|
119
|
-
.decodeFunctionResult('getPriceOracle', returnData[i++])[0]
|
|
120
|
-
.toLowerCase();
|
|
121
|
-
}
|
|
122
|
-
pool.tokenAddresses = Platypus.poolInterface
|
|
123
|
-
.decodeFunctionResult('getTokenAddresses', returnData[i++])[0]
|
|
124
|
-
.map((a) => a.toLowerCase());
|
|
125
|
-
}
|
|
126
|
-
inputs = [];
|
|
127
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
128
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
129
|
-
for (const tokenAddress of pool.tokenAddresses) {
|
|
130
|
-
inputs.push({
|
|
131
|
-
target: tokenAddress,
|
|
132
|
-
callData: Platypus.erc20Interface.encodeFunctionData('symbol'),
|
|
133
|
-
});
|
|
134
|
-
inputs.push({
|
|
135
|
-
target: tokenAddress,
|
|
136
|
-
callData: Platypus.erc20Interface.encodeFunctionData('decimals'),
|
|
137
|
-
});
|
|
138
|
-
inputs.push({
|
|
139
|
-
target: poolAddress,
|
|
140
|
-
callData: Platypus.poolInterface.encodeFunctionData('assetOf', [
|
|
141
|
-
tokenAddress,
|
|
142
|
-
]),
|
|
143
|
-
});
|
|
144
|
-
if (pool.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
145
|
-
inputs.push({
|
|
146
|
-
target: pool.priceOracleAddress,
|
|
147
|
-
callData: Platypus.oracleInterface.encodeFunctionData('getSourceOfAsset', [tokenAddress]),
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
returnData = (await this.dexHelper.multiContract.methods
|
|
153
|
-
.aggregate(inputs)
|
|
154
|
-
.call({}, blockNumber)).returnData;
|
|
155
|
-
i = 0;
|
|
156
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
157
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
158
|
-
for (const tokenAddress of pool.tokenAddresses) {
|
|
159
|
-
const tokenSymbol = Platypus.erc20Interface.decodeFunctionResult('symbol', returnData[i++])[0];
|
|
160
|
-
const tokenDecimals = Platypus.erc20Interface.decodeFunctionResult('decimals', returnData[i++])[0];
|
|
161
|
-
const assetAddress = Platypus.poolInterface
|
|
162
|
-
.decodeFunctionResult('assetOf', returnData[i++])[0]
|
|
163
|
-
.toLowerCase();
|
|
164
|
-
if (pool.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
165
|
-
const proxyAddress = Platypus.oracleInterface
|
|
166
|
-
.decodeFunctionResult('getSourceOfAsset', returnData[i++])[0]
|
|
167
|
-
.toLowerCase();
|
|
168
|
-
pool.tokens[tokenAddress] = {
|
|
169
|
-
tokenSymbol,
|
|
170
|
-
tokenDecimals,
|
|
171
|
-
assetAddress,
|
|
172
|
-
chainlink: {
|
|
173
|
-
proxyAddress,
|
|
174
|
-
aggregatorAddress: '',
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
pool.tokens[tokenAddress] = {
|
|
180
|
-
tokenSymbol,
|
|
181
|
-
tokenDecimals,
|
|
182
|
-
assetAddress,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
inputs = [];
|
|
188
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
189
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
190
|
-
if (pool.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
191
|
-
for (const tokenAddress of pool.tokenAddresses) {
|
|
192
|
-
inputs.push(chainlink_1.ChainLinkSubscriber.getReadAggregatorMultiCallInput(pool.tokens[tokenAddress].chainlink.proxyAddress));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
returnData = (await this.dexHelper.multiContract.methods
|
|
197
|
-
.aggregate(inputs)
|
|
198
|
-
.call({}, blockNumber)).returnData;
|
|
199
|
-
i = 0;
|
|
200
|
-
for (const poolAddress of cfgInfo.poolAddresses) {
|
|
201
|
-
const pool = cfgInfo.pools[poolAddress];
|
|
202
|
-
if (pool.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
203
|
-
for (const tokenAddress of pool.tokenAddresses) {
|
|
204
|
-
pool.tokens[tokenAddress].chainlink.aggregatorAddress =
|
|
205
|
-
chainlink_1.ChainLinkSubscriber.readAggregator(returnData[i++]).toLowerCase();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return cfgInfo;
|
|
210
|
-
}
|
|
211
|
-
async init(blockNumber) {
|
|
212
|
-
if (this.cfgInfo)
|
|
213
|
-
return;
|
|
214
|
-
this.cfgInfo = await this.generateConfigInfo(blockNumber);
|
|
215
|
-
}
|
|
216
|
-
// Initialize pricing is called once in the start of
|
|
217
|
-
// pricing service. It is intended to setup the integration
|
|
218
|
-
// for pricing requests. It is optional for a DEX to
|
|
219
|
-
// implement this function
|
|
220
|
-
async initializePricing(blockNumber) {
|
|
221
|
-
await this.init(blockNumber);
|
|
222
|
-
if (!this.cfgInfo)
|
|
223
|
-
throw new Error(`initializePricing: ${this.dexKey} cfgInfo still null after init`);
|
|
224
|
-
const eventPools = {};
|
|
225
|
-
for (const poolAddress of this.cfgInfo.poolAddresses) {
|
|
226
|
-
const cfgPool = this.cfgInfo.pools[poolAddress];
|
|
227
|
-
const poolName = this.config.pools.find(p => p.address.toLowerCase() === poolAddress).name;
|
|
228
|
-
let pool;
|
|
229
|
-
if (cfgPool.oracleType === types_1.PlatypusOracleType.None) {
|
|
230
|
-
pool = new pool_pure_1.PlatypusPurePool(this.dexKey, this.network, poolName, poolAddress, cfgPool, this.dexHelper);
|
|
231
|
-
}
|
|
232
|
-
else if (cfgPool.oracleType === types_1.PlatypusOracleType.ChainLink) {
|
|
233
|
-
pool = new pool_1.PlatypusPool(this.dexKey, this.network, poolName, poolAddress, cfgPool, this.dexHelper);
|
|
234
|
-
}
|
|
235
|
-
else if (cfgPool.oracleType === types_1.PlatypusOracleType.StakedAvax) {
|
|
236
|
-
pool = new pool_avax_1.PlatypusAvaxPool(this.dexKey, this.network, poolName, poolAddress, cfgPool, this.dexHelper);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
throw new Error(`${this.dexKey} cfgInfo invalid pool type`);
|
|
240
|
-
}
|
|
241
|
-
await pool.initialize(blockNumber);
|
|
242
|
-
eventPools[poolAddress] = pool;
|
|
243
|
-
}
|
|
244
|
-
this.eventPools = eventPools;
|
|
245
|
-
}
|
|
246
|
-
// Returns the list of contract adapters (name and index)
|
|
247
|
-
// for a buy/sell. Return null if there are no adapters.
|
|
248
|
-
getAdapters(side) {
|
|
249
|
-
return this.adapters[side];
|
|
250
|
-
}
|
|
251
|
-
findPools(srcTokenAddress, destTokenAddress) {
|
|
252
|
-
if (!this.cfgInfo)
|
|
253
|
-
return [];
|
|
254
|
-
return Object.entries(this.cfgInfo.pools)
|
|
255
|
-
.filter(([poolAddress, poolConfig]) => poolConfig.tokenAddresses.includes(srcTokenAddress) &&
|
|
256
|
-
poolConfig.tokenAddresses.includes(destTokenAddress))
|
|
257
|
-
.map(([poolAddress, poolConfig]) => poolAddress);
|
|
258
|
-
}
|
|
259
|
-
getPoolIdentifier(poolAddress) {
|
|
260
|
-
return `${this.dexKey}_${poolAddress}`;
|
|
261
|
-
}
|
|
262
|
-
// Returns list of pool identifiers that can be used
|
|
263
|
-
// for a given swap. poolIdentifers must be unique
|
|
264
|
-
// across DEXes. It is recommended to use
|
|
265
|
-
// ${dexKey}_${poolAddress} as a poolIdentifier
|
|
266
|
-
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
267
|
-
if (side === constants_1.SwapSide.BUY)
|
|
268
|
-
return [];
|
|
269
|
-
return this.findPools(this.dexHelper.config.wrapETH(srcToken).address.toLowerCase(), this.dexHelper.config.wrapETH(destToken).address.toLowerCase()).map(p => this.getPoolIdentifier(p));
|
|
270
|
-
}
|
|
271
|
-
// Returns pool prices for amounts.
|
|
272
|
-
// If limitPools is defined only pools in limitPools
|
|
273
|
-
// should be used. If limitPools is undefined then
|
|
274
|
-
// any pools can be used.
|
|
275
|
-
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
276
|
-
if (side === constants_1.SwapSide.BUY)
|
|
277
|
-
return null;
|
|
278
|
-
if (!this.eventPools) {
|
|
279
|
-
this.logger.error(`Missing event pools for ${this.dexKey} in getPricesVolume`);
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
const srcTokenAddress = this.dexHelper.config
|
|
283
|
-
.wrapETH(srcToken)
|
|
284
|
-
.address.toLowerCase();
|
|
285
|
-
const destTokenAddress = this.dexHelper.config
|
|
286
|
-
.wrapETH(destToken)
|
|
287
|
-
.address.toLowerCase();
|
|
288
|
-
if (srcTokenAddress === destTokenAddress)
|
|
289
|
-
return null;
|
|
290
|
-
return (await Promise.all(this.findPools(srcTokenAddress, destTokenAddress)
|
|
291
|
-
.filter(poolAddress => !limitPools ||
|
|
292
|
-
limitPools.includes(this.getPoolIdentifier(poolAddress)))
|
|
293
|
-
.map(poolAddress => (async (pool) => {
|
|
294
|
-
let state = pool.getState(blockNumber);
|
|
295
|
-
if (!state) {
|
|
296
|
-
state = await pool.generateState(blockNumber);
|
|
297
|
-
pool.setState(state, blockNumber);
|
|
298
|
-
}
|
|
299
|
-
if (state.params.paused)
|
|
300
|
-
return null;
|
|
301
|
-
const [unit, ...prices] = pool.computePrices({
|
|
302
|
-
address: srcTokenAddress,
|
|
303
|
-
decimals: srcToken.decimals,
|
|
304
|
-
}, {
|
|
305
|
-
address: destTokenAddress,
|
|
306
|
-
decimals: destToken.decimals,
|
|
307
|
-
}, [(0, utils_1.getBigIntPow)(srcToken.decimals), ...amounts], state);
|
|
308
|
-
const ret = {
|
|
309
|
-
prices,
|
|
310
|
-
unit,
|
|
311
|
-
data: {
|
|
312
|
-
pool: poolAddress,
|
|
313
|
-
},
|
|
314
|
-
poolAddresses: [poolAddress],
|
|
315
|
-
exchange: this.dexKey,
|
|
316
|
-
gasCost: 260 * 1000,
|
|
317
|
-
poolIdentifier: this.getPoolIdentifier(poolAddress),
|
|
318
|
-
};
|
|
319
|
-
return ret;
|
|
320
|
-
})(this.eventPools[poolAddress])))).filter((p) => !!p);
|
|
321
|
-
}
|
|
322
|
-
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
323
|
-
getCalldataGasCost(poolPrices) {
|
|
324
|
-
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
325
|
-
}
|
|
326
|
-
// Encode params required by the exchange adapter
|
|
327
|
-
// Used for multiSwap, buy & megaSwap
|
|
328
|
-
// Hint: abiCoder.encodeParameter() couls be useful
|
|
329
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
330
|
-
return {
|
|
331
|
-
targetExchange: data.pool,
|
|
332
|
-
payload: '0x',
|
|
333
|
-
networkFee: '0',
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
// Encode call data used by simpleSwap like routers
|
|
337
|
-
// Used for simpleSwap & simpleBuy
|
|
338
|
-
// Hint: this.buildSimpleParamWithoutWETHConversion
|
|
339
|
-
// could be useful
|
|
340
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
341
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, (0, utils_1.isETHAddress)(srcToken)
|
|
342
|
-
? Platypus.avaxPoolInterface.encodeFunctionData('swapFromETH', [
|
|
343
|
-
destToken,
|
|
344
|
-
1,
|
|
345
|
-
this.augustusAddress,
|
|
346
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
347
|
-
])
|
|
348
|
-
: (0, utils_1.isETHAddress)(destToken)
|
|
349
|
-
? Platypus.avaxPoolInterface.encodeFunctionData('swapToETH', [
|
|
350
|
-
srcToken,
|
|
351
|
-
srcAmount,
|
|
352
|
-
1,
|
|
353
|
-
this.augustusAddress,
|
|
354
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
355
|
-
])
|
|
356
|
-
: Platypus.poolInterface.encodeFunctionData('swap', [
|
|
357
|
-
srcToken,
|
|
358
|
-
destToken,
|
|
359
|
-
srcAmount,
|
|
360
|
-
1,
|
|
361
|
-
this.augustusAddress,
|
|
362
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
363
|
-
]), data.pool);
|
|
364
|
-
}
|
|
365
|
-
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
366
|
-
const swapData = (0, utils_1.isETHAddress)(srcToken)
|
|
367
|
-
? Platypus.avaxPoolInterface.encodeFunctionData('swapFromETH', [
|
|
368
|
-
destToken,
|
|
369
|
-
1,
|
|
370
|
-
recipient,
|
|
371
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
372
|
-
])
|
|
373
|
-
: (0, utils_1.isETHAddress)(destToken)
|
|
374
|
-
? Platypus.avaxPoolInterface.encodeFunctionData('swapToETH', [
|
|
375
|
-
srcToken,
|
|
376
|
-
srcAmount,
|
|
377
|
-
1,
|
|
378
|
-
recipient,
|
|
379
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
380
|
-
])
|
|
381
|
-
: Platypus.poolInterface.encodeFunctionData('swap', [
|
|
382
|
-
srcToken,
|
|
383
|
-
destToken,
|
|
384
|
-
srcAmount,
|
|
385
|
-
1,
|
|
386
|
-
recipient,
|
|
387
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
388
|
-
]);
|
|
389
|
-
return {
|
|
390
|
-
needWrapNative: this.needWrapNative,
|
|
391
|
-
dexFuncHasRecipient: true,
|
|
392
|
-
exchangeData: swapData,
|
|
393
|
-
targetExchange: data.pool,
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
// This is called once before getTopPoolsForToken is
|
|
397
|
-
// called for multiple tokens. This can be helpful to
|
|
398
|
-
// update common state required for calculating
|
|
399
|
-
// getTopPoolsForToken. It is optional for a DEX
|
|
400
|
-
// to implement this
|
|
401
|
-
async updatePoolState() {
|
|
402
|
-
const blockNumber = await this.dexHelper.web3Provider.eth.getBlockNumber();
|
|
403
|
-
await this.init(blockNumber);
|
|
404
|
-
if (!this.cfgInfo)
|
|
405
|
-
throw new Error('updatePoolState: Platypus cfgInfo still null after init');
|
|
406
|
-
// All tokens are USD stablecoins so to estimate liquidity can just add
|
|
407
|
-
// the cash balances of all the tokens
|
|
408
|
-
const poolLiquidityUSD = {};
|
|
409
|
-
let inputs = [];
|
|
410
|
-
for (const poolAddress of this.cfgInfo.poolAddresses) {
|
|
411
|
-
for (const tokenAddress of this.cfgInfo.pools[poolAddress]
|
|
412
|
-
.tokenAddresses) {
|
|
413
|
-
inputs.push({
|
|
414
|
-
target: this.cfgInfo.pools[poolAddress].tokens[tokenAddress].assetAddress,
|
|
415
|
-
callData: Platypus.assetInterface.encodeFunctionData('cash'),
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
const returnData = (await this.dexHelper.multiContract.methods
|
|
420
|
-
.aggregate(inputs)
|
|
421
|
-
.call({}, blockNumber)).returnData;
|
|
422
|
-
const usdPromises = [];
|
|
423
|
-
let i = 0;
|
|
424
|
-
for (const poolAddress of this.cfgInfo.poolAddresses) {
|
|
425
|
-
for (const tokenAddress of this.cfgInfo.pools[poolAddress]
|
|
426
|
-
.tokenAddresses) {
|
|
427
|
-
usdPromises.push(this.dexHelper.getTokenUSDPrice({
|
|
428
|
-
address: tokenAddress,
|
|
429
|
-
decimals: this.cfgInfo.pools[poolAddress].tokens[tokenAddress]
|
|
430
|
-
.tokenDecimals,
|
|
431
|
-
}, BigInt(Platypus.assetInterface
|
|
432
|
-
.decodeFunctionResult('cash', returnData[i++])[0]
|
|
433
|
-
.toString())));
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
const usdValues = await Promise.all(usdPromises);
|
|
437
|
-
i = 0;
|
|
438
|
-
for (const poolAddress of this.cfgInfo.poolAddresses) {
|
|
439
|
-
poolLiquidityUSD[poolAddress] = 0;
|
|
440
|
-
for (const tokenAddress of this.cfgInfo.pools[poolAddress]
|
|
441
|
-
.tokenAddresses) {
|
|
442
|
-
poolLiquidityUSD[poolAddress] += usdValues[i++];
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
this.poolLiquidityUSD = poolLiquidityUSD;
|
|
446
|
-
}
|
|
447
|
-
// Returns list of top pools based on liquidity. Max
|
|
448
|
-
// limit number pools should be returned.
|
|
449
|
-
async getTopPoolsForToken(tokenAddress, limit) {
|
|
450
|
-
if (!this.cfgInfo || !this.poolLiquidityUSD)
|
|
451
|
-
await this.updatePoolState();
|
|
452
|
-
tokenAddress = tokenAddress.toLowerCase();
|
|
453
|
-
const pools = this.cfgInfo.poolAddresses.filter(poolAddress => !!this.cfgInfo.pools[poolAddress].tokens[tokenAddress]);
|
|
454
|
-
pools.sort((a, b) => this.poolLiquidityUSD[b] - this.poolLiquidityUSD[a]);
|
|
455
|
-
return pools.slice(0, limit).map(poolAddress => ({
|
|
456
|
-
exchange: this.dexKey,
|
|
457
|
-
address: poolAddress,
|
|
458
|
-
connectorTokens: this.cfgInfo.pools[poolAddress].tokenAddresses.filter(t => t !== tokenAddress).map(t => ({
|
|
459
|
-
decimals: this.cfgInfo.pools[poolAddress].tokens[t].tokenDecimals,
|
|
460
|
-
address: t,
|
|
461
|
-
})),
|
|
462
|
-
liquidityUSD: this.poolLiquidityUSD[poolAddress],
|
|
463
|
-
}));
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
exports.Platypus = Platypus;
|
|
467
|
-
Platypus.erc20Interface = new abi_1.Interface(erc20_json_1.default);
|
|
468
|
-
Platypus.poolInterface = new abi_1.Interface(pool_json_1.default);
|
|
469
|
-
Platypus.avaxPoolInterface = new abi_1.Interface(avax_pool_json_1.default);
|
|
470
|
-
Platypus.assetInterface = new abi_1.Interface(asset_json_1.default);
|
|
471
|
-
Platypus.oracleInterface = new abi_1.Interface(oracle_json_1.default);
|
|
472
|
-
Platypus.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.PlatypusConfig);
|
|
473
|
-
//# sourceMappingURL=platypus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platypus.js","sourceRoot":"","sources":["../../../src/dex/platypus/platypus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA+C;AAc/C,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAgF;AAGhF,mCAKiB;AACjB,wDAG4B;AAC5B,qCAAoD;AACpD,mDAA0D;AAE1D,iCAAsC;AACtC,2CAA+C;AAC/C,2CAA+C;AAC/C,sEAA4C;AAC5C,6EAAmD;AACnD,uFAA4D;AAC5D,+EAAqD;AACrD,iFAAuD;AAEvD,MAAa,QAAS,SAAQ,gCAAc;IAuB1C,YACY,OAAgB,EAC1B,MAAc,EACJ,SAAqB,EACrB,WAAW,iBAAQ,CAAC,OAAO,CAAC;QAEtC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QALf,YAAO,GAAP,OAAO,CAAS;QAEhB,cAAS,GAAT,SAAS,CAAY;QACrB,aAAQ,GAAR,QAAQ,CAAoB;QAZ/B,iCAA4B,GAAG,KAAK,CAAC;QACrC,6BAAwB,GAAG,KAAK,CA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,CAAC,CAAC;QAC5E,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC/C,QAAQ,EAAE,IAAI,CAAC,MAAM;YACrB,OAAO,EAAE,WAAW;YACpB,eAAe,EAAE,IAAI,CAAC,OAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,MAAM,CACrE,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CACxB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,OAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa;gBAClE,OAAO,EAAE,CAAC;aACX,CAAC,CAAC;YACH,YAAY,EAAE,IAAI,CAAC,gBAAiB,CAAC,WAAW,CAAC;SAClD,CAAC,CAAC,CAAC;IACN,CAAC;;AAnkBH,4BAokBC;AAnkBiB,uBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC;AACzC,sBAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC;AACvC,0BAAiB,GAAG,IAAI,eAAS,CAAC,wBAAW,CAAC,CAAC;AAC/C,uBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC;AACzC,wBAAe,GAAG,IAAI,eAAS,CAAC,qBAAS,CAAC,CAAC;AAa7C,2BAAkB,GAC9B,IAAA,6BAAqB,EAAC,uBAAc,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Address, Token } from '../../types';
|
|
2
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
3
|
-
import { PlatypusAvaxPoolState, PlatypusAvaxPoolConfigInfo } from './types';
|
|
4
|
-
import { PlatypusPoolBase } from './pool-base';
|
|
5
|
-
export declare class PlatypusAvaxPool extends PlatypusPoolBase<PlatypusAvaxPoolState> {
|
|
6
|
-
constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusAvaxPoolConfigInfo, dexHelper: IDexHelper);
|
|
7
|
-
computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusAvaxPoolState): bigint[];
|
|
8
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatypusAvaxPool = void 0;
|
|
4
|
-
const lens_1 = require("../../lens");
|
|
5
|
-
const staked_avax_1 = require("../../lib/benqi/staked-avax");
|
|
6
|
-
const asset_1 = require("./asset");
|
|
7
|
-
const pool_subscriber_1 = require("./pool-subscriber");
|
|
8
|
-
const pool_base_1 = require("./pool-base");
|
|
9
|
-
class PlatypusAvaxPool extends pool_base_1.PlatypusPoolBase {
|
|
10
|
-
constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
|
|
11
|
-
super(dexKey, network, name, dexHelper, [
|
|
12
|
-
new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
|
|
13
|
-
new staked_avax_1.StakedAvaxSubscriber(poolCfg.priceOracleAddress, (0, lens_1.lens)().stakedAvax, dexHelper.getLogger(`Staked AVAX for ${dexKey}-${network} ${name}`)),
|
|
14
|
-
...Object.entries(poolCfg.tokens).map(([tokenAddress, c]) => new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`))),
|
|
15
|
-
], {
|
|
16
|
-
params: {
|
|
17
|
-
paused: false,
|
|
18
|
-
slippageParamK: 0n,
|
|
19
|
-
slippageParamN: 0n,
|
|
20
|
-
c1: 0n,
|
|
21
|
-
xThreshold: 0n,
|
|
22
|
-
haircutRate: 0n,
|
|
23
|
-
retentionRatio: 0n,
|
|
24
|
-
maxPriceDeviation: 0n,
|
|
25
|
-
},
|
|
26
|
-
asset: {},
|
|
27
|
-
stakedAvax: {
|
|
28
|
-
totalPooledAvax: 0n,
|
|
29
|
-
totalShares: 0n,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
computePrices(srcToken, destToken, amounts, state) {
|
|
34
|
-
let fromShares;
|
|
35
|
-
if (this.dexHelper.config.isWETH(destToken.address)) {
|
|
36
|
-
fromShares = true;
|
|
37
|
-
}
|
|
38
|
-
else if (this.dexHelper.config.isWETH(srcToken.address)) {
|
|
39
|
-
fromShares = false;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw new Error(`Unexpected tokens being swapped in ${this.name}`);
|
|
43
|
-
}
|
|
44
|
-
const sAvaxRate = staked_avax_1.StakedAvaxSubscriber.getPooledAvaxByShares(pool_base_1.WAD, state.stakedAvax);
|
|
45
|
-
return amounts.map(fromAmount => {
|
|
46
|
-
const idealToAmount = fromShares
|
|
47
|
-
? (0, pool_base_1.wmul)(fromAmount, sAvaxRate)
|
|
48
|
-
: (0, pool_base_1.wdiv)(fromAmount, sAvaxRate);
|
|
49
|
-
return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.PlatypusAvaxPool = PlatypusAvaxPool;
|
|
54
|
-
//# sourceMappingURL=pool-avax.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pool-avax.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-avax.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,6DAAmE;AACnE,mCAAkD;AAClD,uDAA2D;AAG3D,2CAA2E;AAE3E,MAAa,gBAAiB,SAAQ,4BAAuC;IAC3E,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAAmC,EACnC,SAAqB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,CAAC,OAAO,CAAC,EAAE;YACnD,UAAU,GAAG,IAAI,CAAC;SACnB;aAAM,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACzD,UAAU,GAAG,KAAK,CAAC;SACpB;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SACpE;QACD,MAAM,SAAS,GAAG,kCAAoB,CAAC,qBAAqB,CAC1D,eAAG,EACH,KAAK,CAAC,UAAU,CACjB,CAAC;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GAAG,UAAU;gBAC9B,CAAC,CAAC,IAAA,gBAAI,EAAC,UAAU,EAAE,SAAS,CAAC;gBAC7B,CAAC,CAAC,IAAA,gBAAI,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAChC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjFD,4CAiFC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { PartialEventSubscriber, ComposedEventSubscriber } from '../../composed-event-subscriber';
|
|
3
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
4
|
-
import { PlatypusPoolStateCommon } from './types';
|
|
5
|
-
import { Token } from '../../types';
|
|
6
|
-
export declare const ETH_UNIT: bigint;
|
|
7
|
-
export declare const WAD: bigint;
|
|
8
|
-
export declare const RAY: bigint;
|
|
9
|
-
export declare function wmul(x: bigint, y: bigint): bigint;
|
|
10
|
-
export declare function wdiv(x: bigint, y: bigint): bigint;
|
|
11
|
-
export declare function rmul(x: bigint, y: bigint): bigint;
|
|
12
|
-
export declare function rpow(x: bigint, n: bigint): bigint;
|
|
13
|
-
export declare function calcPrice(srcToken: Token, destToken: Token, fromAmount: bigint, idealToAmount: bigint, state: PlatypusPoolStateCommon): bigint;
|
|
14
|
-
export declare abstract class PlatypusPoolBase<State extends PlatypusPoolStateCommon> extends ComposedEventSubscriber<State> {
|
|
15
|
-
readonly dexKey: string;
|
|
16
|
-
protected readonly network: number;
|
|
17
|
-
constructor(dexKey: string, network: number, name: string, dexHelper: IDexHelper, parts: PartialEventSubscriber<State, any>[], blankState: DeepReadonly<State>);
|
|
18
|
-
abstract computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: State): bigint[];
|
|
19
|
-
}
|