@paraswap/dex-lib 3.11.0-bebop.3 → 3.11.1-algebra.0
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/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
- package/build/config.js +0 -1
- package/build/config.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.js +1 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/algebra/algebra-pool-v1_1.js +5 -5
- package/build/dex/algebra/algebra-pool-v1_1.js.map +1 -1
- package/build/dex/algebra/lib/AlgebraMath.js +1 -4
- package/build/dex/algebra/lib/AlgebraMath.js.map +1 -1
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3-pool.d.ts +76 -0
- package/build/dex/balancer-v3/balancer-v3-pool.js +383 -0
- package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3.d.ts +57 -0
- package/build/dex/balancer-v3/balancer-v3.js +373 -0
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -0
- package/build/dex/balancer-v3/config.d.ts +8 -0
- package/build/dex/balancer-v3/config.js +24 -0
- package/build/dex/balancer-v3/config.js.map +1 -0
- package/build/dex/balancer-v3/getOnChainState.d.ts +10 -0
- package/build/dex/balancer-v3/getOnChainState.js +158 -0
- package/build/dex/balancer-v3/getOnChainState.js.map +1 -0
- package/build/dex/balancer-v3/getPoolsApi.d.ts +2 -0
- package/build/dex/balancer-v3/getPoolsApi.js +81 -0
- package/build/dex/balancer-v3/getPoolsApi.js.map +1 -0
- package/build/dex/balancer-v3/getTopPoolsApi.d.ts +13 -0
- package/build/dex/balancer-v3/getTopPoolsApi.js +62 -0
- package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -0
- package/build/dex/balancer-v3/types.d.ts +63 -0
- package/build/dex/balancer-v3/types.js +3 -0
- package/build/dex/balancer-v3/types.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/bebop/bebop.js +1 -1
- package/build/dex/bebop/bebop.js.map +1 -1
- package/build/dex/bebop/config.js +0 -5
- package/build/dex/bebop/config.js.map +1 -1
- package/build/dex/bebop/rate-fetcher.d.ts +1 -3
- package/build/dex/bebop/rate-fetcher.js +2 -42
- package/build/dex/bebop/rate-fetcher.js.map +1 -1
- package/build/dex/bebop/validators.d.ts +0 -2
- package/build/dex/bebop/validators.js +1 -9
- package/build/dex/bebop/validators.js.map +1 -1
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex-pool.d.ts +47 -0
- package/build/dex/fluid-dex/fluid-dex-pool.js +119 -0
- package/build/dex/fluid-dex/fluid-dex-pool.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex.js +1 -1
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
- package/build/dex/inception/inception-event-pool.d.ts +4 -4
- package/build/dex/inception/inception-event-pool.js +7 -9
- package/build/dex/inception/inception-event-pool.js.map +1 -1
- package/build/dex/inception/inception.d.ts +6 -6
- package/build/dex/inception/inception.js +16 -40
- package/build/dex/inception/inception.js.map +1 -1
- package/build/dex/inception/utils.d.ts +1 -0
- package/build/dex/inception/utils.js +22 -1
- package/build/dex/inception/utils.js.map +1 -1
- package/build/dex/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/platypus/platypus.js +17 -3
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +55 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.js +4 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
- package/build/lib/fetcher/wsFetcher.d.ts +3 -7
- package/build/lib/fetcher/wsFetcher.js +51 -64
- package/build/lib/fetcher/wsFetcher.js.map +1 -1
- package/package.json +2 -4
- package/src/config.ts +0 -1
- package/src/dex/algebra/algebra-pool-v1_1.ts +5 -5
- package/src/dex/algebra/lib/AlgebraMath.ts +1 -5
- package/src/dex/algebra/scripts/validate-state.test.ts +384 -0
- package/src/dex/bebop/bebop-e2e.test.ts +0 -21
- package/src/dex/bebop/bebop.ts +1 -1
- package/src/dex/bebop/config.ts +0 -5
- package/src/dex/bebop/rate-fetcher.ts +6 -51
- package/src/dex/bebop/validators.ts +0 -10
- package/src/dex/fluid-dex/fluid-dex.ts +0 -1
- package/src/lib/fetcher/wsFetcher.ts +66 -79
- 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/ChainlinkEACAggregatorProxy.json +0 -509
- package/build/abi/cables/CablesMainnetRFQ.json +0 -1083
- 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.json +0 -609
- 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/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
- package/build/dex/balancer-v1/balancer-pools.json +0 -33333
- package/build/dex/bebop/bebop.json +0 -72
- 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/cables/cables.d.ts +0 -57
- package/build/dex/cables/cables.js +0 -471
- package/build/dex/cables/cables.js.map +0 -1
- package/build/dex/cables/config.d.ts +0 -4
- package/build/dex/cables/config.js +0 -15
- package/build/dex/cables/config.js.map +0 -1
- package/build/dex/cables/constants.d.ts +0 -19
- package/build/dex/cables/constants.js +0 -26
- package/build/dex/cables/constants.js.map +0 -1
- package/build/dex/cables/rate-fetcher.d.ts +0 -34
- package/build/dex/cables/rate-fetcher.js +0 -106
- package/build/dex/cables/rate-fetcher.js.map +0 -1
- package/build/dex/cables/types.d.ts +0 -106
- package/build/dex/cables/types.js +0 -12
- package/build/dex/cables/types.js.map +0 -1
- package/build/dex/cables/validators.d.ts +0 -5
- package/build/dex/cables/validators.js +0 -49
- package/build/dex/cables/validators.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/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/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
- package/src/dex/bebop/bebop.json +0 -72
- package/src/dex/bebop/bebop.proto +0 -15
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AlienV3 = exports.AlienBaseV3Config = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const constants_1 = require("../../../../constants");
|
|
9
|
+
const utils_1 = require("../../../../utils");
|
|
10
|
+
const types_1 = require("../../types");
|
|
11
|
+
const uniswap_v3_1 = require("../../uniswap-v3");
|
|
12
|
+
const AlienBaseV3Router_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v3/AlienBaseV3Router.abi.json"));
|
|
13
|
+
exports.AlienBaseV3Config = {
|
|
14
|
+
AlienV3: {
|
|
15
|
+
[constants_1.Network.BASE]: {
|
|
16
|
+
factory: '0x0Fd83557b2be93617c9C1C1B6fd549401C74558C',
|
|
17
|
+
quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
|
|
18
|
+
router: '0xB20C411FC84FBB27e78608C24d0056D974ea9411',
|
|
19
|
+
supportedFees: [10000n, 3000n, 750n, 200n],
|
|
20
|
+
stateMulticall: '0x7160f736c52e1e78e92FD4eE4D73e21A7Cf4F950',
|
|
21
|
+
uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
|
|
22
|
+
chunksCount: 10,
|
|
23
|
+
initRetryFrequency: 10,
|
|
24
|
+
initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
|
|
25
|
+
subgraphURL: 'https://api.studio.thegraph.com/query/59130/v3alb/0.3',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
DackieSwapV3: {
|
|
29
|
+
[constants_1.Network.BASE]: {
|
|
30
|
+
factory: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870',
|
|
31
|
+
quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
|
|
32
|
+
router: '0x195FBc5B8Fbd5Ac739C1BA57D4Ef6D5a704F34f7',
|
|
33
|
+
// supportedFees: [10000n, 2500n, 500n, 100n],
|
|
34
|
+
supportedFees: [100n],
|
|
35
|
+
stateMulticall: '0x7160f736c52e1e78e92FD4eE4D73e21A7Cf4F950',
|
|
36
|
+
uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
|
|
37
|
+
chunksCount: 10,
|
|
38
|
+
initRetryFrequency: 10,
|
|
39
|
+
initHash: `0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2`,
|
|
40
|
+
subgraphURL: 'https://api.studio.thegraph.com/query/59130/v3alb/0.3',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
class AlienV3 extends uniswap_v3_1.UniswapV3 {
|
|
45
|
+
constructor(network, dexKey, dexHelper) {
|
|
46
|
+
super(network, dexKey, dexHelper, {}, new abi_1.Interface(AlienBaseV3Router_abi_json_1.default), undefined, exports.AlienBaseV3Config[dexKey][network]);
|
|
47
|
+
this.network = network;
|
|
48
|
+
this.dexHelper = dexHelper;
|
|
49
|
+
}
|
|
50
|
+
static getDirectFunctionName() {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
54
|
+
const swapFunction = side === constants_1.SwapSide.SELL
|
|
55
|
+
? types_1.UniswapV3Functions.exactInput
|
|
56
|
+
: types_1.UniswapV3Functions.exactOutput;
|
|
57
|
+
const path = this._encodePath(data.path, side);
|
|
58
|
+
const swapFunctionParams = side === constants_1.SwapSide.SELL
|
|
59
|
+
? {
|
|
60
|
+
recipient: this.augustusAddress,
|
|
61
|
+
amountIn: srcAmount,
|
|
62
|
+
amountOutMinimum: destAmount,
|
|
63
|
+
path,
|
|
64
|
+
}
|
|
65
|
+
: {
|
|
66
|
+
recipient: this.augustusAddress,
|
|
67
|
+
amountOut: destAmount,
|
|
68
|
+
amountInMaximum: srcAmount,
|
|
69
|
+
path,
|
|
70
|
+
};
|
|
71
|
+
const swapData = this.routerIface.encodeFunctionData(swapFunction, [
|
|
72
|
+
swapFunctionParams,
|
|
73
|
+
]);
|
|
74
|
+
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.config.router);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.AlienV3 = AlienV3;
|
|
78
|
+
AlienV3.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(exports.AlienBaseV3Config);
|
|
79
|
+
//# sourceMappingURL=alien-v3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alien-v3.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v3/forks/alien-v3/alien-v3.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,qDAA0D;AAG1D,6CAA0D;AAC1D,uCAMqB;AACrB,iDAA6C;AAC7C,uHAAyF;AAE5E,QAAA,iBAAiB,GAA4B;IACxD,OAAO,EAAE;QACP,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,OAAO,EAAE,4CAA4C;YACrD,MAAM,EAAE,4CAA4C;YACpD,MAAM,EAAE,4CAA4C;YACpD,aAAa,EAAE,CAAC,MAAM,EAAE,KAA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IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,kBAAkB,GACtB,IAAI,KAAK,oBAAQ,CAAC,IAAI;YACpB,CAAC,CAAC;gBACE,SAAS,EAAE,IAAI,CAAC,eAAe;gBAC/B,QAAQ,EAAE,SAAS;gBACnB,gBAAgB,EAAE,UAAU;gBAC5B,IAAI;aACL;YACH,CAAC,CAAC;gBACE,SAAS,EAAE,IAAI,CAAC,eAAe;gBAC/B,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,SAAS;gBAC1B,IAAI;aACL,CAAC;QAER,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,YAAY,EAAE;YACjE,kBAAkB;SACnB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,MAAM,CAAC,MAAM,CACnB,CAAC;IACJ,CAAC;;AAjEH,0BAkEC;AAjEe,0BAAkB,GAC9B,IAAA,6BAAqB,EAAC,yBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
2
|
+
import { PoolState } from './types';
|
|
3
|
+
import { SwapSide } from '@paraswap/core';
|
|
4
|
+
export declare function _getOutputs(state: DeepReadonly<PoolState>, amounts: bigint[], zeroForOne: boolean, side: SwapSide, destTokenBalance: bigint, fmode?: boolean): import("./types").OutputResult | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._getOutputs = void 0;
|
|
4
|
+
const core_1 = require("@paraswap/core");
|
|
5
|
+
const uniswap_v3_math_1 = require("./contract-math/uniswap-v3-math");
|
|
6
|
+
function _getOutputs(state, amounts, zeroForOne, side, destTokenBalance, fmode) {
|
|
7
|
+
try {
|
|
8
|
+
const outputsResult = uniswap_v3_math_1.uniswapV3Math.queryOutputs(state, amounts, zeroForOne, side, fmode);
|
|
9
|
+
if (side === core_1.SwapSide.SELL) {
|
|
10
|
+
if (outputsResult.outputs[0] > destTokenBalance) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
for (let i = 0; i < outputsResult.outputs.length; i++) {
|
|
14
|
+
if (outputsResult.outputs[i] > destTokenBalance) {
|
|
15
|
+
outputsResult.outputs[i] = 0n;
|
|
16
|
+
outputsResult.tickCounts[i] = 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (amounts[0] > destTokenBalance) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
// This may be improved by first checking outputs and requesting outputs
|
|
25
|
+
// only for amounts that makes more sense, but I don't think this is really
|
|
26
|
+
// important now
|
|
27
|
+
for (let i = 0; i < amounts.length; i++) {
|
|
28
|
+
if (amounts[i] > destTokenBalance) {
|
|
29
|
+
outputsResult.outputs[i] = 0n;
|
|
30
|
+
outputsResult.tickCounts[i] = 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return outputsResult;
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.debug(`received error in _getOutputs while calculating outputs`, e);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports._getOutputs = _getOutputs;
|
|
43
|
+
//# sourceMappingURL=uniswap-v3-pricing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniswap-v3-pricing.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v3/uniswap-v3-pricing.ts"],"names":[],"mappings":";;;AAEA,yCAA0C;AAC1C,qEAAgE;AAEhE,SAAgB,WAAW,CACzB,KAA8B,EAC9B,OAAiB,EACjB,UAA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AAlDD,kCAkDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const worker_threads_1 = require("worker_threads");
|
|
4
|
+
const uniswap_v3_pricing_1 = require("./uniswap-v3-pricing");
|
|
5
|
+
const { state, amounts, zeroForOne, side, destTokenBalance, fmode } = worker_threads_1.workerData;
|
|
6
|
+
const result = (0, uniswap_v3_pricing_1._getOutputs)(state, amounts, zeroForOne, side, destTokenBalance, fmode);
|
|
7
|
+
if (worker_threads_1.parentPort) {
|
|
8
|
+
worker_threads_1.parentPort.postMessage(result);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=uniswap-v3-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniswap-v3-worker.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v3/uniswap-v3-worker.ts"],"names":[],"mappings":";;AAAA,mDAAwD;AAKxD,6DAAmD;AAWnD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,GACjE,2BAAU,CAAC;AACb,MAAM,MAAM,GAAG,IAAA,gCAAW,EACxB,KAAK,EACL,OAAO,EACP,UAAU,EACV,IAAI,EACJ,gBAAgB,EAChB,KAAK,CACN,CAAC;AAEF,IAAI,2BAAU,EAAE;IACd,2BAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC"}
|
|
@@ -18,21 +18,17 @@ export declare type RequestInfoWithHandler<T> = {
|
|
|
18
18
|
export declare class WebSocketFetcher<T> {
|
|
19
19
|
private logger;
|
|
20
20
|
private requests;
|
|
21
|
-
private timeoutInterval;
|
|
22
|
-
private reconnectDelay;
|
|
23
|
-
private pingTimeout;
|
|
24
21
|
lastFetchSucceeded: boolean;
|
|
25
22
|
private stop;
|
|
23
|
+
private ws;
|
|
26
24
|
private connection;
|
|
27
|
-
constructor(requestsInfo: RequestInfoWithHandler<T>, logger: Logger
|
|
25
|
+
constructor(requestsInfo: RequestInfoWithHandler<T>, logger: Logger);
|
|
28
26
|
private connected;
|
|
29
|
-
private
|
|
27
|
+
private connectFailed;
|
|
30
28
|
private onClose;
|
|
31
29
|
private onError;
|
|
32
30
|
private onMessage;
|
|
33
31
|
private connect;
|
|
34
|
-
reconnectWithDelay(): void;
|
|
35
|
-
reconnect(): void;
|
|
36
32
|
startPolling(): void;
|
|
37
33
|
stopPolling(): void;
|
|
38
34
|
isPolling(): boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.WebSocketFetcher = exports.SkippingRequest = void 0;
|
|
7
|
-
const
|
|
4
|
+
const websocket_1 = require("websocket");
|
|
8
5
|
class SkippingRequest {
|
|
9
6
|
constructor(message = '') {
|
|
10
7
|
this.message = message;
|
|
@@ -12,55 +9,61 @@ class SkippingRequest {
|
|
|
12
9
|
}
|
|
13
10
|
exports.SkippingRequest = SkippingRequest;
|
|
14
11
|
class WebSocketFetcher {
|
|
15
|
-
constructor(requestsInfo, logger
|
|
12
|
+
constructor(requestsInfo, logger) {
|
|
16
13
|
this.logger = logger;
|
|
17
|
-
this.pingTimeout = undefined;
|
|
18
14
|
this.lastFetchSucceeded = false;
|
|
19
15
|
this.stop = true;
|
|
16
|
+
this.ws = new websocket_1.client();
|
|
20
17
|
this.connection = null;
|
|
21
18
|
this.requests = requestsInfo;
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
19
|
+
this.ws.on('connect', this.connected.bind(this));
|
|
20
|
+
this.ws.on('connectFailed', this.connectFailed.bind(this));
|
|
24
21
|
}
|
|
25
|
-
connected() {
|
|
22
|
+
connected(connection) {
|
|
23
|
+
this.connection = connection;
|
|
26
24
|
this.logger.info(`Connected to ${this.requests.info.requestOptions.url}`);
|
|
27
|
-
this.
|
|
25
|
+
this.connection.on('error', this.onError.bind(this));
|
|
26
|
+
this.connection.on('close', this.onClose.bind(this));
|
|
27
|
+
this.connection.on('message', this.onMessage.bind(this));
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this
|
|
34
|
-
},
|
|
29
|
+
connectFailed(error) {
|
|
30
|
+
this.logger.error(`Connect Error: ${error.toString()}. Reconnecting...`);
|
|
31
|
+
// reconnect on errors / failures
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
this.startPolling();
|
|
34
|
+
}, 3000);
|
|
35
35
|
}
|
|
36
36
|
onClose() {
|
|
37
|
-
this.logger.info(`Connection closed
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
this.logger.info(`Unexpected closure, Reconnecting...`);
|
|
44
|
-
this.reconnectWithDelay();
|
|
37
|
+
this.logger.info(`Connection closed. Reconnecting...`);
|
|
38
|
+
// reconnect on errors / failures
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
this.startPolling();
|
|
41
|
+
}, 3000);
|
|
45
42
|
}
|
|
46
43
|
onError(error) {
|
|
47
|
-
this.logger.error(`
|
|
48
|
-
this
|
|
44
|
+
this.logger.error(`Connection Error: ${error.toString()}. Stopping & Reconnecting...`);
|
|
45
|
+
this.stopPolling();
|
|
46
|
+
// reconnect on errors / failures
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
this.startPolling();
|
|
49
|
+
}, 3000);
|
|
49
50
|
}
|
|
50
|
-
onMessage(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
onMessage(message) {
|
|
52
|
+
if (message.type === 'utf8') {
|
|
53
|
+
const response = JSON.parse(message.utf8Data);
|
|
54
|
+
const reqInfo = this.requests;
|
|
55
|
+
const info = reqInfo.info;
|
|
56
|
+
const options = reqInfo.info.requestOptions;
|
|
57
|
+
this.logger.debug(`(${options.url}) received new data`);
|
|
58
|
+
try {
|
|
59
|
+
const parsedData = info.caster(response);
|
|
60
|
+
reqInfo.handler(parsedData);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
this.logger.info(e);
|
|
64
|
+
this.logger.info(`(${options.url}) received incorrect data ${JSON.stringify(response).replace(/(?:\r\n|\r|\n)/g, ' ')}`, e);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
connect() {
|
|
@@ -73,37 +76,21 @@ class WebSocketFetcher {
|
|
|
73
76
|
throw new Error('Name header is not a string');
|
|
74
77
|
}
|
|
75
78
|
this.logger.info(`Connecting to ${this.requests.info.requestOptions.url}...`);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
name: name,
|
|
80
|
-
},
|
|
79
|
+
this.ws.connect(this.requests.info.requestOptions.url, undefined, undefined, {
|
|
80
|
+
Authorization: authorization,
|
|
81
|
+
name: name,
|
|
81
82
|
});
|
|
82
|
-
ws.on('open', this.connected.bind(this));
|
|
83
|
-
ws.on('message', this.onMessage.bind(this));
|
|
84
|
-
ws.on('error', this.onError.bind(this));
|
|
85
|
-
ws.on('close', this.onClose.bind(this));
|
|
86
|
-
this.connection = ws;
|
|
87
|
-
}
|
|
88
|
-
reconnectWithDelay() {
|
|
89
|
-
this.logger.info(`Waiting ${this.reconnectDelay}ms before reconnecting...`);
|
|
90
|
-
clearTimeout(this.pingTimeout);
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
this.reconnect();
|
|
93
|
-
}, this.reconnectDelay);
|
|
94
|
-
}
|
|
95
|
-
reconnect() {
|
|
96
|
-
clearTimeout(this.pingTimeout);
|
|
97
|
-
this.connect();
|
|
98
|
-
this.logger.info(`Connection started for ${this.requests.info.requestOptions.url}`);
|
|
99
83
|
}
|
|
100
84
|
startPolling() {
|
|
101
85
|
this.stop = false;
|
|
102
|
-
this.
|
|
86
|
+
this.connect();
|
|
87
|
+
this.logger.info(`Connection started for ${this.requests.info.requestOptions.url}`);
|
|
103
88
|
}
|
|
104
89
|
stopPolling() {
|
|
90
|
+
if (this.connection) {
|
|
91
|
+
this.connection.close();
|
|
92
|
+
}
|
|
105
93
|
this.stop = true;
|
|
106
|
-
this.connection?.terminate();
|
|
107
94
|
this.logger.info(`Connection stopped for ${this.requests.info.requestOptions.url}`);
|
|
108
95
|
}
|
|
109
96
|
isPolling() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsFetcher.js","sourceRoot":"","sources":["../../../src/lib/fetcher/wsFetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wsFetcher.js","sourceRoot":"","sources":["../../../src/lib/fetcher/wsFetcher.ts"],"names":[],"mappings":";;;AAEA,yCAGmB;AAEnB,MAAa,eAAe;IAC1B,YAAmB,UAAU,EAAE;QAAZ,YAAO,GAAP,OAAO,CAAK;IAAG,CAAC;CACpC;AAFD,0CAEC;AAiBD,MAAa,gBAAgB;IAO3B,YAAY,YAAuC,EAAU,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QALpE,uBAAkB,GAAY,KAAK,CAAC;QACnC,SAAI,GAAY,IAAI,CAAC;QACrB,OAAE,GAAoB,IAAI,kBAAe,EAAE,CAAC;QAC5C,eAAU,GAA+B,IAAI,CAAC;QAGpD,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,EAAE,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"main": "build/index.js",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/paraswap/paraswap-dex-lib",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"@hashflow/sdk": "^2.2.7",
|
|
59
59
|
"@hashflow/taker-js": "^0.3.7",
|
|
60
60
|
"@paraswap/core": "2.4.0",
|
|
61
|
-
"@types/ws": "^8.5.12",
|
|
62
61
|
"async": "^3.2.4",
|
|
63
62
|
"axios": "0.27.2",
|
|
64
63
|
"bignumber.js": "9.1.0",
|
|
@@ -70,7 +69,6 @@
|
|
|
70
69
|
"lodash": "4.17.21",
|
|
71
70
|
"log4js": "6.6.1",
|
|
72
71
|
"node-cache": "^5.1.2",
|
|
73
|
-
"protobufjs": "^7.4.0",
|
|
74
72
|
"ts-essentials": "9.1.2",
|
|
75
73
|
"uuid": "^9.0.0",
|
|
76
74
|
"web3": "1.6.0",
|
|
@@ -79,7 +77,7 @@
|
|
|
79
77
|
"web3-eth-abi": "1.4.0",
|
|
80
78
|
"web3-eth-contract": "1.6.0",
|
|
81
79
|
"web3-utils": "1.6.0",
|
|
82
|
-
"
|
|
80
|
+
"websocket": "1.0.35"
|
|
83
81
|
},
|
|
84
82
|
"sideEffects": false
|
|
85
83
|
}
|
package/src/config.ts
CHANGED
|
@@ -147,7 +147,6 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
147
147
|
multicallV2Address: '0xC50F4c1E81c873B2204D7eFf7069Ffec6Fbe136D',
|
|
148
148
|
privateHttpProvider: process.env.HTTP_PROVIDER_56,
|
|
149
149
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
150
|
-
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
151
150
|
executorsAddresses: {
|
|
152
151
|
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
|
|
153
152
|
Executor02: '0x00C600b30fb0400701010F4b080409018B9006E0',
|
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
_reduceTickBitmap,
|
|
39
39
|
_reduceTicks,
|
|
40
40
|
} from '../uniswap-v3/contract-math/utils';
|
|
41
|
-
import { Constants } from './lib/Constants';
|
|
42
41
|
import { Network, NULL_ADDRESS } from '../../constants';
|
|
43
42
|
import { TickTable } from './lib/TickTable';
|
|
44
43
|
import {
|
|
@@ -336,7 +335,8 @@ export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1>
|
|
|
336
335
|
globalState: { tick },
|
|
337
336
|
} = _stateWithoutTicksAndTickBitmap;
|
|
338
337
|
const currentBitmapIndex = int16(
|
|
339
|
-
(BigInt(tick) /
|
|
338
|
+
(BigInt(tick) / BigInt(_stateWithoutTicksAndTickBitmap.tickSpacing)) >>
|
|
339
|
+
8n,
|
|
340
340
|
);
|
|
341
341
|
|
|
342
342
|
const buffer = this.getBitmapRangeToRequest();
|
|
@@ -633,7 +633,7 @@ export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1>
|
|
|
633
633
|
};
|
|
634
634
|
const currentTick = globalState.tick;
|
|
635
635
|
const startTickBitmap = TickTable.position(
|
|
636
|
-
BigInt(currentTick) /
|
|
636
|
+
BigInt(currentTick) / BigInt(_state.tickSpacing),
|
|
637
637
|
)[0];
|
|
638
638
|
|
|
639
639
|
return {
|
|
@@ -641,8 +641,8 @@ export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1>
|
|
|
641
641
|
blockTimestamp: bigIntify(_state.blockTimestamp),
|
|
642
642
|
globalState,
|
|
643
643
|
liquidity: bigIntify(_state.liquidity),
|
|
644
|
-
tickSpacing:
|
|
645
|
-
maxLiquidityPerTick:
|
|
644
|
+
tickSpacing: bigIntify(_state.tickSpacing),
|
|
645
|
+
maxLiquidityPerTick: bigIntify(_state.maxLiquidityPerTick),
|
|
646
646
|
tickBitmap,
|
|
647
647
|
ticks,
|
|
648
648
|
startTickBitmap,
|
|
@@ -651,11 +651,7 @@ class AlgebraMathClass {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
// check stop condition
|
|
654
|
-
if (
|
|
655
|
-
amountRequired == 0n ||
|
|
656
|
-
currentPrice == newSqrtPriceX96 ||
|
|
657
|
-
currentTick === newTick // deviation from contract
|
|
658
|
-
) {
|
|
654
|
+
if (amountRequired == 0n || currentPrice == newSqrtPriceX96) {
|
|
659
655
|
break;
|
|
660
656
|
}
|
|
661
657
|
}
|