@paraswap/dex-lib 3.8.25 → 3.8.27-dualsync.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dex/generic-rfq/rate-fetcher.js +1 -1
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/idex.d.ts +4 -0
- package/build/dex/uniswap-v2/uniswap-v2.d.ts +11 -4
- package/build/dex/uniswap-v2/uniswap-v2.js +40 -13
- package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +3 -2
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +3 -3
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +4 -0
- package/build/dex/uniswap-v3/uniswap-v3.js +11 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex-helper/dummy-dex-helper.d.ts +2 -0
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/idex-helper.d.ts +2 -0
- package/build/dex-utils.d.ts +3 -0
- package/build/dex-utils.js +10 -0
- package/build/dex-utils.js.map +1 -0
- package/build/stateful-dual-synchronizer.d.ts +46 -0
- package/build/stateful-dual-synchronizer.js +300 -0
- package/build/stateful-dual-synchronizer.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/generic-rfq/rate-fetcher.ts +6 -5
- package/src/dex/idex.ts +8 -0
- package/src/dex/uniswap-v2/uniswap-v2.ts +66 -16
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +4 -6
- package/src/dex/uniswap-v3/uniswap-v3.ts +28 -2
- package/src/dex-helper/dummy-dex-helper.ts +2 -0
- package/src/dex-helper/idex-helper.ts +2 -0
- package/src/dex-utils.ts +5 -0
- package/src/stateful-dual-synchronizer.ts +415 -0
- package/.vscode/launch.json +0 -16
- package/.vscode/settings.json +0 -3
- package/build/abi/AaveV1_lending_pool.json +0 -27
- package/build/abi/BProtocol.json +0 -1155
- package/build/abi/Jarvis.json +0 -1172
- package/build/abi/MStableAsset.json +0 -1545
- package/build/abi/OneInchLp.json +0 -1304
- package/build/abi/Onebit.json +0 -736
- package/build/abi/Shell.json +0 -1294
- package/build/abi/TraderJoeV2Router.json +0 -50
- package/build/abi/Uncompressor.json +0 -250
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/integral/pool.json +0 -1041
- package/build/abi/integral/relayer.json +0 -1536
- package/build/abi/platypus/asset.json +0 -490
- package/build/abi/platypus/avax-pool.json +0 -820
- package/build/abi/platypus/oracle.json +0 -119
- package/build/abi/platypus/pool.json +0 -677
- package/build/abi/smardex/all/smardex-router.json +0 -648
- package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
- package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
- package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
- package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
- package/build/abi/swaap-v1/pool.json +0 -1346
- package/build/abi/zrx.v2.json +0 -1967
- package/build/abi/zrx.v3.json +0 -3454
- package/build/abi/zrx.v4.json +0 -2193
- package/build/dex/OneInchLp.d.ts +0 -24
- package/build/dex/OneInchLp.js +0 -43
- package/build/dex/OneInchLp.js.map +0 -1
- package/build/dex/aave-v1/aave-v1.d.ts +0 -33
- package/build/dex/aave-v1/aave-v1.js +0 -158
- package/build/dex/aave-v1/aave-v1.js.map +0 -1
- package/build/dex/aave-v1/config.d.ts +0 -11
- package/build/dex/aave-v1/config.js +0 -20
- package/build/dex/aave-v1/config.js.map +0 -1
- package/build/dex/aave-v1/tokens-mainnet.json +0 -134
- package/build/dex/aave-v1/tokens.d.ts +0 -3
- package/build/dex/aave-v1/tokens.js +0 -50
- package/build/dex/aave-v1/tokens.js.map +0 -1
- package/build/dex/aave-v1/types.d.ts +0 -12
- package/build/dex/aave-v1/types.js +0 -3
- package/build/dex/aave-v1/types.js.map +0 -1
- package/build/dex/bProtocol/bProtocol.d.ts +0 -15
- package/build/dex/bProtocol/bProtocol.js +0 -56
- package/build/dex/bProtocol/bProtocol.js.map +0 -1
- package/build/dex/bProtocol/types.d.ts +0 -11
- package/build/dex/bProtocol/types.js +0 -8
- package/build/dex/bProtocol/types.js.map +0 -1
- 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/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/etherfi/etherfi.d.ts +0 -26
- package/build/dex/etherfi/etherfi.js +0 -96
- package/build/dex/etherfi/etherfi.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/helpers.d.ts +0 -17
- package/build/dex/integral/helpers.js +0 -157
- package/build/dex/integral/helpers.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.d.ts +0 -41
- 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/jarvis.d.ts +0 -56
- package/build/dex/jarvis.js +0 -163
- package/build/dex/jarvis.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/mStable.d.ts +0 -44
- package/build/dex/mStable.js +0 -75
- package/build/dex/mStable.js.map +0 -1
- package/build/dex/onebit/onebit.d.ts +0 -16
- package/build/dex/onebit/onebit.js +0 -61
- package/build/dex/onebit/onebit.js.map +0 -1
- package/build/dex/onebit/types.d.ts +0 -14
- package/build/dex/onebit/types.js +0 -8
- package/build/dex/onebit/types.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/platypus/asset.d.ts +0 -14
- package/build/dex/platypus/asset.js +0 -97
- package/build/dex/platypus/asset.js.map +0 -1
- package/build/dex/platypus/config.d.ts +0 -11
- package/build/dex/platypus/config.js +0 -69
- package/build/dex/platypus/config.js.map +0 -1
- package/build/dex/platypus/platypus.d.ts +0 -62
- package/build/dex/platypus/platypus.js +0 -442
- package/build/dex/platypus/platypus.js.map +0 -1
- package/build/dex/platypus/pool-avax.d.ts +0 -8
- package/build/dex/platypus/pool-avax.js +0 -54
- package/build/dex/platypus/pool-avax.js.map +0 -1
- package/build/dex/platypus/pool-base.d.ts +0 -19
- package/build/dex/platypus/pool-base.js +0 -86
- package/build/dex/platypus/pool-base.js.map +0 -1
- package/build/dex/platypus/pool-pure.d.ts +0 -8
- package/build/dex/platypus/pool-pure.js +0 -37
- package/build/dex/platypus/pool-pure.js.map +0 -1
- package/build/dex/platypus/pool-subscriber.d.ts +0 -14
- package/build/dex/platypus/pool-subscriber.js +0 -167
- package/build/dex/platypus/pool-subscriber.js.map +0 -1
- package/build/dex/platypus/pool.d.ts +0 -8
- package/build/dex/platypus/pool.js +0 -58
- package/build/dex/platypus/pool.js.map +0 -1
- package/build/dex/platypus/types.d.ts +0 -92
- package/build/dex/platypus/types.js +0 -10
- package/build/dex/platypus/types.js.map +0 -1
- package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
- package/build/dex/quickswap/spiritswap-v3.js +0 -19
- package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
- package/build/dex/sdai/config.d.ts +0 -11
- package/build/dex/sdai/config.js +0 -21
- package/build/dex/sdai/config.js.map +0 -1
- package/build/dex/sdai/constants.d.ts +0 -2
- package/build/dex/sdai/constants.js +0 -6
- package/build/dex/sdai/constants.js.map +0 -1
- package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
- package/build/dex/sdai/scripts/validate-state.js +0 -102
- package/build/dex/sdai/scripts/validate-state.js.map +0 -1
- package/build/dex/sdai/sdai-pool.d.ts +0 -16
- package/build/dex/sdai/sdai-pool.js +0 -85
- package/build/dex/sdai/sdai-pool.js.map +0 -1
- package/build/dex/sdai/sdai.d.ts +0 -51
- package/build/dex/sdai/sdai.js +0 -172
- package/build/dex/sdai/sdai.js.map +0 -1
- package/build/dex/sdai/types.d.ts +0 -21
- package/build/dex/sdai/types.js +0 -11
- package/build/dex/sdai/types.js.map +0 -1
- package/build/dex/sdai/utils.d.ts +0 -4
- package/build/dex/sdai/utils.js +0 -39
- package/build/dex/sdai/utils.js.map +0 -1
- package/build/dex/shell.d.ts +0 -25
- package/build/dex/shell.js +0 -41
- package/build/dex/shell.js.map +0 -1
- package/build/dex/smardex/config.d.ts +0 -4
- package/build/dex/smardex/config.js +0 -64
- package/build/dex/smardex/config.js.map +0 -1
- package/build/dex/smardex/constants.d.ts +0 -18
- package/build/dex/smardex/constants.js +0 -33
- package/build/dex/smardex/constants.js.map +0 -1
- package/build/dex/smardex/sdk/constants.d.ts +0 -6
- package/build/dex/smardex/sdk/constants.js +0 -13
- package/build/dex/smardex/sdk/constants.js.map +0 -1
- package/build/dex/smardex/sdk/core.d.ts +0 -113
- package/build/dex/smardex/sdk/core.js +0 -499
- package/build/dex/smardex/sdk/core.js.map +0 -1
- package/build/dex/smardex/sdk/errors.d.ts +0 -15
- package/build/dex/smardex/sdk/errors.js +0 -22
- package/build/dex/smardex/sdk/errors.js.map +0 -1
- package/build/dex/smardex/sdk/types.d.ts +0 -62
- package/build/dex/smardex/sdk/types.js +0 -3
- package/build/dex/smardex/sdk/types.js.map +0 -1
- package/build/dex/smardex/sdk/utils.d.ts +0 -44
- package/build/dex/smardex/sdk/utils.js +0 -133
- package/build/dex/smardex/sdk/utils.js.map +0 -1
- package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
- package/build/dex/smardex/smardex-event-pool.js +0 -119
- package/build/dex/smardex/smardex-event-pool.js.map +0 -1
- package/build/dex/smardex/smardex.d.ts +0 -65
- package/build/dex/smardex/smardex.js +0 -519
- package/build/dex/smardex/smardex.js.map +0 -1
- package/build/dex/smardex/types.d.ts +0 -55
- package/build/dex/smardex/types.js +0 -3
- package/build/dex/smardex/types.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/solidly/forks-override/cone.d.ts +0 -22
- package/build/dex/solidly/forks-override/cone.js +0 -53
- package/build/dex/solidly/forks-override/cone.js.map +0 -1
- package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
- package/build/dex/solidly/forks-override/solisnek.js +0 -15
- package/build/dex/solidly/forks-override/solisnek.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/swaap-v1/config.d.ts +0 -17
- package/build/dex/swaap-v1/config.js +0 -56
- package/build/dex/swaap-v1/config.js.map +0 -1
- package/build/dex/swaap-v1/constants.d.ts +0 -6
- package/build/dex/swaap-v1/constants.js +0 -17
- package/build/dex/swaap-v1/constants.js.map +0 -1
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
- package/build/dex/swaap-v1/libraries/Const.js +0 -26
- package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
- package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
- package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
- package/build/dex/swaap-v1/libraries/Num.js +0 -167
- package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
- package/build/dex/swaap-v1/libraries/Struct.js +0 -3
- package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
- package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +0 -61
- package/build/dex/swaap-v1/swaap-v1.js +0 -369
- package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
- package/build/dex/swaap-v1/types.d.ts +0 -106
- package/build/dex/swaap-v1/types.js +0 -9
- package/build/dex/swaap-v1/types.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 -44
- package/build/dex/trader-joe-v2.1/optimizer.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/build/dex/trader-joe-v2.d.ts +0 -40
- package/build/dex/trader-joe-v2.js +0 -74
- package/build/dex/trader-joe-v2.js.map +0 -1
- package/build/dex/zerox/config.d.ts +0 -2
- package/build/dex/zerox/config.js +0 -33
- package/build/dex/zerox/config.js.map +0 -1
- package/build/dex/zerox/index.d.ts +0 -22
- package/build/dex/zerox/index.js +0 -225
- package/build/dex/zerox/index.js.map +0 -1
- package/build/dex/zerox/order.d.ts +0 -88
- package/build/dex/zerox/order.js +0 -53
- package/build/dex/zerox/order.js.map +0 -1
- package/build/dex/zerox/types.d.ts +0 -73
- package/build/dex/zerox/types.js +0 -21
- package/build/dex/zerox/types.js.map +0 -1
- package/build/executor/compressor/Compressor.d.ts +0 -23
- package/build/executor/compressor/Compressor.js +0 -144
- package/build/executor/compressor/Compressor.js.map +0 -1
- package/build/executor/compressor/compress.d.ts +0 -17
- package/build/executor/compressor/compress.js +0 -187
- package/build/executor/compressor/compress.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
- package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
- package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
- package/build/executor/compressor/fetchSaved.d.ts +0 -0
- package/build/executor/compressor/fetchSaved.js +0 -17
- package/build/executor/compressor/fetchSaved.js.map +0 -1
- package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
- package/build/executor/compressor/utils/computeCostL2.js +0 -14
- package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
- package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
- package/build/executor/compressor/utils/getAllIndexes.js +0 -12
- package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
- package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
- package/build/executor/compressor/utils/getByteForAddress.js +0 -14
- package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
- package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
- package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intToByte.d.ts +0 -2
- package/build/executor/compressor/utils/intToByte.js +0 -10
- package/build/executor/compressor/utils/intToByte.js.map +0 -1
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
2
|
-
import { Interface } from '@ethersproject/abi';
|
|
3
|
-
import type { IDexHelper } from '../../dex-helper';
|
|
4
|
-
import type { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
5
|
-
import type { Address, BlockHeader, Log, Logger } from '../../types';
|
|
6
|
-
import type { SDaiPoolState } from './types';
|
|
7
|
-
export declare class SDaiEventPool extends StatefulEventSubscriber<SDaiPoolState> {
|
|
8
|
-
protected dexHelper: IDexHelper;
|
|
9
|
-
private potAddress;
|
|
10
|
-
private potInterface;
|
|
11
|
-
constructor(parentName: string, dexHelper: IDexHelper, potAddress: Address, potInterface: Interface, logger: Logger);
|
|
12
|
-
protected processLog(state: DeepReadonly<SDaiPoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): AsyncOrSync<DeepReadonly<SDaiPoolState> | null>;
|
|
13
|
-
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<SDaiPoolState>>;
|
|
14
|
-
convertToSDai(daiAmount: bigint, blockNumber: number): bigint;
|
|
15
|
-
convertToDai(sdaiAmount: bigint, blockNumber: number): bigint;
|
|
16
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SDaiEventPool = void 0;
|
|
4
|
-
const bigint_constants_1 = require("../../bigint-constants");
|
|
5
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
const RAY = bigint_constants_1.BI_POWS[27];
|
|
8
|
-
const ZERO = BigInt(0);
|
|
9
|
-
const TWO = BigInt(2);
|
|
10
|
-
const HALF = RAY / TWO;
|
|
11
|
-
// function file(bytes32,uint256)
|
|
12
|
-
const FILE_TOPICHASH = `0x29ae811400000000000000000000000000000000000000000000000000000000`;
|
|
13
|
-
// function drip()
|
|
14
|
-
const DRIP_TOPICHASH = `0x9f678cca00000000000000000000000000000000000000000000000000000000`;
|
|
15
|
-
// function cage()
|
|
16
|
-
const CAGE_TOPICHASH = `0x6924500900000000000000000000000000000000000000000000000000000000`;
|
|
17
|
-
// bytes32 repr of "dsr" string
|
|
18
|
-
const DSR_TOPIC = `0x6473720000000000000000000000000000000000000000000000000000000000`;
|
|
19
|
-
const rpow = (x, n) => {
|
|
20
|
-
if (!x && !n)
|
|
21
|
-
return RAY;
|
|
22
|
-
if (!x)
|
|
23
|
-
return ZERO;
|
|
24
|
-
let z = n % TWO > ZERO ? x : RAY;
|
|
25
|
-
for (n = n / TWO; n; n /= TWO) {
|
|
26
|
-
x = (x * x + HALF) / RAY;
|
|
27
|
-
if (n % TWO > ZERO) {
|
|
28
|
-
z = (z * x + HALF) / RAY;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return z;
|
|
32
|
-
};
|
|
33
|
-
const calcChi = (state, currentTimestamp) => {
|
|
34
|
-
currentTimestamp || (currentTimestamp = Math.floor(Date.now() / 1000));
|
|
35
|
-
if (!state.live)
|
|
36
|
-
return RAY;
|
|
37
|
-
const { dsr: dsr_, chi: chi_, rho: rho_ } = state;
|
|
38
|
-
const now = BigInt(currentTimestamp);
|
|
39
|
-
const rho = BigInt(rho_);
|
|
40
|
-
const dsr = BigInt(dsr_);
|
|
41
|
-
const chi = BigInt(chi_);
|
|
42
|
-
return now > rho ? (rpow(dsr, now - rho) * chi) / RAY : chi;
|
|
43
|
-
};
|
|
44
|
-
class SDaiEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
45
|
-
constructor(parentName, dexHelper, potAddress, potInterface, logger) {
|
|
46
|
-
super(parentName, 'sdai', dexHelper, logger);
|
|
47
|
-
this.dexHelper = dexHelper;
|
|
48
|
-
this.potAddress = potAddress;
|
|
49
|
-
this.potInterface = potInterface;
|
|
50
|
-
this.addressesSubscribed = [potAddress];
|
|
51
|
-
}
|
|
52
|
-
processLog(state, log, blockHeader) {
|
|
53
|
-
if (log.topics[0] === FILE_TOPICHASH && log.topics[2] === DSR_TOPIC) {
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
56
|
-
dsr: BigInt(log.topics[3]).toString(),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
if (log.topics[0] === DRIP_TOPICHASH) {
|
|
60
|
-
return {
|
|
61
|
-
...state,
|
|
62
|
-
rho: blockHeader.timestamp.toString(),
|
|
63
|
-
chi: calcChi(state, +blockHeader.timestamp).toString(),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
async generateState(blockNumber = 'latest') {
|
|
69
|
-
return (0, utils_1.getOnChainState)(this.dexHelper.multiContract, this.potAddress, this.potInterface, blockNumber);
|
|
70
|
-
}
|
|
71
|
-
convertToSDai(daiAmount, blockNumber) {
|
|
72
|
-
const state = this.getState(blockNumber);
|
|
73
|
-
if (!state)
|
|
74
|
-
throw new Error(`SDai state at ${blockNumber} does not exists`);
|
|
75
|
-
return (daiAmount * RAY) / calcChi(state);
|
|
76
|
-
}
|
|
77
|
-
convertToDai(sdaiAmount, blockNumber) {
|
|
78
|
-
const state = this.getState(blockNumber);
|
|
79
|
-
if (!state)
|
|
80
|
-
throw new Error(`SDai state at ${blockNumber} does not exists`);
|
|
81
|
-
return (sdaiAmount * calcChi(state)) / RAY;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.SDaiEventPool = SDaiEventPool;
|
|
85
|
-
//# sourceMappingURL=sdai-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdai-pool.js","sourceRoot":"","sources":["../../../src/dex/sdai/sdai-pool.ts"],"names":[],"mappings":";;;AAAA,6DAAiD;AACjD,+EAA0E;AAO1E,mCAA0C;AAE1C,MAAM,GAAG,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC;AACxB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAEvB,iCAAiC;AACjC,MAAM,cAAc,GAAG,oEAAoE,CAAC;AAC5F,kBAAkB;AAClB,MAAM,cAAc,GAAG,oEAAoE,CAAC;AAC5F,kBAAkB;AAClB,MAAM,cAAc,GAAG,oEAAoE,CAAC;AAC5F,+BAA+B;AAC/B,MAAM,SAAS,GAAG,oEAAoE,CAAC;AAEvF,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE;I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B,EAAE,WAAmB;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,WAAW,kBAAkB,CAAC,CAAC;QAE5E,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,WAAmB;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,WAAW,kBAAkB,CAAC,CAAC;QAE5E,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC;IAC7C,CAAC;CACF;AA3DD,sCA2DC"}
|
package/build/dex/sdai/sdai.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { SimpleExchange } from '../simple-exchange';
|
|
2
|
-
import { IDex } from '../idex';
|
|
3
|
-
import { SDaiParams, SDaiData } from './types';
|
|
4
|
-
import { Network, SwapSide } from '../../constants';
|
|
5
|
-
import { AdapterExchangeParam, Address, ExchangePrices, Logger, PoolLiquidity, PoolPrices, SimpleExchangeParam, Token } from '../../types';
|
|
6
|
-
import { IDexHelper } from '../../dex-helper';
|
|
7
|
-
import { Interface } from 'ethers/lib/utils';
|
|
8
|
-
import { SDaiEventPool } from './sdai-pool';
|
|
9
|
-
export declare class SDai extends SimpleExchange implements IDex<SDaiData, SDaiParams> {
|
|
10
|
-
protected network: Network;
|
|
11
|
-
protected dexHelper: IDexHelper;
|
|
12
|
-
readonly daiAddress: string;
|
|
13
|
-
readonly sdaiAddress: string;
|
|
14
|
-
readonly potAddress: string;
|
|
15
|
-
protected adapters: {
|
|
16
|
-
[side: string]: {
|
|
17
|
-
name: string;
|
|
18
|
-
index: number;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
protected sdaiInterface: Interface;
|
|
22
|
-
protected potInterface: Interface;
|
|
23
|
-
readonly hasConstantPriceLargeAmounts = true;
|
|
24
|
-
readonly isFeeOnTransferSupported = false;
|
|
25
|
-
static dexKeysWithNetwork: {
|
|
26
|
-
key: string;
|
|
27
|
-
networks: Network[];
|
|
28
|
-
}[];
|
|
29
|
-
readonly eventPool: SDaiEventPool;
|
|
30
|
-
logger: Logger;
|
|
31
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, daiAddress?: string, sdaiAddress?: string, potAddress?: string, adapters?: {
|
|
32
|
-
[side: string]: {
|
|
33
|
-
name: string;
|
|
34
|
-
index: number;
|
|
35
|
-
}[];
|
|
36
|
-
}, sdaiInterface?: Interface, potInterface?: Interface);
|
|
37
|
-
getAdapters(side: SwapSide): {
|
|
38
|
-
name: string;
|
|
39
|
-
index: number;
|
|
40
|
-
}[] | null;
|
|
41
|
-
isSDai(tokenAddress: Address): boolean;
|
|
42
|
-
isDai(tokenAddress: Address): boolean;
|
|
43
|
-
isAppropriatePair(srcToken: Token, destToken: Token): boolean;
|
|
44
|
-
initializePricing(blockNumber: number): Promise<void>;
|
|
45
|
-
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
46
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<SDaiData>>;
|
|
47
|
-
getCalldataGasCost(poolPrices: PoolPrices<SDaiData>): number | number[];
|
|
48
|
-
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
49
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: SDaiData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
50
|
-
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: SDaiData, side: SwapSide): AdapterExchangeParam;
|
|
51
|
-
}
|
package/build/dex/sdai/sdai.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SDai = void 0;
|
|
30
|
-
const simple_exchange_1 = require("../simple-exchange");
|
|
31
|
-
const types_1 = require("./types");
|
|
32
|
-
const constants_1 = require("../../constants");
|
|
33
|
-
const utils_1 = require("../../utils");
|
|
34
|
-
const config_1 = require("./config");
|
|
35
|
-
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
36
|
-
const pot_json_1 = __importDefault(require("../../abi/maker-psm/pot.json"));
|
|
37
|
-
const SavingsDai_abi_json_1 = __importDefault(require("../../abi/sdai/SavingsDai.abi.json"));
|
|
38
|
-
const utils_2 = require("ethers/lib/utils");
|
|
39
|
-
const sdai_pool_1 = require("./sdai-pool");
|
|
40
|
-
const bigint_constants_1 = require("../../bigint-constants");
|
|
41
|
-
const constants_2 = require("./constants");
|
|
42
|
-
class SDai extends simple_exchange_1.SimpleExchange {
|
|
43
|
-
constructor(network, dexKey, dexHelper, daiAddress = config_1.SDaiConfig[dexKey][network].daiAddress, sdaiAddress = config_1.SDaiConfig[dexKey][network].sdaiAddress, potAddress = config_1.SDaiConfig[dexKey][network].potAddress, adapters = config_1.Adapters[network] || {}, sdaiInterface = new utils_2.Interface(SavingsDai_abi_json_1.default), potInterface = new utils_2.Interface(pot_json_1.default)) {
|
|
44
|
-
super(dexHelper, dexKey);
|
|
45
|
-
this.network = network;
|
|
46
|
-
this.dexHelper = dexHelper;
|
|
47
|
-
this.daiAddress = daiAddress;
|
|
48
|
-
this.sdaiAddress = sdaiAddress;
|
|
49
|
-
this.potAddress = potAddress;
|
|
50
|
-
this.adapters = adapters;
|
|
51
|
-
this.sdaiInterface = sdaiInterface;
|
|
52
|
-
this.potInterface = potInterface;
|
|
53
|
-
this.hasConstantPriceLargeAmounts = true;
|
|
54
|
-
this.isFeeOnTransferSupported = false;
|
|
55
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
56
|
-
this.eventPool = new sdai_pool_1.SDaiEventPool(this.dexKey, dexHelper, this.potAddress, this.potInterface, this.logger);
|
|
57
|
-
}
|
|
58
|
-
getAdapters(side) {
|
|
59
|
-
return this.adapters[side] || null;
|
|
60
|
-
}
|
|
61
|
-
isSDai(tokenAddress) {
|
|
62
|
-
return this.sdaiAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
63
|
-
}
|
|
64
|
-
isDai(tokenAddress) {
|
|
65
|
-
return this.daiAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
66
|
-
}
|
|
67
|
-
isAppropriatePair(srcToken, destToken) {
|
|
68
|
-
return ((this.isDai(srcToken.address) && this.isSDai(destToken.address)) ||
|
|
69
|
-
(this.isDai(destToken.address) && this.isSDai(srcToken.address)));
|
|
70
|
-
}
|
|
71
|
-
async initializePricing(blockNumber) {
|
|
72
|
-
await this.eventPool.initialize(blockNumber);
|
|
73
|
-
}
|
|
74
|
-
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
75
|
-
return this.isAppropriatePair(srcToken, destToken)
|
|
76
|
-
? [`${this.dexKey}_${this.sdaiAddress}`]
|
|
77
|
-
: [];
|
|
78
|
-
}
|
|
79
|
-
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
80
|
-
if (!this.isAppropriatePair(srcToken, destToken))
|
|
81
|
-
return null;
|
|
82
|
-
if (!this.eventPool.getState(blockNumber))
|
|
83
|
-
return null;
|
|
84
|
-
if (side === constants_1.SwapSide.SELL) {
|
|
85
|
-
const calcSellFn = (blockNumber, amountIn) => this.isDai(srcToken.address)
|
|
86
|
-
? this.eventPool.convertToSDai(amountIn, blockNumber)
|
|
87
|
-
: this.eventPool.convertToDai(amountIn, blockNumber);
|
|
88
|
-
return [
|
|
89
|
-
{
|
|
90
|
-
prices: amounts.map(amount => calcSellFn(blockNumber, amount)),
|
|
91
|
-
unit: calcSellFn(blockNumber, bigint_constants_1.BI_POWS[18]),
|
|
92
|
-
gasCost: constants_2.SDAI_DEPOSIT_GAS_COST,
|
|
93
|
-
exchange: this.dexKey,
|
|
94
|
-
data: { exchange: `${this.sdaiAddress}` },
|
|
95
|
-
poolAddresses: [`${this.sdaiAddress}`],
|
|
96
|
-
},
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
const calcBuyFn = (blockNumber, amountIn) => this.isDai(srcToken.address)
|
|
101
|
-
? this.eventPool.convertToDai(amountIn, blockNumber)
|
|
102
|
-
: this.eventPool.convertToSDai(amountIn, blockNumber);
|
|
103
|
-
return [
|
|
104
|
-
{
|
|
105
|
-
prices: amounts.map(amount => calcBuyFn(blockNumber, amount)),
|
|
106
|
-
unit: calcBuyFn(blockNumber, bigint_constants_1.BI_POWS[18]),
|
|
107
|
-
gasCost: constants_2.SDAI_REDEEM_GAS_COST,
|
|
108
|
-
exchange: this.dexKey,
|
|
109
|
-
data: { exchange: `${this.sdaiAddress}` },
|
|
110
|
-
poolAddresses: [`${this.sdaiAddress}`],
|
|
111
|
-
},
|
|
112
|
-
];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
116
|
-
getCalldataGasCost(poolPrices) {
|
|
117
|
-
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
118
|
-
}
|
|
119
|
-
async getTopPoolsForToken(tokenAddress, limit) {
|
|
120
|
-
if (!this.isDai(tokenAddress) && !this.isSDai(tokenAddress))
|
|
121
|
-
return [];
|
|
122
|
-
return [
|
|
123
|
-
{
|
|
124
|
-
exchange: this.dexKey,
|
|
125
|
-
address: this.sdaiAddress,
|
|
126
|
-
connectorTokens: [
|
|
127
|
-
{
|
|
128
|
-
decimals: 18,
|
|
129
|
-
address: this.isDai(tokenAddress)
|
|
130
|
-
? this.sdaiAddress
|
|
131
|
-
: this.daiAddress,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
139
|
-
const isSell = side === constants_1.SwapSide.SELL;
|
|
140
|
-
const { exchange } = data;
|
|
141
|
-
let swapData;
|
|
142
|
-
if (this.isDai(srcToken)) {
|
|
143
|
-
swapData = this.sdaiInterface.encodeFunctionData(isSell ? types_1.SDaiFunctions.deposit : types_1.SDaiFunctions.mint, [isSell ? srcAmount : destAmount, this.augustusAddress]);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
swapData = this.sdaiInterface.encodeFunctionData(isSell ? types_1.SDaiFunctions.redeem : types_1.SDaiFunctions.withdraw, [
|
|
147
|
-
isSell ? srcAmount : destAmount,
|
|
148
|
-
this.augustusAddress,
|
|
149
|
-
this.augustusAddress,
|
|
150
|
-
]);
|
|
151
|
-
}
|
|
152
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, exchange);
|
|
153
|
-
}
|
|
154
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
155
|
-
const { exchange } = data;
|
|
156
|
-
const payload = this.abiCoder.encodeParameter({
|
|
157
|
-
ParentStruct: {
|
|
158
|
-
toStaked: 'bool',
|
|
159
|
-
},
|
|
160
|
-
}, {
|
|
161
|
-
toStaked: this.isDai(srcToken),
|
|
162
|
-
});
|
|
163
|
-
return {
|
|
164
|
-
targetExchange: exchange,
|
|
165
|
-
payload,
|
|
166
|
-
networkFee: '0',
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.SDai = SDai;
|
|
171
|
-
SDai.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.SDaiConfig);
|
|
172
|
-
//# sourceMappingURL=sdai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdai.js","sourceRoot":"","sources":["../../../src/dex/sdai/sdai.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAoD;AAEpD,mCAA8D;AAC9D,+CAAoD;AACpD,uCAAoD;AACpD,qCAAgD;AAYhD,2EAA6D;AAC7D,4EAAkD;AAClD,6FAA+D;AAC/D,4CAA6C;AAC7C,2CAA4C;AAC5C,6DAAiD;AACjD,2CAA0E;AAE1E,MA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,IAAI,EACnD,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CACxD,CAAC;SACH;aAAM;YACL,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAC9C,MAAM,CAAC,CAAC,CAAC,qBAAa,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAa,CAAC,QAAQ,EACtD;gBACE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;gBAC/B,IAAI,CAAC,eAAe;gBACpB,IAAI,CAAC,eAAe;aACrB,CACF,CAAC;SACH;QAED,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAc,EACd,IAAc;QAEd,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE1B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAC3C;YACE,YAAY,EAAE;gBACZ,QAAQ,EAAE,MAAM;aACjB;SACF,EACD;YACE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC/B,CACF,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,QAAQ;YACxB,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;;AA9MH,oBA+MC;AA3Me,uBAAkB,GAC9B,IAAA,6BAAqB,EAAC,mBAAU,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Address } from '../../types';
|
|
2
|
-
export declare type SDaiData = {
|
|
3
|
-
exchange: Address;
|
|
4
|
-
};
|
|
5
|
-
export declare type SDaiParams = {
|
|
6
|
-
sdaiAddress: Address;
|
|
7
|
-
daiAddress: Address;
|
|
8
|
-
potAddress: Address;
|
|
9
|
-
};
|
|
10
|
-
export declare enum SDaiFunctions {
|
|
11
|
-
deposit = "deposit",
|
|
12
|
-
redeem = "redeem",
|
|
13
|
-
withdraw = "withdraw",
|
|
14
|
-
mint = "mint"
|
|
15
|
-
}
|
|
16
|
-
export declare type SDaiPoolState = {
|
|
17
|
-
rho: string;
|
|
18
|
-
chi: string;
|
|
19
|
-
dsr: string;
|
|
20
|
-
live: boolean;
|
|
21
|
-
};
|
package/build/dex/sdai/types.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SDaiFunctions = void 0;
|
|
4
|
-
var SDaiFunctions;
|
|
5
|
-
(function (SDaiFunctions) {
|
|
6
|
-
SDaiFunctions["deposit"] = "deposit";
|
|
7
|
-
SDaiFunctions["redeem"] = "redeem";
|
|
8
|
-
SDaiFunctions["withdraw"] = "withdraw";
|
|
9
|
-
SDaiFunctions["mint"] = "mint";
|
|
10
|
-
})(SDaiFunctions = exports.SDaiFunctions || (exports.SDaiFunctions = {}));
|
|
11
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/sdai/types.ts"],"names":[],"mappings":";;;AAUA,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,8BAAa,CAAA;AACf,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Contract } from 'web3-eth-contract';
|
|
2
|
-
import { SDaiPoolState } from './types';
|
|
3
|
-
import { Interface } from '@ethersproject/abi';
|
|
4
|
-
export declare function getOnChainState(multiContract: Contract, potAddress: string, potInterface: Interface, blockNumber: number | 'latest'): Promise<SDaiPoolState>;
|
package/build/dex/sdai/utils.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOnChainState = void 0;
|
|
4
|
-
const abi_1 = require("@ethersproject/abi");
|
|
5
|
-
const coder = new abi_1.AbiCoder();
|
|
6
|
-
// - `dsr`: the Dai Savings Rate
|
|
7
|
-
// - `chi`: the Rate Accumulator
|
|
8
|
-
// - `rho`: time of last drip
|
|
9
|
-
async function getOnChainState(multiContract, potAddress, potInterface, blockNumber) {
|
|
10
|
-
const data = await multiContract.methods
|
|
11
|
-
.aggregate([
|
|
12
|
-
{
|
|
13
|
-
target: potAddress,
|
|
14
|
-
callData: potInterface.encodeFunctionData('dsr', []),
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
target: potAddress,
|
|
18
|
-
callData: potInterface.encodeFunctionData('chi', []),
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
target: potAddress,
|
|
22
|
-
callData: potInterface.encodeFunctionData('rho', []),
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
target: potAddress,
|
|
26
|
-
callData: potInterface.encodeFunctionData('live', []),
|
|
27
|
-
},
|
|
28
|
-
])
|
|
29
|
-
.call({}, blockNumber);
|
|
30
|
-
const [dsr, chi, rho, live] = data.returnData.map(item => coder.decode(['uint256'], item)[0].toString());
|
|
31
|
-
return {
|
|
32
|
-
live: !!live,
|
|
33
|
-
dsr,
|
|
34
|
-
chi,
|
|
35
|
-
rho,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.getOnChainState = getOnChainState;
|
|
39
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/sdai/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAyD;AAGzD,MAAM,KAAK,GAAG,IAAI,cAAQ,EAAE,CAAC;AAE7B,gCAAgC;AAChC,gCAAgC;AAChC,6BAA6B;AACtB,KAAK,UAAU,eAAe,CACnC,aAAuB,EACvB,UAAkB,EAClB,YAAuB,EACvB,WAA8B;IAE9B,MAAM,IAAI,GAA0B,MAAM,aAAa,CAAC,OAAO;SAC5D,SAAS,CAAC;QACT;YACE,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC;SACrD;QACD;YACE,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC;SACrD;QACD;YACE,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC;SACrD;QACD;YACE,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,YAAY,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;SACtD;KACF,CAAC;SACD,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAEzB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACvD,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAC9C,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,GAAG;QACH,GAAG;QACH,GAAG;KACJ,CAAC;AACJ,CAAC;AArCD,0CAqCC"}
|
package/build/dex/shell.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { SwapSide } from '../constants';
|
|
3
|
-
import { AdapterExchangeParam, Address, SimpleExchangeParam } from '../types';
|
|
4
|
-
import { IDexTxBuilder } from './idex';
|
|
5
|
-
import { SimpleExchange } from './simple-exchange';
|
|
6
|
-
import { IDexHelper } from '../dex-helper';
|
|
7
|
-
export declare type ShellData = {
|
|
8
|
-
exchange: Address;
|
|
9
|
-
deadline?: number;
|
|
10
|
-
};
|
|
11
|
-
declare type ShellParam = [
|
|
12
|
-
_origin: string,
|
|
13
|
-
_target: string,
|
|
14
|
-
_originAmount: string,
|
|
15
|
-
_minTargetAmount: string,
|
|
16
|
-
_deadline: string
|
|
17
|
-
];
|
|
18
|
-
export declare class Shell extends SimpleExchange implements IDexTxBuilder<ShellData, ShellParam> {
|
|
19
|
-
static dexKeys: string[];
|
|
20
|
-
exchangeRouterInterface: Interface;
|
|
21
|
-
constructor(dexHelper: IDexHelper);
|
|
22
|
-
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: ShellData, side: SwapSide): AdapterExchangeParam;
|
|
23
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: ShellData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
package/build/dex/shell.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Shell = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const simple_exchange_1 = require("./simple-exchange");
|
|
9
|
-
const Shell_json_1 = __importDefault(require("../abi/Shell.json"));
|
|
10
|
-
var ShellFunctions;
|
|
11
|
-
(function (ShellFunctions) {
|
|
12
|
-
ShellFunctions["originSwap"] = "originSwap";
|
|
13
|
-
})(ShellFunctions || (ShellFunctions = {}));
|
|
14
|
-
class Shell extends simple_exchange_1.SimpleExchange {
|
|
15
|
-
constructor(dexHelper) {
|
|
16
|
-
super(dexHelper, 'shell');
|
|
17
|
-
this.exchangeRouterInterface = new abi_1.Interface(Shell_json_1.default);
|
|
18
|
-
}
|
|
19
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
20
|
-
return {
|
|
21
|
-
targetExchange: data.exchange,
|
|
22
|
-
payload: '0x',
|
|
23
|
-
networkFee: '0',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
27
|
-
const swapFunction = ShellFunctions.originSwap;
|
|
28
|
-
const swapFunctionParams = [
|
|
29
|
-
srcToken,
|
|
30
|
-
destToken,
|
|
31
|
-
srcAmount,
|
|
32
|
-
destAmount,
|
|
33
|
-
(0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
|
|
34
|
-
];
|
|
35
|
-
const swapData = this.exchangeRouterInterface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
36
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, data.exchange);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.Shell = Shell;
|
|
40
|
-
Shell.dexKeys = ['shell'];
|
|
41
|
-
//# sourceMappingURL=shell.js.map
|
package/build/dex/shell.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/dex/shell.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAI7D,uDAG2B;AAC3B,mEAAyC;AAczC,IAAK,cAEJ;AAFD,WAAK,cAAc;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAFI,cAAc,KAAd,cAAc,QAElB;AAED,MAAa,KACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAAC,oBAA0B,CAAC,CAAC;IAC3E,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAe,EACf,IAAc;QAEd,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,QAAQ;YAC7B,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAe,EACf,IAAc;QAEd,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC;QAC/C,MAAM,kBAAkB,GAAe;YACrC,QAAQ;YACR,SAAS;YACT,SAAS;YACT,UAAU;YACV,IAAA,uDAAqC,GAAE;SACxC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAC9D,YAAY,EACZ,kBAAkB,CACnB,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,QAAQ,CACd,CAAC;IACJ,CAAC;;AAxDH,sBAyDC;AArDQ,aAAO,GAAG,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Adapters = exports.SmardexConfig = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
const GATEWAY_SUBGRAPH = 'https://subgraph.smardex.io';
|
|
6
|
-
const MAINNET_INIT_HASH = '0xc762a0f9885cc92b9fd8eef224b75997682b634460611bc0f2138986e20b653f';
|
|
7
|
-
const LAYER2_INIT_HASH = '0x33bee911475f015247aeb1eebe149d1c6d2669be54126c29d85df6b0abb4c4e9';
|
|
8
|
-
exports.SmardexConfig = {
|
|
9
|
-
Smardex: {
|
|
10
|
-
[constants_1.Network.MAINNET]: {
|
|
11
|
-
factoryAddress: '0xB878DC600550367e14220d4916Ff678fB284214F',
|
|
12
|
-
router: '0xC33984ABcAe20f47a754eF78f6526FeF266c0C6F',
|
|
13
|
-
initCode: MAINNET_INIT_HASH,
|
|
14
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/ethereum`,
|
|
15
|
-
},
|
|
16
|
-
[constants_1.Network.ARBITRUM]: {
|
|
17
|
-
factoryAddress: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22',
|
|
18
|
-
router: '0xDA3970a20cdc2B1269fc96C4E8D300E0fdDB7b3D',
|
|
19
|
-
initCode: LAYER2_INIT_HASH,
|
|
20
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/arbitrum`,
|
|
21
|
-
},
|
|
22
|
-
[constants_1.Network.BSC]: {
|
|
23
|
-
factoryAddress: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33',
|
|
24
|
-
router: '0xaB3699B71e89a53c529eC037C3389B5A2Caf545A',
|
|
25
|
-
initCode: LAYER2_INIT_HASH,
|
|
26
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/bsc`,
|
|
27
|
-
},
|
|
28
|
-
[constants_1.Network.POLYGON]: {
|
|
29
|
-
factoryAddress: '0x9A1e1681f6D59Ca051776410465AfAda6384398f',
|
|
30
|
-
router: '0xedD758D17175Dc9131992ebd02F55Cc4ebeb7B7c',
|
|
31
|
-
initCode: LAYER2_INIT_HASH,
|
|
32
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/polygon`,
|
|
33
|
-
},
|
|
34
|
-
[constants_1.Network.BASE]: {
|
|
35
|
-
factoryAddress: '0xdd4536dD9636564D891c919416880a3e250f975A',
|
|
36
|
-
router: '0xF03D133627364E5eDDaB8134faB3A030cf7b3020',
|
|
37
|
-
initCode: LAYER2_INIT_HASH,
|
|
38
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/base`,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
exports.Adapters = {
|
|
43
|
-
[constants_1.Network.MAINNET]: {
|
|
44
|
-
[constants_1.SwapSide.SELL]: [{ name: 'Adapter04', index: 6 }],
|
|
45
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BuyAdapter02', index: 2 }],
|
|
46
|
-
},
|
|
47
|
-
[constants_1.Network.ARBITRUM]: {
|
|
48
|
-
[constants_1.SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 9 }],
|
|
49
|
-
[constants_1.SwapSide.BUY]: [{ name: 'ArbitrumBuyAdapter', index: 9 }],
|
|
50
|
-
},
|
|
51
|
-
[constants_1.Network.BSC]: {
|
|
52
|
-
[constants_1.SwapSide.SELL]: [{ name: 'BscAdapter02', index: 8 }],
|
|
53
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BscBuyAdapter', index: 7 }],
|
|
54
|
-
},
|
|
55
|
-
[constants_1.Network.POLYGON]: {
|
|
56
|
-
[constants_1.SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 9 }],
|
|
57
|
-
[constants_1.SwapSide.BUY]: [{ name: 'PolygonBuyAdapter', index: 8 }],
|
|
58
|
-
},
|
|
59
|
-
[constants_1.Network.BASE]: {
|
|
60
|
-
[constants_1.SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 8 }],
|
|
61
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BaseBuyAdapter', index: 5 }],
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/smardex/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEpD,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AACvD,MAAM,iBAAiB,GACrB,oEAAoE,CAAC;AACvE,MAAM,gBAAgB,GACpB,oEAAoE,CAAC;AAE1D,QAAA,aAAa,GAA4B;IACpD,OAAO,EAAE;QACP,CAAC,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31069d9ed20e7af9a010ca1a02d4855cee54e08e188fcc32c",
|
|
5
|
-
FEES_EVENT = "0x64f84976d9c917a44796104a59950fdbd9b3c16a5dd348b546d738301f6bd068"
|
|
6
|
-
}
|
|
7
|
-
export declare enum SmardexRouterFunctions {
|
|
8
|
-
sellExactEth = "swapExactETHForTokens",
|
|
9
|
-
sellExactToken = "swapExactTokensForETH",
|
|
10
|
-
swapExactIn = "swapExactTokensForTokens",
|
|
11
|
-
buyExactEth = "swapTokensForExactETH",
|
|
12
|
-
buyExactToken = "swapETHForExactTokens",
|
|
13
|
-
swapExactOut = "swapTokensForExactTokens"
|
|
14
|
-
}
|
|
15
|
-
export declare const directSmardexFunctionName: SmardexRouterFunctions[];
|
|
16
|
-
export declare const SUBGRAPH_TIMEOUT: number;
|
|
17
|
-
export declare const DefaultSmardexPoolGasCost: number;
|
|
18
|
-
export declare const FEES_LAYER_ONE: SmardexFees;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEES_LAYER_ONE = exports.DefaultSmardexPoolGasCost = exports.SUBGRAPH_TIMEOUT = exports.directSmardexFunctionName = exports.SmardexRouterFunctions = exports.TOPICS = void 0;
|
|
4
|
-
var TOPICS;
|
|
5
|
-
(function (TOPICS) {
|
|
6
|
-
TOPICS["SYNC_EVENT"] = "0x2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd6";
|
|
7
|
-
TOPICS["SWAP_EVENT"] = "0xa4228e1eb11eb9b31069d9ed20e7af9a010ca1a02d4855cee54e08e188fcc32c";
|
|
8
|
-
TOPICS["FEES_EVENT"] = "0x64f84976d9c917a44796104a59950fdbd9b3c16a5dd348b546d738301f6bd068";
|
|
9
|
-
})(TOPICS = exports.TOPICS || (exports.TOPICS = {}));
|
|
10
|
-
var SmardexRouterFunctions;
|
|
11
|
-
(function (SmardexRouterFunctions) {
|
|
12
|
-
SmardexRouterFunctions["sellExactEth"] = "swapExactETHForTokens";
|
|
13
|
-
SmardexRouterFunctions["sellExactToken"] = "swapExactTokensForETH";
|
|
14
|
-
SmardexRouterFunctions["swapExactIn"] = "swapExactTokensForTokens";
|
|
15
|
-
SmardexRouterFunctions["buyExactEth"] = "swapTokensForExactETH";
|
|
16
|
-
SmardexRouterFunctions["buyExactToken"] = "swapETHForExactTokens";
|
|
17
|
-
SmardexRouterFunctions["swapExactOut"] = "swapTokensForExactTokens";
|
|
18
|
-
})(SmardexRouterFunctions = exports.SmardexRouterFunctions || (exports.SmardexRouterFunctions = {}));
|
|
19
|
-
exports.directSmardexFunctionName = [
|
|
20
|
-
SmardexRouterFunctions.sellExactEth,
|
|
21
|
-
SmardexRouterFunctions.sellExactToken,
|
|
22
|
-
SmardexRouterFunctions.swapExactIn,
|
|
23
|
-
SmardexRouterFunctions.buyExactEth,
|
|
24
|
-
SmardexRouterFunctions.buyExactToken,
|
|
25
|
-
SmardexRouterFunctions.swapExactOut,
|
|
26
|
-
];
|
|
27
|
-
exports.SUBGRAPH_TIMEOUT = 20 * 1000;
|
|
28
|
-
exports.DefaultSmardexPoolGasCost = 130 * 1000;
|
|
29
|
-
exports.FEES_LAYER_ONE = {
|
|
30
|
-
feesLP: 500n,
|
|
31
|
-
feesPool: 200n,
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/smardex/constants.ts"],"names":[],"mappings":";;;AAGA,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,2FAAiF,CAAA;IACjF,2FAAiF,CAAA;IACjF,2FAAiF,CAAA;AACnF,CAAC,EAJW,MAAM,GAAN,cAAM,KAAN,cAAM,QAIjB;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,gEAAsC,CAAA;IACtC,kEAAwC,CAAA;IACxC,kEAAwC,CAAA;IACxC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;IACvC,mEAAyC,CAAA;AAC3C,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC;AAEY,QAAA,yBAAyB,GAAG;IACvC,sBAAsB,CAAC,YAAY;IACnC,sBAAsB,CAAC,cAAc;IACrC,sBAAsB,CAAC,WAAW;IAClC,sBAAsB,CAAC,WAAW;IAClC,sBAAsB,CAAC,aAAa;IACpC,sBAAsB,CAAC,YAAY;CACpC,CAAC;AAEW,QAAA,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7B,QAAA,yBAAyB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,QAAA,cAAc,GAAgB;IACzC,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC"}
|