@paraswap/dex-lib 4.1.9 → 4.1.10-pubsub
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/AaveV1_lending_pool.json +27 -0
- package/build/abi/Aave_GSM.json +751 -0
- package/build/abi/Balancer.json +257 -0
- package/build/abi/BalancerV2.json +1179 -0
- package/build/abi/RamsesV2Pool.abi.json +1554 -0
- package/build/abi/RamsesV2Quoter.abi.json +274 -0
- package/build/abi/USDM.json +807 -0
- package/build/abi/UniswapV2Router.json +397 -0
- package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
- package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
- package/build/abi/curve-v1/CurveBUSDv2.abi.json +1356 -0
- package/build/abi/curve-v1/CurveTokenV1.json +305 -0
- package/build/abi/curve-v1/CurveTokenV2.json +318 -0
- package/build/abi/curve-v1/CurveV1StableNg.json +1452 -0
- package/build/abi/curve-v1/CurveV2Swap.json +700 -0
- package/build/abi/curve-v1/FactoryCryptoRegistry.json +316 -0
- package/build/abi/curve-v1/FactoryRegistry.json +508 -0
- package/build/abi/curve-v1/StableSwapAave.json +1152 -0
- package/build/abi/curve-v1/StableSwapBUSD.json +814 -0
- package/build/abi/curve-v1/StableSwapCompound.json +814 -0
- package/build/abi/curve-v1/StableSwapIDLE.json +1253 -0
- package/build/abi/curve-v1/StableSwapPax.json +865 -0
- package/build/abi/curve-v1/StableSwapSnow.json +900 -0
- package/build/abi/curve-v1/StableSwapUSDN.json +1004 -0
- package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
- package/build/abi/curve-v1/StableSwapY.json +814 -0
- package/build/abi/ekubo/core.json +1266 -0
- package/build/abi/ekubo/data-fetcher.json +161 -0
- package/build/abi/ekubo/router.json +803 -0
- package/build/abi/inception/inception-ineth-pool.json +1062 -0
- package/build/abi/inception/inception-ineth.json +609 -0
- package/build/abi/inception/inception-ratio-feed.json +329 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/kyberdmm/kyber-storage.abi.json +824 -0
- package/build/abi/kyberdmm.abi.json +1148 -0
- package/build/abi/maverick-v2/MaverickV2Quoter.json +278 -0
- package/build/abi/nerve/nerve-metapool.json +790 -0
- package/build/abi/platypus/asset.json +490 -0
- package/build/abi/platypus/avax-pool.json +820 -0
- package/build/abi/platypus/oracle.json +119 -0
- package/build/abi/platypus/pool.json +677 -0
- package/build/abi/smardex/all/smardex-router.json +648 -0
- package/build/abi/smardex/layer-1/smardex-factory.json +242 -0
- package/build/abi/smardex/layer-1/smardex-pool.json +506 -0
- package/build/abi/smardex/layer-2/smardex-factory.json +185 -0
- package/build/abi/smardex/layer-2/smardex-pool.json +578 -0
- package/build/abi/swaap-v1/pool.json +1346 -0
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
- package/build/dex/aave-v1/aave-v1.d.ts +34 -0
- package/build/dex/aave-v1/aave-v1.js +180 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -0
- package/build/dex/aave-v1/config.d.ts +11 -0
- package/build/dex/aave-v1/config.js +20 -0
- package/build/dex/aave-v1/config.js.map +1 -0
- package/build/dex/aave-v1/tokens-mainnet.json +134 -0
- package/build/dex/aave-v1/tokens.d.ts +3 -0
- package/build/dex/aave-v1/tokens.js +50 -0
- package/build/dex/aave-v1/tokens.js.map +1 -0
- package/build/dex/aave-v1/types.d.ts +12 -0
- package/build/dex/aave-v1/types.js +3 -0
- package/build/dex/aave-v1/types.js.map +1 -0
- package/build/dex/aave-v3-stata/config.js +8 -8
- package/build/dex/aave-v3-stata/config.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js +2 -2
- package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/config.js +31 -24
- package/build/dex/aave-v3-stata-v2/config.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/types.d.ts +3 -2
- package/build/dex/aave-v3-stata-v2/types.js.map +1 -1
- package/build/dex/aave-v3-stata-v2/utils.d.ts +2 -2
- package/build/dex/aave-v3-stata-v2/utils.js +7 -6
- package/build/dex/aave-v3-stata-v2/utils.js.map +1 -1
- package/build/dex/balancer-v1/balancer-pools.json +33333 -0
- package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
- package/build/dex/bebop/websocket-fetcher.js +87 -0
- package/build/dex/bebop/websocket-fetcher.js.map +1 -0
- package/build/dex/ekubo/config.d.ts +3 -0
- package/build/dex/ekubo/config.js +23 -0
- package/build/dex/ekubo/config.js.map +1 -0
- package/build/dex/ekubo/ekubo.d.ts +49 -0
- package/build/dex/ekubo/ekubo.js +418 -0
- package/build/dex/ekubo/ekubo.js.map +1 -0
- package/build/dex/ekubo/pools/base-pool.d.ts +47 -0
- package/build/dex/ekubo/pools/base-pool.js +184 -0
- package/build/dex/ekubo/pools/base-pool.js.map +1 -0
- package/build/dex/ekubo/pools/math/constants.d.ts +3 -0
- package/build/dex/ekubo/pools/math/constants.js +7 -0
- package/build/dex/ekubo/pools/math/constants.js.map +1 -0
- package/build/dex/ekubo/pools/math/delta.d.ts +2 -0
- package/build/dex/ekubo/pools/math/delta.js +51 -0
- package/build/dex/ekubo/pools/math/delta.js.map +1 -0
- package/build/dex/ekubo/pools/math/price.d.ts +7 -0
- package/build/dex/ekubo/pools/math/price.js +116 -0
- package/build/dex/ekubo/pools/math/price.js.map +1 -0
- package/build/dex/ekubo/pools/math/swap.d.ts +18 -0
- package/build/dex/ekubo/pools/math/swap.js +128 -0
- package/build/dex/ekubo/pools/math/swap.js.map +1 -0
- package/build/dex/ekubo/pools/math/tick.d.ts +7 -0
- package/build/dex/ekubo/pools/math/tick.js +112 -0
- package/build/dex/ekubo/pools/math/tick.js.map +1 -0
- package/build/dex/ekubo/pools/oracle-pool.d.ts +10 -0
- package/build/dex/ekubo/pools/oracle-pool.js +19 -0
- package/build/dex/ekubo/pools/oracle-pool.js.map +1 -0
- package/build/dex/ekubo/types.d.ts +88 -0
- package/build/dex/ekubo/types.js +238 -0
- package/build/dex/ekubo/types.js.map +1 -0
- package/build/dex/ekubo/utils.d.ts +6 -0
- package/build/dex/ekubo/utils.js +30 -0
- package/build/dex/ekubo/utils.js.map +1 -0
- package/build/dex/generic-rfq/generic-rfq.js +1 -2
- package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
- package/build/dex/generic-rfq/rate-fetcher.d.ts +4 -1
- package/build/dex/generic-rfq/rate-fetcher.js +84 -23
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/hashflow/hashflow.js +4 -0
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/inception/config.d.ts +4 -0
- package/build/dex/inception/config.js +109 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +16 -0
- package/build/dex/inception/inception-event-pool.js +51 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/inception/inception-native.d.ts +43 -0
- package/build/dex/inception/inception-native.js +131 -0
- package/build/dex/inception/inception-native.js.map +1 -0
- package/build/dex/inception/inception-pool.d.ts +18 -0
- package/build/dex/inception/inception-pool.js +32 -0
- package/build/dex/inception/inception-pool.js.map +1 -0
- package/build/dex/inception/inception-price-feed.d.ts +19 -0
- package/build/dex/inception/inception-price-feed.js +51 -0
- package/build/dex/inception/inception-price-feed.js.map +1 -0
- package/build/dex/inception/inception.d.ts +43 -0
- package/build/dex/inception/inception.js +204 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/inception/types.js +3 -0
- package/build/dex/inception/types.js.map +1 -0
- package/build/dex/inception/utils.d.ts +6 -0
- package/build/dex/inception/utils.js +37 -0
- package/build/dex/inception/utils.js.map +1 -0
- package/build/dex/platypus/asset.d.ts +14 -0
- package/build/dex/platypus/asset.js +97 -0
- package/build/dex/platypus/asset.js.map +1 -0
- package/build/dex/platypus/config.d.ts +11 -0
- package/build/dex/platypus/config.js +69 -0
- package/build/dex/platypus/config.js.map +1 -0
- package/build/dex/platypus/platypus.d.ts +63 -0
- package/build/dex/platypus/platypus.js +473 -0
- package/build/dex/platypus/platypus.js.map +1 -0
- package/build/dex/platypus/pool-avax.d.ts +8 -0
- package/build/dex/platypus/pool-avax.js +54 -0
- package/build/dex/platypus/pool-avax.js.map +1 -0
- package/build/dex/platypus/pool-base.d.ts +19 -0
- package/build/dex/platypus/pool-base.js +86 -0
- package/build/dex/platypus/pool-base.js.map +1 -0
- package/build/dex/platypus/pool-pure.d.ts +8 -0
- package/build/dex/platypus/pool-pure.js +37 -0
- package/build/dex/platypus/pool-pure.js.map +1 -0
- package/build/dex/platypus/pool-subscriber.d.ts +14 -0
- package/build/dex/platypus/pool-subscriber.js +167 -0
- package/build/dex/platypus/pool-subscriber.js.map +1 -0
- package/build/dex/platypus/pool.d.ts +8 -0
- package/build/dex/platypus/pool.js +58 -0
- package/build/dex/platypus/pool.js.map +1 -0
- package/build/dex/platypus/types.d.ts +92 -0
- package/build/dex/platypus/types.js +10 -0
- package/build/dex/platypus/types.js.map +1 -0
- package/build/dex/quickswap/spiritswap-v3.d.ts +6 -0
- package/build/dex/quickswap/spiritswap-v3.js +19 -0
- package/build/dex/quickswap/spiritswap-v3.js.map +1 -0
- package/build/dex/smardex/config.d.ts +4 -0
- package/build/dex/smardex/config.js +64 -0
- package/build/dex/smardex/config.js.map +1 -0
- package/build/dex/smardex/constants.d.ts +18 -0
- package/build/dex/smardex/constants.js +33 -0
- package/build/dex/smardex/constants.js.map +1 -0
- package/build/dex/smardex/sdk/constants.d.ts +6 -0
- package/build/dex/smardex/sdk/constants.js +13 -0
- package/build/dex/smardex/sdk/constants.js.map +1 -0
- package/build/dex/smardex/sdk/core.d.ts +113 -0
- package/build/dex/smardex/sdk/core.js +499 -0
- package/build/dex/smardex/sdk/core.js.map +1 -0
- package/build/dex/smardex/sdk/errors.d.ts +15 -0
- package/build/dex/smardex/sdk/errors.js +22 -0
- package/build/dex/smardex/sdk/errors.js.map +1 -0
- package/build/dex/smardex/sdk/types.d.ts +62 -0
- package/build/dex/smardex/sdk/types.js +3 -0
- package/build/dex/smardex/sdk/types.js.map +1 -0
- package/build/dex/smardex/sdk/utils.d.ts +44 -0
- package/build/dex/smardex/sdk/utils.js +133 -0
- package/build/dex/smardex/sdk/utils.js.map +1 -0
- package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
- package/build/dex/smardex/smardex-event-pool.js +119 -0
- package/build/dex/smardex/smardex-event-pool.js.map +1 -0
- package/build/dex/smardex/smardex.d.ts +65 -0
- package/build/dex/smardex/smardex.js +519 -0
- package/build/dex/smardex/smardex.js.map +1 -0
- package/build/dex/smardex/types.d.ts +55 -0
- package/build/dex/smardex/types.js +3 -0
- package/build/dex/smardex/types.js.map +1 -0
- package/build/dex/solidly/forks-override/cone.d.ts +22 -0
- package/build/dex/solidly/forks-override/cone.js +53 -0
- package/build/dex/solidly/forks-override/cone.js.map +1 -0
- package/build/dex/solidly/forks-override/solisnek.d.ts +8 -0
- package/build/dex/solidly/forks-override/solisnek.js +15 -0
- package/build/dex/solidly/forks-override/solisnek.js.map +1 -0
- package/build/dex/swaap-v1/config.d.ts +17 -0
- package/build/dex/swaap-v1/config.js +56 -0
- package/build/dex/swaap-v1/config.js.map +1 -0
- package/build/dex/swaap-v1/constants.d.ts +6 -0
- package/build/dex/swaap-v1/constants.js +17 -0
- package/build/dex/swaap-v1/constants.js.map +1 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +25 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +62 -0
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Const.d.ts +18 -0
- package/build/dex/swaap-v1/libraries/Const.js +26 -0
- package/build/dex/swaap-v1/libraries/Const.js.map +1 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +77 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +316 -0
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +1 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +75 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.js +418 -0
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +1 -0
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +185 -0
- package/build/dex/swaap-v1/libraries/MathMMM.js +453 -0
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Num.d.ts +31 -0
- package/build/dex/swaap-v1/libraries/Num.js +167 -0
- package/build/dex/swaap-v1/libraries/Num.js.map +1 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +23 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +131 -0
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +1 -0
- package/build/dex/swaap-v1/libraries/Struct.d.ts +56 -0
- package/build/dex/swaap-v1/libraries/Struct.js +3 -0
- package/build/dex/swaap-v1/libraries/Struct.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +45 -0
- package/build/dex/swaap-v1/swaap-v1-pool.js +656 -0
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +62 -0
- package/build/dex/swaap-v1/swaap-v1.js +379 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -0
- package/build/dex/swaap-v1/types.d.ts +106 -0
- package/build/dex/swaap-v1/types.js +9 -0
- package/build/dex/swaap-v1/types.js.map +1 -0
- package/build/dex/zerox/index.d.ts +1 -1
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.js +3 -0
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
- package/build/lib/pub-sub.d.ts +20 -0
- package/build/lib/pub-sub.js +112 -4
- package/build/lib/pub-sub.js.map +1 -1
- package/package.json +2 -2
- package/src/abi/balancer-v3/directionalFeeHook.json +677 -677
- package/src/abi/balancer-v3/stableSurgeHook.json +975 -975
- package/src/dex/aave-v3-stata/config.ts +8 -8
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts +5 -5
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts +2 -2
- package/src/dex/aave-v3-stata-v2/config.ts +31 -24
- package/src/dex/aave-v3-stata-v2/types.ts +3 -2
- package/src/dex/aave-v3-stata-v2/utils.ts +18 -10
- package/src/dex/generic-rfq/generic-rfq.ts +1 -6
- package/src/dex/generic-rfq/rate-fetcher.ts +130 -58
- package/src/dex/hashflow/hashflow.ts +12 -0
- package/src/dex-helper/dummy-dex-helper.ts +10 -0
- package/src/lib/pub-sub.ts +145 -5
- package/tests/constants-e2e.ts +10 -0
- package/tests/utils-e2e.ts +0 -1
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -12
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/scripts/get-uniswap-v3-dexes.ts +0 -64
package/src/lib/pub-sub.ts
CHANGED
|
@@ -11,6 +11,151 @@ type KeyValuePubSubMsg = {
|
|
|
11
11
|
|
|
12
12
|
type SetPubSubMsg = string[];
|
|
13
13
|
|
|
14
|
+
export class ExpKeyValuePubSub {
|
|
15
|
+
channel: string;
|
|
16
|
+
network: Network;
|
|
17
|
+
localCache: NodeCache = new NodeCache();
|
|
18
|
+
|
|
19
|
+
logger: Logger;
|
|
20
|
+
|
|
21
|
+
private localCacheHits = 0;
|
|
22
|
+
private localCacheMisses = 0;
|
|
23
|
+
private redisCacheHits = 0;
|
|
24
|
+
private redisCacheMisses = 0;
|
|
25
|
+
private cacheLogInterval = parseInt(
|
|
26
|
+
process.env.CACHE_LOG_INTERVAL || '1000',
|
|
27
|
+
10,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
private dexHelper: IDexHelper,
|
|
32
|
+
private dexKey: string,
|
|
33
|
+
channel: string,
|
|
34
|
+
private defaultValue?: any,
|
|
35
|
+
private defaultTTL?: number,
|
|
36
|
+
) {
|
|
37
|
+
this.network = this.dexHelper.config.data.network;
|
|
38
|
+
this.channel = `${this.network}_${this.dexKey}_${channel}`;
|
|
39
|
+
|
|
40
|
+
this.logger = this.dexHelper.getLogger(`ExpKeyValuePubSub_${this.channel}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
subscribe() {
|
|
44
|
+
this.logger.info(
|
|
45
|
+
`Subscribing to ${this.channel} with isSlave=${this.dexHelper.config.isSlave}`,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
this.dexHelper.cache.subscribe(this.channel, (_, msg) => {
|
|
49
|
+
try {
|
|
50
|
+
const decodedMsg = JSON.parse(msg) as KeyValuePubSubMsg;
|
|
51
|
+
this.handleSubscription(decodedMsg);
|
|
52
|
+
} catch (error: any) {
|
|
53
|
+
this.logger.error(
|
|
54
|
+
`Failed to process pub/sub message: ${error?.message}`,
|
|
55
|
+
{
|
|
56
|
+
channel: this.channel,
|
|
57
|
+
messagePreview: msg.substring(0, 100),
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
publish(data: Record<string, unknown>, ttl: number) {
|
|
65
|
+
const expiresAt = Math.round(Date.now() / 1000) + ttl;
|
|
66
|
+
this.logger.debug(
|
|
67
|
+
`Publishing to ${this.channel} with keys: ${Object.keys(data).join(
|
|
68
|
+
', ',
|
|
69
|
+
)}, TTL: ${ttl}`,
|
|
70
|
+
);
|
|
71
|
+
this.dexHelper.cache.publish(
|
|
72
|
+
this.channel,
|
|
73
|
+
JSON.stringify({ expiresAt, data }),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
handleSubscription(msg: KeyValuePubSubMsg) {
|
|
78
|
+
const { expiresAt, data } = msg;
|
|
79
|
+
|
|
80
|
+
const now = Math.round(Date.now() / 1000);
|
|
81
|
+
// calculating ttl as message might come with the delay
|
|
82
|
+
const ttl = expiresAt - now;
|
|
83
|
+
|
|
84
|
+
if (ttl > 0) {
|
|
85
|
+
const keys = Object.keys(data);
|
|
86
|
+
for (const key of keys) {
|
|
87
|
+
this.logger.debug(`Setting local cache for ${key} with TTL ${ttl}`);
|
|
88
|
+
this.localCache.set(key, data[key], ttl);
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
this.logger.error('Message has expired', {
|
|
92
|
+
now,
|
|
93
|
+
expiresAt,
|
|
94
|
+
diffInSeconds: now - expiresAt,
|
|
95
|
+
keys: Object.keys(data),
|
|
96
|
+
channel: this.channel,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async getAndCache<T>(key: string): Promise<T | null> {
|
|
102
|
+
const localValue = this.localCache.get<T>(key);
|
|
103
|
+
|
|
104
|
+
if (localValue) {
|
|
105
|
+
this.localCacheHits++;
|
|
106
|
+
if (this.localCacheHits % this.cacheLogInterval === 0) {
|
|
107
|
+
this.logger.info(
|
|
108
|
+
`Cache stats for ${this.channel}: local hits=${this.localCacheHits}, local misses=${this.localCacheMisses}, redis hits=${this.redisCacheHits}, redis misses=${this.redisCacheMisses}`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return localValue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
this.localCacheMisses++;
|
|
115
|
+
const cacheKey = `${this.dexKey}_${this.network}_${key}`;
|
|
116
|
+
|
|
117
|
+
this.logger.debug(`Cache miss for ${cacheKey} in local cache`);
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const [value, ttl] = await Promise.all([
|
|
121
|
+
this.dexHelper.cache.get(this.dexKey, this.network, key),
|
|
122
|
+
this.dexHelper.cache.ttl(this.dexKey, this.network, key),
|
|
123
|
+
]);
|
|
124
|
+
|
|
125
|
+
if (value && ttl > 0) {
|
|
126
|
+
this.redisCacheHits++;
|
|
127
|
+
this.logger.debug(`Redis cache hit for ${cacheKey} with TTL ${ttl}`);
|
|
128
|
+
const parsedValue = JSON.parse(value);
|
|
129
|
+
this.localCache.set(key, parsedValue, ttl);
|
|
130
|
+
return parsedValue;
|
|
131
|
+
} else if (value) {
|
|
132
|
+
this.redisCacheMisses++;
|
|
133
|
+
this.logger.warn(
|
|
134
|
+
`Redis cache hit for ${cacheKey} but TTL is ${ttl} (expired)`,
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
this.redisCacheMisses++;
|
|
138
|
+
this.logger.debug(`Redis cache miss for ${cacheKey}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (this.defaultValue && this.defaultTTL && this.defaultTTL > 0) {
|
|
142
|
+
this.logger.debug(
|
|
143
|
+
`Using default value for ${cacheKey} with TTL ${this.defaultTTL}`,
|
|
144
|
+
);
|
|
145
|
+
this.localCache.set(key, this.defaultValue, this.defaultTTL);
|
|
146
|
+
return this.defaultValue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return null;
|
|
150
|
+
} catch (error: any) {
|
|
151
|
+
this.logger.error(
|
|
152
|
+
`Error fetching from Redis for ${cacheKey}: ${error.message}`,
|
|
153
|
+
);
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
14
159
|
export class ExpStringPubSub {
|
|
15
160
|
channel: string;
|
|
16
161
|
network: Network;
|
|
@@ -193,8 +338,6 @@ export class NonExpSetPubSub {
|
|
|
193
338
|
}
|
|
194
339
|
|
|
195
340
|
async initializeAndSubscribe(initialSet: string[]) {
|
|
196
|
-
this.logger.info(`initializeAndSubscribe with ${initialSet}`);
|
|
197
|
-
|
|
198
341
|
for (const member of initialSet) {
|
|
199
342
|
this.set.add(member);
|
|
200
343
|
}
|
|
@@ -213,14 +356,11 @@ export class NonExpSetPubSub {
|
|
|
213
356
|
|
|
214
357
|
publish(msg: SetPubSubMsg) {
|
|
215
358
|
if (msg.length > 0) {
|
|
216
|
-
this.logger.info(`Publishing msg: '${msg}'`);
|
|
217
359
|
this.dexHelper.cache.publish(this.channel, JSON.stringify(msg));
|
|
218
360
|
}
|
|
219
361
|
}
|
|
220
362
|
|
|
221
363
|
handleSubscription(set: SetPubSubMsg) {
|
|
222
|
-
this.logger.info(`Received subscription msg: '${set}'`);
|
|
223
|
-
|
|
224
364
|
for (const key of set) {
|
|
225
365
|
this.set.add(key);
|
|
226
366
|
}
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1411,6 +1411,14 @@ export const Tokens: {
|
|
|
1411
1411
|
address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
|
|
1412
1412
|
decimals: 6,
|
|
1413
1413
|
},
|
|
1414
|
+
stataUSDC: {
|
|
1415
|
+
address: '0x41B334E9F2C0ED1f30fD7c351874a6071C53a78E',
|
|
1416
|
+
decimals: 6,
|
|
1417
|
+
},
|
|
1418
|
+
aOptUSDCn: {
|
|
1419
|
+
address: '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5',
|
|
1420
|
+
decimals: 6,
|
|
1421
|
+
},
|
|
1414
1422
|
USDT: {
|
|
1415
1423
|
address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
1416
1424
|
decimals: 6,
|
|
@@ -2093,6 +2101,7 @@ export const Holders: {
|
|
|
2093
2101
|
POPS: '0x3cbd9044aaabef08ce93a68448e093cff405ad76',
|
|
2094
2102
|
USDCe: '0xdecc0c09c3b5f6e92ef4184125d5648a66e35298',
|
|
2095
2103
|
USDC: '0x8aF3827a41c26C7F32C81E93bb66e837e0210D5c',
|
|
2104
|
+
aOptUSDCn: '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5',
|
|
2096
2105
|
USDT: '0xf977814e90da44bfa03b6295a0616a897441acec',
|
|
2097
2106
|
OP: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466',
|
|
2098
2107
|
aOptWETH: '0x7B7D80C40415F744864f051B806b466e2fbB8E68',
|
|
@@ -2112,6 +2121,7 @@ export const Holders: {
|
|
|
2112
2121
|
LUSD: '0xf0a9abb11958a071e168f2ee5bcbacf1abbde9cf',
|
|
2113
2122
|
GRAI: '0x92b051204816DC4fbA7AC1A68a2cf319A9a387CB',
|
|
2114
2123
|
stataUSDT: '0xd55263b84685Ced7e10a77607C7fFD763D495B6e',
|
|
2124
|
+
stataUSDC: '0x450C01300B83bE379113256038b4Dd3b45d23B5e',
|
|
2115
2125
|
aaveUSDT: '0x1Fd458C52fEb7Bb35097ebd9566DB6C269341FDD',
|
|
2116
2126
|
tBTC: '0xf7b4531e52211CC44379102F719cad29411dB053',
|
|
2117
2127
|
PSTAKE: '0xc45398444B83183b2018e0224B3D332b42D492Af',
|
package/tests/utils-e2e.ts
CHANGED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
-
</JSCodeStyleSettings>
|
|
15
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
16
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
17
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
18
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
19
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
20
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
21
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
22
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
23
|
-
</TypeScriptCodeStyleSettings>
|
|
24
|
-
<VueCodeStyleSettings>
|
|
25
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
26
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
27
|
-
</VueCodeStyleSettings>
|
|
28
|
-
<codeStyleSettings language="HTML">
|
|
29
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
30
|
-
<indentOptions>
|
|
31
|
-
<option name="INDENT_SIZE" value="2" />
|
|
32
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
33
|
-
<option name="TAB_SIZE" value="2" />
|
|
34
|
-
</indentOptions>
|
|
35
|
-
</codeStyleSettings>
|
|
36
|
-
<codeStyleSettings language="JavaScript">
|
|
37
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
38
|
-
<indentOptions>
|
|
39
|
-
<option name="INDENT_SIZE" value="2" />
|
|
40
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
41
|
-
<option name="TAB_SIZE" value="2" />
|
|
42
|
-
</indentOptions>
|
|
43
|
-
</codeStyleSettings>
|
|
44
|
-
<codeStyleSettings language="TypeScript">
|
|
45
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
46
|
-
<indentOptions>
|
|
47
|
-
<option name="INDENT_SIZE" value="2" />
|
|
48
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
49
|
-
<option name="TAB_SIZE" value="2" />
|
|
50
|
-
</indentOptions>
|
|
51
|
-
</codeStyleSettings>
|
|
52
|
-
<codeStyleSettings language="Vue">
|
|
53
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
54
|
-
<indentOptions>
|
|
55
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
56
|
-
</indentOptions>
|
|
57
|
-
</codeStyleSettings>
|
|
58
|
-
</code_scheme>
|
|
59
|
-
</component>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/prettier.xml
DELETED
package/.idea/vcs.xml
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { UniswapV3Config } from '../src/dex/uniswap-v3/config';
|
|
2
|
-
import { PancakeswapV3Config } from '../src/dex/pancakeswap-v3/config';
|
|
3
|
-
import { constructSimpleSDK } from '@paraswap/sdk';
|
|
4
|
-
import { ParaSwapVersion } from '@paraswap/core';
|
|
5
|
-
import axios from 'axios';
|
|
6
|
-
|
|
7
|
-
const main = async () => {
|
|
8
|
-
const network = 1;
|
|
9
|
-
const userAddress = '0x75C94990D2Ad92D8da4E0a238d872D09ec16706E';
|
|
10
|
-
const srcToken = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
|
|
11
|
-
const destToken = '0xdAC17F958D2ee523a2206206994597C13D831ec7';
|
|
12
|
-
const amount = '1000000'
|
|
13
|
-
const partner = 'paraswap.io';
|
|
14
|
-
const prodSdk = constructSimpleSDK({
|
|
15
|
-
version: ParaSwapVersion.V6,
|
|
16
|
-
chainId: network,
|
|
17
|
-
axios,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const ordersSdk = constructSimpleSDK({
|
|
21
|
-
version: ParaSwapVersion.V6,
|
|
22
|
-
chainId: network,
|
|
23
|
-
axios,
|
|
24
|
-
apiURL:
|
|
25
|
-
'https://api.orders.paraswap.io'
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const priceRoute = await prodSdk.swap.getRate({
|
|
29
|
-
srcToken,
|
|
30
|
-
destToken,
|
|
31
|
-
amount,
|
|
32
|
-
options: {
|
|
33
|
-
partner
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
console.log(priceRoute);
|
|
38
|
-
|
|
39
|
-
const txOrders = await ordersSdk.swap.buildTx({
|
|
40
|
-
priceRoute,
|
|
41
|
-
srcToken,
|
|
42
|
-
destToken,
|
|
43
|
-
userAddress,
|
|
44
|
-
srcAmount: amount,
|
|
45
|
-
slippage: 50,
|
|
46
|
-
partner
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
const txProd = await prodSdk.swap.buildTx({
|
|
50
|
-
priceRoute,
|
|
51
|
-
srcToken,
|
|
52
|
-
destToken,
|
|
53
|
-
userAddress,
|
|
54
|
-
srcAmount: amount,
|
|
55
|
-
slippage: 50,
|
|
56
|
-
partner
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
console.log();
|
|
60
|
-
console.log(txOrders);
|
|
61
|
-
console.log(txProd);
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
main().catch(console.log)
|