@paraswap/dex-lib 4.1.23 → 4.1.24-uni-v4.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/build/abi/integral/factory.json +333 -0
- package/build/abi/{angle-transmuter/ChainlinkEACAggregatorProxy.json → integral/oracle.json} +239 -247
- package/build/abi/{curve-v1/StableSwapUSDN.json → integral/pool.json} +487 -450
- package/build/abi/{RamsesV2Pool.abi.json → integral/relayer.json} +833 -851
- package/build/abi/uniswap-v4/pool-manager.abi.json +1367 -0
- package/build/abi/uniswap-v4/quoter.abi.json +461 -0
- package/build/abi/uniswap-v4/router.abi.json +230 -0
- package/build/abi/uniswap-v4/state-view.abi.json +365 -0
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -22
- package/build/dex/aave-v1/aave-v1.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/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- 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-generate-pool.d.ts +49 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +104 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +1 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/integral/config.d.ts +4 -0
- package/build/dex/integral/config.js +20 -0
- package/build/dex/integral/config.js.map +1 -0
- package/build/dex/integral/context.d.ts +40 -0
- package/build/dex/integral/context.js +158 -0
- package/build/dex/integral/context.js.map +1 -0
- package/build/dex/integral/integral-factory.d.ts +24 -0
- package/build/dex/integral/integral-factory.js +95 -0
- package/build/dex/integral/integral-factory.js.map +1 -0
- package/build/dex/integral/integral-pool.d.ts +50 -0
- package/build/dex/integral/integral-pool.js +149 -0
- package/build/dex/integral/integral-pool.js.map +1 -0
- package/build/dex/integral/integral-pricing.d.ts +18 -0
- package/build/dex/integral/integral-pricing.js +114 -0
- package/build/dex/integral/integral-pricing.js.map +1 -0
- package/build/dex/integral/integral-relayer.d.ts +42 -0
- package/build/dex/integral/integral-relayer.js +192 -0
- package/build/dex/integral/integral-relayer.js.map +1 -0
- package/build/dex/integral/integral-token.d.ts +27 -0
- package/build/dex/integral/integral-token.js +59 -0
- package/build/dex/integral/integral-token.js.map +1 -0
- package/build/dex/{inception/inception-native.d.ts → integral/integral.d.ts} +19 -21
- package/build/dex/integral/integral.js +376 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +85 -0
- package/build/dex/integral/types.js +9 -0
- package/build/dex/integral/types.js.map +1 -0
- package/build/dex/integral/utils-e2e.d.ts +9 -0
- package/build/dex/integral/utils-e2e.js +131 -0
- package/build/dex/integral/utils-e2e.js.map +1 -0
- package/build/dex/integral/utils.d.ts +17 -0
- package/build/dex/integral/utils.js +94 -0
- package/build/dex/integral/utils.js.map +1 -0
- package/build/dex/jarvis.d.ts +1 -2
- package/build/dex/jarvis.js +0 -58
- package/build/dex/jarvis.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/m-token/config.d.ts +3 -0
- package/build/dex/m-token/config.js +19 -0
- package/build/dex/m-token/config.js.map +1 -0
- package/build/dex/m-token/m-token.d.ts +29 -0
- package/build/dex/m-token/m-token.js +145 -0
- package/build/dex/m-token/m-token.js.map +1 -0
- package/build/dex/m-token/m-wrapped-m.d.ts +17 -0
- package/build/dex/m-token/m-wrapped-m.js +50 -0
- package/build/dex/m-token/m-wrapped-m.js.map +1 -0
- package/build/dex/m-token/types.d.ts +12 -0
- package/build/dex/{inception → m-token}/types.js.map +1 -1
- 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.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -31
- 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/spark/susds-psm.d.ts +49 -0
- package/build/dex/spark/susds-psm.js +245 -0
- package/build/dex/spark/susds-psm.js.map +1 -0
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +62 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -10
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
- package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
- package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
- 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-v4/config.d.ts +3 -0
- package/build/dex/uniswap-v4/config.js +58 -0
- package/build/dex/uniswap-v4/config.js.map +1 -0
- package/build/dex/uniswap-v4/constants.d.ts +9 -0
- package/build/dex/uniswap-v4/constants.js +18 -0
- package/build/dex/uniswap-v4/constants.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/BalanceDelta.d.ts +6 -0
- package/build/dex/uniswap-v4/contract-math/BalanceDelta.js +22 -0
- package/build/dex/uniswap-v4/contract-math/BalanceDelta.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js +53 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js +8 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js +9 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js +20 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.d.ts +13 -0
- package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.js +35 -0
- package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js +16 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/Position.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/Position.js +39 -0
- package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.d.ts +10 -0
- package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.js +28 -0
- package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js +67 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.d.ts +10 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js +63 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/Tick.d.ts +10 -0
- package/build/dex/uniswap-v4/contract-math/Tick.js +64 -0
- package/build/dex/uniswap-v4/contract-math/Tick.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js +64 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js +83 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js +17 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js +11 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.d.ts +29 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js +419 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/utils.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/utils.js +15 -0
- package/build/dex/uniswap-v4/contract-math/utils.js.map +1 -0
- package/build/dex/uniswap-v4/encoder.d.ts +17 -0
- package/build/dex/uniswap-v4/encoder.js +160 -0
- package/build/dex/uniswap-v4/encoder.js.map +1 -0
- package/build/dex/uniswap-v4/subgraph.d.ts +7 -0
- package/build/dex/uniswap-v4/subgraph.js +122 -0
- package/build/dex/uniswap-v4/subgraph.js.map +1 -0
- package/build/dex/uniswap-v4/types.d.ts +92 -0
- package/build/dex/uniswap-v4/types.js +3 -0
- package/build/dex/uniswap-v4/types.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +31 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +135 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool.d.ts +40 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool.js +343 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +41 -0
- package/build/dex/uniswap-v4/uniswap-v4.js +205 -0
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -0
- package/build/dex/uniswap-v4/utils.d.ts +2 -0
- package/build/dex/uniswap-v4/utils.js +15 -0
- package/build/dex/uniswap-v4/utils.js.map +1 -0
- package/build/dex/zerox/index.d.ts +26 -4
- package/build/dex/zerox/index.js +42 -50
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +0 -29
- package/build/dex/zerox/types.js +1 -8
- package/build/dex/zerox/types.js.map +1 -1
- package/package.json +1 -1
- 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/RamsesV2Quoter.abi.json +0 -274
- package/build/abi/USDM.json +0 -807
- package/build/abi/UniswapV2Router.json +0 -397
- package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +0 -1246
- package/build/abi/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/StableSwapUSDT.json +0 -814
- package/build/abi/curve-v1/StableSwapY.json +0 -814
- package/build/abi/inception/inception-ineth-pool.json +0 -1062
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-ratio-feed.json +0 -329
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
- package/build/abi/kyberdmm.abi.json +0 -1148
- package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
- package/build/abi/nerve/nerve-metapool.json +0 -790
- package/build/abi/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/websocket-fetcher.d.ts +0 -35
- package/build/dex/bebop/websocket-fetcher.js +0 -87
- package/build/dex/bebop/websocket-fetcher.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -4
- package/build/dex/inception/config.js +0 -109
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -16
- package/build/dex/inception/inception-event-pool.js +0 -51
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -43
- package/build/dex/inception/inception.js +0 -204
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/utils.d.ts +0 -6
- package/build/dex/inception/utils.js +0 -37
- package/build/dex/inception/utils.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/build/dex/{inception → m-token}/types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/encoder.ts"],"names":[],"mappings":";;;;;;AAmDA,oEAsFC;AAUD,sEAkFC;AArOD,mCAAgC;AAGhC,2FAA6D;AAC7D,4CAA+C;AAC/C,uCA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G;QACE,IAAA,oBAAY,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,wBAAY,CAAC,CAAC,CAAC,QAAQ;QAChD,eAAe,CAAC,UAAU;QAC1B,IAAI;KACL,CACF,CAAC;IAEF,cAAc;IACd,MAAM,IAAI,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAC9C,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACjC,kEAAkE;IAClE,CAAC,IAAA,oBAAY,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,wBAAY,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAC3E,CAAC;IAEF,MAAM,KAAK,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAC/C,CAAC,OAAO,EAAE,SAAS,CAAC,EACpB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAChC,CAAC;IAEF,OAAO,WAAW,CAAC,kBAAkB,CAAC,wBAAwB,EAAE;QAC9D,OAAO;QACP,CAAC,KAAK,CAAC;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SubgraphPool, Tick } from './types';
|
|
2
|
+
import { IDexHelper } from '../../dex-helper';
|
|
3
|
+
import { Logger } from 'log4js';
|
|
4
|
+
import { Address } from '@paraswap/core';
|
|
5
|
+
export declare function queryTicksForPool(dexHelper: IDexHelper, logger: Logger, dexKey: string, subgraphUrl: string, blockNumber: number, id: string, latestBlock?: boolean): Promise<Tick[]>;
|
|
6
|
+
export declare function queryAvailablePoolsForPairFromSubgraph(dexHelper: IDexHelper, subgraphUrl: string, srcToken: Address, destToken: Address): Promise<SubgraphPool[]>;
|
|
7
|
+
export declare function queryOnePageForAllAvailablePoolsFromSubgraph(dexHelper: IDexHelper, logger: Logger, dexKey: string, subgraphUrl: string, blockNumber: number, skip: number, limit: number, latestBlock?: boolean): Promise<SubgraphPool[]>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryTicksForPool = queryTicksForPool;
|
|
4
|
+
exports.queryAvailablePoolsForPairFromSubgraph = queryAvailablePoolsForPairFromSubgraph;
|
|
5
|
+
exports.queryOnePageForAllAvailablePoolsFromSubgraph = queryOnePageForAllAvailablePoolsFromSubgraph;
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const constants_2 = require("../../constants");
|
|
8
|
+
async function queryTicksForPool(dexHelper, logger, dexKey, subgraphUrl, blockNumber, id, latestBlock = false) {
|
|
9
|
+
const ticksLimit = 300;
|
|
10
|
+
const poolQuery = `query {
|
|
11
|
+
pools(
|
|
12
|
+
${latestBlock ? '' : `block: { number: ${blockNumber} }`}
|
|
13
|
+
where: {id: "${id}"}
|
|
14
|
+
) {
|
|
15
|
+
ticks(first: ${ticksLimit}) {
|
|
16
|
+
id
|
|
17
|
+
liquidityGross
|
|
18
|
+
liquidityNet
|
|
19
|
+
tickIdx
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}`;
|
|
23
|
+
const res = await dexHelper.httpRequest.querySubgraph(subgraphUrl, {
|
|
24
|
+
query: poolQuery,
|
|
25
|
+
variables: {},
|
|
26
|
+
}, { timeout: constants_1.SUBGRAPH_TIMEOUT });
|
|
27
|
+
if (res.errors && res.errors.length) {
|
|
28
|
+
if (res.errors[0].message.includes('missing block')) {
|
|
29
|
+
logger.info(`${dexKey}: subgraph query ticks fallback to the latest block...`);
|
|
30
|
+
return queryTicksForPool(dexHelper, logger, dexKey, subgraphUrl, blockNumber, id, true);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new Error(res.errors[0].message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return res.data.pools[0]?.ticks || [];
|
|
37
|
+
}
|
|
38
|
+
async function queryAvailablePoolsForPairFromSubgraph(dexHelper, subgraphUrl, srcToken, destToken) {
|
|
39
|
+
const ticksLimit = 300;
|
|
40
|
+
const poolsQuery = `query ($token0: Bytes!, $token1: Bytes!, $hooks: Bytes!) {
|
|
41
|
+
pools(
|
|
42
|
+
where: { token0: $token0, token1: $token1, hooks: $hooks, liquidity_gt: 0 },
|
|
43
|
+
orderBy: volumeUSD
|
|
44
|
+
orderDirection: desc
|
|
45
|
+
) {
|
|
46
|
+
id
|
|
47
|
+
fee: feeTier
|
|
48
|
+
tickSpacing
|
|
49
|
+
token0 {
|
|
50
|
+
address: id
|
|
51
|
+
}
|
|
52
|
+
token1 {
|
|
53
|
+
address: id
|
|
54
|
+
}
|
|
55
|
+
hooks
|
|
56
|
+
tick
|
|
57
|
+
ticks(first: ${ticksLimit}) {
|
|
58
|
+
id
|
|
59
|
+
liquidityGross
|
|
60
|
+
liquidityNet
|
|
61
|
+
tickIdx
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}`;
|
|
65
|
+
const [token0, token1] = parseInt(srcToken, 16) < parseInt(destToken, 16)
|
|
66
|
+
? [srcToken, destToken]
|
|
67
|
+
: [destToken, srcToken];
|
|
68
|
+
const res = await dexHelper.httpRequest.querySubgraph(subgraphUrl, {
|
|
69
|
+
query: poolsQuery,
|
|
70
|
+
variables: { token0, token1, hooks: constants_2.NULL_ADDRESS },
|
|
71
|
+
}, { timeout: constants_1.SUBGRAPH_TIMEOUT });
|
|
72
|
+
if (res.errors && res.errors.length) {
|
|
73
|
+
throw new Error(res.errors[0].message);
|
|
74
|
+
}
|
|
75
|
+
return res.data.pools;
|
|
76
|
+
}
|
|
77
|
+
async function queryOnePageForAllAvailablePoolsFromSubgraph(dexHelper, logger, dexKey, subgraphUrl, blockNumber, skip, limit, latestBlock = false) {
|
|
78
|
+
const ticksLimit = 300;
|
|
79
|
+
const poolsQuery = `query ($skip: Int!, $hooks: Bytes!) {
|
|
80
|
+
pools(
|
|
81
|
+
where: { hooks: $hooks, liquidity_gt: 0 },
|
|
82
|
+
${latestBlock ? '' : `block: { number: ${blockNumber} }`}
|
|
83
|
+
orderBy: volumeUSD
|
|
84
|
+
orderDirection: desc
|
|
85
|
+
skip: $skip
|
|
86
|
+
first: ${limit}
|
|
87
|
+
) {
|
|
88
|
+
id
|
|
89
|
+
fee: feeTier
|
|
90
|
+
tickSpacing
|
|
91
|
+
token0 {
|
|
92
|
+
address: id
|
|
93
|
+
}
|
|
94
|
+
token1 {
|
|
95
|
+
address: id
|
|
96
|
+
}
|
|
97
|
+
hooks
|
|
98
|
+
tick
|
|
99
|
+
ticks(first: ${ticksLimit}) {
|
|
100
|
+
id
|
|
101
|
+
liquidityGross
|
|
102
|
+
liquidityNet
|
|
103
|
+
tickIdx
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}`;
|
|
107
|
+
const res = await dexHelper.httpRequest.querySubgraph(subgraphUrl, {
|
|
108
|
+
query: poolsQuery,
|
|
109
|
+
variables: { skip: skip, hooks: constants_2.NULL_ADDRESS },
|
|
110
|
+
}, { timeout: constants_1.SUBGRAPH_TIMEOUT });
|
|
111
|
+
if (res.errors && res.errors.length) {
|
|
112
|
+
if (res.errors[0].message.includes('missing block')) {
|
|
113
|
+
logger.info(`${dexKey}: subgraph fallback to the latest block...`);
|
|
114
|
+
return queryOnePageForAllAvailablePoolsFromSubgraph(dexHelper, logger, dexKey, subgraphUrl, blockNumber, skip, limit, true);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error(res.errors[0].message);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return res.data.pools;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=subgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subgraph.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/subgraph.ts"],"names":[],"mappings":";;AAOA,8CA2DC;AAED,wFA0DC;AAED,oGA0EC;AAzMD,2CAA+C;AAI/C,+CAA+C;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EAAE,KAAK,EAAE,wBAAY,EAAE;KAC/C,EACD,EAAE,OAAO,EAAE,4BAAgB,EAAE,CAC9B,CAAC;IAEF,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,4CAA4C,CAAC,CAAC;YACnE,OAAO,4CAA4C,CACjD,SAAS,EACT,MAAM,EACN,MAAM,EACN,WAAW,EACX,WAAW,EACX,IAAI,EACJ,KAAK,EACL,IAAI,CACL,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Address, NumberAsString } from '../../types';
|
|
2
|
+
export type ModifyLiquidityParams = {
|
|
3
|
+
liquidityDelta: bigint;
|
|
4
|
+
tickLower: bigint;
|
|
5
|
+
tickUpper: bigint;
|
|
6
|
+
owner: string;
|
|
7
|
+
tickSpacing: bigint;
|
|
8
|
+
salt: string;
|
|
9
|
+
};
|
|
10
|
+
export type TickInfo = {
|
|
11
|
+
liquidityGross: bigint;
|
|
12
|
+
liquidityNet: bigint;
|
|
13
|
+
feeGrowthOutside0X128: bigint;
|
|
14
|
+
feeGrowthOutside1X128: bigint;
|
|
15
|
+
};
|
|
16
|
+
export type PositionState = {
|
|
17
|
+
liquidity: bigint;
|
|
18
|
+
feeGrowthInside0LastX128: bigint;
|
|
19
|
+
feeGrowthInside1LastX128: bigint;
|
|
20
|
+
};
|
|
21
|
+
export type Tick = {
|
|
22
|
+
tickIdx: string;
|
|
23
|
+
liquidityGross: string;
|
|
24
|
+
liquidityNet: string;
|
|
25
|
+
};
|
|
26
|
+
export type PoolManagerState = Record<string, never>;
|
|
27
|
+
export type PoolState = {
|
|
28
|
+
id: string;
|
|
29
|
+
token0: string;
|
|
30
|
+
token1: string;
|
|
31
|
+
fee: string;
|
|
32
|
+
hooks: string;
|
|
33
|
+
feeGrowthGlobal0X128: bigint;
|
|
34
|
+
feeGrowthGlobal1X128: bigint;
|
|
35
|
+
liquidity: bigint;
|
|
36
|
+
slot0: Slot0;
|
|
37
|
+
tickSpacing: number;
|
|
38
|
+
ticks: Record<NumberAsString, TickInfo>;
|
|
39
|
+
positions: Record<string, PositionState>;
|
|
40
|
+
tickBitmap: Record<NumberAsString, bigint>;
|
|
41
|
+
};
|
|
42
|
+
export type FeeGrowthGlobals = {
|
|
43
|
+
feeGrowthGlobal0: bigint;
|
|
44
|
+
feeGrowthGlobal1: bigint;
|
|
45
|
+
};
|
|
46
|
+
export type Slot0 = {
|
|
47
|
+
sqrtPriceX96: bigint;
|
|
48
|
+
tick: bigint;
|
|
49
|
+
protocolFee: bigint;
|
|
50
|
+
lpFee: bigint;
|
|
51
|
+
};
|
|
52
|
+
export type UniswapV4Data = {
|
|
53
|
+
exchange: Address;
|
|
54
|
+
zeroForOne: boolean;
|
|
55
|
+
pool: Pool;
|
|
56
|
+
};
|
|
57
|
+
export type Pool = {
|
|
58
|
+
id: string;
|
|
59
|
+
key: PoolKey;
|
|
60
|
+
};
|
|
61
|
+
export type OutputResult = {
|
|
62
|
+
outputs: bigint[];
|
|
63
|
+
tickCounts: number[];
|
|
64
|
+
};
|
|
65
|
+
export type SubgraphPool = {
|
|
66
|
+
id: string;
|
|
67
|
+
fee: string;
|
|
68
|
+
hooks: string;
|
|
69
|
+
token0: {
|
|
70
|
+
address: string;
|
|
71
|
+
};
|
|
72
|
+
token1: {
|
|
73
|
+
address: string;
|
|
74
|
+
};
|
|
75
|
+
tick: string;
|
|
76
|
+
tickSpacing: string;
|
|
77
|
+
ticks: Tick[];
|
|
78
|
+
};
|
|
79
|
+
export type DexParams = {
|
|
80
|
+
poolManager: Address;
|
|
81
|
+
quoter: Address;
|
|
82
|
+
router: Address;
|
|
83
|
+
subgraphURL: string;
|
|
84
|
+
stateView: string;
|
|
85
|
+
};
|
|
86
|
+
export type PoolKey = {
|
|
87
|
+
currency0: Address;
|
|
88
|
+
currency1: Address;
|
|
89
|
+
fee: string;
|
|
90
|
+
tickSpacing: number;
|
|
91
|
+
hooks: Address;
|
|
92
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InitializeStateOptions, StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
2
|
+
import { DexParams, Pool, PoolManagerState } from './types';
|
|
3
|
+
import { Address, Log, Logger } from '../../types';
|
|
4
|
+
import { Interface } from 'ethers/lib/utils';
|
|
5
|
+
import { IDexHelper } from '../../dex-helper';
|
|
6
|
+
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
7
|
+
import { LogDescription } from '@ethersproject/abi/lib.esm';
|
|
8
|
+
import { FactoryState } from '../uniswap-v3/types';
|
|
9
|
+
import { UniswapV4Pool } from './uniswap-v4-pool';
|
|
10
|
+
export declare class UniswapV4PoolManager extends StatefulEventSubscriber<PoolManagerState> {
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
private readonly network;
|
|
13
|
+
private readonly config;
|
|
14
|
+
protected logger: Logger;
|
|
15
|
+
handlers: {
|
|
16
|
+
[event: string]: (event: any, log: Log) => AsyncOrSync<PoolManagerState>;
|
|
17
|
+
};
|
|
18
|
+
private pools;
|
|
19
|
+
eventPools: Record<string, UniswapV4Pool>;
|
|
20
|
+
logDecoder: (log: Log) => any;
|
|
21
|
+
stateViewIface: Interface;
|
|
22
|
+
poolManagerIface: Interface;
|
|
23
|
+
private subgraphPoolsCacheKey;
|
|
24
|
+
constructor(dexHelper: IDexHelper, parentName: string, network: number, config: DexParams, logger: Logger, mapKey?: string);
|
|
25
|
+
initialize(blockNumber: number, options?: InitializeStateOptions<PoolManagerState>): Promise<void>;
|
|
26
|
+
generateState(): FactoryState;
|
|
27
|
+
protected processLog(_: DeepReadonly<FactoryState>, log: Readonly<Log>): Promise<FactoryState>;
|
|
28
|
+
getAvailablePoolsForPair(srcToken: Address, destToken: Address, blockNumber: number): Promise<Pool[]>;
|
|
29
|
+
private queryPoolsForPair;
|
|
30
|
+
handleInitializeEvent(event: LogDescription, log: Log): Promise<PoolManagerState>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
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.UniswapV4PoolManager = void 0;
|
|
7
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
8
|
+
const state_view_abi_json_1 = __importDefault(require("../../abi/uniswap-v4/state-view.abi.json"));
|
|
9
|
+
const pool_manager_abi_json_1 = __importDefault(require("../../abi/uniswap-v4/pool-manager.abi.json"));
|
|
10
|
+
const utils_1 = require("ethers/lib/utils");
|
|
11
|
+
const subgraph_1 = require("./subgraph");
|
|
12
|
+
const utils_2 = require("../../utils");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
14
|
+
const constants_2 = require("./constants");
|
|
15
|
+
const uniswap_v4_pool_1 = require("./uniswap-v4-pool");
|
|
16
|
+
class UniswapV4PoolManager extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
17
|
+
dexHelper;
|
|
18
|
+
network;
|
|
19
|
+
config;
|
|
20
|
+
logger;
|
|
21
|
+
handlers = {};
|
|
22
|
+
pools = [];
|
|
23
|
+
eventPools = {};
|
|
24
|
+
logDecoder;
|
|
25
|
+
stateViewIface;
|
|
26
|
+
poolManagerIface;
|
|
27
|
+
subgraphPoolsCacheKey = 'subgraph_pools';
|
|
28
|
+
constructor(dexHelper, parentName, network, config, logger, mapKey = '') {
|
|
29
|
+
super(parentName, `${parentName} PoolManager`, dexHelper, logger, true, mapKey);
|
|
30
|
+
this.dexHelper = dexHelper;
|
|
31
|
+
this.network = network;
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.logger = logger;
|
|
34
|
+
this.stateViewIface = new utils_1.Interface(state_view_abi_json_1.default);
|
|
35
|
+
this.poolManagerIface = new utils_1.Interface(pool_manager_abi_json_1.default);
|
|
36
|
+
this.addressesSubscribed = [this.config.poolManager];
|
|
37
|
+
this.logDecoder = (log) => this.poolManagerIface.parseLog(log);
|
|
38
|
+
// Add handlers
|
|
39
|
+
this.handlers['Initialize'] = this.handleInitializeEvent.bind(this);
|
|
40
|
+
}
|
|
41
|
+
async initialize(blockNumber, options) {
|
|
42
|
+
return super.initialize(blockNumber, options);
|
|
43
|
+
}
|
|
44
|
+
generateState() {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
async processLog(_, log) {
|
|
48
|
+
const event = this.logDecoder(log);
|
|
49
|
+
if (event.name in this.handlers) {
|
|
50
|
+
await this.handlers[event.name](event, log);
|
|
51
|
+
}
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
async getAvailablePoolsForPair(srcToken, destToken, blockNumber) {
|
|
55
|
+
const isEthSrc = (0, utils_2.isETHAddress)(srcToken);
|
|
56
|
+
const isEthDest = (0, utils_2.isETHAddress)(destToken);
|
|
57
|
+
const _src = isEthSrc ? constants_1.NULL_ADDRESS : srcToken.toLowerCase();
|
|
58
|
+
const _dest = isEthDest ? constants_1.NULL_ADDRESS : destToken.toLowerCase();
|
|
59
|
+
let pools = this.pools.filter(pool => (pool.token0.address === _src && pool.token1.address === _dest) ||
|
|
60
|
+
(pool.token0.address === _dest && pool.token1.address === _src));
|
|
61
|
+
if (pools.length === 0) {
|
|
62
|
+
const newPoolsToInit = await this.queryPoolsForPair(_src, _dest);
|
|
63
|
+
await Promise.all(newPoolsToInit.map(async (pool) => {
|
|
64
|
+
const eventPool = new uniswap_v4_pool_1.UniswapV4Pool(this.dexHelper, this.parentName, this.network, this.config, this.logger, '', pool.id.toLowerCase(), pool.token0.address.toLowerCase(), pool.token1.address.toLowerCase(), pool.fee, pool.hooks, 0n, pool.tick, pool.tickSpacing);
|
|
65
|
+
await eventPool.initialize(blockNumber);
|
|
66
|
+
// Add new Pool
|
|
67
|
+
this.pools.push(pool);
|
|
68
|
+
this.eventPools[pool.id.toLowerCase()] = eventPool;
|
|
69
|
+
}));
|
|
70
|
+
if (newPoolsToInit.length > 0) {
|
|
71
|
+
pools = this.pools.filter(pool => (pool.token0.address === _src && pool.token1.address === _dest) ||
|
|
72
|
+
(pool.token0.address === _dest && pool.token1.address === _src));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return pools.map(pool => ({
|
|
76
|
+
id: pool.id,
|
|
77
|
+
key: {
|
|
78
|
+
currency0: pool.token0.address,
|
|
79
|
+
currency1: pool.token1.address,
|
|
80
|
+
fee: pool.fee,
|
|
81
|
+
tickSpacing: parseInt(pool.tickSpacing),
|
|
82
|
+
hooks: pool.hooks,
|
|
83
|
+
},
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
async queryPoolsForPair(srcToken, destToken) {
|
|
87
|
+
const cachedSubgraphPools = await this.dexHelper.cache.getAndCacheLocally(this.parentName, this.network, this.subgraphPoolsCacheKey, constants_2.POOL_CACHE_REFRESH_INTERVAL);
|
|
88
|
+
let pools;
|
|
89
|
+
if (cachedSubgraphPools) {
|
|
90
|
+
pools = JSON.parse(cachedSubgraphPools);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
pools = [];
|
|
94
|
+
}
|
|
95
|
+
const poolsForPair = pools.filter(pool => (pool.token0.address === srcToken &&
|
|
96
|
+
pool.token1.address === destToken) ||
|
|
97
|
+
(pool.token0.address === destToken && pool.token1.address === srcToken));
|
|
98
|
+
if (poolsForPair.length > 0)
|
|
99
|
+
return poolsForPair;
|
|
100
|
+
const newlyRequestedPoolsForPair = await (0, subgraph_1.queryAvailablePoolsForPairFromSubgraph)(this.dexHelper, this.config.subgraphURL, srcToken, destToken);
|
|
101
|
+
newlyRequestedPoolsForPair.forEach(pool => pools.push(pool));
|
|
102
|
+
await this.dexHelper.cache.setexAndCacheLocally(this.parentName, this.network, this.subgraphPoolsCacheKey, constants_2.POOL_CACHE_REFRESH_INTERVAL, JSON.stringify(pools));
|
|
103
|
+
return pools;
|
|
104
|
+
}
|
|
105
|
+
async handleInitializeEvent(event, log) {
|
|
106
|
+
const id = event.args.id.toLowerCase();
|
|
107
|
+
const currency0 = event.args.currency0;
|
|
108
|
+
const currency1 = event.args.currency1;
|
|
109
|
+
const fee = event.args.fee;
|
|
110
|
+
const tickSpacing = parseInt(event.args.tickSpacing);
|
|
111
|
+
const hooks = event.args.hooks;
|
|
112
|
+
const sqrtPriceX96 = BigInt(event.args.sqrtPriceX96);
|
|
113
|
+
const tick = parseInt(event.args.tick);
|
|
114
|
+
this.pools.push({
|
|
115
|
+
id,
|
|
116
|
+
fee,
|
|
117
|
+
hooks,
|
|
118
|
+
token0: {
|
|
119
|
+
address: currency0.toLowerCase(),
|
|
120
|
+
},
|
|
121
|
+
token1: {
|
|
122
|
+
address: currency1.toLowerCase(),
|
|
123
|
+
},
|
|
124
|
+
tick: tick.toString(),
|
|
125
|
+
tickSpacing: tickSpacing.toString(),
|
|
126
|
+
ticks: [],
|
|
127
|
+
});
|
|
128
|
+
const eventPool = new uniswap_v4_pool_1.UniswapV4Pool(this.dexHelper, this.parentName, this.network, this.config, this.logger, '', id, currency0.toLowerCase(), currency1.toLowerCase(), fee, hooks, sqrtPriceX96, tick.toString(), tickSpacing.toString());
|
|
129
|
+
await eventPool.initialize(log.blockNumber);
|
|
130
|
+
this.eventPools[id] = eventPool;
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.UniswapV4PoolManager = UniswapV4PoolManager;
|
|
135
|
+
//# sourceMappingURL=uniswap-v4-pool-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniswap-v4-pool-manager.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/uniswap-v4-pool-manager.ts"],"names":[],"mappings":";;;;;;AAAA,+EAGyC;AAGzC,mGAA6E;AAC7E,uGAAiF;AACjF,4CAA6C;AAI7C,yCAGoB;AACpB,uCAA2C;AAC3C,+CAA+C;AAC/C,2CAGqB;AAErB,uDAAkD;AAElD,MAAa,oBAAqB,SAAQ,mDAAyC;IAkBtE;IAEQ;IACA;IACP;IArBZ,QAAQ,GAEJ,EAAE,CAAC;IAEC,KAAK,GAAmB,EAAE,CAAC;IAEnC,UAAU,GAAkC,EAAE,CAAC;IAE/C,UAAU,CAAoB;IAE9B,cAAc,CAAY;IAE1B,gBAAgB,CAAY;IAEpB,qBAAqB,GAAG,gBAAgB,CAAC;IAEjD,YACW,SAAqB,EAC9B,UAAkB,EACD,OAAe,EACf,MAAiB,EACxB,MAAc,EACxB,SAAiB,EAAE;QAEnB,KAAK,CACH,UAAU,EACV,GAAG,UAAU,cAAc,EAC3B,SAAS,EACT,MAAM,EACN,IAAI,EACJ,MAAM,CACP,CAAC;QAdO,cAAS,GAAT,SAAS,CAAY;QAEb,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAW;QACxB,WAAM,GAAN,MAAM,CAAQ;QAYxB,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAS,CAAC,6BAAqB,CAAC,CAAC;QAC3D,IAAI,CAAC,gBAAgB,GAAG,IAAI,iBAAS,CAAC,+BAAuB,CAAC,CAAC;QAC/D,IAAI,CAAC,mBAAmB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAA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I,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,EAAE;YACF,GAAG;YACH,KAAK;YACL,MAAM,EAAE;gBACN,OAAO,EAAE,SAAS,CAAC,WAAW,EAAE;aACjC;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,SAAS,CAAC,WAAW,EAAE;aACjC;YACD,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;YACrB,WAAW,EAAE,WAAW,CAAC,QAAQ,EAAE;YACnC,KAAK,EAAE,EAAE;SACV,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,+BAAa,CACjC,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,EAAE,EACF,EAAE,EACF,SAAS,CAAC,WAAW,EAAE,EACvB,SAAS,CAAC,WAAW,EAAE,EACvB,GAAG,EACH,KAAK,EACL,YAAY,EACZ,IAAI,CAAC,QAAQ,EAAE,EACf,WAAW,CAAC,QAAQ,EAAE,CACvB,CAAC;QACF,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;QAEhC,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAvOD,oDAuOC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InitializeStateOptions, StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
2
|
+
import { DexParams, FeeGrowthGlobals, PoolState, PositionState, Slot0, Tick, TickInfo } from './types';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper';
|
|
4
|
+
import { Log, Logger } from '../../types';
|
|
5
|
+
import { Interface } from 'ethers/lib/utils';
|
|
6
|
+
import { BlockHeader } from 'web3-eth';
|
|
7
|
+
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
8
|
+
import { MultiCallParams } from '../../lib/multi-wrapper';
|
|
9
|
+
export declare class UniswapV4Pool extends StatefulEventSubscriber<PoolState> {
|
|
10
|
+
readonly dexHelper: IDexHelper;
|
|
11
|
+
private readonly network;
|
|
12
|
+
private readonly config;
|
|
13
|
+
protected logger: Logger;
|
|
14
|
+
readonly poolId: string;
|
|
15
|
+
readonly token0: string;
|
|
16
|
+
readonly token1: string;
|
|
17
|
+
readonly fee: string;
|
|
18
|
+
readonly hooks: string;
|
|
19
|
+
readonly sqrtPriceX96: bigint;
|
|
20
|
+
readonly tick: string;
|
|
21
|
+
readonly tickSpacing: string;
|
|
22
|
+
handlers: {
|
|
23
|
+
[event: string]: (event: any, pool: PoolState, log: Log, blockHeader: Readonly<BlockHeader>) => AsyncOrSync<PoolState>;
|
|
24
|
+
};
|
|
25
|
+
logDecoder: (log: Log) => any;
|
|
26
|
+
stateViewIface: Interface;
|
|
27
|
+
poolManagerIface: Interface;
|
|
28
|
+
constructor(dexHelper: IDexHelper, parentName: string, network: number, config: DexParams, logger: Logger, mapKey: string | undefined, poolId: string, token0: string, token1: string, fee: string, hooks: string, sqrtPriceX96: bigint, tick: string, tickSpacing: string);
|
|
29
|
+
initialize(blockNumber: number, options?: InitializeStateOptions<PoolState>): Promise<void>;
|
|
30
|
+
protected _getPositionInfoCallData(poolId: string, owner: string, tickLower: number, tickUpper: number, salt: string): MultiCallParams<PositionState>;
|
|
31
|
+
protected _getStateRequestCallDataPerPool(poolId: string, tick: string, tickSpacing: string, ticks: Tick[]): MultiCallParams<bigint | [bigint, bigint] | TickInfo | Slot0 | FeeGrowthGlobals>[];
|
|
32
|
+
getOrGenerateState(blockNumber: number): Promise<PoolState>;
|
|
33
|
+
generateState(blockNumber: number): Promise<PoolState>;
|
|
34
|
+
getBitmapRangeToRequest(tick: string, tickSpacing: string): [bigint, bigint];
|
|
35
|
+
protected processLog(state: PoolState, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): Promise<DeepReadonly<PoolState | null>>;
|
|
36
|
+
handleProtocolFeeUpdatedEvent(event: any, poolState: PoolState): PoolState;
|
|
37
|
+
handleDonateEvent(event: any, poolState: PoolState): PoolState;
|
|
38
|
+
handleSwapEvent(event: any, poolState: PoolState): PoolState;
|
|
39
|
+
handleModifyLiquidityEvent(event: any, poolState: PoolState, log: Log): Promise<PoolState>;
|
|
40
|
+
}
|