@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
|
@@ -17,28 +17,28 @@ import {
|
|
|
17
17
|
export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
18
18
|
AaveV3Stata: {
|
|
19
19
|
[Network.MAINNET]: {
|
|
20
|
-
factoryAddress: AaveV3Ethereum.
|
|
20
|
+
factoryAddress: AaveV3Ethereum.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
21
21
|
},
|
|
22
22
|
[Network.POLYGON]: {
|
|
23
|
-
factoryAddress: AaveV3Polygon.
|
|
23
|
+
factoryAddress: AaveV3Polygon.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
24
24
|
},
|
|
25
25
|
[Network.AVALANCHE]: {
|
|
26
|
-
factoryAddress: AaveV3Avalanche.
|
|
26
|
+
factoryAddress: AaveV3Avalanche.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
27
27
|
},
|
|
28
28
|
[Network.ARBITRUM]: {
|
|
29
|
-
factoryAddress: AaveV3Arbitrum.
|
|
29
|
+
factoryAddress: AaveV3Arbitrum.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
30
30
|
},
|
|
31
31
|
[Network.OPTIMISM]: {
|
|
32
|
-
factoryAddress: AaveV3Optimism.
|
|
32
|
+
factoryAddress: AaveV3Optimism.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
33
33
|
},
|
|
34
34
|
[Network.BASE]: {
|
|
35
|
-
factoryAddress: AaveV3Base.
|
|
35
|
+
factoryAddress: AaveV3Base.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
36
36
|
},
|
|
37
37
|
[Network.BSC]: {
|
|
38
|
-
factoryAddress: AaveV3BNB.
|
|
38
|
+
factoryAddress: AaveV3BNB.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
39
39
|
},
|
|
40
40
|
[Network.GNOSIS]: {
|
|
41
|
-
factoryAddress: AaveV3Gnosis.
|
|
41
|
+
factoryAddress: AaveV3Gnosis.LEGACY_STATIC_A_TOKEN_FACTORY,
|
|
42
42
|
},
|
|
43
43
|
// [Network.Scroll]: {
|
|
44
44
|
// factoryAddress: AaveV3Scroll.STATIC_A_TOKEN_FACTORY,
|
|
@@ -264,28 +264,28 @@ describe('AaveV3Stata E2E', () => {
|
|
|
264
264
|
});
|
|
265
265
|
|
|
266
266
|
// no tokens yet deployed
|
|
267
|
-
describe
|
|
267
|
+
describe('Optimism', () => {
|
|
268
268
|
const network = Network.OPTIMISM;
|
|
269
269
|
|
|
270
270
|
const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [
|
|
271
271
|
[
|
|
272
272
|
{
|
|
273
|
-
name: '
|
|
273
|
+
name: 'USDC',
|
|
274
274
|
amount: '100000',
|
|
275
275
|
},
|
|
276
276
|
{
|
|
277
|
-
name: '
|
|
277
|
+
name: 'stataUSDC',
|
|
278
278
|
amount: '100000',
|
|
279
279
|
},
|
|
280
280
|
],
|
|
281
281
|
[
|
|
282
282
|
{
|
|
283
|
-
name: '
|
|
283
|
+
name: 'aOptUSDCn',
|
|
284
284
|
amount: '100000',
|
|
285
285
|
skipBuy: true,
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
|
-
name: '
|
|
288
|
+
name: 'stataUSDC', // no holders
|
|
289
289
|
amount: '100000',
|
|
290
290
|
},
|
|
291
291
|
],
|
|
@@ -103,7 +103,7 @@ export class AaveV3StataV2
|
|
|
103
103
|
|
|
104
104
|
let tokenList = await fetchTokenList(
|
|
105
105
|
this.dexHelper.web3Provider,
|
|
106
|
-
this.config
|
|
106
|
+
this.config,
|
|
107
107
|
this.dexHelper.multiWrapper,
|
|
108
108
|
blockNumber,
|
|
109
109
|
);
|
|
@@ -216,7 +216,7 @@ export class AaveV3StataV2
|
|
|
216
216
|
true,
|
|
217
217
|
[
|
|
218
218
|
{
|
|
219
|
-
target:
|
|
219
|
+
target: stataToken.pool,
|
|
220
220
|
callData: AaveV3StataV2.pool.encodeFunctionData(
|
|
221
221
|
'getReserveNormalizedIncome',
|
|
222
222
|
[stataToken.underlying],
|
|
@@ -12,29 +12,36 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
14
14
|
AaveV3StataV2: {
|
|
15
|
-
[Network.MAINNET]:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
AaveV3EthereumLido.STATA_FACTORY,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[Network.GNOSIS]:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
[Network.MAINNET]: [
|
|
16
|
+
{ factory: AaveV3Ethereum.STATA_FACTORY, pool: AaveV3Ethereum.POOL },
|
|
17
|
+
{
|
|
18
|
+
factory: AaveV3EthereumLido.STATA_FACTORY,
|
|
19
|
+
pool: AaveV3EthereumLido.POOL,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
[Network.GNOSIS]: [
|
|
23
|
+
{
|
|
24
|
+
factory: AaveV3Gnosis.STATA_FACTORY,
|
|
25
|
+
pool: AaveV3Gnosis.POOL,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
[Network.OPTIMISM]: [
|
|
29
|
+
{
|
|
30
|
+
factory: AaveV3Optimism.STATA_FACTORY,
|
|
31
|
+
pool: AaveV3Optimism.POOL,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
[Network.ARBITRUM]: [
|
|
35
|
+
{
|
|
36
|
+
factory: AaveV3Arbitrum.STATA_FACTORY,
|
|
37
|
+
pool: AaveV3Arbitrum.POOL,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
[Network.BASE]: [
|
|
41
|
+
{
|
|
42
|
+
factory: AaveV3Base.STATA_FACTORY,
|
|
43
|
+
pool: AaveV3Base.POOL,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
39
46
|
},
|
|
40
47
|
};
|
|
@@ -8,9 +8,9 @@ export enum TokenType {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export type DexParams = {
|
|
11
|
-
|
|
11
|
+
factory: string;
|
|
12
12
|
pool: string;
|
|
13
|
-
};
|
|
13
|
+
}[];
|
|
14
14
|
|
|
15
15
|
export type AaveV3StataV2Data = {
|
|
16
16
|
exchange: Address;
|
|
@@ -24,6 +24,7 @@ export type StataToken = {
|
|
|
24
24
|
underlyingAToken: string;
|
|
25
25
|
stataSymbol: string;
|
|
26
26
|
decimals: number;
|
|
27
|
+
pool: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export enum StataFunctions {
|
|
@@ -6,21 +6,26 @@ import { Interface } from '@ethersproject/abi';
|
|
|
6
6
|
import Web3 from 'web3';
|
|
7
7
|
import { MultiCallParams, MultiWrapper } from '../../lib/multi-wrapper';
|
|
8
8
|
import { stringDecode, uint8ToNumber, addressDecode } from '../../lib/decoders';
|
|
9
|
-
import { StataToken } from './types';
|
|
9
|
+
import { StataToken, DexParams } from './types';
|
|
10
10
|
import FactoryABI from '../../abi/aavev3statav2/Factory.json';
|
|
11
11
|
import TokenABI from '../../abi/aavev3statav2/Token.json';
|
|
12
12
|
import { AbiItem } from 'web3-utils';
|
|
13
13
|
|
|
14
|
+
type PoolAndToken = {
|
|
15
|
+
token: string;
|
|
16
|
+
pool: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
// const stataInterface = new Interface(IStaticATokenLM_ABI);
|
|
15
20
|
const statav2Interface = new Interface(TokenABI);
|
|
16
21
|
|
|
17
22
|
async function getTokenMetaData(
|
|
18
|
-
stataTokens:
|
|
23
|
+
stataTokens: PoolAndToken[],
|
|
19
24
|
multiWrapper: MultiWrapper,
|
|
20
25
|
blockNumber?: number,
|
|
21
26
|
): Promise<StataToken[]> {
|
|
22
27
|
const calls: MultiCallParams<any>[] = stataTokens
|
|
23
|
-
.map(token => {
|
|
28
|
+
.map(({ token }) => {
|
|
24
29
|
return [
|
|
25
30
|
{
|
|
26
31
|
target: token,
|
|
@@ -54,7 +59,8 @@ async function getTokenMetaData(
|
|
|
54
59
|
let tokenList: StataToken[] = [];
|
|
55
60
|
for (let i = 0, x = 0; i < stataTokens.length; ++i, x += 4) {
|
|
56
61
|
tokenList.push({
|
|
57
|
-
address: stataTokens[i].toLowerCase(),
|
|
62
|
+
address: stataTokens[i].token.toLowerCase(),
|
|
63
|
+
pool: stataTokens[i].pool.toLowerCase(),
|
|
58
64
|
stataSymbol: results[x] as string,
|
|
59
65
|
decimals: results[x + 1] as number,
|
|
60
66
|
underlying: (results[x + 2] as string).toLowerCase(),
|
|
@@ -66,22 +72,24 @@ async function getTokenMetaData(
|
|
|
66
72
|
|
|
67
73
|
export const fetchTokenList = async (
|
|
68
74
|
web3Provider: Web3,
|
|
69
|
-
|
|
75
|
+
config: DexParams,
|
|
70
76
|
multiWrapper: MultiWrapper,
|
|
71
77
|
blockNumber?: number,
|
|
72
78
|
): Promise<StataToken[]> => {
|
|
73
|
-
let stataList:
|
|
79
|
+
let stataList: PoolAndToken[] = (
|
|
74
80
|
(await Promise.all(
|
|
75
|
-
|
|
81
|
+
config.map(async ({ factory, pool }) => {
|
|
76
82
|
let factoryContract = new web3Provider.eth.Contract(
|
|
77
83
|
FactoryABI as AbiItem[],
|
|
78
84
|
// IStaticATokenFactory_ABI as any,
|
|
79
|
-
|
|
85
|
+
factory,
|
|
80
86
|
);
|
|
81
87
|
|
|
82
|
-
return
|
|
88
|
+
return (
|
|
89
|
+
(await factoryContract.methods.getStataTokens().call()) as string[]
|
|
90
|
+
).map(address => ({ token: address, pool }));
|
|
83
91
|
}),
|
|
84
|
-
)) as
|
|
92
|
+
)) as PoolAndToken[][]
|
|
85
93
|
).flat();
|
|
86
94
|
|
|
87
95
|
return getTokenMetaData(stataList, multiWrapper, blockNumber);
|
|
@@ -447,12 +447,7 @@ export class GenericRFQ extends ParaSwapLimitOrders {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
async setBlacklist(userAddress: string): Promise<boolean> {
|
|
450
|
-
|
|
451
|
-
this.rateFetcher.blackListCacheKey,
|
|
452
|
-
userAddress.toLowerCase(),
|
|
453
|
-
'true',
|
|
454
|
-
);
|
|
455
|
-
return true;
|
|
450
|
+
return this.rateFetcher.setBlacklist(userAddress);
|
|
456
451
|
}
|
|
457
452
|
|
|
458
453
|
releaseResources(): void {
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
ERC1271Contract,
|
|
38
38
|
} from '../../lib/erc1271-utils';
|
|
39
39
|
import { isContractAddress } from '../../utils';
|
|
40
|
+
import { ExpKeyValuePubSub, NonExpSetPubSub } from '../../lib/pub-sub';
|
|
40
41
|
|
|
41
42
|
const GET_FIRM_RATE_TIMEOUT_MS = 2000;
|
|
42
43
|
export const reversePrice = (price: PriceAndAmountBigNumber) =>
|
|
@@ -55,6 +56,9 @@ export class RateFetcher {
|
|
|
55
56
|
private addressToTokenMap: Record<string, TokenWithInfo> = {};
|
|
56
57
|
private pairs: PairMap = {};
|
|
57
58
|
|
|
59
|
+
private pricesPubSub: ExpKeyValuePubSub;
|
|
60
|
+
private blacklistPubSub?: NonExpSetPubSub;
|
|
61
|
+
|
|
58
62
|
private firmRateAuth?: (options: RequestConfig) => void;
|
|
59
63
|
|
|
60
64
|
public blackListCacheKey: string;
|
|
@@ -123,6 +127,13 @@ export class RateFetcher {
|
|
|
123
127
|
logger,
|
|
124
128
|
);
|
|
125
129
|
|
|
130
|
+
this.pricesPubSub = new ExpKeyValuePubSub(
|
|
131
|
+
this.dexHelper,
|
|
132
|
+
this.dexKey,
|
|
133
|
+
'prices',
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
this.blackListCacheKey = `${this.dexHelper.config.data.network}_${this.dexKey}_blacklist`;
|
|
126
137
|
if (config.blacklistConfig) {
|
|
127
138
|
this.blackListFetcher = new Fetcher<BlackListResponse>(
|
|
128
139
|
dexHelper.httpRequest,
|
|
@@ -142,9 +153,14 @@ export class RateFetcher {
|
|
|
142
153
|
config.blacklistConfig.intervalMs,
|
|
143
154
|
logger,
|
|
144
155
|
);
|
|
156
|
+
|
|
157
|
+
this.blacklistPubSub = new NonExpSetPubSub(
|
|
158
|
+
this.dexHelper,
|
|
159
|
+
this.dexKey,
|
|
160
|
+
'blacklist',
|
|
161
|
+
);
|
|
145
162
|
}
|
|
146
163
|
|
|
147
|
-
this.blackListCacheKey = `${this.dexHelper.config.data.network}_${this.dexKey}_blacklist`;
|
|
148
164
|
if (this.config.firmRateConfig.secret) {
|
|
149
165
|
this.firmRateAuth = this.authHttp(this.config.firmRateConfig.secret);
|
|
150
166
|
}
|
|
@@ -161,6 +177,30 @@ export class RateFetcher {
|
|
|
161
177
|
this.config.maker,
|
|
162
178
|
);
|
|
163
179
|
}
|
|
180
|
+
|
|
181
|
+
this.logger.info(
|
|
182
|
+
`Initializing RateFetcher for ${this.dexKey}, isSlave=${this.dexHelper.config.isSlave}`,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
if (this.dexHelper.config.isSlave) {
|
|
186
|
+
this.logger.info(
|
|
187
|
+
`Subscribing to price updates as slave for ${this.dexKey}`,
|
|
188
|
+
);
|
|
189
|
+
this.pricesPubSub.subscribe();
|
|
190
|
+
if (this.blacklistPubSub) {
|
|
191
|
+
const initSet = await this.dexHelper.cache.smembers(
|
|
192
|
+
this.blackListCacheKey,
|
|
193
|
+
);
|
|
194
|
+
this.logger.info(
|
|
195
|
+
`Initializing blacklist with ${initSet.length} entries`,
|
|
196
|
+
);
|
|
197
|
+
this.blacklistPubSub.initializeAndSubscribe(initSet);
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
this.logger.info(
|
|
201
|
+
`Not subscribing to price updates as master for ${this.dexKey}`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
164
204
|
}
|
|
165
205
|
|
|
166
206
|
start() {
|
|
@@ -214,74 +254,110 @@ export class RateFetcher {
|
|
|
214
254
|
for (const address of resp.blacklist) {
|
|
215
255
|
this.dexHelper.cache.sadd(this.blackListCacheKey, address.toLowerCase());
|
|
216
256
|
}
|
|
257
|
+
|
|
258
|
+
if (this.blacklistPubSub) {
|
|
259
|
+
this.blacklistPubSub.publish(resp.blacklist);
|
|
260
|
+
}
|
|
217
261
|
}
|
|
218
262
|
|
|
219
263
|
public isBlackListed(userAddress: string) {
|
|
220
|
-
|
|
221
|
-
this.
|
|
222
|
-
|
|
223
|
-
|
|
264
|
+
if (this.blacklistPubSub) {
|
|
265
|
+
return this.blacklistPubSub.has(userAddress.toLowerCase());
|
|
266
|
+
}
|
|
267
|
+
return false;
|
|
224
268
|
}
|
|
225
269
|
|
|
226
270
|
private handleRatesResponse(resp: RatesResponse) {
|
|
271
|
+
const pubSubData: Record<string, unknown> = {};
|
|
272
|
+
const ttl = this.config.rateConfig.dataTTLS;
|
|
227
273
|
const pairs = this.pairs;
|
|
228
274
|
|
|
229
|
-
if (isEmpty(pairs))
|
|
275
|
+
if (isEmpty(pairs)) {
|
|
276
|
+
this.logger.debug(`No pairs available for ${this.dexKey}`);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
230
279
|
|
|
231
280
|
const currentPricePairs = new Set();
|
|
281
|
+
let updatedPairsCount = 0;
|
|
232
282
|
|
|
233
283
|
Object.keys(resp.prices).forEach(pairName => {
|
|
234
284
|
const pair = pairs[pairName];
|
|
235
285
|
if (!pair) {
|
|
286
|
+
this.logger.debug(`Pair ${pairName} not found in available pairs`);
|
|
236
287
|
return;
|
|
237
288
|
}
|
|
238
289
|
const prices = resp.prices[pairName];
|
|
239
290
|
|
|
240
291
|
if (!prices.asks || !prices.bids) {
|
|
292
|
+
this.logger.debug(`No asks or bids for pair ${pairName}`);
|
|
241
293
|
return;
|
|
242
294
|
}
|
|
243
295
|
|
|
244
|
-
if (isEmpty(this.tokens))
|
|
296
|
+
if (isEmpty(this.tokens)) {
|
|
297
|
+
this.logger.debug(`No tokens available for ${this.dexKey}`);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
245
300
|
|
|
246
301
|
const baseToken = this.tokens[pair.base];
|
|
247
302
|
const quoteToken = this.tokens[pair.quote];
|
|
248
303
|
|
|
249
304
|
if (!baseToken || !quoteToken) {
|
|
250
|
-
this.logger.warn(`
|
|
305
|
+
this.logger.warn(`Missing base or quote token for pair ${pairName}`);
|
|
251
306
|
return;
|
|
252
307
|
}
|
|
253
308
|
|
|
254
309
|
if (prices.bids.length) {
|
|
310
|
+
const key = `${baseToken.address}_${quoteToken.address}_bids`;
|
|
311
|
+
const value = prices.bids;
|
|
312
|
+
pubSubData[key] = value;
|
|
313
|
+
updatedPairsCount++;
|
|
314
|
+
|
|
255
315
|
this.dexHelper.cache.setex(
|
|
256
316
|
this.dexKey,
|
|
257
317
|
this.dexHelper.config.data.network,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
JSON.stringify(
|
|
318
|
+
key,
|
|
319
|
+
ttl,
|
|
320
|
+
JSON.stringify(value),
|
|
261
321
|
);
|
|
262
322
|
currentPricePairs.add(`${baseToken.address}_${quoteToken.address}`);
|
|
263
323
|
}
|
|
264
324
|
|
|
265
325
|
if (prices.asks.length) {
|
|
326
|
+
const key = `${baseToken.address}_${quoteToken.address}_asks`;
|
|
327
|
+
const value = prices.asks;
|
|
328
|
+
pubSubData[key] = value;
|
|
329
|
+
updatedPairsCount++;
|
|
330
|
+
|
|
266
331
|
this.dexHelper.cache.setex(
|
|
267
332
|
this.dexKey,
|
|
268
333
|
this.dexHelper.config.data.network,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
JSON.stringify(
|
|
334
|
+
key,
|
|
335
|
+
ttl,
|
|
336
|
+
JSON.stringify(value),
|
|
272
337
|
);
|
|
273
338
|
currentPricePairs.add(`${quoteToken.address}_${baseToken.address}`);
|
|
274
339
|
}
|
|
275
340
|
});
|
|
276
341
|
|
|
277
342
|
if (currentPricePairs.size > 0) {
|
|
343
|
+
const key = `pairs`;
|
|
344
|
+
const value = Array.from(currentPricePairs);
|
|
345
|
+
pubSubData[key] = value;
|
|
346
|
+
|
|
278
347
|
this.dexHelper.cache.setex(
|
|
279
348
|
this.dexKey,
|
|
280
349
|
this.dexHelper.config.data.network,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
JSON.stringify(
|
|
350
|
+
key,
|
|
351
|
+
ttl,
|
|
352
|
+
JSON.stringify(value),
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
this.logger.info(
|
|
356
|
+
`Updated ${updatedPairsCount} price entries for ${currentPricePairs.size} pairs`,
|
|
284
357
|
);
|
|
358
|
+
this.pricesPubSub.publish(pubSubData, ttl);
|
|
359
|
+
} else {
|
|
360
|
+
this.logger.warn(`No price pairs were updated for ${this.dexKey}`);
|
|
285
361
|
}
|
|
286
362
|
}
|
|
287
363
|
|
|
@@ -322,18 +398,12 @@ export class RateFetcher {
|
|
|
322
398
|
}
|
|
323
399
|
|
|
324
400
|
public async getAvailablePairs(): Promise<string[]> {
|
|
325
|
-
const pairs = await this.
|
|
326
|
-
this.dexKey,
|
|
327
|
-
this.dexHelper.config.data.network,
|
|
328
|
-
`pairs`,
|
|
329
|
-
this.config.rateConfig.intervalMs / 1000,
|
|
330
|
-
);
|
|
331
|
-
|
|
401
|
+
const pairs = await this.pricesPubSub.getAndCache<string[]>(`pairs`);
|
|
332
402
|
if (!pairs) {
|
|
333
403
|
return [];
|
|
334
404
|
}
|
|
335
405
|
|
|
336
|
-
return
|
|
406
|
+
return pairs;
|
|
337
407
|
}
|
|
338
408
|
|
|
339
409
|
public async getOrderPrice(
|
|
@@ -342,54 +412,44 @@ export class RateFetcher {
|
|
|
342
412
|
side: SwapSide,
|
|
343
413
|
): Promise<PriceAndAmountBigNumber[] | null> {
|
|
344
414
|
let reversed = false;
|
|
415
|
+
const srcAddress = srcToken.address.toLowerCase();
|
|
416
|
+
const destAddress = destToken.address.toLowerCase();
|
|
417
|
+
|
|
418
|
+
let prices: PriceAndAmount[] | null = null;
|
|
419
|
+
let cacheKey = '';
|
|
345
420
|
|
|
346
|
-
let pricesAsString: string | null = null;
|
|
347
421
|
if (side === SwapSide.SELL) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
this.dexHelper.config.data.network,
|
|
351
|
-
`${srcToken.address}_${destToken.address}_bids`,
|
|
352
|
-
this.config.rateConfig.intervalMs / 1000,
|
|
353
|
-
);
|
|
422
|
+
cacheKey = `${srcAddress}_${destAddress}_bids`;
|
|
423
|
+
prices = await this.pricesPubSub.getAndCache(cacheKey);
|
|
354
424
|
|
|
355
|
-
if (!
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.dexHelper.config.data.network,
|
|
359
|
-
`${destToken.address}_${srcToken.address}_asks`,
|
|
360
|
-
this.config.rateConfig.intervalMs / 1000,
|
|
361
|
-
);
|
|
425
|
+
if (!prices) {
|
|
426
|
+
cacheKey = `${destAddress}_${srcAddress}_asks`;
|
|
427
|
+
prices = await this.pricesPubSub.getAndCache(cacheKey);
|
|
362
428
|
reversed = true;
|
|
363
429
|
}
|
|
364
430
|
} else {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
this.dexHelper.config.data.network,
|
|
368
|
-
`${destToken.address}_${srcToken.address}_asks`,
|
|
369
|
-
this.config.rateConfig.intervalMs / 1000,
|
|
370
|
-
);
|
|
431
|
+
cacheKey = `${destAddress}_${srcAddress}_asks`;
|
|
432
|
+
prices = await this.pricesPubSub.getAndCache(cacheKey);
|
|
371
433
|
|
|
372
|
-
if (!
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
this.dexHelper.config.data.network,
|
|
376
|
-
`${srcToken.address}_${destToken.address}_bids`,
|
|
377
|
-
this.config.rateConfig.intervalMs / 1000,
|
|
378
|
-
);
|
|
434
|
+
if (!prices) {
|
|
435
|
+
cacheKey = `${srcAddress}_${destAddress}_bids`;
|
|
436
|
+
prices = await this.pricesPubSub.getAndCache(cacheKey);
|
|
379
437
|
reversed = true;
|
|
380
438
|
}
|
|
381
439
|
}
|
|
382
440
|
|
|
383
|
-
if (!
|
|
441
|
+
if (!prices) {
|
|
442
|
+
this.logger.debug(
|
|
443
|
+
`No prices found for ${srcAddress} to ${destAddress} (${side}) using key ${cacheKey}`,
|
|
444
|
+
);
|
|
384
445
|
return null;
|
|
385
446
|
}
|
|
386
447
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
448
|
+
this.logger.debug(
|
|
449
|
+
`Found ${prices.length} prices for ${srcAddress} to ${destAddress} (${side}), reversed=${reversed}`,
|
|
450
|
+
);
|
|
391
451
|
|
|
392
|
-
let orderPrices =
|
|
452
|
+
let orderPrices = prices.map(price => [
|
|
393
453
|
new BigNumber(price[0]),
|
|
394
454
|
new BigNumber(price[1]),
|
|
395
455
|
]);
|
|
@@ -488,4 +548,16 @@ export class RateFetcher {
|
|
|
488
548
|
throw e;
|
|
489
549
|
}
|
|
490
550
|
}
|
|
551
|
+
|
|
552
|
+
async setBlacklist(userAddress: string): Promise<boolean> {
|
|
553
|
+
await this.dexHelper.cache.hset(
|
|
554
|
+
this.blackListCacheKey,
|
|
555
|
+
userAddress.toLowerCase(),
|
|
556
|
+
'true',
|
|
557
|
+
);
|
|
558
|
+
if (this.blacklistPubSub) {
|
|
559
|
+
this.blacklistPubSub.publish([userAddress.toLowerCase()]);
|
|
560
|
+
}
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
491
563
|
}
|
|
@@ -191,6 +191,9 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
191
191
|
side: SwapSide,
|
|
192
192
|
blockNumber: number,
|
|
193
193
|
): Promise<string[]> {
|
|
194
|
+
this.logger.debug(
|
|
195
|
+
`Getting pool identifiers for ${srcToken.address} to ${destToken.address} (${side}) for ${this.dexKey}-${this.network}`,
|
|
196
|
+
);
|
|
194
197
|
const _srcToken = this.dexHelper.config.wrapETH(srcToken);
|
|
195
198
|
const _destToken = this.dexHelper.config.wrapETH(destToken);
|
|
196
199
|
|
|
@@ -398,6 +401,9 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
398
401
|
}
|
|
399
402
|
|
|
400
403
|
async getCachedLevels(): Promise<PriceLevelsResponse['levels'] | null> {
|
|
404
|
+
this.logger.debug(
|
|
405
|
+
`Getting cached levels for ${this.pricesCacheKey} for ${this.dexKey}-${this.network}`,
|
|
406
|
+
);
|
|
401
407
|
const cachedLevels = await this.dexHelper.cache.rawget(this.pricesCacheKey);
|
|
402
408
|
|
|
403
409
|
if (cachedLevels) {
|
|
@@ -416,6 +422,11 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
416
422
|
limitPools?: string[],
|
|
417
423
|
): Promise<null | ExchangePrices<HashflowData>> {
|
|
418
424
|
try {
|
|
425
|
+
this.logger.debug(
|
|
426
|
+
`Getting prices volume for ${srcToken.symbol || srcToken.address}, ${
|
|
427
|
+
destToken.symbol || destToken.address
|
|
428
|
+
}, ${side} for ${this.dexKey}-${this.network}`,
|
|
429
|
+
);
|
|
419
430
|
const _srcToken = this.dexHelper.config.wrapETH(srcToken);
|
|
420
431
|
const _destToken = this.dexHelper.config.wrapETH(destToken);
|
|
421
432
|
|
|
@@ -916,6 +927,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
|
|
|
916
927
|
}
|
|
917
928
|
|
|
918
929
|
async isBlacklisted(txOrigin: Address): Promise<boolean> {
|
|
930
|
+
this.logger.debug(`Checking if ${txOrigin} is blacklisted for Hashflow`);
|
|
919
931
|
const result = await this.dexHelper.cache.get(
|
|
920
932
|
this.dexKey,
|
|
921
933
|
this.network,
|
|
@@ -329,6 +329,7 @@ export class DummyDexHelper implements IDexHelper {
|
|
|
329
329
|
rpcUrl ? rpcUrl : this.config.data.privateHttpProvider,
|
|
330
330
|
network,
|
|
331
331
|
);
|
|
332
|
+
|
|
332
333
|
this.web3Provider = new Web3(
|
|
333
334
|
rpcUrl ? rpcUrl : this.config.data.privateHttpProvider,
|
|
334
335
|
);
|
|
@@ -365,5 +366,14 @@ export class DummyDexHelper implements IDexHelper {
|
|
|
365
366
|
|
|
366
367
|
replaceProviderWithRPC(rpcUrl: string) {
|
|
367
368
|
this.provider = new StaticJsonRpcProvider(rpcUrl, this.config.data.network);
|
|
369
|
+
this.web3Provider = new Web3(rpcUrl);
|
|
370
|
+
this.multiContract = new this.web3Provider.eth.Contract(
|
|
371
|
+
multiABIV2 as any,
|
|
372
|
+
this.config.data.multicallV2Address,
|
|
373
|
+
);
|
|
374
|
+
this.multiWrapper = new MultiWrapper(
|
|
375
|
+
this.multiContract,
|
|
376
|
+
this.getLogger(`MultiWrapper-${this.config.data.network}`),
|
|
377
|
+
);
|
|
368
378
|
}
|
|
369
379
|
}
|