@paraswap/dex-lib 4.1.2-pubsub-fluid → 4.1.2
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/.idea/aws.xml +17 -0
- package/.idea/codeStyles/Project.xml +19 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/paraswap-dex-lib.iml +9 -0
- package/.idea/prettier.xml +7 -0
- package/.idea/vcs.xml +6 -0
- package/build/abi/fluid-dex/resolver.abi.json +0 -30
- 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/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/config.js +2 -2
- package/build/dex/fluid-dex/constants.d.ts +1 -1
- package/build/dex/fluid-dex/constants.js +1 -2
- package/build/dex/fluid-dex/constants.js.map +1 -1
- 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/fluid-dex/fluid-dex-liquidity-proxy.js +1 -3
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex.d.ts +5 -4
- package/build/dex/fluid-dex/fluid-dex.js +57 -63
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
- package/build/dex/fluid-dex/types.d.ts +0 -3
- package/build/dex/generic-rfq/generic-rfq.js +2 -1
- package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
- package/build/dex/generic-rfq/rate-fetcher.d.ts +1 -4
- package/build/dex/generic-rfq/rate-fetcher.js +20 -53
- package/build/dex/generic-rfq/rate-fetcher.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/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/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/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/build/lib/pub-sub.d.ts +0 -15
- package/build/lib/pub-sub.js +1 -72
- package/build/lib/pub-sub.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/fluid-dex/resolver.abi.json +0 -30
- package/src/dex/fluid-dex/config.ts +2 -2
- package/src/dex/fluid-dex/constants.ts +1 -2
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +71 -31
- package/src/dex/fluid-dex/fluid-dex-liquidity-proxy.ts +0 -3
- package/src/dex/fluid-dex/fluid-dex.ts +91 -98
- package/src/dex/fluid-dex/types.ts +0 -3
- package/src/dex/generic-rfq/generic-rfq.ts +6 -1
- package/src/dex/generic-rfq/rate-fetcher.ts +47 -83
- package/src/lib/pub-sub.ts +0 -86
- package/tests/constants-e2e.ts +1 -1
- package/tests/tenderly-simulation.ts +0 -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/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- 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/zerox/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OrderStatus = void 0;
|
|
4
4
|
var OrderStatus;
|
|
5
5
|
(function (OrderStatus) {
|
|
6
6
|
OrderStatus[OrderStatus["INVALID"] = 0] = "INVALID";
|
|
@@ -11,11 +11,4 @@ var OrderStatus;
|
|
|
11
11
|
OrderStatus[OrderStatus["FULLY_FILLED"] = 5] = "FULLY_FILLED";
|
|
12
12
|
OrderStatus[OrderStatus["CANCELLED"] = 6] = "CANCELLED";
|
|
13
13
|
})(OrderStatus = exports.OrderStatus || (exports.OrderStatus = {}));
|
|
14
|
-
var ZeroXFunctions;
|
|
15
|
-
(function (ZeroXFunctions) {
|
|
16
|
-
ZeroXFunctions["swapOnZeroXv2"] = "swapOnZeroXv2";
|
|
17
|
-
ZeroXFunctions["swapOnZeroXv4"] = "swapOnZeroXv4";
|
|
18
|
-
ZeroXFunctions["swapOnZeroXv2WithPermit"] = "swapOnZeroXv2WithPermit";
|
|
19
|
-
ZeroXFunctions["swapOnZeroXv4WithPermit"] = "swapOnZeroXv4WithPermit";
|
|
20
|
-
})(ZeroXFunctions = exports.ZeroXFunctions || (exports.ZeroXFunctions = {}));
|
|
21
14
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/zerox/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/zerox/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,mDAAO,CAAA;IACP,yFAA0B,CAAA;IAC1B,yFAA0B,CAAA;IAC1B,qDAAQ,CAAA;IACR,mDAAO,CAAA;IACP,6DAAY,CAAA;IACZ,uDAAS,CAAA;AACX,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"}
|
package/build/lib/pub-sub.d.ts
CHANGED
|
@@ -7,21 +7,6 @@ type KeyValuePubSubMsg = {
|
|
|
7
7
|
data: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
9
|
type SetPubSubMsg = string[];
|
|
10
|
-
export declare class ExpKeyValuePubSub {
|
|
11
|
-
private dexHelper;
|
|
12
|
-
private dexKey;
|
|
13
|
-
private defaultValue?;
|
|
14
|
-
private defaultTTL?;
|
|
15
|
-
channel: string;
|
|
16
|
-
network: Network;
|
|
17
|
-
localCache: NodeCache;
|
|
18
|
-
logger: Logger;
|
|
19
|
-
constructor(dexHelper: IDexHelper, dexKey: string, channel: string, defaultValue?: any | undefined, defaultTTL?: number | undefined);
|
|
20
|
-
subscribe(): void;
|
|
21
|
-
publish(data: Record<string, unknown>, ttl: number): void;
|
|
22
|
-
handleSubscription(msg: KeyValuePubSubMsg): void;
|
|
23
|
-
getAndCache<T>(key: string): Promise<T | null>;
|
|
24
|
-
}
|
|
25
10
|
export declare class ExpStringPubSub {
|
|
26
11
|
private dexHelper;
|
|
27
12
|
private dexKey;
|
package/build/lib/pub-sub.js
CHANGED
|
@@ -3,80 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NonExpSetPubSub = exports.ExpHashPubSub = exports.ExpStringPubSub =
|
|
6
|
+
exports.NonExpSetPubSub = exports.ExpHashPubSub = exports.ExpStringPubSub = void 0;
|
|
7
7
|
const node_cache_1 = __importDefault(require("node-cache"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
|
-
class ExpKeyValuePubSub {
|
|
10
|
-
dexHelper;
|
|
11
|
-
dexKey;
|
|
12
|
-
defaultValue;
|
|
13
|
-
defaultTTL;
|
|
14
|
-
channel;
|
|
15
|
-
network;
|
|
16
|
-
localCache = new node_cache_1.default();
|
|
17
|
-
logger;
|
|
18
|
-
constructor(dexHelper, dexKey, channel, defaultValue, defaultTTL) {
|
|
19
|
-
this.dexHelper = dexHelper;
|
|
20
|
-
this.dexKey = dexKey;
|
|
21
|
-
this.defaultValue = defaultValue;
|
|
22
|
-
this.defaultTTL = defaultTTL;
|
|
23
|
-
this.network = this.dexHelper.config.data.network;
|
|
24
|
-
this.channel = `${this.network}_${this.dexKey}_${channel}`;
|
|
25
|
-
this.logger = this.dexHelper.getLogger(`ExpKeyValuePubSub_${this.channel}`);
|
|
26
|
-
}
|
|
27
|
-
subscribe() {
|
|
28
|
-
this.logger.info(`Subscribing to ${this.channel}`);
|
|
29
|
-
this.dexHelper.cache.subscribe(this.channel, (_, msg) => {
|
|
30
|
-
const decodedMsg = JSON.parse(msg);
|
|
31
|
-
this.handleSubscription(decodedMsg);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
publish(data, ttl) {
|
|
35
|
-
const expiresAt = Math.round(Date.now() / 1000) + ttl;
|
|
36
|
-
this.dexHelper.cache.publish(this.channel, JSON.stringify({ expiresAt, data }));
|
|
37
|
-
}
|
|
38
|
-
handleSubscription(msg) {
|
|
39
|
-
const { expiresAt, data } = msg;
|
|
40
|
-
const now = Math.round(Date.now() / 1000);
|
|
41
|
-
// calculating ttl as message might come with the delay
|
|
42
|
-
const ttl = expiresAt - now;
|
|
43
|
-
if (ttl > 0) {
|
|
44
|
-
const keys = Object.keys(data);
|
|
45
|
-
for (const key of keys) {
|
|
46
|
-
this.localCache.set(key, data[key], ttl);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.logger.error('Message has expired', {
|
|
51
|
-
now,
|
|
52
|
-
expiresAt,
|
|
53
|
-
diffInSeconds: now - expiresAt,
|
|
54
|
-
keys: Object.keys(data),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async getAndCache(key) {
|
|
59
|
-
const localValue = this.localCache.get(key);
|
|
60
|
-
if (localValue) {
|
|
61
|
-
return localValue;
|
|
62
|
-
}
|
|
63
|
-
const [value, ttl] = await Promise.all([
|
|
64
|
-
this.dexHelper.cache.get(this.dexKey, this.network, key),
|
|
65
|
-
this.dexHelper.cache.ttl(this.dexKey, this.network, key),
|
|
66
|
-
]);
|
|
67
|
-
if (value && ttl > 0) {
|
|
68
|
-
const parsedValue = JSON.parse(value);
|
|
69
|
-
this.localCache.set(key, parsedValue, ttl);
|
|
70
|
-
return parsedValue;
|
|
71
|
-
}
|
|
72
|
-
if (this.defaultValue && this.defaultTTL && this.defaultTTL > 0) {
|
|
73
|
-
this.localCache.set(key, this.defaultValue, this.defaultTTL);
|
|
74
|
-
return this.defaultValue;
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.ExpKeyValuePubSub = ExpKeyValuePubSub;
|
|
80
9
|
class ExpStringPubSub {
|
|
81
10
|
dexHelper;
|
|
82
11
|
dexKey;
|
package/build/lib/pub-sub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pub-sub.js","sourceRoot":"","sources":["../../src/lib/pub-sub.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AAInC,oCAAiC;AASjC,MAAa,
|
|
1
|
+
{"version":3,"file":"pub-sub.js","sourceRoot":"","sources":["../../src/lib/pub-sub.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AAInC,oCAAiC;AASjC,MAAa,eAAe;IAQhB;IACA;IAEA;IACA;IAXV,OAAO,CAAS;IAChB,OAAO,CAAU;IACjB,UAAU,GAAc,IAAI,oBAAS,EAAE,CAAC;IAExC,MAAM,CAAS;IAEf,YACU,SAAqB,EACrB,MAAc,EACtB,OAAe,EACP,YAAkB,EAClB,UAAmB;QAJnB,cAAS,GAAT,SAAS,CAAY;QACrB,WAAM,GAAN,MAAM,CAAQ;QAEd,iBAAY,GAAZ,YAAY,CAAM;QAClB,eAAU,GAAV,UAAU,CAAS;QAE3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;QAE3D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,SAAS;QACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,OAAO,EAAE,CAAC,CA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AM,GAAG,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,GAAG,GAAG,CAAC,CAAC;YAC7C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,kBAAkB,CAAC,GAAiB;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,GAAG,GAAG,CAAC,CAAC;QAExD,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF;AAvDD,0CAuDC"}
|
package/package.json
CHANGED
|
@@ -201,11 +201,6 @@
|
|
|
201
201
|
"name": "fee",
|
|
202
202
|
"type": "uint256"
|
|
203
203
|
},
|
|
204
|
-
{
|
|
205
|
-
"internalType": "uint256",
|
|
206
|
-
"name": "centerPrice",
|
|
207
|
-
"type": "uint256"
|
|
208
|
-
},
|
|
209
204
|
{
|
|
210
205
|
"components": [
|
|
211
206
|
{
|
|
@@ -400,11 +395,6 @@
|
|
|
400
395
|
"name": "fee",
|
|
401
396
|
"type": "uint256"
|
|
402
397
|
},
|
|
403
|
-
{
|
|
404
|
-
"internalType": "uint256",
|
|
405
|
-
"name": "centerPrice",
|
|
406
|
-
"type": "uint256"
|
|
407
|
-
},
|
|
408
398
|
{
|
|
409
399
|
"components": [
|
|
410
400
|
{
|
|
@@ -1202,11 +1192,6 @@
|
|
|
1202
1192
|
"name": "fee",
|
|
1203
1193
|
"type": "uint256"
|
|
1204
1194
|
},
|
|
1205
|
-
{
|
|
1206
|
-
"internalType": "uint256",
|
|
1207
|
-
"name": "centerPrice",
|
|
1208
|
-
"type": "uint256"
|
|
1209
|
-
},
|
|
1210
1195
|
{
|
|
1211
1196
|
"components": [
|
|
1212
1197
|
{
|
|
@@ -1407,11 +1392,6 @@
|
|
|
1407
1392
|
"name": "fee",
|
|
1408
1393
|
"type": "uint256"
|
|
1409
1394
|
},
|
|
1410
|
-
{
|
|
1411
|
-
"internalType": "uint256",
|
|
1412
|
-
"name": "centerPrice",
|
|
1413
|
-
"type": "uint256"
|
|
1414
|
-
},
|
|
1415
1395
|
{
|
|
1416
1396
|
"components": [
|
|
1417
1397
|
{
|
|
@@ -1636,11 +1616,6 @@
|
|
|
1636
1616
|
"name": "fee",
|
|
1637
1617
|
"type": "uint256"
|
|
1638
1618
|
},
|
|
1639
|
-
{
|
|
1640
|
-
"internalType": "uint256",
|
|
1641
|
-
"name": "centerPrice",
|
|
1642
|
-
"type": "uint256"
|
|
1643
|
-
},
|
|
1644
1619
|
{
|
|
1645
1620
|
"components": [
|
|
1646
1621
|
{
|
|
@@ -1841,11 +1816,6 @@
|
|
|
1841
1816
|
"name": "fee",
|
|
1842
1817
|
"type": "uint256"
|
|
1843
1818
|
},
|
|
1844
|
-
{
|
|
1845
|
-
"internalType": "uint256",
|
|
1846
|
-
"name": "centerPrice",
|
|
1847
|
-
"type": "uint256"
|
|
1848
|
-
},
|
|
1849
1819
|
{
|
|
1850
1820
|
"components": [
|
|
1851
1821
|
{
|
|
@@ -7,14 +7,14 @@ export const FluidDexConfig: DexConfigMap<DexParams> = {
|
|
|
7
7
|
[Network.MAINNET]: {
|
|
8
8
|
commonAddresses: {
|
|
9
9
|
liquidityProxy: '0x52aa899454998be5b000ad077a46bbe360f4e497',
|
|
10
|
-
resolver: '
|
|
10
|
+
resolver: '0x45f4ad57e300da55c33dea579a40fcee000d7b94',
|
|
11
11
|
dexFactory: '0x91716C4EDA1Fb55e84Bf8b4c7085f84285c19085',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
[Network.ARBITRUM]: {
|
|
15
15
|
commonAddresses: {
|
|
16
16
|
liquidityProxy: '0x52Aa899454998Be5b000Ad077a46Bbe360F4e497',
|
|
17
|
-
resolver: '
|
|
17
|
+
resolver: '0xb8f526718FF58758E256D9aD86bC194a9ff5986D',
|
|
18
18
|
dexFactory: '0x91716C4EDA1Fb55e84Bf8b4c7085f84285c19085',
|
|
19
19
|
},
|
|
20
20
|
},
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const MIN_SWAP_LIQUIDITY = 8500n;
|
|
1
|
+
export const MIN_SWAP_LIQUIDITY = 10n ** 4n;
|
|
@@ -4,13 +4,46 @@ dotenv.config();
|
|
|
4
4
|
|
|
5
5
|
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
6
6
|
import { testE2E } from '../../../tests/utils-e2e';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Tokens,
|
|
9
|
+
Holders,
|
|
10
|
+
NativeTokenSymbols,
|
|
11
|
+
} from '../../../tests/constants-e2e';
|
|
8
12
|
import { Network, ContractMethod, SwapSide } from '../../constants';
|
|
9
13
|
import { generateConfig } from '../../config';
|
|
10
14
|
import { CollateralReserves, DebtReserves, DexLimits } from './types';
|
|
11
15
|
import { DummyDexHelper } from '../../dex-helper/index';
|
|
12
16
|
import { FluidDex } from './fluid-dex';
|
|
13
17
|
|
|
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
|
+
|
|
14
47
|
function testForNetwork(
|
|
15
48
|
network: Network,
|
|
16
49
|
dexKey: string,
|
|
@@ -23,14 +56,9 @@ function testForNetwork(
|
|
|
23
56
|
generateConfig(network).privateHttpProvider,
|
|
24
57
|
network,
|
|
25
58
|
);
|
|
26
|
-
|
|
27
59
|
const tokens = Tokens[network];
|
|
28
60
|
const holders = Holders[network];
|
|
29
61
|
|
|
30
|
-
// Create FluidDex instance to check reserves
|
|
31
|
-
const dexHelper = new DummyDexHelper(network);
|
|
32
|
-
const fluidDex = new FluidDex(network, dexKey, dexHelper);
|
|
33
|
-
|
|
34
62
|
const sideToContractMethods = new Map([
|
|
35
63
|
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
36
64
|
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
@@ -41,11 +69,11 @@ function testForNetwork(
|
|
|
41
69
|
describe(`${side}`, () => {
|
|
42
70
|
contractMethods.forEach((contractMethod: string) => {
|
|
43
71
|
describe(`${contractMethod}`, () => {
|
|
44
|
-
it(`${
|
|
72
|
+
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
45
73
|
await testE2E(
|
|
46
|
-
tokens[tokenBSymbol],
|
|
47
74
|
tokens[tokenASymbol],
|
|
48
|
-
|
|
75
|
+
tokens[tokenBSymbol],
|
|
76
|
+
holders[tokenASymbol],
|
|
49
77
|
tokenBAmount,
|
|
50
78
|
side,
|
|
51
79
|
dexKey,
|
|
@@ -54,13 +82,12 @@ function testForNetwork(
|
|
|
54
82
|
provider,
|
|
55
83
|
);
|
|
56
84
|
});
|
|
57
|
-
|
|
58
|
-
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
85
|
+
it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
|
|
59
86
|
await testE2E(
|
|
60
|
-
tokens[tokenASymbol],
|
|
61
87
|
tokens[tokenBSymbol],
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
tokens[tokenASymbol],
|
|
89
|
+
holders[tokenBSymbol],
|
|
90
|
+
tokenBAmount,
|
|
64
91
|
side,
|
|
65
92
|
dexKey,
|
|
66
93
|
contractMethod as ContractMethod,
|
|
@@ -81,11 +108,30 @@ describe('FluidDex E2E', () => {
|
|
|
81
108
|
describe('Mainnet', () => {
|
|
82
109
|
const network = Network.MAINNET;
|
|
83
110
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
// TODO: Uncomment & test when the issue is resolved. Currently no price as expected.
|
|
112
|
+
// describe.only('FLUID -> ETH', () => {
|
|
113
|
+
// const tokenASymbol: string = 'FLUID';
|
|
114
|
+
// const tokenBSymbol: string = 'ETH';
|
|
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';
|
|
89
135
|
|
|
90
136
|
testForNetwork(
|
|
91
137
|
network,
|
|
@@ -102,7 +148,7 @@ describe('FluidDex E2E', () => {
|
|
|
102
148
|
const tokenBSymbol: string = 'ETH';
|
|
103
149
|
|
|
104
150
|
const tokenAAmount: string = '100000000000000';
|
|
105
|
-
const tokenBAmount: string = '
|
|
151
|
+
const tokenBAmount: string = '100000000000000';
|
|
106
152
|
|
|
107
153
|
testForNetwork(
|
|
108
154
|
network,
|
|
@@ -191,9 +237,6 @@ function NewDebtReservesOne(): DebtReserves {
|
|
|
191
237
|
};
|
|
192
238
|
}
|
|
193
239
|
|
|
194
|
-
const centerPriceTight: bigint = 3401944443797854601871360n;
|
|
195
|
-
const centerPriceWide: bigint = 1190081051944310368000000000n;
|
|
196
|
-
|
|
197
240
|
const limitsTight: DexLimits = {
|
|
198
241
|
withdrawableToken0: {
|
|
199
242
|
available: 456740438880263n,
|
|
@@ -240,9 +283,9 @@ const limitsWide: DexLimits = {
|
|
|
240
283
|
},
|
|
241
284
|
};
|
|
242
285
|
|
|
243
|
-
const ErrInsufficientBorrowable = new Error('
|
|
244
|
-
const ErrInsufficientMaxPrice = new Error('
|
|
245
|
-
const ErrInsufficientReserve = new Error('
|
|
286
|
+
const ErrInsufficientBorrowable = new Error('insufficient borrowable');
|
|
287
|
+
const ErrInsufficientMaxPrice = new Error('insufficient max price');
|
|
288
|
+
const ErrInsufficientReserve = new Error('insufficient reserve');
|
|
246
289
|
|
|
247
290
|
describe('TestPoolSimulator_SwapInLimits', () => {
|
|
248
291
|
const network = Network.MAINNET;
|
|
@@ -261,7 +304,6 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
261
304
|
100n,
|
|
262
305
|
18,
|
|
263
306
|
limitsTight,
|
|
264
|
-
BigInt(centerPriceTight),
|
|
265
307
|
Math.floor(Date.now() / 1000) - 10,
|
|
266
308
|
);
|
|
267
309
|
expect(outAmt).toEqual(0n);
|
|
@@ -279,10 +321,10 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
279
321
|
100n,
|
|
280
322
|
18,
|
|
281
323
|
limitsTight,
|
|
282
|
-
BigInt(centerPriceTight),
|
|
283
324
|
Math.floor(Date.now() / 1000) - 6000,
|
|
284
325
|
);
|
|
285
|
-
|
|
326
|
+
console.log('outAmt: ', outAmt);
|
|
327
|
+
expect(outAmt?.toString()).toEqual('998262697204710');
|
|
286
328
|
});
|
|
287
329
|
|
|
288
330
|
it('when price diff hit', () => {
|
|
@@ -296,7 +338,6 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
296
338
|
100n,
|
|
297
339
|
18,
|
|
298
340
|
limitsWide,
|
|
299
|
-
BigInt(centerPriceWide),
|
|
300
341
|
Math.floor(Date.now() / 1000) - 10,
|
|
301
342
|
);
|
|
302
343
|
expect(outAmt).toEqual(0n);
|
|
@@ -316,7 +357,6 @@ describe('TestPoolSimulator_SwapInLimits', () => {
|
|
|
316
357
|
100n,
|
|
317
358
|
18,
|
|
318
359
|
limitsWide,
|
|
319
|
-
BigInt(centerPriceWide),
|
|
320
360
|
Math.floor(Date.now() / 1000) - 10,
|
|
321
361
|
);
|
|
322
362
|
expect(outAmt).toEqual(0n);
|
|
@@ -137,14 +137,12 @@ export class FluidDexLiquidityProxy extends StatefulEventSubscriber<FluidDexLiqu
|
|
|
137
137
|
token0,
|
|
138
138
|
token1,
|
|
139
139
|
feeHex,
|
|
140
|
-
centerPriceHex,
|
|
141
140
|
collateralReservesHex,
|
|
142
141
|
debtReservesHex,
|
|
143
142
|
dexLimitsHex,
|
|
144
143
|
] = poolReserve;
|
|
145
144
|
|
|
146
145
|
const fee = Number(feeHex.toString());
|
|
147
|
-
const centerPrice = Number(centerPriceHex.toString());
|
|
148
146
|
|
|
149
147
|
const collateralReserves = {
|
|
150
148
|
token0RealReserves: bigIntify(collateralReservesHex[0]),
|
|
@@ -198,7 +196,6 @@ export class FluidDexLiquidityProxy extends StatefulEventSubscriber<FluidDexLiqu
|
|
|
198
196
|
token0,
|
|
199
197
|
token1,
|
|
200
198
|
fee,
|
|
201
|
-
centerPrice,
|
|
202
199
|
collateralReserves,
|
|
203
200
|
debtReserves,
|
|
204
201
|
dexLimits,
|