@paraswap/dex-lib 4.1.19 → 4.1.20
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/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/balancer-v1/balancer-pools.json +33333 -0
- package/build/dex/balancer-v3/balancer-test-helpers.d.ts +5 -0
- package/build/dex/balancer-v3/balancer-test-helpers.js +25 -1
- package/build/dex/balancer-v3/balancer-test-helpers.js.map +1 -1
- package/build/dex/balancer-v3/balancer-v3-pool.js +35 -7
- package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
- package/build/dex/balancer-v3/balancer-v3.js +9 -2
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
- package/build/dex/balancer-v3/config.d.ts +2 -1
- package/build/dex/balancer-v3/config.js +7 -0
- package/build/dex/balancer-v3/config.js.map +1 -1
- package/build/dex/balancer-v3/getGasCost.js +3 -0
- package/build/dex/balancer-v3/getGasCost.js.map +1 -1
- package/build/dex/balancer-v3/getOnChainState.d.ts +5 -1
- package/build/dex/balancer-v3/getOnChainState.js +69 -9
- package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
- package/build/dex/balancer-v3/getPoolsApi.js +45 -7
- package/build/dex/balancer-v3/getPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/getTopPoolsApi.d.ts +4 -3
- package/build/dex/balancer-v3/getTopPoolsApi.js +17 -6
- package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/gyroECLPPool.d.ts +11 -0
- package/build/dex/balancer-v3/gyroECLPPool.js +6 -0
- package/build/dex/balancer-v3/gyroECLPPool.js.map +1 -0
- package/build/dex/balancer-v3/hooks/directionalFeeHook.d.ts +2 -0
- package/build/dex/balancer-v3/hooks/directionalFeeHook.js +1 -0
- package/build/dex/balancer-v3/hooks/directionalFeeHook.js.map +1 -1
- package/build/dex/balancer-v3/hooks/stableSurgeHook.d.ts +2 -0
- package/build/dex/balancer-v3/hooks/stableSurgeHook.js +1 -0
- package/build/dex/balancer-v3/hooks/stableSurgeHook.js.map +1 -1
- package/build/dex/balancer-v3/types.d.ts +6 -2
- package/build/dex/balancer-v3/utils.d.ts +2 -0
- package/build/dex/balancer-v3/utils.js +11 -0
- package/build/dex/balancer-v3/utils.js.map +1 -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/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/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/package.json +2 -2
- package/src/dex/balancer-v3/balancer-api.test.ts +122 -0
- package/src/dex/balancer-v3/balancer-buffer.test.ts +75 -0
- package/src/dex/balancer-v3/balancer-gyroECLP.test.ts +76 -0
- package/src/dex/balancer-v3/balancer-stableSurge.test.ts +54 -52
- package/src/dex/balancer-v3/balancer-test-helpers.ts +52 -0
- package/src/dex/balancer-v3/balancer-test-weighted.test.ts +96 -0
- package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +49 -2
- package/src/dex/balancer-v3/balancer-v3-events.test.ts +162 -1
- package/src/dex/balancer-v3/balancer-v3-pool.ts +50 -15
- package/src/dex/balancer-v3/balancer-v3.ts +14 -4
- package/src/dex/balancer-v3/config.ts +7 -0
- package/src/dex/balancer-v3/getGasCost.ts +3 -0
- package/src/dex/balancer-v3/getOnChainState.ts +101 -12
- package/src/dex/balancer-v3/getPoolsApi.ts +55 -12
- package/src/dex/balancer-v3/getTopPoolsApi.ts +29 -11
- package/src/dex/balancer-v3/gyroECLPPool.ts +17 -0
- package/src/dex/balancer-v3/hooks/directionalFeeHook.ts +2 -0
- package/src/dex/balancer-v3/hooks/stableSurgeHook.ts +2 -0
- package/src/dex/balancer-v3/types.ts +6 -2
- package/src/dex/balancer-v3/utils.ts +11 -0
- package/tests/constants-e2e.ts +9 -0
- package/tests/token-storage-slots.json +40 -0
- 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/build/dex/uniswap-v3/uniswap-v3-new.d.ts +0 -94
- package/build/dex/uniswap-v3/uniswap-v3-new.js +0 -923
- package/build/dex/uniswap-v3/uniswap-v3-new.js.map +0 -1
- package/scripts/get-uniswap-v3-dexes.ts +0 -64
|
@@ -7,7 +7,8 @@ exports.getPoolsApi = getPoolsApi;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const config_1 = require("./config");
|
|
9
9
|
const utils_1 = require("ethers/lib/utils");
|
|
10
|
-
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
function createQuery(networkId, poolTypes, hooks, timestamp) {
|
|
11
12
|
const poolTypesString = poolTypes.map(type => `${type}`).join(', ');
|
|
12
13
|
const networkString = config_1.BalancerV3Config.BalancerV3[networkId].apiNetworkName;
|
|
13
14
|
const disabledPoolIdsString = config_1.disabledPoolIds.BalancerV3[networkId]
|
|
@@ -20,6 +21,7 @@ function createQuery(networkId, poolTypes, timestamp) {
|
|
|
20
21
|
poolTypeIn: `[${poolTypesString}]`,
|
|
21
22
|
...(timestamp && { createTime: `{lt: ${timestamp}}` }),
|
|
22
23
|
...(disabledPoolIdsString && { idNotIn: `[${disabledPoolIdsString}]` }),
|
|
24
|
+
includeHooks: `[${hooks}]`,
|
|
23
25
|
};
|
|
24
26
|
// Convert where clause to string, filtering out undefined values
|
|
25
27
|
const whereString = Object.entries(whereClause)
|
|
@@ -27,7 +29,7 @@ function createQuery(networkId, poolTypes, timestamp) {
|
|
|
27
29
|
.join(', ');
|
|
28
30
|
return `
|
|
29
31
|
query MyQuery {
|
|
30
|
-
|
|
32
|
+
aggregatorPools(
|
|
31
33
|
where: {${whereString}}
|
|
32
34
|
) {
|
|
33
35
|
id
|
|
@@ -35,7 +37,7 @@ function createQuery(networkId, poolTypes, timestamp) {
|
|
|
35
37
|
poolTokens {
|
|
36
38
|
address
|
|
37
39
|
weight
|
|
38
|
-
|
|
40
|
+
canUseBufferForSwaps
|
|
39
41
|
underlyingToken {
|
|
40
42
|
address
|
|
41
43
|
}
|
|
@@ -43,6 +45,20 @@ function createQuery(networkId, poolTypes, timestamp) {
|
|
|
43
45
|
hook {
|
|
44
46
|
address
|
|
45
47
|
}
|
|
48
|
+
alpha
|
|
49
|
+
beta
|
|
50
|
+
c
|
|
51
|
+
s
|
|
52
|
+
lambda
|
|
53
|
+
tauAlphaX
|
|
54
|
+
tauAlphaY
|
|
55
|
+
tauBetaX
|
|
56
|
+
tauBetaY
|
|
57
|
+
u
|
|
58
|
+
v
|
|
59
|
+
w
|
|
60
|
+
z
|
|
61
|
+
dSq
|
|
46
62
|
}
|
|
47
63
|
}
|
|
48
64
|
`;
|
|
@@ -56,23 +72,45 @@ function toImmutablePoolStateMap(pools, hooksConfigMap) {
|
|
|
56
72
|
const immutablePoolState = {
|
|
57
73
|
poolAddress: pool.id,
|
|
58
74
|
tokens: pool.poolTokens.map(t => t.address),
|
|
59
|
-
tokensUnderlying: pool.poolTokens.map(t => t.underlyingToken
|
|
60
|
-
|
|
75
|
+
tokensUnderlying: pool.poolTokens.map(t => t.underlyingToken && t.canUseBufferForSwaps
|
|
76
|
+
? t.underlyingToken.address
|
|
77
|
+
: null),
|
|
78
|
+
weights: pool.poolTokens.map(t => scaleOrDefault(t.weight, 18, 0n)),
|
|
61
79
|
poolType: pool.type,
|
|
62
80
|
hookAddress: pool.hook ? pool.hook.address.toLowerCase() : undefined,
|
|
63
81
|
hookType: pool.hook
|
|
64
82
|
? hooksConfigMap[pool.hook.address.toLowerCase()].type
|
|
65
83
|
: undefined,
|
|
66
84
|
supportsUnbalancedLiquidity: true, // can default to true as only required for add/remove maths which we don't use
|
|
85
|
+
// GyroECLP
|
|
86
|
+
// Parameters to configure the E-CLP pool, with 18 decimals
|
|
87
|
+
paramsAlpha: scaleOrDefault(pool.alpha, 18, 0n),
|
|
88
|
+
paramsBeta: scaleOrDefault(pool.beta, 18, 0n),
|
|
89
|
+
paramsC: scaleOrDefault(pool.c, 18, 0n),
|
|
90
|
+
paramsS: scaleOrDefault(pool.s, 18, 0n),
|
|
91
|
+
paramsLambda: scaleOrDefault(pool.lambda, 18, 0n),
|
|
92
|
+
// Parameters calculated off-chain based on eclpParams. 38 decimals for higher precision
|
|
93
|
+
tauAlphaX: scaleOrDefault(pool.tauAlphaX, 38, 0n),
|
|
94
|
+
tauAlphaY: scaleOrDefault(pool.tauAlphaY, 38, 0n),
|
|
95
|
+
tauBetaX: scaleOrDefault(pool.tauBetaX, 38, 0n),
|
|
96
|
+
tauBetaY: scaleOrDefault(pool.tauBetaY, 38, 0n),
|
|
97
|
+
u: scaleOrDefault(pool.u, 38, 0n),
|
|
98
|
+
v: scaleOrDefault(pool.v, 38, 0n),
|
|
99
|
+
w: scaleOrDefault(pool.w, 38, 0n),
|
|
100
|
+
z: scaleOrDefault(pool.z, 38, 0n),
|
|
101
|
+
dSq: scaleOrDefault(pool.dSq, 38, 0n),
|
|
67
102
|
};
|
|
68
103
|
map[pool.id] = immutablePoolState;
|
|
69
104
|
return map;
|
|
70
105
|
}, {}));
|
|
71
106
|
}
|
|
107
|
+
function scaleOrDefault(original, decimals, defaultValue) {
|
|
108
|
+
return original ? (0, utils_1.parseUnits)(original, decimals).toBigInt() : defaultValue;
|
|
109
|
+
}
|
|
72
110
|
// Any data from API will be immutable. Mutable data such as balances, etc will be fetched via onchain/event state.
|
|
73
111
|
async function getPoolsApi(network, hooksConfigMap, timestamp) {
|
|
74
112
|
try {
|
|
75
|
-
const query = createQuery(network, Object.values(config_1.SUPPORTED_POOLS), timestamp);
|
|
113
|
+
const query = createQuery(network, Object.values(config_1.SUPPORTED_POOLS), (0, utils_2.getUniqueHookNames)(hooksConfigMap), timestamp);
|
|
76
114
|
const response = await axios_1.default.post(config_1.apiUrl, {
|
|
77
115
|
query,
|
|
78
116
|
}, {
|
|
@@ -80,7 +118,7 @@ async function getPoolsApi(network, hooksConfigMap, timestamp) {
|
|
|
80
118
|
'Content-Type': 'application/json',
|
|
81
119
|
},
|
|
82
120
|
});
|
|
83
|
-
const pools = response.data.data.
|
|
121
|
+
const pools = response.data.data.aggregatorPools;
|
|
84
122
|
return toImmutablePoolStateMap(pools, hooksConfigMap);
|
|
85
123
|
}
|
|
86
124
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getPoolsApi.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"get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C,EAAE,EAA2B,CAAC,CAClC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,QAAuB,EACvB,QAAgB,EAChB,YAAoB;IAEpB,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;AAC7E,CAAC;AAED,mHAAmH;AAC5G,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,cAA8B,EAC9B,SAAkB;IAElB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,WAAW,CACvB,OAAO,EACP,MAAM,CAAC,MAAM,CAAC,wBAAe,CAAC,EAC9B,IAAA,0BAAkB,EAAC,cAAc,CAAC,EAClC,SAAS,CACV,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,eAAM,EACN;YACE,KAAK;SACN,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;QACjD,OAAO,uBAAuB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0DAA0D;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -2,10 +2,11 @@ import { HooksConfigMap } from './hooks/balancer-hook-event-subscriber';
|
|
|
2
2
|
interface PoolToken {
|
|
3
3
|
address: string;
|
|
4
4
|
decimals: number;
|
|
5
|
-
|
|
5
|
+
canUseBufferForSwaps: boolean | null;
|
|
6
|
+
underlyingToken: {
|
|
6
7
|
address: string;
|
|
7
8
|
decimals: number;
|
|
8
|
-
};
|
|
9
|
+
} | null;
|
|
9
10
|
}
|
|
10
11
|
export interface Pool {
|
|
11
12
|
address: string;
|
|
@@ -17,5 +18,5 @@ export interface Pool {
|
|
|
17
18
|
address: string;
|
|
18
19
|
} | null;
|
|
19
20
|
}
|
|
20
|
-
export declare function getTopPoolsApi(networkId: number, poolsFilter: string[], count: number,
|
|
21
|
+
export declare function getTopPoolsApi(networkId: number, poolsFilter: string[], count: number, hooksConfigMap: HooksConfigMap): Promise<Pool[]>;
|
|
21
22
|
export {};
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getTopPoolsApi = getTopPoolsApi;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const config_1 = require("./config");
|
|
9
|
-
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
|
+
function createQuery(networkId, poolsFilter, hooks, count) {
|
|
10
11
|
const disabledPoolIdsString = config_1.disabledPoolIds.BalancerV3[networkId]
|
|
11
12
|
?.map(p => `"${p}"`)
|
|
12
13
|
.join(', ');
|
|
@@ -18,6 +19,7 @@ function createQuery(networkId, poolsFilter, count) {
|
|
|
18
19
|
protocolVersionIn: 3,
|
|
19
20
|
idIn: `[${poolIdString}]`,
|
|
20
21
|
...(disabledPoolIdsString && { idNotIn: `[${disabledPoolIdsString}]` }),
|
|
22
|
+
includeHooks: `[${hooks}]`,
|
|
21
23
|
};
|
|
22
24
|
// Convert where clause to string, filtering out undefined values
|
|
23
25
|
const whereString = Object.entries(whereClause)
|
|
@@ -25,7 +27,7 @@ function createQuery(networkId, poolsFilter, count) {
|
|
|
25
27
|
.join(', ');
|
|
26
28
|
return `
|
|
27
29
|
query MyQuery {
|
|
28
|
-
|
|
30
|
+
aggregatorPools(
|
|
29
31
|
where: {${whereString}}
|
|
30
32
|
first: ${count}
|
|
31
33
|
orderBy: totalLiquidity
|
|
@@ -35,6 +37,7 @@ function createQuery(networkId, poolsFilter, count) {
|
|
|
35
37
|
poolTokens {
|
|
36
38
|
address
|
|
37
39
|
decimals
|
|
40
|
+
canUseBufferForSwaps
|
|
38
41
|
underlyingToken {
|
|
39
42
|
address
|
|
40
43
|
decimals
|
|
@@ -50,9 +53,9 @@ function createQuery(networkId, poolsFilter, count) {
|
|
|
50
53
|
}
|
|
51
54
|
`;
|
|
52
55
|
}
|
|
53
|
-
async function getTopPoolsApi(networkId, poolsFilter, count,
|
|
56
|
+
async function getTopPoolsApi(networkId, poolsFilter, count, hooksConfigMap) {
|
|
54
57
|
try {
|
|
55
|
-
const query = createQuery(networkId, poolsFilter, count);
|
|
58
|
+
const query = createQuery(networkId, poolsFilter, (0, utils_1.getUniqueHookNames)(hooksConfigMap), count);
|
|
56
59
|
const response = await axios_1.default.post(config_1.apiUrl, {
|
|
57
60
|
query,
|
|
58
61
|
}, {
|
|
@@ -60,8 +63,16 @@ async function getTopPoolsApi(networkId, poolsFilter, count, hooksTypeMap) {
|
|
|
60
63
|
'Content-Type': 'application/json',
|
|
61
64
|
},
|
|
62
65
|
});
|
|
63
|
-
const pools = response.data.data.
|
|
64
|
-
(pool
|
|
66
|
+
const pools = response.data.data.aggregatorPools
|
|
67
|
+
.filter(pool => !pool.hook ||
|
|
68
|
+
(pool.hook && pool.hook.address.toLowerCase() in hooksConfigMap))
|
|
69
|
+
.map(pool => ({
|
|
70
|
+
...pool,
|
|
71
|
+
poolTokens: pool.poolTokens.map(t => ({
|
|
72
|
+
...t,
|
|
73
|
+
underlyingToken: t.canUseBufferForSwaps ? t.underlyingToken : null,
|
|
74
|
+
})),
|
|
75
|
+
}));
|
|
65
76
|
return pools;
|
|
66
77
|
}
|
|
67
78
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTopPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getTopPoolsApi.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"getTopPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getTopPoolsApi.ts"],"names":[],"mappings":";;;;;AAsFA,wCA2CC;AAjID,kDAA0B;AAC1B,qCAAqE;AAErE,mCAA6C;AA6B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MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,eAAM,EACN;YACE,KAAK;SACN,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe;aAC7C,MAAM,CACL,IAAI,CAAC,EAAE,CACL,CAAC,IAAI,CAAC,IAAI;YACV,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,cAAc,CAAC,CACnE;aACA,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACZ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACpC,GAAG,CAAC;gBACJ,eAAe,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;aACnE,CAAC,CAAC;SACJ,CAAC,CAAC,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0DAA0D;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GyroECLPImmutable } from '@balancer-labs/balancer-maths';
|
|
2
|
+
export declare const GYROECLP_GAS_COST = 214120;
|
|
3
|
+
export type GyroECLPImmutableString = {
|
|
4
|
+
[K in keyof Omit<GyroECLPImmutable, 'paramsAlpha' | 'paramsBeta' | 'paramsC' | 'paramsS' | 'paramsLambda'>]: string;
|
|
5
|
+
} & {
|
|
6
|
+
alpha: string;
|
|
7
|
+
beta: string;
|
|
8
|
+
c: string;
|
|
9
|
+
s: string;
|
|
10
|
+
lambda: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GYROECLP_GAS_COST = void 0;
|
|
4
|
+
// https://sepolia.etherscan.io/tx/0x222800381cfc60b6af18c0f533149b6a3b4cda6c05aafb92cfbac42eb281bf76
|
|
5
|
+
exports.GYROECLP_GAS_COST = 214120;
|
|
6
|
+
//# sourceMappingURL=gyroECLPPool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gyroECLPPool.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/gyroECLPPool.ts"],"names":[],"mappings":";;;AAEA,qGAAqG;AACxF,QAAA,iBAAiB,GAAG,MAAM,CAAC"}
|
|
@@ -3,9 +3,11 @@ import { DeepReadonly } from 'ts-essentials';
|
|
|
3
3
|
import { HookStateMap } from './balancer-hook-event-subscriber';
|
|
4
4
|
export declare const DirectionalFee: {
|
|
5
5
|
type: "DirectionalFee";
|
|
6
|
+
apiName: "DIRECTIONAL_FEE";
|
|
6
7
|
};
|
|
7
8
|
export type DirectionalFeeConfig = {
|
|
8
9
|
type: typeof DirectionalFee.type;
|
|
10
|
+
apiName: typeof DirectionalFee.apiName;
|
|
9
11
|
address: string;
|
|
10
12
|
};
|
|
11
13
|
export type DirectionalFeeHookState = {
|
|
@@ -12,6 +12,7 @@ exports.exitFeeHookExampleRegisteredEvent = exitFeeHookExampleRegisteredEvent;
|
|
|
12
12
|
const lodash_1 = __importDefault(require("lodash"));
|
|
13
13
|
exports.DirectionalFee = {
|
|
14
14
|
type: 'DirectionalFee',
|
|
15
|
+
apiName: 'DIRECTIONAL_FEE',
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* Retrieve any initial hook state required.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directionalFeeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/directionalFeeHook.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"directionalFeeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/directionalFeeHook.ts"],"names":[],"mappings":";;;;;;AA2BA,gEAGC;AASD,8EAaC;AApDD;;GAEG;AACH,oDAAuB;AAKV,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAyB;IAC/B,OAAO,EAAE,iBAA0B;CACpC,CAAC;AAYF;;;GAGG;AACI,KAAK,UAAU,0BAA0B;IAC9C,4FAA4F;IAC5F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iCAAiC,CAC/C,KAAU,EACV,KAAiC,EACjC,GAAkB;IAElB,+IAA+I;IAC/I,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;IAC3D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAiB,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -6,9 +6,11 @@ import { IDexHelper } from '../../../dex-helper';
|
|
|
6
6
|
import { Logger } from 'log4js';
|
|
7
7
|
export declare const StableSurge: {
|
|
8
8
|
type: "StableSurge";
|
|
9
|
+
apiName: "STABLE_SURGE";
|
|
9
10
|
};
|
|
10
11
|
export type StableSurgeConfig = {
|
|
11
12
|
type: typeof StableSurge.type;
|
|
13
|
+
apiName: typeof StableSurge.apiName;
|
|
12
14
|
factory: string;
|
|
13
15
|
address: string;
|
|
14
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stableSurgeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/stableSurgeHook.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"stableSurgeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/stableSurgeHook.ts"],"names":[],"mappings":";;;;;;AAiCA,0DAgDC;AA6CD,oFAkCC;AASD,8EA8BC;AAvMD,oDAAuB;AAKvB,mCAAkC;AAElC,wDAAgE;AAGnD,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,aAAsB;IAC5B,OAAO,EAAE,cAAuB;CACjC,CAAC;AAgBF;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAC3C,aAAwB,EACxB,WAAmB,EACnB,cAAsB,EACtB,SAAqB,EACrB,WAAmB;IAEnB,2BAA2B;IAC3B,MAAM,gBAAgB,GAAG,IAAI,iBAAQ,CACnC,cAAc,EACd,CAAC,uDAAuD,CAAC,EACzD,SAAS,CAAC,QAAQ,CACnB,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,MAAM,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC;QACxD,QAAQ,EAAE,WAAW;KACtB,CAAC,CAAa,CAAC;IAChB,MAAM,sBAAsB,GAAe,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9D,OAAO;YACL;gBACE,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CACxC,6BAA6B,EAC7B,CAAC,IAAI,CAAC,CACP;aACF;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,0BAA0B,EAAE;oBACrE,IAAI;iBACL,CAAC;aACH;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,MAAM,mBAAmB,GAAG,gBAAC,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;IAEjE,MAAM,mBAAmB,GAAG,CAC1B,MAAM,OAAO,CAAC,GAAG,CACf,mBAAmB,CAAC,GAAG,C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IACE,QAAQ,CAAC,WAAW,CAAC;QACrB,CAAE,QAAQ,CAAC,WAAW,CAA0B,CAC9C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAY,CACxC,EACD,CAAC;QACA,QAAQ,CAAC,WAAW,CAA0B,CAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAC9B,GAAG;YACF,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC;SACnE,CAAC;IACJ,CAAC;SAAM,CAAC;QACL,QAAQ,CAAC,WAAW,CAA0B,CAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAC9B,CAAC,qBAAqB,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferState } from '@balancer-labs/balancer-maths';
|
|
1
|
+
import { BufferState, GyroECLPImmutable } from '@balancer-labs/balancer-maths';
|
|
2
2
|
import { Address } from '../../types';
|
|
3
3
|
import { HookConfig } from './hooks/balancer-hook-event-subscriber';
|
|
4
4
|
export type CommonImmutablePoolState = {
|
|
@@ -10,10 +10,12 @@ export type CommonImmutablePoolState = {
|
|
|
10
10
|
hookAddress: string | undefined;
|
|
11
11
|
hookType: string | undefined;
|
|
12
12
|
supportsUnbalancedLiquidity: boolean;
|
|
13
|
-
};
|
|
13
|
+
} & GyroECLPImmutable;
|
|
14
14
|
export interface CommonMutableState {
|
|
15
15
|
tokenRates: bigint[];
|
|
16
16
|
erc4626Rates: (bigint | null)[];
|
|
17
|
+
erc4626MaxDeposit: (bigint | null)[];
|
|
18
|
+
erc4626MaxMint: (bigint | null)[];
|
|
17
19
|
balancesLiveScaled18: bigint[];
|
|
18
20
|
swapFee: bigint;
|
|
19
21
|
aggregateSwapFee: bigint;
|
|
@@ -62,5 +64,7 @@ export type TokenInfo = {
|
|
|
62
64
|
mainToken: string;
|
|
63
65
|
index: number;
|
|
64
66
|
rate: bigint;
|
|
67
|
+
maxDeposit: bigint;
|
|
68
|
+
maxMint: bigint;
|
|
65
69
|
};
|
|
66
70
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUniqueHookNames = getUniqueHookNames;
|
|
4
|
+
function getUniqueHookNames(hooksConfigMap) {
|
|
5
|
+
// Use Object.values to get all HookConfig objects
|
|
6
|
+
// Then map to extract just the names
|
|
7
|
+
// Use Set to get unique names
|
|
8
|
+
// Convert back to array and join with comma
|
|
9
|
+
return Array.from(new Set(Object.values(hooksConfigMap).map(hook => hook.apiName))).join(', ');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/utils.ts"],"names":[],"mappings":";;AAEA,gDAQC;AARD,SAAgB,kBAAkB,CAAC,cAA8B;IAC/D,kDAAkD;IAClD,qCAAqC;IACrC,8BAA8B;IAC9B,4CAA4C;IAC5C,OAAO,KAAK,CAAC,IAAI,CACf,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Logger } from 'log4js';
|
|
2
|
+
import { RequestConfig, Response } from '../../dex-helper/irequest-wrapper';
|
|
3
|
+
export declare class SkippingRequest {
|
|
4
|
+
message: string;
|
|
5
|
+
constructor(message?: string);
|
|
6
|
+
}
|
|
7
|
+
export declare type RequestInfo<T> = {
|
|
8
|
+
requestFunc?: (options: RequestConfig) => Promise<Response<T> | SkippingRequest>;
|
|
9
|
+
requestOptions: RequestConfig;
|
|
10
|
+
caster: (data: unknown) => T;
|
|
11
|
+
authenticate?: (options: RequestConfig) => RequestConfig;
|
|
12
|
+
excludedFieldsCaching?: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare type RequestInfoWithHandler<T> = {
|
|
15
|
+
info: RequestInfo<T>;
|
|
16
|
+
handler: (data: T) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare class WebSocketFetcher<T> {
|
|
19
|
+
private logger;
|
|
20
|
+
private requests;
|
|
21
|
+
lastFetchSucceeded: boolean;
|
|
22
|
+
private stop;
|
|
23
|
+
private ws;
|
|
24
|
+
private connection;
|
|
25
|
+
constructor(requestsInfo: RequestInfoWithHandler<T>, logger: Logger);
|
|
26
|
+
private connected;
|
|
27
|
+
private connectFailed;
|
|
28
|
+
private onClose;
|
|
29
|
+
private onError;
|
|
30
|
+
private onMessage;
|
|
31
|
+
private connect;
|
|
32
|
+
startPolling(): void;
|
|
33
|
+
stopPolling(): void;
|
|
34
|
+
isPolling(): boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebSocketFetcher = exports.SkippingRequest = void 0;
|
|
4
|
+
const websocket_1 = require("websocket");
|
|
5
|
+
class SkippingRequest {
|
|
6
|
+
constructor(message = '') {
|
|
7
|
+
this.message = message;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.SkippingRequest = SkippingRequest;
|
|
11
|
+
class WebSocketFetcher {
|
|
12
|
+
constructor(requestsInfo, logger) {
|
|
13
|
+
this.logger = logger;
|
|
14
|
+
this.lastFetchSucceeded = false;
|
|
15
|
+
this.stop = true;
|
|
16
|
+
this.ws = new websocket_1.client();
|
|
17
|
+
this.connection = null;
|
|
18
|
+
this.requests = requestsInfo;
|
|
19
|
+
this.ws.on('connect', this.connected.bind(this));
|
|
20
|
+
this.ws.on('connectFailed', this.connectFailed.bind(this));
|
|
21
|
+
}
|
|
22
|
+
connected(connection) {
|
|
23
|
+
this.connection = connection;
|
|
24
|
+
this.logger.info(`Connected to ${this.requests.info.requestOptions.url}`);
|
|
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
|
+
}
|
|
29
|
+
connectFailed(error) {
|
|
30
|
+
this.logger.error(`Connect Error: ${error.toString()}`);
|
|
31
|
+
}
|
|
32
|
+
onClose() {
|
|
33
|
+
this.logger.info(`Connection closed`);
|
|
34
|
+
}
|
|
35
|
+
onError(error) {
|
|
36
|
+
this.logger.error(`Connection Error: ${error.toString()}`);
|
|
37
|
+
}
|
|
38
|
+
onMessage(message) {
|
|
39
|
+
if (message.type === 'utf8') {
|
|
40
|
+
const response = JSON.parse(message.utf8Data);
|
|
41
|
+
const reqInfo = this.requests;
|
|
42
|
+
const info = reqInfo.info;
|
|
43
|
+
const options = reqInfo.info.requestOptions;
|
|
44
|
+
this.logger.debug(`(${options.url}) received new data`);
|
|
45
|
+
try {
|
|
46
|
+
const parsedData = info.caster(response);
|
|
47
|
+
reqInfo.handler(parsedData);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
this.logger.info(e);
|
|
51
|
+
this.logger.info(`(${options.url}) received incorrect data ${JSON.stringify(response).replace(/(?:\r\n|\r|\n)/g, ' ')}`, e);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
connect() {
|
|
57
|
+
const authorization = this.requests.info.requestOptions.headers.authorization;
|
|
58
|
+
const name = this.requests.info.requestOptions.headers.name;
|
|
59
|
+
if (typeof authorization !== 'string') {
|
|
60
|
+
throw new Error('Authorization header is not a string');
|
|
61
|
+
}
|
|
62
|
+
if (typeof name !== 'string') {
|
|
63
|
+
throw new Error('Name header is not a string');
|
|
64
|
+
}
|
|
65
|
+
this.ws.connect(this.requests.info.requestOptions.url, undefined, undefined, {
|
|
66
|
+
Authorization: authorization,
|
|
67
|
+
name: name,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
startPolling() {
|
|
71
|
+
this.stop = false;
|
|
72
|
+
this.connect();
|
|
73
|
+
this.logger.info(`Connection started for ${this.requests.info.requestOptions.url}`);
|
|
74
|
+
}
|
|
75
|
+
stopPolling() {
|
|
76
|
+
if (this.connection) {
|
|
77
|
+
this.connection.close();
|
|
78
|
+
}
|
|
79
|
+
this.stop = true;
|
|
80
|
+
this.logger.info(`Connection stopped for ${this.requests.info.requestOptions.url}`);
|
|
81
|
+
}
|
|
82
|
+
isPolling() {
|
|
83
|
+
return !this.stop;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.WebSocketFetcher = WebSocketFetcher;
|
|
87
|
+
//# sourceMappingURL=websocket-fetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket-fetcher.js","sourceRoot":"","sources":["../../../src/dex/bebop/websocket-fetcher.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,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ACX,CACF,CAAC;IACJ,CAAC;IAED,YAAY;QACV,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,0BAA0B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,0BAA0B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC;CACF;AAnGD,4CAmGC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { Contract } from 'web3-eth-contract';
|
|
3
|
+
import { Interface } from '@ethersproject/abi';
|
|
4
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
5
|
+
import { Log, Logger } from '../../types';
|
|
6
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
7
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
8
|
+
import { PoolState, IdleToken } from './types';
|
|
9
|
+
import { IdleDao } from './idle-dao';
|
|
10
|
+
declare type BlocksTransfers = Record<number, {
|
|
11
|
+
underlyingAmount: BigNumber;
|
|
12
|
+
idleAmount: BigNumber;
|
|
13
|
+
processed: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare class IdleDaoEventPool extends StatefulEventSubscriber<PoolState> {
|
|
16
|
+
readonly parentName: string;
|
|
17
|
+
protected network: number;
|
|
18
|
+
protected dexHelper: IDexHelper;
|
|
19
|
+
protected logger: Logger;
|
|
20
|
+
protected idleToken: IdleToken;
|
|
21
|
+
protected IdleDao: IdleDao;
|
|
22
|
+
handlers: {
|
|
23
|
+
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => Promise<DeepReadonly<PoolState> | null>;
|
|
24
|
+
};
|
|
25
|
+
logDecoder: (log: Log) => any;
|
|
26
|
+
cdoContract: Contract;
|
|
27
|
+
poolInterface: Interface;
|
|
28
|
+
addressesSubscribed: string[];
|
|
29
|
+
blocksTransfers: BlocksTransfers;
|
|
30
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, idleToken: IdleToken, IdleDao: IdleDao);
|
|
31
|
+
/**
|
|
32
|
+
* The function is called every time any of the subscribed
|
|
33
|
+
* addresses release log. The function accepts the current
|
|
34
|
+
* state, updates the state according to the log, and returns
|
|
35
|
+
* the updated state.
|
|
36
|
+
* @param state - Current state of event subscriber
|
|
37
|
+
* @param log - Log released by one of the subscribed addresses
|
|
38
|
+
* @returns Updates state of the event subscriber after the log
|
|
39
|
+
*/
|
|
40
|
+
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
|
|
41
|
+
/**
|
|
42
|
+
* The function generates state using on-chain calls. This
|
|
43
|
+
* function is called to regenerate state if the event based
|
|
44
|
+
* system fails to fetch events and the local state is no
|
|
45
|
+
* more correct.
|
|
46
|
+
* @param blockNumber - Blocknumber for which the state should
|
|
47
|
+
* should be generated
|
|
48
|
+
* @returns state of the event subscriber at blocknumber
|
|
49
|
+
*/
|
|
50
|
+
generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
|
|
51
|
+
setBlockState(blockNumber: number, state: PoolState): void;
|
|
52
|
+
handleCoinTransfer(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
|
|
53
|
+
processBlockTransfer(blockNumber: number, state: PoolState): PoolState;
|
|
54
|
+
handleCoinTransfer_old(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|