@paraswap/dex-lib 4.1.12 → 4.1.13
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/integral/factory.json +333 -0
- package/build/abi/integral/oracle.json +501 -0
- package/build/abi/{curve-v1/StableSwapUSDN.json → integral/pool.json} +487 -450
- package/build/abi/{RamsesV2Pool.abi.json → integral/relayer.json} +833 -851
- package/build/abi/{inception/inception-ineth.json → sdai/PSM3.abi.json} +354 -242
- package/build/abi/{angle-transmuter/ChainlinkEACAggregatorProxy.json → sdai/SSRAuthOracle.abi.json} +233 -220
- package/build/abi/uniswap-v4/pool-manager.abi.json +1366 -0
- package/build/abi/uniswap-v4/quoter.abi.json +461 -0
- package/build/abi/uniswap-v4/router.abi.json +230 -0
- package/build/abi/uniswap-v4/state-view.abi.json +365 -0
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -22
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +49 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +104 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +1 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/integral/config.d.ts +4 -0
- package/build/dex/integral/config.js +20 -0
- package/build/dex/integral/config.js.map +1 -0
- package/build/dex/integral/context.d.ts +40 -0
- package/build/dex/integral/context.js +158 -0
- package/build/dex/integral/context.js.map +1 -0
- package/build/dex/integral/integral-factory.d.ts +24 -0
- package/build/dex/integral/integral-factory.js +95 -0
- package/build/dex/integral/integral-factory.js.map +1 -0
- package/build/dex/integral/integral-pool.d.ts +50 -0
- package/build/dex/integral/integral-pool.js +149 -0
- package/build/dex/integral/integral-pool.js.map +1 -0
- package/build/dex/integral/integral-pricing.d.ts +18 -0
- package/build/dex/integral/integral-pricing.js +114 -0
- package/build/dex/integral/integral-pricing.js.map +1 -0
- package/build/dex/integral/integral-relayer.d.ts +42 -0
- package/build/dex/integral/integral-relayer.js +192 -0
- package/build/dex/integral/integral-relayer.js.map +1 -0
- package/build/dex/integral/integral-token.d.ts +27 -0
- package/build/dex/integral/integral-token.js +59 -0
- package/build/dex/integral/integral-token.js.map +1 -0
- package/build/dex/{inception/inception-native.d.ts → integral/integral.d.ts} +19 -21
- package/build/dex/integral/integral.js +376 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +85 -0
- package/build/dex/integral/types.js +9 -0
- package/build/dex/integral/types.js.map +1 -0
- package/build/dex/integral/utils-e2e.d.ts +9 -0
- package/build/dex/integral/utils-e2e.js +131 -0
- package/build/dex/integral/utils-e2e.js.map +1 -0
- package/build/dex/integral/utils.d.ts +17 -0
- package/build/dex/integral/utils.js +94 -0
- package/build/dex/integral/utils.js.map +1 -0
- package/build/dex/jarvis.d.ts +1 -2
- package/build/dex/jarvis.js +0 -58
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/m-token/config.d.ts +3 -0
- package/build/dex/m-token/config.js +19 -0
- package/build/dex/m-token/config.js.map +1 -0
- package/build/dex/m-token/m-token.d.ts +29 -0
- package/build/dex/m-token/m-token.js +145 -0
- package/build/dex/m-token/m-token.js.map +1 -0
- package/build/dex/m-token/m-wrapped-m.d.ts +17 -0
- package/build/dex/m-token/m-wrapped-m.js +50 -0
- package/build/dex/m-token/m-wrapped-m.js.map +1 -0
- package/build/dex/m-token/types.d.ts +12 -0
- package/build/dex/{inception → m-token}/types.js.map +1 -1
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -31
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/spark/config.js.map +1 -1
- package/build/dex/spark/spark-psm.d.ts +51 -0
- package/build/dex/spark/spark-psm.js +276 -0
- package/build/dex/spark/spark-psm.js.map +1 -0
- package/build/dex/spark/spark-sdai-pool.d.ts +1 -1
- package/build/dex/spark/spark-sdai-pool.js.map +1 -1
- package/build/dex/spark/spark.d.ts +4 -3
- package/build/dex/spark/spark.js +4 -2
- package/build/dex/spark/spark.js.map +1 -1
- package/build/dex/spark/susds-psm.d.ts +49 -0
- package/build/dex/spark/susds-psm.js +245 -0
- package/build/dex/spark/susds-psm.js.map +1 -0
- package/build/dex/spark/types.d.ts +13 -2
- package/build/dex/spark/types.js +8 -1
- package/build/dex/spark/types.js.map +1 -1
- package/build/dex/spark/utils.d.ts +2 -1
- package/build/dex/spark/utils.js +23 -0
- package/build/dex/spark/utils.js.map +1 -1
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +62 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -10
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
- package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
- package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/dex/uniswap-v4/config.d.ts +3 -0
- package/build/dex/uniswap-v4/config.js +58 -0
- package/build/dex/uniswap-v4/config.js.map +1 -0
- package/build/dex/uniswap-v4/constants.d.ts +7 -0
- package/build/dex/uniswap-v4/constants.js +18 -0
- package/build/dex/uniswap-v4/constants.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js +93 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js +8 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js +9 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js +19 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js +22 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.d.ts +10 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js +91 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js +70 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.d.ts +7 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js +86 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js +162 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js +10 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js +11 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js.map +1 -0
- package/build/dex/uniswap-v4/encoder.d.ts +16 -0
- package/build/dex/uniswap-v4/encoder.js +104 -0
- package/build/dex/uniswap-v4/encoder.js.map +1 -0
- package/build/dex/uniswap-v4/subgraph.d.ts +5 -0
- package/build/dex/uniswap-v4/subgraph.js +80 -0
- package/build/dex/uniswap-v4/subgraph.js.map +1 -0
- package/build/dex/uniswap-v4/types.d.ts +64 -0
- package/build/dex/uniswap-v4/types.js +3 -0
- package/build/dex/uniswap-v4/types.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +33 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +152 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +38 -0
- package/build/dex/uniswap-v4/uniswap-v4.js +169 -0
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -0
- package/build/dex/uniswap-v4/utils.d.ts +2 -0
- package/build/dex/uniswap-v4/utils.js +15 -0
- package/build/dex/uniswap-v4/utils.js.map +1 -0
- package/build/dex/zerox/index.d.ts +26 -4
- package/build/dex/zerox/index.js +42 -50
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +0 -29
- package/build/dex/zerox/types.js +1 -8
- package/build/dex/zerox/types.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/sdai/PSM3.abi.json +721 -0
- package/src/abi/sdai/SSRAuthOracle.abi.json +522 -0
- package/src/dex/index.ts +2 -0
- package/src/dex/spark/config.ts +15 -2
- package/src/dex/spark/spark-e2e.test.ts +130 -13
- package/src/dex/spark/spark-events.test.ts +97 -0
- package/src/dex/spark/spark-integration.test.ts +256 -0
- package/src/dex/spark/spark-psm.ts +361 -0
- package/src/dex/spark/spark-sdai-pool.ts +1 -2
- package/src/dex/spark/spark.ts +4 -3
- package/src/dex/spark/types.ts +17 -2
- package/src/dex/spark/utils.ts +41 -1
- package/tests/constants-e2e.ts +18 -3
- 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-ratio-feed.json +0 -329
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
- package/build/abi/kyberdmm.abi.json +0 -1148
- package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
- package/build/abi/nerve/nerve-metapool.json +0 -790
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
- package/build/dex/balancer-v1/balancer-pools.json +0 -33333
- package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
- package/build/dex/bebop/websocket-fetcher.js +0 -87
- package/build/dex/bebop/websocket-fetcher.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -4
- package/build/dex/inception/config.js +0 -109
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -16
- package/build/dex/inception/inception-event-pool.js +0 -51
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -43
- package/build/dex/inception/inception.js +0 -204
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/utils.d.ts +0 -6
- package/build/dex/inception/utils.js +0 -37
- package/build/dex/inception/utils.js.map +0 -1
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
- package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
- package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
- package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
- package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
- package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
- package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
- package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
- /package/build/dex/{inception → m-token}/types.js +0 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { Spark } from './spark';
|
|
2
|
+
import { Address, NumberAsString } from '@paraswap/core';
|
|
3
|
+
import {
|
|
4
|
+
SparkData,
|
|
5
|
+
SparkParams,
|
|
6
|
+
SparkSDaiPoolState,
|
|
7
|
+
SparkSUSDSPsmFunctions,
|
|
8
|
+
} from './types';
|
|
9
|
+
import { SwapSide } from '@paraswap/core/build/constants';
|
|
10
|
+
import { Context } from '../idex';
|
|
11
|
+
import {
|
|
12
|
+
DexConfigMap,
|
|
13
|
+
DexExchangeParam,
|
|
14
|
+
ExchangePrices,
|
|
15
|
+
PoolLiquidity,
|
|
16
|
+
Token,
|
|
17
|
+
} from '../../types';
|
|
18
|
+
import { Network } from '../../constants';
|
|
19
|
+
import { getDexKeysWithNetwork } from '../../utils';
|
|
20
|
+
import { Interface } from '@ethersproject/abi';
|
|
21
|
+
import SSRAuthOracleAbi from '../../abi/sdai/SSRAuthOracle.abi.json';
|
|
22
|
+
import SparkPSM3Abi from '../../abi/sdai/PSM3.abi.json';
|
|
23
|
+
import { IDexHelper } from '../../dex-helper';
|
|
24
|
+
import { Adapters } from './config';
|
|
25
|
+
import { extractReturnAmountPosition } from '../../executor/utils';
|
|
26
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
27
|
+
import { SDAI_DEPOSIT_GAS_COST } from './constants';
|
|
28
|
+
|
|
29
|
+
export const sUSDSPsmConfig: DexConfigMap<SparkParams> = {
|
|
30
|
+
SparkPsm: {
|
|
31
|
+
[Network.ARBITRUM]: {
|
|
32
|
+
sdaiAddress: '0xdDb46999F8891663a8F2828d25298f70416d7610', // sUSDS
|
|
33
|
+
sdaiDecimals: 18,
|
|
34
|
+
daiAddress: '0x6491c05A82219b8D1479057361ff1654749b876b', // USDS
|
|
35
|
+
daiDecimals: 18,
|
|
36
|
+
usdcAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // USDC
|
|
37
|
+
usdcDecimals: 6,
|
|
38
|
+
potAddress: '0xEE2816c1E1eed14d444552654Ed3027abC033A36', // SSRAuthOracle contract address
|
|
39
|
+
psmAddress: '0x2B05F8e1cACC6974fD79A673a341Fe1f58d27266', // PSM contract address
|
|
40
|
+
savingsRate: {
|
|
41
|
+
symbol: 'ssrOracle',
|
|
42
|
+
topic:
|
|
43
|
+
'0xc234856e2a0c5b406365714ced016892e7d98f7b1d49982cdd8db416a586d811', // SetSUSDSData event
|
|
44
|
+
},
|
|
45
|
+
poolInterface: new Interface(SSRAuthOracleAbi),
|
|
46
|
+
exchangeInterface: new Interface(SparkPSM3Abi),
|
|
47
|
+
swapFunctions: SparkSUSDSPsmFunctions,
|
|
48
|
+
referralCode: '1004',
|
|
49
|
+
},
|
|
50
|
+
[Network.BASE]: {
|
|
51
|
+
sdaiAddress: '0x5875eEE11Cf8398102FdAd704C9E96607675467a', // sUSDS
|
|
52
|
+
sdaiDecimals: 18,
|
|
53
|
+
daiAddress: '0x820C137fa70C8691f0e44Dc420a5e53c168921Dc', // USDS
|
|
54
|
+
daiDecimals: 18,
|
|
55
|
+
usdcAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
|
|
56
|
+
usdcDecimals: 6,
|
|
57
|
+
potAddress: '0x65d946e533748A998B1f0E430803e39A6388f7a1', // SSRAuthOracle contract address
|
|
58
|
+
psmAddress: '0x1601843c5E9bC251A3272907010AFa41Fa18347E', // PSM contract address
|
|
59
|
+
savingsRate: {
|
|
60
|
+
symbol: 'ssrOracle',
|
|
61
|
+
topic:
|
|
62
|
+
'0x7373720000000000000000000000000000000000000000000000000000000000',
|
|
63
|
+
},
|
|
64
|
+
poolInterface: new Interface(SSRAuthOracleAbi),
|
|
65
|
+
exchangeInterface: new Interface(SparkPSM3Abi),
|
|
66
|
+
swapFunctions: SparkSUSDSPsmFunctions,
|
|
67
|
+
referralCode: '1004',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export class SparkPsm extends Spark {
|
|
73
|
+
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
74
|
+
getDexKeysWithNetwork(sUSDSPsmConfig);
|
|
75
|
+
|
|
76
|
+
protected readonly usdcAddress: string;
|
|
77
|
+
protected readonly daiPrecision: bigint;
|
|
78
|
+
protected readonly sDaiPrecision: bigint;
|
|
79
|
+
protected readonly usdcPrecision: bigint;
|
|
80
|
+
|
|
81
|
+
constructor(
|
|
82
|
+
protected network: Network,
|
|
83
|
+
dexKey: string,
|
|
84
|
+
readonly dexHelper: IDexHelper,
|
|
85
|
+
protected readonly config = sUSDSPsmConfig[dexKey][network],
|
|
86
|
+
readonly daiAddress: string = sUSDSPsmConfig[dexKey][network].daiAddress,
|
|
87
|
+
readonly sdaiAddress: string = sUSDSPsmConfig[dexKey][network].sdaiAddress,
|
|
88
|
+
readonly potAddress: string = sUSDSPsmConfig[dexKey][network].potAddress,
|
|
89
|
+
readonly abiInterface: Interface = sUSDSPsmConfig[dexKey][network]
|
|
90
|
+
.poolInterface,
|
|
91
|
+
|
|
92
|
+
protected adapters = Adapters[network] || {},
|
|
93
|
+
protected sdaiInterface = sUSDSPsmConfig[dexKey][network].exchangeInterface,
|
|
94
|
+
protected swapFunctions = sUSDSPsmConfig[dexKey][network].swapFunctions,
|
|
95
|
+
protected referralCode = sUSDSPsmConfig[dexKey][network].referralCode,
|
|
96
|
+
) {
|
|
97
|
+
super(
|
|
98
|
+
network,
|
|
99
|
+
dexKey,
|
|
100
|
+
dexHelper,
|
|
101
|
+
config,
|
|
102
|
+
daiAddress,
|
|
103
|
+
sdaiAddress,
|
|
104
|
+
potAddress,
|
|
105
|
+
abiInterface,
|
|
106
|
+
adapters,
|
|
107
|
+
sdaiInterface,
|
|
108
|
+
swapFunctions,
|
|
109
|
+
referralCode,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
this.usdcAddress = config.usdcAddress!;
|
|
113
|
+
this.daiPrecision = 10n ** BigInt(config.daiDecimals!);
|
|
114
|
+
this.sDaiPrecision = 10n ** BigInt(config.sdaiDecimals!);
|
|
115
|
+
this.usdcPrecision = 10n ** BigInt(config.usdcDecimals!);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
isUSDC(tokenAddress: Address) {
|
|
119
|
+
return this.usdcAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
isAppropriateTokenAddress(tokenAddress: string): boolean {
|
|
123
|
+
const supportedTokens = [
|
|
124
|
+
this.daiAddress.toLowerCase(),
|
|
125
|
+
this.usdcAddress.toLowerCase(),
|
|
126
|
+
this.sdaiAddress.toLowerCase(),
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
return supportedTokens.indexOf(tokenAddress.toLowerCase()) > -1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
isAppropriatePair(srcToken: Token, destToken: Token): boolean {
|
|
133
|
+
if (srcToken.address.toLowerCase() === destToken.address.toLowerCase()) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
this.isAppropriateTokenAddress(srcToken.address) &&
|
|
139
|
+
this.isAppropriateTokenAddress(destToken.address)
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
convertOneToOne(assetPrecision: bigint, convertAssetPrecision: bigint) {
|
|
144
|
+
return (assets: bigint): bigint => {
|
|
145
|
+
return (assets * convertAssetPrecision + assetPrecision) / assetPrecision;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
previewSell(
|
|
150
|
+
srcToken: Token,
|
|
151
|
+
destToken: Token,
|
|
152
|
+
amounts: bigint[],
|
|
153
|
+
state: SparkSDaiPoolState,
|
|
154
|
+
): bigint[] {
|
|
155
|
+
let calcFunction: Function;
|
|
156
|
+
|
|
157
|
+
const isDaiSrcAsset = this.isDai(srcToken.address);
|
|
158
|
+
const isUSDCToUSDS =
|
|
159
|
+
this.isUSDC(srcToken.address) && this.isDai(destToken.address);
|
|
160
|
+
|
|
161
|
+
const isUSDSToUSDC =
|
|
162
|
+
this.isDai(srcToken.address) && this.isUSDC(destToken.address);
|
|
163
|
+
|
|
164
|
+
const isUSDCSrcAsset = this.isUSDC(srcToken.address);
|
|
165
|
+
const isUSDCDestAsset = this.isUSDC(destToken.address);
|
|
166
|
+
|
|
167
|
+
if (isUSDCToUSDS) {
|
|
168
|
+
calcFunction = this.convertOneToOne(
|
|
169
|
+
this.usdcPrecision,
|
|
170
|
+
this.daiPrecision,
|
|
171
|
+
).bind(this);
|
|
172
|
+
} else if (isUSDSToUSDC) {
|
|
173
|
+
calcFunction = this.convertOneToOne(
|
|
174
|
+
this.daiPrecision,
|
|
175
|
+
this.usdcPrecision,
|
|
176
|
+
).bind(this);
|
|
177
|
+
} else if (isDaiSrcAsset) {
|
|
178
|
+
calcFunction = this.previewDeposit.bind(this);
|
|
179
|
+
} else {
|
|
180
|
+
if (isUSDCSrcAsset) {
|
|
181
|
+
calcFunction = (assets: bigint, state: SparkSDaiPoolState) => {
|
|
182
|
+
const res = this.previewDeposit(assets, state);
|
|
183
|
+
return (res * this.sDaiPrecision) / this.usdcPrecision;
|
|
184
|
+
};
|
|
185
|
+
} else if (isUSDCDestAsset) {
|
|
186
|
+
calcFunction = (assets: bigint, state: SparkSDaiPoolState) => {
|
|
187
|
+
const res = this.previewRedeem(assets, state);
|
|
188
|
+
return (res * this.usdcPrecision) / this.sDaiPrecision;
|
|
189
|
+
};
|
|
190
|
+
} else {
|
|
191
|
+
calcFunction = this.previewRedeem.bind(this);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return amounts.map(amount => calcFunction(amount, state));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
previewBuy(
|
|
199
|
+
srcToken: Token,
|
|
200
|
+
destToken: Token,
|
|
201
|
+
amounts: bigint[],
|
|
202
|
+
state: SparkSDaiPoolState,
|
|
203
|
+
): bigint[] {
|
|
204
|
+
let calcFunction: Function;
|
|
205
|
+
|
|
206
|
+
const isDaiSrcAsset = this.isDai(srcToken.address);
|
|
207
|
+
const isUSDCToUSDS =
|
|
208
|
+
this.isUSDC(srcToken.address) && this.isDai(destToken.address);
|
|
209
|
+
|
|
210
|
+
const isUSDSToUSDC =
|
|
211
|
+
this.isDai(srcToken.address) && this.isUSDC(destToken.address);
|
|
212
|
+
|
|
213
|
+
const isUSDCSrcAsset = this.isUSDC(srcToken.address);
|
|
214
|
+
const isUSDCDestAsset = this.isUSDC(destToken.address);
|
|
215
|
+
|
|
216
|
+
if (isUSDCToUSDS) {
|
|
217
|
+
calcFunction = this.convertOneToOne(
|
|
218
|
+
this.daiPrecision,
|
|
219
|
+
this.usdcPrecision,
|
|
220
|
+
).bind(this);
|
|
221
|
+
} else if (isUSDSToUSDC) {
|
|
222
|
+
calcFunction = this.convertOneToOne(
|
|
223
|
+
this.usdcPrecision,
|
|
224
|
+
this.daiPrecision,
|
|
225
|
+
).bind(this);
|
|
226
|
+
} else if (isDaiSrcAsset) {
|
|
227
|
+
calcFunction = this.previewMint.bind(this);
|
|
228
|
+
} else {
|
|
229
|
+
if (isUSDCSrcAsset) {
|
|
230
|
+
calcFunction = (assets: bigint, state: SparkSDaiPoolState) => {
|
|
231
|
+
const res = this.previewMint(assets, state);
|
|
232
|
+
return (res * this.usdcPrecision) / this.sDaiPrecision;
|
|
233
|
+
};
|
|
234
|
+
} else if (isUSDCDestAsset) {
|
|
235
|
+
calcFunction = (assets: bigint, state: SparkSDaiPoolState) => {
|
|
236
|
+
const res = this.previewWithdraw(assets, state);
|
|
237
|
+
return (res * this.sDaiPrecision) / this.usdcPrecision;
|
|
238
|
+
};
|
|
239
|
+
} else {
|
|
240
|
+
calcFunction = this.previewWithdraw.bind(this);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return amounts.map(amount => calcFunction(amount, state));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
async getPricesVolume(
|
|
248
|
+
srcToken: Token,
|
|
249
|
+
destToken: Token,
|
|
250
|
+
amounts: bigint[],
|
|
251
|
+
side: SwapSide,
|
|
252
|
+
blockNumber: number,
|
|
253
|
+
limitPools?: string[],
|
|
254
|
+
): Promise<null | ExchangePrices<SparkData>> {
|
|
255
|
+
if (!this.isAppropriatePair(srcToken, destToken)) return null;
|
|
256
|
+
const state = this.eventPool.getState(blockNumber);
|
|
257
|
+
if (!state) return null;
|
|
258
|
+
|
|
259
|
+
let results: bigint[];
|
|
260
|
+
if (side === SwapSide.SELL) {
|
|
261
|
+
results = this.previewSell(srcToken, destToken, amounts, state);
|
|
262
|
+
} else {
|
|
263
|
+
results = this.previewBuy(srcToken, destToken, amounts, state);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return [
|
|
267
|
+
{
|
|
268
|
+
// cannot produce 1:1 price without making an rpc call for block.timestamp and using it for price calculation in `calcChi` function
|
|
269
|
+
prices: results,
|
|
270
|
+
unit: BI_POWS[18],
|
|
271
|
+
gasCost: SDAI_DEPOSIT_GAS_COST,
|
|
272
|
+
exchange: this.dexKey,
|
|
273
|
+
data: { exchange: `${this.sdaiAddress}` },
|
|
274
|
+
poolAddresses: [`${this.sdaiAddress}`],
|
|
275
|
+
},
|
|
276
|
+
];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async getTopPoolsForToken(
|
|
280
|
+
tokenAddress: Address,
|
|
281
|
+
limit: number,
|
|
282
|
+
): Promise<PoolLiquidity[]> {
|
|
283
|
+
if (!this.isAppropriateTokenAddress(tokenAddress)) return [];
|
|
284
|
+
|
|
285
|
+
const connectors = [
|
|
286
|
+
{
|
|
287
|
+
decimals: this.config.daiDecimals,
|
|
288
|
+
address: this.daiAddress,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
decimals: this.config.sdaiDecimals,
|
|
292
|
+
address: this.sdaiAddress,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
decimals: this.config.usdcDecimals,
|
|
296
|
+
address: this.usdcAddress,
|
|
297
|
+
},
|
|
298
|
+
] as Token[];
|
|
299
|
+
|
|
300
|
+
const allPossiblePools = connectors.map(connenctor => ({
|
|
301
|
+
exchange: this.dexKey,
|
|
302
|
+
address: this.config.psmAddress!,
|
|
303
|
+
connectorTokens: [{ ...connenctor }],
|
|
304
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
305
|
+
}));
|
|
306
|
+
|
|
307
|
+
return allPossiblePools.filter(pool => {
|
|
308
|
+
const token = pool.connectorTokens[0];
|
|
309
|
+
return token.address.toLowerCase() !== tokenAddress.toLowerCase();
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
getDexParam(
|
|
314
|
+
srcToken: Address,
|
|
315
|
+
destToken: Address,
|
|
316
|
+
srcAmount: NumberAsString,
|
|
317
|
+
destAmount: NumberAsString,
|
|
318
|
+
recipient: Address,
|
|
319
|
+
data: SparkData,
|
|
320
|
+
side: SwapSide,
|
|
321
|
+
_: Context,
|
|
322
|
+
executorAddress: Address,
|
|
323
|
+
): DexExchangeParam {
|
|
324
|
+
const isSell = side === SwapSide.SELL;
|
|
325
|
+
let swapData: string;
|
|
326
|
+
|
|
327
|
+
if (isSell) {
|
|
328
|
+
swapData = this.sdaiInterface.encodeFunctionData('swapExactIn', [
|
|
329
|
+
srcToken,
|
|
330
|
+
destToken,
|
|
331
|
+
srcAmount,
|
|
332
|
+
destAmount,
|
|
333
|
+
recipient,
|
|
334
|
+
this.config.referralCode,
|
|
335
|
+
]);
|
|
336
|
+
} else {
|
|
337
|
+
swapData = this.sdaiInterface.encodeFunctionData('swapExactOut', [
|
|
338
|
+
srcToken,
|
|
339
|
+
destToken,
|
|
340
|
+
destAmount,
|
|
341
|
+
srcAmount,
|
|
342
|
+
recipient,
|
|
343
|
+
this.config.referralCode,
|
|
344
|
+
]);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return {
|
|
348
|
+
needWrapNative: this.needWrapNative,
|
|
349
|
+
dexFuncHasRecipient: true,
|
|
350
|
+
exchangeData: swapData,
|
|
351
|
+
targetExchange: this.config.psmAddress!,
|
|
352
|
+
returnAmountPos: isSell
|
|
353
|
+
? extractReturnAmountPosition(
|
|
354
|
+
this.sdaiInterface,
|
|
355
|
+
'swapExactIn',
|
|
356
|
+
'amountOut',
|
|
357
|
+
)
|
|
358
|
+
: undefined,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}
|
|
@@ -7,7 +7,6 @@ import type { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
|
7
7
|
import type { Address, BlockHeader, Log, Logger } from '../../types';
|
|
8
8
|
import type { SparkSDaiPoolState } from './types';
|
|
9
9
|
import { getOnChainState } from './utils';
|
|
10
|
-
import { SDaiConfig } from './config';
|
|
11
10
|
import { Network } from '../../constants';
|
|
12
11
|
|
|
13
12
|
export const RAY = BI_POWS[27];
|
|
@@ -62,7 +61,7 @@ export class SparkSDaiEventPool extends StatefulEventSubscriber<SparkSDaiPoolSta
|
|
|
62
61
|
private potInterface: Interface,
|
|
63
62
|
logger: Logger,
|
|
64
63
|
private savingsRateTopic: string,
|
|
65
|
-
private savingsRateSymbol: 'ssr' | 'dsr',
|
|
64
|
+
private savingsRateSymbol: 'ssr' | 'dsr' | 'ssrOracle',
|
|
66
65
|
) {
|
|
67
66
|
super(parentName, poolName, dexHelper, logger);
|
|
68
67
|
this.addressesSubscribed = [potAddress];
|
package/src/dex/spark/spark.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class Spark
|
|
|
41
41
|
protected network: Network,
|
|
42
42
|
dexKey: string,
|
|
43
43
|
readonly dexHelper: IDexHelper,
|
|
44
|
-
|
|
44
|
+
protected readonly config = SDaiConfig[dexKey][network],
|
|
45
45
|
readonly daiAddress: string = SDaiConfig[dexKey][network].daiAddress,
|
|
46
46
|
readonly sdaiAddress: string = SDaiConfig[dexKey][network].sdaiAddress,
|
|
47
47
|
readonly potAddress: string = SDaiConfig[dexKey][network].potAddress,
|
|
@@ -63,8 +63,8 @@ export class Spark
|
|
|
63
63
|
this.potAddress,
|
|
64
64
|
this.abiInterface,
|
|
65
65
|
this.logger,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
config.savingsRate.topic,
|
|
67
|
+
config.savingsRate.symbol,
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -236,6 +236,7 @@ export class Spark
|
|
|
236
236
|
const { exchange } = data;
|
|
237
237
|
|
|
238
238
|
let swapData: string;
|
|
239
|
+
|
|
239
240
|
if (this.isDai(srcToken)) {
|
|
240
241
|
const calldata = [isSell ? srcAmount : destAmount, recipient];
|
|
241
242
|
|
package/src/dex/spark/types.ts
CHANGED
|
@@ -5,15 +5,23 @@ export type SparkData = { exchange: Address };
|
|
|
5
5
|
|
|
6
6
|
export type SparkParams = {
|
|
7
7
|
sdaiAddress: Address;
|
|
8
|
+
sdaiDecimals?: number;
|
|
8
9
|
daiAddress: Address;
|
|
10
|
+
daiDecimals?: number;
|
|
11
|
+
usdcAddress?: Address;
|
|
12
|
+
usdcDecimals?: number;
|
|
9
13
|
potAddress: Address;
|
|
14
|
+
psmAddress?: Address;
|
|
10
15
|
savingsRate: {
|
|
11
|
-
symbol: 'dsr' | 'ssr';
|
|
16
|
+
symbol: 'dsr' | 'ssr' | 'ssrOracle';
|
|
12
17
|
topic: string;
|
|
13
18
|
};
|
|
14
19
|
poolInterface: Interface;
|
|
15
20
|
exchangeInterface: Interface;
|
|
16
|
-
swapFunctions:
|
|
21
|
+
swapFunctions:
|
|
22
|
+
| typeof SparkSDaiFunctions
|
|
23
|
+
| typeof SparkSUSDSFunctions
|
|
24
|
+
| typeof SparkSUSDSPsmFunctions;
|
|
17
25
|
referralCode: null | string;
|
|
18
26
|
};
|
|
19
27
|
|
|
@@ -31,6 +39,13 @@ export enum SparkSUSDSFunctions {
|
|
|
31
39
|
mint = 'mint(uint256,address,uint16)',
|
|
32
40
|
}
|
|
33
41
|
|
|
42
|
+
export enum SparkSUSDSPsmFunctions {
|
|
43
|
+
deposit = 'swapExactIn(address,address,uint256)',
|
|
44
|
+
redeem = 'swapExactIn(address,address,uint256)',
|
|
45
|
+
withdraw = 'swapExactOut(address,address,uint256)',
|
|
46
|
+
mint = 'swapExactOut(address,address,uint256)',
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
export type SparkSDaiPoolState = {
|
|
35
50
|
rho: string;
|
|
36
51
|
chi: string;
|
package/src/dex/spark/utils.ts
CHANGED
|
@@ -11,7 +11,7 @@ export async function getOnChainState(
|
|
|
11
11
|
multiContract: Contract,
|
|
12
12
|
potAddress: string,
|
|
13
13
|
potInterface: Interface,
|
|
14
|
-
savingsRateSymbol: 'dsr' | 'ssr',
|
|
14
|
+
savingsRateSymbol: 'dsr' | 'ssr' | 'ssrOracle',
|
|
15
15
|
blockNumber: number | 'latest',
|
|
16
16
|
): Promise<SparkSDaiPoolState> {
|
|
17
17
|
if (savingsRateSymbol === 'dsr') {
|
|
@@ -23,6 +23,15 @@ export async function getOnChainState(
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
if (savingsRateSymbol === 'ssrOracle') {
|
|
27
|
+
return getOnChainStateUSDSOracle(
|
|
28
|
+
multiContract,
|
|
29
|
+
potAddress,
|
|
30
|
+
potInterface,
|
|
31
|
+
blockNumber,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
return getOnChainStateUSDS(
|
|
27
36
|
multiContract,
|
|
28
37
|
potAddress,
|
|
@@ -72,6 +81,37 @@ export async function getOnChainStateSDAI(
|
|
|
72
81
|
};
|
|
73
82
|
}
|
|
74
83
|
|
|
84
|
+
export async function getOnChainStateUSDSOracle(
|
|
85
|
+
multiContract: Contract,
|
|
86
|
+
potAddress: string,
|
|
87
|
+
potInterface: Interface,
|
|
88
|
+
blockNumber: number | 'latest',
|
|
89
|
+
): Promise<SparkSDaiPoolState> {
|
|
90
|
+
const calls = [
|
|
91
|
+
{
|
|
92
|
+
target: potAddress,
|
|
93
|
+
callData: potInterface.encodeFunctionData('getSUSDSData', []),
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const data: { returnData: any[] } = await multiContract.methods
|
|
98
|
+
.aggregate(calls)
|
|
99
|
+
.call({}, blockNumber);
|
|
100
|
+
|
|
101
|
+
const decoded = potInterface.decodeFunctionResult(
|
|
102
|
+
'getSUSDSData',
|
|
103
|
+
data.returnData[0],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
// 'hack' - sUSDS doesn't have global shutdown and no notion of `live`, so it's always `live`
|
|
108
|
+
live: true,
|
|
109
|
+
dsr: decoded[0].ssr.toString(),
|
|
110
|
+
chi: decoded[0].chi.toString(),
|
|
111
|
+
rho: decoded[0].rho.toString(),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
75
115
|
export async function getOnChainStateUSDS(
|
|
76
116
|
multiContract: Contract,
|
|
77
117
|
potAddress: string,
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1394,6 +1394,14 @@ export const Tokens: {
|
|
|
1394
1394
|
address: '0xe98fc055c99decd8da0c111b090885d5d15c774e',
|
|
1395
1395
|
decimals: 18,
|
|
1396
1396
|
},
|
|
1397
|
+
USDS: {
|
|
1398
|
+
address: '0x6491c05A82219b8D1479057361ff1654749b876b',
|
|
1399
|
+
decimals: 18,
|
|
1400
|
+
},
|
|
1401
|
+
sUSDS: {
|
|
1402
|
+
address: '0xdDb46999F8891663a8F2828d25298f70416d7610',
|
|
1403
|
+
decimals: 18,
|
|
1404
|
+
},
|
|
1397
1405
|
},
|
|
1398
1406
|
[Network.OPTIMISM]: {
|
|
1399
1407
|
DAI: {
|
|
@@ -1747,6 +1755,10 @@ export const Tokens: {
|
|
|
1747
1755
|
address: '0x5875eee11cf8398102fdad704c9e96607675467a',
|
|
1748
1756
|
decimals: 18,
|
|
1749
1757
|
},
|
|
1758
|
+
USDS: {
|
|
1759
|
+
address: '0x820C137fa70C8691f0e44Dc420a5e53c168921Dc',
|
|
1760
|
+
decimals: 18,
|
|
1761
|
+
},
|
|
1750
1762
|
smUSDC: {
|
|
1751
1763
|
address: '0x616a4e1db48e22028f6bbf20444cd3b8e3273738',
|
|
1752
1764
|
decimals: 18,
|
|
@@ -1794,8 +1806,8 @@ export const Holders: {
|
|
|
1794
1806
|
} = {
|
|
1795
1807
|
[Network.MAINNET]: {
|
|
1796
1808
|
FLUID: '0x2d675D4C52a8aE117b935fF98c6F9f29A15827F0',
|
|
1797
|
-
USDS: '
|
|
1798
|
-
sUSDS: '
|
|
1809
|
+
USDS: '0x67A9e0F4Cc10C3F6cb55503e0888129039Ea7C90',
|
|
1810
|
+
sUSDS: '0x0955F0D3729E035B9f5b808fEcd602B2891A32fc',
|
|
1799
1811
|
SKY: '0x0ddda327A6614130CCb20bc0097313A282176A01',
|
|
1800
1812
|
MKR: '0xe9aAA7A9DDc0877626C1779AbC29993aD89A6c1f',
|
|
1801
1813
|
// Idle tokens
|
|
@@ -2098,6 +2110,8 @@ export const Holders: {
|
|
|
2098
2110
|
USDM: '0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812',
|
|
2099
2111
|
wUSDM: '0x12c9cE6b155c8aaC74004732A621B64bC669bb79',
|
|
2100
2112
|
waArbWETH: '0x854B004700885A61107B458f11eCC169A019b764',
|
|
2113
|
+
USDS: '0x2f47a6D6115AF4fC1935f5C9079C8aCBA92E5aB4',
|
|
2114
|
+
sUSDS: '0x999F26D47B916340E62A6bb924708A5007eb80Cb',
|
|
2101
2115
|
},
|
|
2102
2116
|
[Network.OPTIMISM]: {
|
|
2103
2117
|
ETH: '0xF6D4E5a7c5215F91f59a95065190CCa24bf64554',
|
|
@@ -2191,9 +2205,10 @@ export const Holders: {
|
|
|
2191
2205
|
waBasWETH: '0xbA1333333333a1BA1108E8412f11850A5C319bA9',
|
|
2192
2206
|
wstETH: '0x96892b8FBd24e0aC40BD98A304095a6c485A6A68',
|
|
2193
2207
|
waBaswstETH: '0x854B004700885A61107B458f11eCC169A019b764',
|
|
2194
|
-
sUSDS: '0xC9716E991396AA933Fa7A481003a5953bcBabC17',
|
|
2195
2208
|
smUSDC: '0x88457F47c9BEC8379eB90d8dC3592F79084e555d',
|
|
2196
2209
|
waBasGHO: '0x450C01300B83bE379113256038b4Dd3b45d23B5e',
|
|
2210
|
+
USDS: '0x87549A7DF7a002f756118EB19b59C2317E227017',
|
|
2211
|
+
sUSDS: '0xC9716E991396AA933Fa7A481003a5953bcBabC17',
|
|
2197
2212
|
},
|
|
2198
2213
|
[Network.SEPOLIA]: {
|
|
2199
2214
|
bal: '0xDb4ff41B4C1222c2b1869A67Be115070688989a2',
|