@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,519 +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.Smardex = void 0;
|
|
30
|
-
const abi_1 = require("@ethersproject/abi");
|
|
31
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
32
|
-
const constants_1 = require("../../constants");
|
|
33
|
-
const utils_1 = require("../../utils");
|
|
34
|
-
const smardex_factory_json_1 = __importDefault(require("../../abi/smardex/layer-1/smardex-factory.json"));
|
|
35
|
-
const smardex_factory_json_2 = __importDefault(require("../../abi/smardex/layer-2/smardex-factory.json"));
|
|
36
|
-
const smardex_router_json_1 = __importDefault(require("../../abi/smardex/all/smardex-router.json"));
|
|
37
|
-
const simple_exchange_1 = require("../simple-exchange");
|
|
38
|
-
const constants_2 = require("../smardex/constants");
|
|
39
|
-
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
40
|
-
const config_1 = require("./config");
|
|
41
|
-
const IParaswap_json_1 = __importDefault(require("../../abi/IParaswap.json"));
|
|
42
|
-
const token_transfer_fee_1 = require("../../lib/token-transfer-fee");
|
|
43
|
-
const core_1 = require("./sdk/core");
|
|
44
|
-
const smardex_event_pool_1 = require("./smardex-event-pool");
|
|
45
|
-
const smardex_pool_json_1 = __importDefault(require("../../abi/smardex/layer-1/smardex-pool.json"));
|
|
46
|
-
const smardex_pool_json_2 = __importDefault(require("../../abi/smardex/layer-2/smardex-pool.json"));
|
|
47
|
-
const smardexPoolL1 = new abi_1.Interface(smardex_pool_json_1.default);
|
|
48
|
-
const smardexPoolL2 = new abi_1.Interface(smardex_pool_json_2.default);
|
|
49
|
-
const coder = new abi_1.AbiCoder();
|
|
50
|
-
function encodePools(pools) {
|
|
51
|
-
return pools.map(({ fee, direction, address }) => {
|
|
52
|
-
return ((BigInt(fee) << 161n) +
|
|
53
|
-
((direction ? 0n : 1n) << 160n) +
|
|
54
|
-
BigInt(address)).toString();
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
class Smardex extends simple_exchange_1.SimpleExchange {
|
|
58
|
-
constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
|
|
59
|
-
super(dexHelper, dexKey);
|
|
60
|
-
this.network = network;
|
|
61
|
-
this.dexHelper = dexHelper;
|
|
62
|
-
this.adapters = adapters;
|
|
63
|
-
this.pairs = {};
|
|
64
|
-
this.hasConstantPriceLargeAmounts = false;
|
|
65
|
-
this.isFeeOnTransferSupported = true;
|
|
66
|
-
this.SRC_TOKEN_DEX_TRANSFERS = 1;
|
|
67
|
-
this.DEST_TOKEN_DEX_TRANSFERS = 1;
|
|
68
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
69
|
-
const config = config_1.SmardexConfig[dexKey];
|
|
70
|
-
this.routerAddress = config[network].router;
|
|
71
|
-
this.factoryAddress = config[network].factoryAddress;
|
|
72
|
-
this.subgraphURL = config[network].subgraphURL;
|
|
73
|
-
this.initCode = config[network].initCode;
|
|
74
|
-
const factoryAbi = this.isLayer1()
|
|
75
|
-
? smardex_factory_json_1.default
|
|
76
|
-
: smardex_factory_json_2.default;
|
|
77
|
-
this.factory = new dexHelper.web3Provider.eth.Contract(factoryAbi, this.factoryAddress);
|
|
78
|
-
this.routerInterface = new abi_1.Interface(IParaswap_json_1.default);
|
|
79
|
-
this.exchangeRouterInterface = new abi_1.Interface(smardex_router_json_1.default);
|
|
80
|
-
}
|
|
81
|
-
getAdapters(side) {
|
|
82
|
-
return this.adapters[side] ? this.adapters[side] : null;
|
|
83
|
-
}
|
|
84
|
-
async getPoolIdentifiers(_from, _to, side, blockNumber) {
|
|
85
|
-
const from = this.dexHelper.config.wrapETH(_from);
|
|
86
|
-
const to = this.dexHelper.config.wrapETH(_to);
|
|
87
|
-
if (from.address.toLowerCase() === to.address.toLowerCase()) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
const tokenAddress = [from.address.toLowerCase(), to.address.toLowerCase()]
|
|
91
|
-
.sort((a, b) => (BigInt(a) > BigInt(b) ? 1 : -1))
|
|
92
|
-
.join('_');
|
|
93
|
-
const poolIdentifier = `${this.dexKey}_${tokenAddress}`;
|
|
94
|
-
return [poolIdentifier];
|
|
95
|
-
}
|
|
96
|
-
async getPricesVolume(_from, _to, amounts, side, blockNumber,
|
|
97
|
-
// list of pool identifiers to use for pricing, if undefined use all pools
|
|
98
|
-
limitPools, transferFees = {
|
|
99
|
-
srcFee: 0,
|
|
100
|
-
destFee: 0,
|
|
101
|
-
srcDexFee: 0,
|
|
102
|
-
destDexFee: 0,
|
|
103
|
-
}) {
|
|
104
|
-
try {
|
|
105
|
-
const from = this.dexHelper.config.wrapETH(_from);
|
|
106
|
-
const to = this.dexHelper.config.wrapETH(_to);
|
|
107
|
-
if (from.address.toLowerCase() === to.address.toLowerCase()) {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
const tokenAddress = [
|
|
111
|
-
from.address.toLowerCase(),
|
|
112
|
-
to.address.toLowerCase(),
|
|
113
|
-
]
|
|
114
|
-
.sort((a, b) => (BigInt(a) > BigInt(b) ? 1 : -1))
|
|
115
|
-
.join('_');
|
|
116
|
-
const poolIdentifier = `${this.dexKey}_${tokenAddress}`;
|
|
117
|
-
if (limitPools && limitPools.every(p => p !== poolIdentifier))
|
|
118
|
-
return null;
|
|
119
|
-
await this.batchCatchUpPairs([[from, to]], blockNumber);
|
|
120
|
-
const isSell = side === constants_1.SwapSide.SELL;
|
|
121
|
-
const pairParam = await this.getPairOrderedParams(from, to, blockNumber, transferFees.srcDexFee);
|
|
122
|
-
if (!pairParam)
|
|
123
|
-
return null;
|
|
124
|
-
const unitAmount = (0, utils_1.getBigIntPow)(isSell ? from.decimals : to.decimals);
|
|
125
|
-
// SmarDex does not support Fees on Transfer Tokens
|
|
126
|
-
const [unitVolumeWithFee, ...amountsWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unitAmount, ...amounts], side, isSell ? transferFees.srcFee : transferFees.destFee, isSell ? constants_1.SRC_TOKEN_PARASWAP_TRANSFERS : constants_1.DEST_TOKEN_PARASWAP_TRANSFERS);
|
|
127
|
-
const unit = isSell
|
|
128
|
-
? await this.getSellPricePath(unitVolumeWithFee, [pairParam])
|
|
129
|
-
: await this.getBuyPricePath(unitVolumeWithFee, [pairParam]);
|
|
130
|
-
const prices = isSell
|
|
131
|
-
? await Promise.all(amountsWithFee.map(amount => this.getSellPricePath(amount, [pairParam])))
|
|
132
|
-
: await Promise.all(amountsWithFee.map(amount => this.getBuyPricePath(amount, [pairParam])));
|
|
133
|
-
const [unitOutWithFee, ...outputsWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unit, ...prices], side,
|
|
134
|
-
// This part is confusing, because we treat differently SELL and BUY fees
|
|
135
|
-
// If Buy, we should apply transfer fee on srcToken on top of dexFee applied earlier
|
|
136
|
-
// But for Sell we should apply only one dexFee
|
|
137
|
-
isSell ? transferFees.destDexFee : transferFees.srcFee, isSell ? this.DEST_TOKEN_DEX_TRANSFERS : constants_1.SRC_TOKEN_PARASWAP_TRANSFERS);
|
|
138
|
-
// As uniswapv2 just has one pool per token pair
|
|
139
|
-
return [
|
|
140
|
-
{
|
|
141
|
-
prices: outputsWithFee,
|
|
142
|
-
unit: unitOutWithFee,
|
|
143
|
-
data: {
|
|
144
|
-
deadline: Math.floor(new Date().getTime()) + 120,
|
|
145
|
-
receiver: this.augustusAddress,
|
|
146
|
-
router: this.routerAddress,
|
|
147
|
-
path: [from.address.toLowerCase(), to.address.toLowerCase()],
|
|
148
|
-
factory: this.factoryAddress,
|
|
149
|
-
initCode: this.initCode,
|
|
150
|
-
pools: [
|
|
151
|
-
{
|
|
152
|
-
address: pairParam.exchange,
|
|
153
|
-
fee: 0,
|
|
154
|
-
direction: pairParam.fromToken.toLocaleLowerCase() ===
|
|
155
|
-
pairParam.token0.toLocaleLowerCase(),
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
exchange: this.dexKey,
|
|
160
|
-
poolIdentifier,
|
|
161
|
-
gasCost: constants_2.DefaultSmardexPoolGasCost,
|
|
162
|
-
poolAddresses: [pairParam.exchange],
|
|
163
|
-
},
|
|
164
|
-
];
|
|
165
|
-
}
|
|
166
|
-
catch (e) {
|
|
167
|
-
if (blockNumber === 0)
|
|
168
|
-
this.logger.error(`Error_getPricesVolume: Aurelius block manager not yet instantiated`);
|
|
169
|
-
this.logger.error(`Error_getPrices:`, e);
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async getBuyPricePath(amount, params) {
|
|
174
|
-
let price = amount;
|
|
175
|
-
for (const param of params.reverse()) {
|
|
176
|
-
price = await this.getBuyPrice(param, price);
|
|
177
|
-
}
|
|
178
|
-
return price;
|
|
179
|
-
}
|
|
180
|
-
async getSellPricePath(amount, params) {
|
|
181
|
-
let price = amount;
|
|
182
|
-
for (const param of params) {
|
|
183
|
-
price = await this.getSellPrice(param, price);
|
|
184
|
-
}
|
|
185
|
-
return price;
|
|
186
|
-
}
|
|
187
|
-
async getBuyPrice(priceParams, destAmount) {
|
|
188
|
-
const amountIn = (0, core_1.computeAmountIn)(priceParams.token0, priceParams.token1, priceParams.reserves0, priceParams.reserves1, priceParams.fictiveReserves0, priceParams.fictiveReserves1, destAmount, priceParams.toToken, +priceParams.priceAverageLastTimestamp, priceParams.priceAverage0, priceParams.priceAverage1, priceParams.feesLP, priceParams.feesPool).amount;
|
|
189
|
-
return BigInt(amountIn.toString());
|
|
190
|
-
}
|
|
191
|
-
async getSellPrice(priceParams, srcAmount) {
|
|
192
|
-
const amountOut = (0, core_1.computeAmountOut)(priceParams.token0, priceParams.token1, priceParams.reserves0, priceParams.reserves1, priceParams.fictiveReserves0, priceParams.fictiveReserves1, srcAmount, priceParams.fromToken, +priceParams.priceAverageLastTimestamp, priceParams.priceAverage0, priceParams.priceAverage1, priceParams.feesLP, priceParams.feesPool).amount;
|
|
193
|
-
return BigInt(amountOut.toString());
|
|
194
|
-
}
|
|
195
|
-
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
196
|
-
getCalldataGasCost(_poolPrices) {
|
|
197
|
-
return (CALLDATA_GAS_COST.DEX_OVERHEAD +
|
|
198
|
-
CALLDATA_GAS_COST.LENGTH_SMALL +
|
|
199
|
-
// ParentStruct header
|
|
200
|
-
CALLDATA_GAS_COST.OFFSET_SMALL +
|
|
201
|
-
// ParentStruct -> weth
|
|
202
|
-
CALLDATA_GAS_COST.ADDRESS +
|
|
203
|
-
// ParentStruct -> pools[] header
|
|
204
|
-
CALLDATA_GAS_COST.OFFSET_SMALL +
|
|
205
|
-
// ParentStruct -> pools[]
|
|
206
|
-
CALLDATA_GAS_COST.LENGTH_SMALL +
|
|
207
|
-
// ParentStruct -> pools[0]
|
|
208
|
-
CALLDATA_GAS_COST.wordNonZeroBytes(22));
|
|
209
|
-
}
|
|
210
|
-
async findPair(from, to) {
|
|
211
|
-
if (from.address.toLowerCase() === to.address.toLowerCase())
|
|
212
|
-
return null;
|
|
213
|
-
const [token0, token1] = BigInt(from.address.toLowerCase()) < BigInt(to.address.toLowerCase())
|
|
214
|
-
? [from, to]
|
|
215
|
-
: [to, from];
|
|
216
|
-
const key = `${token0.address.toLowerCase()}-${token1.address.toLowerCase()}`;
|
|
217
|
-
let pair = this.pairs[key];
|
|
218
|
-
if (pair)
|
|
219
|
-
return pair;
|
|
220
|
-
const exchange = await this.factory.methods
|
|
221
|
-
.getPair(token0.address, token1.address)
|
|
222
|
-
.call();
|
|
223
|
-
if (exchange === constants_1.NULL_ADDRESS) {
|
|
224
|
-
pair = { token0, token1 };
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
pair = { token0, token1, exchange };
|
|
228
|
-
}
|
|
229
|
-
this.pairs[key] = pair;
|
|
230
|
-
return pair;
|
|
231
|
-
}
|
|
232
|
-
async batchCatchUpPairs(pairs, blockNumber) {
|
|
233
|
-
if (!blockNumber)
|
|
234
|
-
return;
|
|
235
|
-
const pairsToFetch = [];
|
|
236
|
-
for (const _pair of pairs) {
|
|
237
|
-
const pair = await this.findPair(_pair[0], _pair[1]);
|
|
238
|
-
if (!(pair && pair.exchange))
|
|
239
|
-
continue;
|
|
240
|
-
if (!pair.pool) {
|
|
241
|
-
pairsToFetch.push(pair);
|
|
242
|
-
}
|
|
243
|
-
else if (!pair.pool.getState(blockNumber)) {
|
|
244
|
-
pairsToFetch.push(pair);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (!pairsToFetch.length)
|
|
248
|
-
return;
|
|
249
|
-
const reserves = await this.getManyPoolReserves(pairsToFetch, blockNumber);
|
|
250
|
-
if (reserves.length !== pairsToFetch.length) {
|
|
251
|
-
this.logger.error(`Error_getManyPoolReserves didn't get any pool reserves`);
|
|
252
|
-
}
|
|
253
|
-
for (let i = 0; i < pairsToFetch.length; i++) {
|
|
254
|
-
const pairState = reserves[i];
|
|
255
|
-
const pair = pairsToFetch[i];
|
|
256
|
-
if (!pair.pool) {
|
|
257
|
-
await this.addPool(pair, pairState.reserves0, pairState.reserves1, pairState.fictiveReserves0, pairState.fictiveReserves1, pairState.priceAverage0, pairState.priceAverage1, pairState.feesLP, pairState.feesPool, blockNumber, pairState.priceAverageLastTimestamp);
|
|
258
|
-
}
|
|
259
|
-
else
|
|
260
|
-
pair.pool.setState(pairState, blockNumber);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
// On Smardex the fees are upgradable on layer 2.
|
|
264
|
-
getFeesMultiCallData(pairAddress) {
|
|
265
|
-
if (this.isLayer1()) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
const callEntry = {
|
|
269
|
-
target: pairAddress,
|
|
270
|
-
callData: smardexPoolL2.encodeFunctionData('getPairFees'),
|
|
271
|
-
};
|
|
272
|
-
const callDecoder = (values) => {
|
|
273
|
-
const feesData = smardexPoolL2.decodeFunctionResult('getPairFees', values);
|
|
274
|
-
return {
|
|
275
|
-
feesLP: feesData.feesLP_.toBigInt(),
|
|
276
|
-
feesPool: feesData.feesPool_.toBigInt(),
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
return {
|
|
280
|
-
callEntry,
|
|
281
|
-
callDecoder,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
async addPool(pair, reserves0, reserves1, fictiveReserves0, fictiveReserves1, priceAverage0, priceAverage1, feesLp, feesPool, blockNumber, priceAverageLastTimestamp) {
|
|
285
|
-
const multiCallFeeData = this.getFeesMultiCallData(pair.exchange);
|
|
286
|
-
pair.pool = new smardex_event_pool_1.SmardexEventPool(this.isLayer1() ? smardexPoolL1 : smardexPoolL2, this.dexHelper, pair.exchange, pair.token0, pair.token1, this.logger,
|
|
287
|
-
// For layer 2 we need to fetch the fees
|
|
288
|
-
multiCallFeeData?.callEntry, multiCallFeeData?.callDecoder, this.isLayer1());
|
|
289
|
-
pair.pool.addressesSubscribed.push(pair.exchange);
|
|
290
|
-
await pair.pool.initialize(blockNumber, {
|
|
291
|
-
state: {
|
|
292
|
-
reserves0,
|
|
293
|
-
reserves1,
|
|
294
|
-
fictiveReserves0,
|
|
295
|
-
fictiveReserves1,
|
|
296
|
-
priceAverage0,
|
|
297
|
-
priceAverage1,
|
|
298
|
-
feesLP: feesLp,
|
|
299
|
-
feesPool,
|
|
300
|
-
priceAverageLastTimestamp,
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
async getManyPoolReserves(pairs, blockNumber) {
|
|
305
|
-
try {
|
|
306
|
-
const multiCallFeeData = pairs.map(pair => this.getFeesMultiCallData(pair.exchange));
|
|
307
|
-
const calldata = pairs
|
|
308
|
-
.map((pair, i) => {
|
|
309
|
-
let calldata = [
|
|
310
|
-
{
|
|
311
|
-
target: pair.exchange,
|
|
312
|
-
callData: smardexPoolL1.encodeFunctionData('getReserves'),
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
target: pair.exchange,
|
|
316
|
-
callData: smardexPoolL1.encodeFunctionData('getFictiveReserves'),
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
target: pair.exchange,
|
|
320
|
-
callData: smardexPoolL1.encodeFunctionData('getPriceAverage'),
|
|
321
|
-
},
|
|
322
|
-
];
|
|
323
|
-
// Fetch fees only on layer 2
|
|
324
|
-
!this.isLayer1() && calldata.push(multiCallFeeData[i].callEntry);
|
|
325
|
-
return calldata;
|
|
326
|
-
})
|
|
327
|
-
.flat();
|
|
328
|
-
const data = await this.dexHelper.multiContract.methods
|
|
329
|
-
.aggregate(calldata)
|
|
330
|
-
.call({}, blockNumber);
|
|
331
|
-
const returnData = lodash_1.default.chunk(data.returnData, 4);
|
|
332
|
-
return pairs.map((_pair, i) => ({
|
|
333
|
-
reserves0: coder
|
|
334
|
-
.decode(['uint256', 'uint256'], returnData[i][0])[0]
|
|
335
|
-
.toString(),
|
|
336
|
-
reserves1: coder
|
|
337
|
-
.decode(['uint256', 'uint256'], returnData[i][0])[1]
|
|
338
|
-
.toString(),
|
|
339
|
-
fictiveReserves0: coder
|
|
340
|
-
.decode(['uint256', 'uint256'], returnData[i][1])[0]
|
|
341
|
-
.toString(),
|
|
342
|
-
fictiveReserves1: coder
|
|
343
|
-
.decode(['uint256', 'uint256'], returnData[i][1])[1]
|
|
344
|
-
.toString(),
|
|
345
|
-
priceAverage0: coder
|
|
346
|
-
.decode(['uint256', 'uint256', 'uint256'], returnData[i][2])[0]
|
|
347
|
-
.toString(),
|
|
348
|
-
priceAverage1: coder
|
|
349
|
-
.decode(['uint256', 'uint256', 'uint256'], returnData[i][2])[1]
|
|
350
|
-
.toString(),
|
|
351
|
-
priceAverageLastTimestamp: coder
|
|
352
|
-
.decode(['uint256', 'uint256', 'uint256'], returnData[i][2])[2]
|
|
353
|
-
.toString(),
|
|
354
|
-
feesLP: this.isLayer1()
|
|
355
|
-
? constants_2.FEES_LAYER_ONE.feesLP
|
|
356
|
-
: multiCallFeeData[i].callDecoder(returnData[i][3]).feesLP,
|
|
357
|
-
feesPool: this.isLayer1()
|
|
358
|
-
? constants_2.FEES_LAYER_ONE.feesPool
|
|
359
|
-
: multiCallFeeData[i].callDecoder(returnData[i][3]).feesPool,
|
|
360
|
-
}));
|
|
361
|
-
}
|
|
362
|
-
catch (e) {
|
|
363
|
-
this.logger.error(`Error_getManyPoolReserves could not get reserves with error:`, e);
|
|
364
|
-
return [];
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
fixPath(path, srcToken, destToken) {
|
|
368
|
-
return path.map((token, i) => {
|
|
369
|
-
if ((i === 0 && srcToken.toLowerCase() === constants_1.ETHER_ADDRESS.toLowerCase()) ||
|
|
370
|
-
(i === path.length - 1 &&
|
|
371
|
-
destToken.toLowerCase() === constants_1.ETHER_ADDRESS.toLowerCase()))
|
|
372
|
-
return constants_1.ETHER_ADDRESS;
|
|
373
|
-
return token;
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
async getPairOrderedParams(from, to, blockNumber, tokenDexTransferFee) {
|
|
377
|
-
const pair = await this.findPair(from, to);
|
|
378
|
-
if (!(pair && pair.pool && pair.exchange))
|
|
379
|
-
return null;
|
|
380
|
-
const pairState = pair.pool.getState(blockNumber);
|
|
381
|
-
if (!pairState) {
|
|
382
|
-
this.logger.error(`Error_orderPairParams expected reserves, got none (maybe the pool doesn't exist) ${from.symbol || from.address} ${to.symbol || to.address}`);
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
// const fee = (pairState.feesPool + tokenDexTransferFee).toString();
|
|
386
|
-
return {
|
|
387
|
-
fromToken: from.address,
|
|
388
|
-
toToken: to.address,
|
|
389
|
-
token0: pair.token0.address,
|
|
390
|
-
token1: pair.token1.address,
|
|
391
|
-
reserves0: BigInt(pairState.reserves0),
|
|
392
|
-
reserves1: BigInt(pairState.reserves1),
|
|
393
|
-
fictiveReserves0: BigInt(pairState.fictiveReserves0),
|
|
394
|
-
fictiveReserves1: BigInt(pairState.fictiveReserves1),
|
|
395
|
-
priceAverage0: BigInt(pairState.priceAverage0),
|
|
396
|
-
priceAverage1: BigInt(pairState.priceAverage1),
|
|
397
|
-
priceAverageLastTimestamp: pairState.priceAverageLastTimestamp,
|
|
398
|
-
exchange: pair.exchange,
|
|
399
|
-
feesLP: BigInt(pairState.feesLP),
|
|
400
|
-
feesPool: BigInt(pairState.feesPool),
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
getWETHAddress(srcToken, destToken, weth) {
|
|
404
|
-
if (!(0, utils_1.isETHAddress)(srcToken) && !(0, utils_1.isETHAddress)(destToken))
|
|
405
|
-
return constants_1.NULL_ADDRESS;
|
|
406
|
-
return weth || this.dexHelper.config.data.wrappedNativeTokenAddress;
|
|
407
|
-
}
|
|
408
|
-
getAdapterParam(srcToken, destToken, srcAmount, toAmount, data, side) {
|
|
409
|
-
const payload = this.abiCoder.encodeParameter({
|
|
410
|
-
ParentStruct: {
|
|
411
|
-
path: 'address[]',
|
|
412
|
-
receiver: 'address',
|
|
413
|
-
},
|
|
414
|
-
}, {
|
|
415
|
-
path: data.path,
|
|
416
|
-
receiver: data.receiver,
|
|
417
|
-
});
|
|
418
|
-
return {
|
|
419
|
-
targetExchange: data.router,
|
|
420
|
-
payload,
|
|
421
|
-
networkFee: '0',
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
async getSimpleParam(src, dest, srcAmount, destAmount, data, side) {
|
|
425
|
-
let routerMethod;
|
|
426
|
-
let routerArgs;
|
|
427
|
-
if (side === constants_1.SwapSide.SELL) {
|
|
428
|
-
routerMethod = (0, utils_1.isETHAddress)(src)
|
|
429
|
-
? constants_2.SmardexRouterFunctions.sellExactEth
|
|
430
|
-
: constants_2.SmardexRouterFunctions.swapExactIn;
|
|
431
|
-
routerMethod = (0, utils_1.isETHAddress)(dest)
|
|
432
|
-
? constants_2.SmardexRouterFunctions.sellExactToken
|
|
433
|
-
: routerMethod;
|
|
434
|
-
routerArgs = (0, utils_1.isETHAddress)(src)
|
|
435
|
-
? [destAmount, data.path, data.receiver, data.deadline]
|
|
436
|
-
: [srcAmount, destAmount, data.path, data.receiver, data.deadline];
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
routerMethod = (0, utils_1.isETHAddress)(src)
|
|
440
|
-
? constants_2.SmardexRouterFunctions.buyExactToken
|
|
441
|
-
: constants_2.SmardexRouterFunctions.swapExactOut;
|
|
442
|
-
routerMethod = (0, utils_1.isETHAddress)(dest)
|
|
443
|
-
? constants_2.SmardexRouterFunctions.buyExactEth
|
|
444
|
-
: routerMethod;
|
|
445
|
-
routerArgs = (0, utils_1.isETHAddress)(src)
|
|
446
|
-
? [destAmount, data.path, data.receiver, data.deadline]
|
|
447
|
-
: [destAmount, srcAmount, data.path, data.receiver, data.deadline];
|
|
448
|
-
}
|
|
449
|
-
const swapData = this.exchangeRouterInterface.encodeFunctionData(routerMethod, routerArgs);
|
|
450
|
-
return this.buildSimpleParamWithoutWETHConversion(src, srcAmount, dest, destAmount, swapData, data.router);
|
|
451
|
-
}
|
|
452
|
-
isLayer1() {
|
|
453
|
-
return this.network === constants_1.Network.MAINNET;
|
|
454
|
-
}
|
|
455
|
-
async getTopPoolsForToken(tokenAddress, limit) {
|
|
456
|
-
if (!this.subgraphURL)
|
|
457
|
-
return [];
|
|
458
|
-
const query = `
|
|
459
|
-
query ($token: Bytes!, $limit: Int) {
|
|
460
|
-
pools0: pairs(first: $limit, orderBy: reserveUSD, orderDirection: desc, where: {token0: $token, reserve0_gt: 1, reserve1_gt: 1}) {
|
|
461
|
-
id
|
|
462
|
-
token0 {
|
|
463
|
-
id
|
|
464
|
-
decimals
|
|
465
|
-
}
|
|
466
|
-
token1 {
|
|
467
|
-
id
|
|
468
|
-
decimals
|
|
469
|
-
}
|
|
470
|
-
reserveUSD
|
|
471
|
-
}
|
|
472
|
-
pools1: pairs(first: $limit, orderBy: reserveUSD, orderDirection: desc, where: {token1: $token, reserve0_gt: 1, reserve1_gt: 1}) {
|
|
473
|
-
id
|
|
474
|
-
token0 {
|
|
475
|
-
id
|
|
476
|
-
decimals
|
|
477
|
-
}
|
|
478
|
-
token1 {
|
|
479
|
-
id
|
|
480
|
-
decimals
|
|
481
|
-
}
|
|
482
|
-
reserveUSD
|
|
483
|
-
}
|
|
484
|
-
}`;
|
|
485
|
-
const { data } = await this.dexHelper.httpRequest.post(this.subgraphURL, {
|
|
486
|
-
query,
|
|
487
|
-
variables: { token: tokenAddress.toLowerCase(), limit },
|
|
488
|
-
}, constants_2.SUBGRAPH_TIMEOUT, { 'x-api-key': this.dexHelper.config.data.smardexSubgraphAuthToken });
|
|
489
|
-
if (!(data && data.pools0 && data.pools1))
|
|
490
|
-
throw new Error("Couldn't fetch the pools from the subgraph");
|
|
491
|
-
const pools0 = lodash_1.default.map(data.pools0, pool => ({
|
|
492
|
-
exchange: this.dexKey,
|
|
493
|
-
address: pool.id.toLowerCase(),
|
|
494
|
-
connectorTokens: [
|
|
495
|
-
{
|
|
496
|
-
address: pool.token1.id.toLowerCase(),
|
|
497
|
-
decimals: parseInt(pool.token1.decimals),
|
|
498
|
-
},
|
|
499
|
-
],
|
|
500
|
-
liquidityUSD: parseFloat(pool.reserveUSD),
|
|
501
|
-
}));
|
|
502
|
-
const pools1 = lodash_1.default.map(data.pools1, pool => ({
|
|
503
|
-
exchange: this.dexKey,
|
|
504
|
-
address: pool.id.toLowerCase(),
|
|
505
|
-
connectorTokens: [
|
|
506
|
-
{
|
|
507
|
-
address: pool.token0.id.toLowerCase(),
|
|
508
|
-
decimals: parseInt(pool.token0.decimals),
|
|
509
|
-
},
|
|
510
|
-
],
|
|
511
|
-
liquidityUSD: parseFloat(pool.reserveUSD),
|
|
512
|
-
}));
|
|
513
|
-
return lodash_1.default.slice(lodash_1.default.sortBy(lodash_1.default.concat(pools0, pools1), [pool => -1 * pool.liquidityUSD]), 0, limit);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
exports.Smardex = Smardex;
|
|
517
|
-
Smardex.directFunctionName = constants_2.directSmardexFunctionName;
|
|
518
|
-
Smardex.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.SmardexConfig);
|
|
519
|
-
//# sourceMappingURL=smardex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smardex.js","sourceRoot":"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WAAW,EAAE;oBACrC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;iBACzC;aACF;YACD,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;SAC1C,CAAC,CAAC,CAAC;QAEJ,MAAM,MAAM,GAAG,gBAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YACzC,QAAQ,EAAE,IAAI,CAAC,MAAM;YACrB,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;YAC9B,eAAe,EAAE;gBACf;oBACE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE;oBACrC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;iBACzC;aACF;YACD,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;SAC1C,CAAC,CAAC,CAAC;QAEJ,OAAO,gBAAC,CAAC,KAAK,CACZ,gBAAC,CAAC,MAAM,CAAC,gBAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EACpE,CAAC,EACD,KAAK,CACN,CAAC;IACJ,CAAC;;AAzrBH,0BA0rBC;AAjrBQ,0BAAkB,GAAG,qCAAyB,CAAC;AAcxC,0BAAkB,GAC9B,IAAA,6BAAqB,EAAC,sBAAa,CAAC,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Address, NumberAsString } from '../../types';
|
|
2
|
-
import { UniswapV2Data, DexParams as UniswapV2DexParams, UniswapPool } from '../uniswap-v2/types';
|
|
3
|
-
import { UniswapV2Pair } from '../uniswap-v2/uniswap-v2';
|
|
4
|
-
import { SmardexEventPool } from './smardex-event-pool';
|
|
5
|
-
export interface SmardexPoolState extends SmardexFees {
|
|
6
|
-
reserves0: string;
|
|
7
|
-
reserves1: string;
|
|
8
|
-
fictiveReserves0: string;
|
|
9
|
-
fictiveReserves1: string;
|
|
10
|
-
priceAverage0: string;
|
|
11
|
-
priceAverage1: string;
|
|
12
|
-
priceAverageLastTimestamp: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SmardexData extends Omit<UniswapV2Data, 'feeFactor'> {
|
|
15
|
-
deadline: number;
|
|
16
|
-
receiver: Address;
|
|
17
|
-
}
|
|
18
|
-
export declare type SellOnSmardexParam = [
|
|
19
|
-
amountIn: NumberAsString,
|
|
20
|
-
amountOutMin: NumberAsString,
|
|
21
|
-
path: Address[],
|
|
22
|
-
receiver: Address,
|
|
23
|
-
deadline: number
|
|
24
|
-
];
|
|
25
|
-
export declare type BuyOnSmardexParam = [
|
|
26
|
-
amountIn: NumberAsString,
|
|
27
|
-
amountOutMin: NumberAsString,
|
|
28
|
-
path: Address[],
|
|
29
|
-
receiver: Address,
|
|
30
|
-
deadline: number
|
|
31
|
-
];
|
|
32
|
-
export declare type SmardexParam = SellOnSmardexParam | BuyOnSmardexParam;
|
|
33
|
-
export declare type DexParams = Omit<UniswapV2DexParams, 'feeCode'>;
|
|
34
|
-
export declare type SmardexFees = {
|
|
35
|
-
feesLP: bigint;
|
|
36
|
-
feesPool: bigint;
|
|
37
|
-
};
|
|
38
|
-
export interface SmardexPoolOrderedParams extends SmardexFees {
|
|
39
|
-
fromToken: string;
|
|
40
|
-
toToken: string;
|
|
41
|
-
token0: string;
|
|
42
|
-
token1: string;
|
|
43
|
-
reserves0: bigint;
|
|
44
|
-
reserves1: bigint;
|
|
45
|
-
fictiveReserves0: bigint;
|
|
46
|
-
fictiveReserves1: bigint;
|
|
47
|
-
priceAverage0: bigint;
|
|
48
|
-
priceAverage1: bigint;
|
|
49
|
-
priceAverageLastTimestamp: number;
|
|
50
|
-
exchange: string;
|
|
51
|
-
}
|
|
52
|
-
export interface SmardexPair extends Omit<UniswapV2Pair, 'pool'> {
|
|
53
|
-
pool?: SmardexEventPool;
|
|
54
|
-
}
|
|
55
|
-
export declare type SmardexPool = UniswapPool;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/smardex/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Solidly } from '../solidly';
|
|
2
|
-
import { SolidlyPair } from '../types';
|
|
3
|
-
import { Network } from '../../../constants';
|
|
4
|
-
import { IDexHelper } from '../../../dex-helper';
|
|
5
|
-
export declare class Cone extends Solidly {
|
|
6
|
-
protected network: Network;
|
|
7
|
-
protected dexHelper: IDexHelper;
|
|
8
|
-
feeFactor: number;
|
|
9
|
-
static dexKeysWithNetwork: {
|
|
10
|
-
key: string;
|
|
11
|
-
networks: Network[];
|
|
12
|
-
}[];
|
|
13
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
14
|
-
private callDecoder;
|
|
15
|
-
protected getFeesMultiCallData(pair: SolidlyPair): {
|
|
16
|
-
callEntry: {
|
|
17
|
-
target: string;
|
|
18
|
-
callData: string;
|
|
19
|
-
};
|
|
20
|
-
callDecoder: (values: any[]) => number;
|
|
21
|
-
};
|
|
22
|
-
}
|