@paraswap/dex-lib 4.1.4-bal-v3-hooks.0 → 4.1.4
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/Aave_GSM.json +751 -0
- package/build/abi/Balancer.json +257 -0
- package/build/abi/{balancer-v3/stableSurgeHook.json → BalancerV2.json} +732 -529
- package/build/abi/{integral/relayer.json → RamsesV2Pool.abi.json} +850 -832
- 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/{integral/oracle.json → angle-transmuter/ChainlinkEACAggregatorProxy.json} +247 -239
- 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/{integral/pool.json → curve-v1/StableSwapUSDN.json} +450 -487
- package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
- package/build/abi/curve-v1/StableSwapY.json +814 -0
- package/build/abi/fluid-dex/resolver.abi.json +30 -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/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 +2 -1
- package/build/dex/aave-v1/aave-v1.js +22 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/balancer-v1/balancer-pools.json +33333 -0
- package/build/dex/balancer-v3/balancer-v3-pool.d.ts +1 -4
- package/build/dex/balancer-v3/balancer-v3-pool.js +13 -20
- package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
- package/build/dex/balancer-v3/balancer-v3.d.ts +0 -4
- package/build/dex/balancer-v3/balancer-v3.js +3 -29
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
- package/build/dex/balancer-v3/config.js +0 -39
- package/build/dex/balancer-v3/config.js.map +1 -1
- package/build/dex/balancer-v3/getOnChainState.d.ts +2 -1
- package/build/dex/balancer-v3/getOnChainState.js +2 -0
- package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
- package/build/dex/balancer-v3/getPoolsApi.d.ts +1 -2
- package/build/dex/balancer-v3/getPoolsApi.js +10 -17
- package/build/dex/balancer-v3/getPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/getTopPoolsApi.d.ts +1 -5
- package/build/dex/balancer-v3/getTopPoolsApi.js +3 -6
- package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/types.d.ts +1 -4
- 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/fluid-dex/config.js +2 -2
- package/build/dex/fluid-dex/constants.d.ts +1 -1
- package/build/dex/fluid-dex/constants.js +2 -1
- package/build/dex/fluid-dex/constants.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js +3 -1
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex.d.ts +4 -5
- package/build/dex/fluid-dex/fluid-dex.js +61 -59
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
- package/build/dex/fluid-dex/types.d.ts +3 -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/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
- 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/jarvis.d.ts +2 -1
- package/build/dex/jarvis.js +58 -0
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +31 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +10 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/zerox/index.d.ts +4 -26
- package/build/dex/zerox/index.js +50 -42
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +29 -0
- package/build/dex/zerox/types.js +8 -1
- package/build/dex/zerox/types.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/scripts/run-dex-integration-v3.ts +4 -4
- package/src/abi/fluid-dex/resolver.abi.json +30 -0
- package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +0 -20
- package/src/dex/balancer-v3/balancer-v3-integration.test.ts +197 -2
- package/src/dex/balancer-v3/balancer-v3-pool.ts +13 -37
- package/src/dex/balancer-v3/balancer-v3.ts +1 -42
- package/src/dex/balancer-v3/config.ts +0 -39
- package/src/dex/balancer-v3/getOnChainState.ts +4 -1
- package/src/dex/balancer-v3/getPoolsApi.ts +23 -42
- package/src/dex/balancer-v3/getTopPoolsApi.ts +2 -13
- package/src/dex/balancer-v3/types.ts +2 -4
- package/src/dex/fluid-dex/config.ts +2 -2
- package/src/dex/fluid-dex/constants.ts +2 -1
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +61 -117
- package/src/dex/fluid-dex/fluid-dex-liquidity-proxy.ts +3 -0
- package/src/dex/fluid-dex/fluid-dex.ts +96 -94
- package/src/dex/fluid-dex/types.ts +3 -0
- package/tests/constants-e2e.ts +2 -7
- package/tests/tenderly-simulation.ts +1 -0
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/build/abi/balancer-v3/directionalFeeHook.json +0 -684
- package/build/abi/integral/factory.json +0 -333
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/balancer-v3/balancer-test-helpers.d.ts +0 -5
- package/build/dex/balancer-v3/balancer-test-helpers.js +0 -122
- package/build/dex/balancer-v3/balancer-test-helpers.js.map +0 -1
- package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.d.ts +0 -54
- package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.js +0 -153
- package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.js.map +0 -1
- package/build/dex/balancer-v3/hooks/directionalFeeHook.d.ts +0 -26
- package/build/dex/balancer-v3/hooks/directionalFeeHook.js +0 -41
- package/build/dex/balancer-v3/hooks/directionalFeeHook.js.map +0 -1
- package/build/dex/balancer-v3/hooks/loadHooksConfig.d.ts +0 -2
- package/build/dex/balancer-v3/hooks/loadHooksConfig.js +0 -11
- package/build/dex/balancer-v3/hooks/loadHooksConfig.js.map +0 -1
- package/build/dex/balancer-v3/hooks/stableSurgeHook.d.ts +0 -39
- package/build/dex/balancer-v3/hooks/stableSurgeHook.js +0 -99
- package/build/dex/balancer-v3/hooks/stableSurgeHook.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
- package/build/dex/integral/config.d.ts +0 -4
- package/build/dex/integral/config.js +0 -20
- package/build/dex/integral/config.js.map +0 -1
- package/build/dex/integral/context.d.ts +0 -40
- package/build/dex/integral/context.js +0 -158
- package/build/dex/integral/context.js.map +0 -1
- package/build/dex/integral/integral-factory.d.ts +0 -24
- package/build/dex/integral/integral-factory.js +0 -95
- package/build/dex/integral/integral-factory.js.map +0 -1
- package/build/dex/integral/integral-pool.d.ts +0 -50
- package/build/dex/integral/integral-pool.js +0 -149
- package/build/dex/integral/integral-pool.js.map +0 -1
- package/build/dex/integral/integral-pricing.d.ts +0 -18
- package/build/dex/integral/integral-pricing.js +0 -114
- package/build/dex/integral/integral-pricing.js.map +0 -1
- package/build/dex/integral/integral-relayer.d.ts +0 -42
- package/build/dex/integral/integral-relayer.js +0 -192
- package/build/dex/integral/integral-relayer.js.map +0 -1
- package/build/dex/integral/integral-token.d.ts +0 -27
- package/build/dex/integral/integral-token.js +0 -59
- package/build/dex/integral/integral-token.js.map +0 -1
- package/build/dex/integral/integral.js +0 -376
- package/build/dex/integral/integral.js.map +0 -1
- package/build/dex/integral/types.d.ts +0 -85
- package/build/dex/integral/types.js +0 -9
- package/build/dex/integral/types.js.map +0 -1
- package/build/dex/integral/utils-e2e.d.ts +0 -9
- package/build/dex/integral/utils-e2e.js +0 -131
- package/build/dex/integral/utils-e2e.js.map +0 -1
- package/build/dex/integral/utils.d.ts +0 -17
- package/build/dex/integral/utils.js +0 -94
- package/build/dex/integral/utils.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -62
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
- package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
- package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
- package/build/dex/trader-joe-v2.1.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
- package/src/abi/balancer-v3/directionalFeeHook.json +0 -684
- package/src/abi/balancer-v3/stableSurgeHook.json +0 -976
- package/src/dex/balancer-v3/balancer-hooks-events.test.ts +0 -99
- package/src/dex/balancer-v3/balancer-stableSurge.test.ts +0 -110
- package/src/dex/balancer-v3/balancer-test-helpers.ts +0 -199
- package/src/dex/balancer-v3/hooks/balancer-hook-event-subscriber.ts +0 -226
- package/src/dex/balancer-v3/hooks/directionalFeeHook.ts +0 -51
- package/src/dex/balancer-v3/hooks/loadHooksConfig.ts +0 -12
- package/src/dex/balancer-v3/hooks/stableSurgeHook.ts +0 -163
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from './config';
|
|
8
8
|
import { CommonImmutablePoolState, ImmutablePoolStateMap } from './types';
|
|
9
9
|
import { parseUnits } from 'ethers/lib/utils';
|
|
10
|
-
import { HooksConfigMap } from './hooks/balancer-hook-event-subscriber';
|
|
11
10
|
|
|
12
11
|
interface PoolToken {
|
|
13
12
|
address: string;
|
|
@@ -22,9 +21,6 @@ interface Pool {
|
|
|
22
21
|
id: string;
|
|
23
22
|
type: string;
|
|
24
23
|
poolTokens: PoolToken[];
|
|
25
|
-
hook: {
|
|
26
|
-
address: string;
|
|
27
|
-
} | null;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
interface QueryResponse {
|
|
@@ -48,6 +44,7 @@ function createQuery(
|
|
|
48
44
|
const whereClause = {
|
|
49
45
|
chainIn: networkString,
|
|
50
46
|
protocolVersionIn: 3,
|
|
47
|
+
hasHook: false,
|
|
51
48
|
poolTypeIn: `[${poolTypesString}]`,
|
|
52
49
|
...(timestamp && { createTime: `{lt: ${timestamp}}` }),
|
|
53
50
|
...(disabledPoolIdsString && { idNotIn: `[${disabledPoolIdsString}]` }),
|
|
@@ -72,53 +69,37 @@ function createQuery(
|
|
|
72
69
|
address
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
hook {
|
|
76
|
-
address
|
|
77
|
-
}
|
|
78
72
|
}
|
|
79
73
|
}
|
|
80
74
|
`;
|
|
81
75
|
}
|
|
82
76
|
|
|
83
|
-
function toImmutablePoolStateMap(
|
|
84
|
-
pools
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
-
poolType: pool.type,
|
|
106
|
-
hookAddress: pool.hook ? pool.hook.address.toLowerCase() : undefined,
|
|
107
|
-
hookType: pool.hook
|
|
108
|
-
? hooksConfigMap[pool.hook.address.toLowerCase()].type
|
|
109
|
-
: undefined,
|
|
110
|
-
supportsUnbalancedLiquidity: true,
|
|
111
|
-
};
|
|
112
|
-
map[pool.id] = immutablePoolState;
|
|
113
|
-
return map;
|
|
114
|
-
}, {} as ImmutablePoolStateMap)
|
|
115
|
-
);
|
|
77
|
+
function toImmutablePoolStateMap(pools: Pool[]): ImmutablePoolStateMap {
|
|
78
|
+
return pools.reduce((map, pool) => {
|
|
79
|
+
const immutablePoolState: CommonImmutablePoolState = {
|
|
80
|
+
poolAddress: pool.id,
|
|
81
|
+
tokens: pool.poolTokens.map(t => t.address),
|
|
82
|
+
tokensUnderlying: pool.poolTokens.map(t =>
|
|
83
|
+
t.underlyingToken ? t.underlyingToken.address : null,
|
|
84
|
+
),
|
|
85
|
+
weights: pool.poolTokens.map(t =>
|
|
86
|
+
t.weight ? parseUnits(t.weight, 18).toBigInt() : 0n,
|
|
87
|
+
),
|
|
88
|
+
poolType: pool.type,
|
|
89
|
+
// TODO add scalingFactors once API provides them
|
|
90
|
+
// scalingFactors: pool.poolTokens.map(t => parseUnits('1', 18).toBigInt()),
|
|
91
|
+
// TODO Hook support will be added in future PR
|
|
92
|
+
hookType: undefined,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
map[pool.id] = immutablePoolState;
|
|
96
|
+
return map;
|
|
97
|
+
}, {} as ImmutablePoolStateMap);
|
|
116
98
|
}
|
|
117
99
|
|
|
118
100
|
// Any data from API will be immutable. Mutable data such as balances, etc will be fetched via onchain/event state.
|
|
119
101
|
export async function getPoolsApi(
|
|
120
102
|
network: number,
|
|
121
|
-
hooksConfigMap: HooksConfigMap,
|
|
122
103
|
timestamp?: number,
|
|
123
104
|
): Promise<ImmutablePoolStateMap> {
|
|
124
105
|
try {
|
|
@@ -140,7 +121,7 @@ export async function getPoolsApi(
|
|
|
140
121
|
);
|
|
141
122
|
|
|
142
123
|
const pools = response.data.data.poolGetAggregatorPools;
|
|
143
|
-
return toImmutablePoolStateMap(pools
|
|
124
|
+
return toImmutablePoolStateMap(pools);
|
|
144
125
|
} catch (error) {
|
|
145
126
|
// console.error('Error executing GraphQL query:', error);
|
|
146
127
|
throw error;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { apiUrl, BalancerV3Config, disabledPoolIds } from './config';
|
|
3
|
-
import { HooksConfigMap } from './hooks/balancer-hook-event-subscriber';
|
|
4
3
|
|
|
5
4
|
interface PoolToken {
|
|
6
5
|
address: string;
|
|
@@ -17,9 +16,6 @@ export interface Pool {
|
|
|
17
16
|
dynamicData: {
|
|
18
17
|
totalLiquidity: string;
|
|
19
18
|
};
|
|
20
|
-
hook: {
|
|
21
|
-
address: string;
|
|
22
|
-
} | null;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
interface QueryResponse {
|
|
@@ -43,6 +39,7 @@ function createQuery(
|
|
|
43
39
|
const whereClause = {
|
|
44
40
|
chainIn: networkString,
|
|
45
41
|
protocolVersionIn: 3,
|
|
42
|
+
hasHook: false,
|
|
46
43
|
idIn: `[${poolIdString}]`,
|
|
47
44
|
...(disabledPoolIdsString && { idNotIn: `[${disabledPoolIdsString}]` }),
|
|
48
45
|
};
|
|
@@ -71,9 +68,6 @@ function createQuery(
|
|
|
71
68
|
dynamicData {
|
|
72
69
|
totalLiquidity
|
|
73
70
|
}
|
|
74
|
-
hook {
|
|
75
|
-
address
|
|
76
|
-
}
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
`;
|
|
@@ -83,7 +77,6 @@ export async function getTopPoolsApi(
|
|
|
83
77
|
networkId: number,
|
|
84
78
|
poolsFilter: string[],
|
|
85
79
|
count: number,
|
|
86
|
-
hooksTypeMap: HooksConfigMap,
|
|
87
80
|
): Promise<Pool[]> {
|
|
88
81
|
try {
|
|
89
82
|
const query = createQuery(networkId, poolsFilter, count);
|
|
@@ -99,11 +92,7 @@ export async function getTopPoolsApi(
|
|
|
99
92
|
},
|
|
100
93
|
);
|
|
101
94
|
|
|
102
|
-
const pools = response.data.data.poolGetAggregatorPools
|
|
103
|
-
pool =>
|
|
104
|
-
!pool.hook ||
|
|
105
|
-
(pool.hook && pool.hook.address.toLowerCase() in hooksTypeMap),
|
|
106
|
-
);
|
|
95
|
+
const pools = response.data.data.poolGetAggregatorPools;
|
|
107
96
|
return pools;
|
|
108
97
|
} catch (error) {
|
|
109
98
|
// console.error('Error executing GraphQL query:', error);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BufferState } from '@balancer-labs/balancer-maths';
|
|
2
2
|
import { Address } from '../../types';
|
|
3
|
-
import { HookConfig } from './hooks/balancer-hook-event-subscriber';
|
|
4
3
|
|
|
5
4
|
// Immutable data types available on all pools (Available from API)
|
|
6
5
|
export type CommonImmutablePoolState = {
|
|
@@ -13,9 +12,7 @@ export type CommonImmutablePoolState = {
|
|
|
13
12
|
weights: bigint[];
|
|
14
13
|
// TODO re-introduce this once added to API
|
|
15
14
|
// scalingFactors: bigint[];
|
|
16
|
-
hookAddress: string | undefined;
|
|
17
15
|
hookType: string | undefined;
|
|
18
|
-
supportsUnbalancedLiquidity: boolean;
|
|
19
16
|
};
|
|
20
17
|
|
|
21
18
|
// Mutable data types available on all pools (Available via onchain calls/events)
|
|
@@ -29,6 +26,8 @@ export interface CommonMutableState {
|
|
|
29
26
|
isPoolPaused: boolean;
|
|
30
27
|
// TODO remove this once API provides it
|
|
31
28
|
scalingFactors: bigint[];
|
|
29
|
+
// TODO remove this once API provides it
|
|
30
|
+
hasHook: boolean;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
type CommonPoolState = CommonImmutablePoolState & CommonMutableState;
|
|
@@ -77,7 +76,6 @@ export type DexParams = {
|
|
|
77
76
|
// https://github.com/balancer/balancer-v3-monorepo/blob/main/pkg/interfaces/contracts/vault/IRouter.sol
|
|
78
77
|
balancerRouterAddress: string;
|
|
79
78
|
balancerBatchRouterAddress: string;
|
|
80
|
-
hooks?: HookConfig[];
|
|
81
79
|
};
|
|
82
80
|
|
|
83
81
|
export type TokenInfo = {
|
|
@@ -7,14 +7,14 @@ export const FluidDexConfig: DexConfigMap<DexParams> = {
|
|
|
7
7
|
[Network.MAINNET]: {
|
|
8
8
|
commonAddresses: {
|
|
9
9
|
liquidityProxy: '0x52aa899454998be5b000ad077a46bbe360f4e497',
|
|
10
|
-
resolver: '
|
|
10
|
+
resolver: '0xb387f9C2092cF7c4943F97842887eBff7AE96EB3',
|
|
11
11
|
dexFactory: '0x91716C4EDA1Fb55e84Bf8b4c7085f84285c19085',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
[Network.ARBITRUM]: {
|
|
15
15
|
commonAddresses: {
|
|
16
16
|
liquidityProxy: '0x52Aa899454998Be5b000Ad077a46Bbe360F4e497',
|
|
17
|
-
resolver: '
|
|
17
|
+
resolver: '0xCe6F4E40152a1DF97ae95a7e4F60D944871A4060',
|
|
18
18
|
dexFactory: '0x91716C4EDA1Fb55e84Bf8b4c7085f84285c19085',
|
|
19
19
|
},
|
|
20
20
|
},
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// on-chain we use 1e4 but use extra buffer to avoid reverts
|
|
2
|
+
export const MIN_SWAP_LIQUIDITY = 8500n;
|
|
@@ -4,46 +4,13 @@ dotenv.config();
|
|
|
4
4
|
|
|
5
5
|
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
6
6
|
import { testE2E } from '../../../tests/utils-e2e';
|
|
7
|
-
import {
|
|
8
|
-
Tokens,
|
|
9
|
-
Holders,
|
|
10
|
-
NativeTokenSymbols,
|
|
11
|
-
} from '../../../tests/constants-e2e';
|
|
7
|
+
import { Tokens, Holders } from '../../../tests/constants-e2e';
|
|
12
8
|
import { Network, ContractMethod, SwapSide } from '../../constants';
|
|
13
9
|
import { generateConfig } from '../../config';
|
|
14
10
|
import { CollateralReserves, DebtReserves, DexLimits } from './types';
|
|
15
11
|
import { DummyDexHelper } from '../../dex-helper/index';
|
|
16
12
|
import { FluidDex } from './fluid-dex';
|
|
17
13
|
|
|
18
|
-
/*
|
|
19
|
-
README
|
|
20
|
-
======
|
|
21
|
-
|
|
22
|
-
The template already enumerates the basic structure which involves
|
|
23
|
-
testing simpleSwap, multiSwap, megaSwap contract methods for
|
|
24
|
-
ETH <> TOKEN and TOKEN <> TOKEN swaps. You should replace tokenA and
|
|
25
|
-
tokenB with any two highly liquid tokens on FluidDex for the tests
|
|
26
|
-
to work. If the tokens that you would like to use are not defined in
|
|
27
|
-
Tokens or Holders map, you can update the './tests/constants-e2e'
|
|
28
|
-
|
|
29
|
-
Other than the standard cases that are already added by the template
|
|
30
|
-
it is highly recommended to add test cases which could be specific
|
|
31
|
-
to testing FluidDex (Eg. Tests based on poolType, special tokens,
|
|
32
|
-
etc).
|
|
33
|
-
|
|
34
|
-
You can run this individual test script by running:
|
|
35
|
-
`npx jest src/dex/<dex-name>/<dex-name>-e2e.test.ts`
|
|
36
|
-
|
|
37
|
-
e2e tests use the Tenderly fork api. Please add the following to your
|
|
38
|
-
.env file:
|
|
39
|
-
TENDERLY_TOKEN=Find this under Account>Settings>Authorization.
|
|
40
|
-
TENDERLY_ACCOUNT_ID=Your Tenderly account name.
|
|
41
|
-
TENDERLY_PROJECT=Name of a Tenderly project you have created in your
|
|
42
|
-
dashboard.
|
|
43
|
-
|
|
44
|
-
(This comment should be removed from the final implementation)
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
14
|
function testForNetwork(
|
|
48
15
|
network: Network,
|
|
49
16
|
dexKey: string,
|
|
@@ -56,9 +23,14 @@ function testForNetwork(
|
|
|
56
23
|
generateConfig(network).privateHttpProvider,
|
|
57
24
|
network,
|
|
58
25
|
);
|
|
26
|
+
|
|
59
27
|
const tokens = Tokens[network];
|
|
60
28
|
const holders = Holders[network];
|
|
61
29
|
|
|
30
|
+
// Create FluidDex instance to check reserves
|
|
31
|
+
const dexHelper = new DummyDexHelper(network);
|
|
32
|
+
const fluidDex = new FluidDex(network, dexKey, dexHelper);
|
|
33
|
+
|
|
62
34
|
const sideToContractMethods = new Map([
|
|
63
35
|
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
64
36
|
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
@@ -69,11 +41,11 @@ function testForNetwork(
|
|
|
69
41
|
describe(`${side}`, () => {
|
|
70
42
|
contractMethods.forEach((contractMethod: string) => {
|
|
71
43
|
describe(`${contractMethod}`, () => {
|
|
72
|
-
it(`${
|
|
44
|
+
it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
|
|
73
45
|
await testE2E(
|
|
74
|
-
tokens[tokenASymbol],
|
|
75
46
|
tokens[tokenBSymbol],
|
|
76
|
-
|
|
47
|
+
tokens[tokenASymbol],
|
|
48
|
+
holders[tokenBSymbol],
|
|
77
49
|
tokenBAmount,
|
|
78
50
|
side,
|
|
79
51
|
dexKey,
|
|
@@ -82,12 +54,13 @@ function testForNetwork(
|
|
|
82
54
|
provider,
|
|
83
55
|
);
|
|
84
56
|
});
|
|
85
|
-
|
|
57
|
+
|
|
58
|
+
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
86
59
|
await testE2E(
|
|
87
|
-
tokens[tokenBSymbol],
|
|
88
60
|
tokens[tokenASymbol],
|
|
89
|
-
|
|
90
|
-
|
|
61
|
+
tokens[tokenBSymbol],
|
|
62
|
+
holders[tokenASymbol],
|
|
63
|
+
tokenAAmount,
|
|
91
64
|
side,
|
|
92
65
|
dexKey,
|
|
93
66
|
contractMethod as ContractMethod,
|
|
@@ -108,30 +81,11 @@ describe('FluidDex E2E', () => {
|
|
|
108
81
|
describe('Mainnet', () => {
|
|
109
82
|
const network = Network.MAINNET;
|
|
110
83
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// const tokenAAmount: string = '160097047322810379';
|
|
117
|
-
// const tokenBAmount: string = '79923068733005505624';
|
|
118
|
-
//
|
|
119
|
-
// testForNetwork(
|
|
120
|
-
// network,
|
|
121
|
-
// dexKey,
|
|
122
|
-
// tokenASymbol,
|
|
123
|
-
// tokenBSymbol,
|
|
124
|
-
// tokenAAmount,
|
|
125
|
-
// tokenBAmount,
|
|
126
|
-
// );
|
|
127
|
-
// });
|
|
128
|
-
|
|
129
|
-
describe('ETH -> INST', () => {
|
|
130
|
-
const tokenASymbol: string = 'ETH';
|
|
131
|
-
const tokenBSymbol: string = 'INST';
|
|
132
|
-
|
|
133
|
-
const tokenAAmount: string = '100000000000000';
|
|
134
|
-
const tokenBAmount: string = '100000000000000';
|
|
84
|
+
describe('limit:FLUID -> ETH', () => {
|
|
85
|
+
const tokenASymbol: string = 'FLUID';
|
|
86
|
+
const tokenBSymbol: string = 'ETH';
|
|
87
|
+
const tokenAAmount: string = '16009704732281037900';
|
|
88
|
+
const tokenBAmount: string = '7992306873300550562400';
|
|
135
89
|
|
|
136
90
|
testForNetwork(
|
|
137
91
|
network,
|
|
@@ -148,7 +102,7 @@ describe('FluidDex E2E', () => {
|
|
|
148
102
|
const tokenBSymbol: string = 'ETH';
|
|
149
103
|
|
|
150
104
|
const tokenAAmount: string = '100000000000000';
|
|
151
|
-
const tokenBAmount: string = '
|
|
105
|
+
const tokenBAmount: string = '3500000000000000000';
|
|
152
106
|
|
|
153
107
|
testForNetwork(
|
|
154
108
|
network,
|
|
@@ -237,6 +191,9 @@ function NewDebtReservesOne(): DebtReserves {
|
|
|
237
191
|
};
|
|
238
192
|
}
|
|
239
193
|
|
|
194
|
+
const centerPriceTight: bigint = 3401944443797854601871360n;
|
|
195
|
+
const centerPriceWide: bigint = 1190081051944310368000000000n;
|
|
196
|
+
|
|
240
197
|
const limitsTight: DexLimits = {
|
|
241
198
|
withdrawableToken0: {
|
|
242
199
|
available: 456740438880263n,
|
|
@@ -283,10 +240,6 @@ const limitsWide: DexLimits = {
|
|
|
283
240
|
},
|
|
284
241
|
};
|
|
285
242
|
|
|
286
|
-
const ErrInsufficientBorrowable = new Error('insufficient borrowable');
|
|
287
|
-
const ErrInsufficientMaxPrice = new Error('insufficient max price');
|
|
288
|
-
const ErrInsufficientReserve = new Error('insufficient reserve');
|
|
289
|
-
|
|
290
243
|
describe('TestPoolSimulator_SwapInLimits', () => {
|
|
291
244
|
const network = Network.MAINNET;
|
|
292
245
|
const dexHelper = new DummyDexHelper(network);
|
|
@@ -295,21 +248,18 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
295
248
|
|
|
296
249
|
it('when limits hit', () => {
|
|
297
250
|
let outAmt;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
} catch (err: any) {
|
|
311
|
-
expect(err.message).toEqual(ErrInsufficientBorrowable.message);
|
|
312
|
-
}
|
|
251
|
+
outAmt = fluidDex.swapInAdjusted(
|
|
252
|
+
true,
|
|
253
|
+
BigInt(1e15),
|
|
254
|
+
NewColReservesOne(),
|
|
255
|
+
NewDebtReservesOne(),
|
|
256
|
+
100n,
|
|
257
|
+
18,
|
|
258
|
+
limitsTight,
|
|
259
|
+
BigInt(centerPriceTight),
|
|
260
|
+
Math.floor(Date.now() / 1000) - 10,
|
|
261
|
+
);
|
|
262
|
+
expect(outAmt).toEqual(0n);
|
|
313
263
|
});
|
|
314
264
|
|
|
315
265
|
it('when expanded', () => {
|
|
@@ -321,47 +271,41 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
321
271
|
100n,
|
|
322
272
|
18,
|
|
323
273
|
limitsTight,
|
|
274
|
+
BigInt(centerPriceTight),
|
|
324
275
|
Math.floor(Date.now() / 1000) - 6000,
|
|
325
276
|
);
|
|
326
|
-
|
|
327
|
-
expect(outAmt?.toString()).toEqual('998262697204710');
|
|
277
|
+
expect(outAmt?.toString()).toEqual('998163044346107');
|
|
328
278
|
});
|
|
329
279
|
|
|
330
280
|
it('when price diff hit', () => {
|
|
331
281
|
let outAmt;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
} catch (err: any) {
|
|
345
|
-
expect(err.message).toEqual(ErrInsufficientMaxPrice.message);
|
|
346
|
-
}
|
|
282
|
+
outAmt = fluidDex.swapInAdjusted(
|
|
283
|
+
true,
|
|
284
|
+
BigInt(3e16),
|
|
285
|
+
NewColReservesOne(),
|
|
286
|
+
NewDebtReservesOne(),
|
|
287
|
+
100n,
|
|
288
|
+
18,
|
|
289
|
+
limitsWide,
|
|
290
|
+
BigInt(centerPriceWide),
|
|
291
|
+
Math.floor(Date.now() / 1000) - 10,
|
|
292
|
+
);
|
|
293
|
+
expect(outAmt).toEqual(0n);
|
|
347
294
|
});
|
|
348
295
|
|
|
349
296
|
it('when reserves limit is hit', () => {
|
|
350
297
|
let outAmt;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
} catch (err: any) {
|
|
364
|
-
expect(err.message).toEqual(ErrInsufficientReserve.message);
|
|
365
|
-
}
|
|
298
|
+
outAmt = fluidDex.swapInAdjusted(
|
|
299
|
+
true,
|
|
300
|
+
BigInt(5e16),
|
|
301
|
+
NewColReservesOne(),
|
|
302
|
+
NewDebtReservesOne(),
|
|
303
|
+
100n,
|
|
304
|
+
18,
|
|
305
|
+
limitsWide,
|
|
306
|
+
BigInt(centerPriceWide),
|
|
307
|
+
Math.floor(Date.now() / 1000) - 10,
|
|
308
|
+
);
|
|
309
|
+
expect(outAmt).toEqual(0n);
|
|
366
310
|
});
|
|
367
311
|
});
|
|
@@ -137,12 +137,14 @@ export class FluidDexLiquidityProxy extends StatefulEventSubscriber<FluidDexLiqu
|
|
|
137
137
|
token0,
|
|
138
138
|
token1,
|
|
139
139
|
feeHex,
|
|
140
|
+
centerPriceHex,
|
|
140
141
|
collateralReservesHex,
|
|
141
142
|
debtReservesHex,
|
|
142
143
|
dexLimitsHex,
|
|
143
144
|
] = poolReserve;
|
|
144
145
|
|
|
145
146
|
const fee = Number(feeHex.toString());
|
|
147
|
+
const centerPrice = Number(centerPriceHex.toString());
|
|
146
148
|
|
|
147
149
|
const collateralReserves = {
|
|
148
150
|
token0RealReserves: bigIntify(collateralReservesHex[0]),
|
|
@@ -196,6 +198,7 @@ export class FluidDexLiquidityProxy extends StatefulEventSubscriber<FluidDexLiqu
|
|
|
196
198
|
token0,
|
|
197
199
|
token1,
|
|
198
200
|
fee,
|
|
201
|
+
centerPrice,
|
|
199
202
|
collateralReserves,
|
|
200
203
|
debtReserves,
|
|
201
204
|
dexLimits,
|