@paraswap/dex-lib 5.0.2-native-dex-math.0 → 5.0.2-native-dex-math.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/pancakeswap-infinity/cl-pool-manager.json +80 -0
- package/build/config.js +24 -24
- package/build/dex/fluid-dex/scripts/measure-calc-time.js +178 -0
- package/build/dex/fluid-dex/scripts/measure-calc-time.js.map +1 -0
- package/build/dex/idex.d.ts +2 -2
- package/build/dex/metric/metric.d.ts +2 -2
- package/build/dex/metric/metric.js +2 -2
- package/build/dex/metric/metric.js.map +1 -1
- package/build/dex/simple-exchange.d.ts +1 -1
- package/build/dex/simple-exchange.js +1 -1
- package/build/dex/simple-exchange.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
- package/build/dex/uniswap-v3/uniswap-v3.js +4 -3
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/uniswap-v4/api-go/compare-pricing.d.ts +1 -0
- package/build/dex/uniswap-v4/api-go/compare-pricing.js +187 -0
- package/build/dex/uniswap-v4/api-go/compare-pricing.js.map +1 -0
- package/build/dex/uniswap-v4/api-go/compare-states.d.ts +1 -0
- package/build/dex/uniswap-v4/api-go/compare-states.js +149 -0
- package/build/dex/uniswap-v4/api-go/compare-states.js.map +1 -0
- package/build/dex/uniswap-v4/api-go/fetch-pool-key.d.ts +0 -0
- package/build/dex/uniswap-v4/api-go/fetch-pool-key.js +140 -0
- package/build/dex/uniswap-v4/api-go/fetch-pool-key.js.map +1 -0
- package/build/executor/Executor01BytecodeBuilder.js +4 -4
- package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor02BytecodeBuilder.js +4 -4
- package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor03BytecodeBuilder.d.ts +0 -15
- package/build/executor/Executor03BytecodeBuilder.js +1 -61
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
- package/build/executor/ExecutorBytecodeBuilder.d.ts +4 -0
- package/build/executor/ExecutorBytecodeBuilder.js +39 -0
- package/build/executor/ExecutorBytecodeBuilder.js.map +1 -1
- package/build/executor/__test-utils__/snapshot-test-helpers.d.ts +10 -0
- package/build/executor/__test-utils__/snapshot-test-helpers.js +72 -0
- package/build/executor/__test-utils__/snapshot-test-helpers.js.map +1 -0
- package/build/executor/address-utils.d.ts +2 -0
- package/build/executor/address-utils.js +7 -0
- package/build/executor/address-utils.js.map +1 -0
- package/build/executor/approval.d.ts +9 -0
- package/build/executor/approval.js +29 -0
- package/build/executor/approval.js.map +1 -0
- package/build/executor/encoding-context.d.ts +4 -0
- package/build/executor/encoding-context.js +54 -0
- package/build/executor/encoding-context.js.map +1 -0
- package/build/executor/encoding-types.d.ts +75 -0
- package/build/{dex/quick-perps/types.js → executor/encoding-types.js} +1 -1
- package/build/executor/encoding-types.js.map +1 -0
- package/build/executor/factory.d.ts +4 -0
- package/build/executor/factory.js +23 -0
- package/build/executor/factory.js.map +1 -0
- package/build/executor/route-plan.d.ts +8 -0
- package/build/executor/route-plan.js +109 -0
- package/build/executor/route-plan.js.map +1 -0
- package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.d.ts +6 -0
- package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js +39 -0
- package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js.map +1 -0
- package/build/generic-swap-transaction-builder/dex-encoder/index.d.ts +4 -0
- package/build/generic-swap-transaction-builder/dex-encoder/index.js +21 -0
- package/build/generic-swap-transaction-builder/dex-encoder/index.js.map +1 -0
- package/build/generic-swap-transaction-builder/dex-encoder/ports.d.ts +26 -0
- package/build/{dex/maker-psm/types.js → generic-swap-transaction-builder/dex-encoder/ports.js} +1 -1
- package/build/generic-swap-transaction-builder/dex-encoder/ports.js.map +1 -0
- package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.d.ts +22 -0
- package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js +299 -0
- package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js.map +1 -0
- package/build/generic-swap-transaction-builder/dex-encoder/types.d.ts +207 -0
- package/build/generic-swap-transaction-builder/dex-encoder/types.js +194 -0
- package/build/generic-swap-transaction-builder/dex-encoder/types.js.map +1 -0
- package/build/generic-swap-transaction-builder/orchestration.d.ts +65 -0
- package/build/generic-swap-transaction-builder/orchestration.js +198 -0
- package/build/generic-swap-transaction-builder/orchestration.js.map +1 -0
- package/build/generic-swap-transaction-builder/resolved/build-transaction.d.ts +13 -0
- package/build/generic-swap-transaction-builder/resolved/build-transaction.js +343 -0
- package/build/generic-swap-transaction-builder/resolved/build-transaction.js.map +1 -0
- package/build/generic-swap-transaction-builder/resolved/index.d.ts +4 -0
- package/build/generic-swap-transaction-builder/resolved/index.js +21 -0
- package/build/generic-swap-transaction-builder/resolved/index.js.map +1 -0
- package/build/generic-swap-transaction-builder/resolved/route-plan.d.ts +2 -0
- package/build/generic-swap-transaction-builder/resolved/route-plan.js +11 -0
- package/build/generic-swap-transaction-builder/resolved/route-plan.js.map +1 -0
- package/build/generic-swap-transaction-builder/resolved/types.d.ts +67 -0
- package/build/generic-swap-transaction-builder/resolved/types.js.map +1 -0
- package/build/generic-swap-transaction-builder/resolved/validation.d.ts +10 -0
- package/build/generic-swap-transaction-builder/resolved/validation.js +69 -0
- package/build/generic-swap-transaction-builder/resolved/validation.js.map +1 -0
- package/build/generic-swap-transaction-builder.d.ts +6 -4
- package/build/generic-swap-transaction-builder.js +8 -6
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +3 -0
- package/package.json +2 -2
- 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/idle-dao/idle-cdo-factory.json +0 -38
- package/build/abi/idle-dao/idle-cdo.json +0 -1245
- package/build/abi/infusion/InfusionFactory.json +0 -147
- package/build/abi/infusion/InfusionPair.json +0 -658
- package/build/abi/infusion/InfusionRouter.json +0 -442
- package/build/abi/maker-psm/pot.json +0 -322
- package/build/abi/maker-psm/psm.json +0 -243
- package/build/abi/maker-psm/vat.json +0 -363
- package/build/abi/nomiswap-v2/nomiswap-v2-pool.json +0 -773
- package/build/abi/quick-perps/fast-price-events.json +0 -70
- package/build/abi/quick-perps/fast-price-feed.json +0 -741
- package/build/abi/quick-perps/reader.json +0 -313
- package/build/abi/quick-perps/vault-price-feed.json +0 -323
- package/build/abi/quick-perps/vault.json +0 -1953
- package/build/abi/uniswap-v2/excalibur-pool.json +0 -881
- package/build/abi/uniswap-v2/mdex-factory.json +0 -759
- package/build/abi/wUSDM.json +0 -757
- 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/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/ekubo/pools/base-pool.d.ts +0 -47
- package/build/dex/ekubo/pools/base-pool.js +0 -184
- package/build/dex/ekubo/pools/base-pool.js.map +0 -1
- package/build/dex/ekubo/pools/iface.d.ts +0 -46
- package/build/dex/ekubo/pools/iface.js +0 -75
- package/build/dex/ekubo/pools/iface.js.map +0 -1
- package/build/dex/ekubo/pools/math/price.d.ts +0 -7
- package/build/dex/ekubo/pools/math/price.js +0 -112
- package/build/dex/ekubo/pools/math/price.js.map +0 -1
- package/build/dex/ekubo/pools/oracle-pool.d.ts +0 -10
- package/build/dex/ekubo/pools/oracle-pool.js +0 -19
- package/build/dex/ekubo/pools/oracle-pool.js.map +0 -1
- package/build/dex/ekubo/pools/pool-utils.d.ts +0 -44
- package/build/dex/ekubo/pools/pool-utils.js +0 -240
- package/build/dex/ekubo/pools/pool-utils.js.map +0 -1
- package/build/dex/idle-dao/config.d.ts +0 -5
- package/build/dex/idle-dao/config.js +0 -24
- package/build/dex/idle-dao/config.js.map +0 -1
- package/build/dex/idle-dao/idle-dao.d.ts +0 -42
- package/build/dex/idle-dao/idle-dao.js +0 -279
- package/build/dex/idle-dao/idle-dao.js.map +0 -1
- package/build/dex/idle-dao/token_list.d.ts +0 -4
- package/build/dex/idle-dao/token_list.js +0 -289
- package/build/dex/idle-dao/token_list.js.map +0 -1
- package/build/dex/idle-dao/tokens.d.ts +0 -9
- package/build/dex/idle-dao/tokens.js +0 -68
- package/build/dex/idle-dao/tokens.js.map +0 -1
- package/build/dex/idle-dao/types.d.ts +0 -35
- package/build/dex/idle-dao/types.js +0 -11
- package/build/dex/idle-dao/types.js.map +0 -1
- package/build/dex/idle-dao/utils.d.ts +0 -8
- package/build/dex/idle-dao/utils.js +0 -149
- package/build/dex/idle-dao/utils.js.map +0 -1
- package/build/dex/infusion/config.d.ts +0 -3
- package/build/dex/infusion/config.js +0 -20
- package/build/dex/infusion/config.js.map +0 -1
- package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
- package/build/dex/infusion/infusion-stable-pool.js +0 -74
- package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
- package/build/dex/infusion/infusion.d.ts +0 -51
- package/build/dex/infusion/infusion.js +0 -500
- package/build/dex/infusion/infusion.js.map +0 -1
- package/build/dex/infusion/types.d.ts +0 -45
- package/build/dex/infusion/types.js.map +0 -1
- package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
- package/build/dex/infusion/utils/isStablePair.js +0 -18
- package/build/dex/infusion/utils/isStablePair.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/mStable.d.ts +0 -44
- package/build/dex/mStable.js +0 -75
- package/build/dex/mStable.js.map +0 -1
- package/build/dex/maker-psm/config.d.ts +0 -11
- package/build/dex/maker-psm/config.js +0 -53
- package/build/dex/maker-psm/config.js.map +0 -1
- package/build/dex/maker-psm/maker-psm.d.ts +0 -103
- package/build/dex/maker-psm/maker-psm.js +0 -493
- package/build/dex/maker-psm/maker-psm.js.map +0 -1
- package/build/dex/maker-psm/types.d.ts +0 -39
- package/build/dex/maker-psm/types.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/quick-perps/config.d.ts +0 -11
- package/build/dex/quick-perps/config.js +0 -27
- package/build/dex/quick-perps/config.js.map +0 -1
- package/build/dex/quick-perps/fast-price-feed.d.ts +0 -26
- package/build/dex/quick-perps/fast-price-feed.js +0 -184
- package/build/dex/quick-perps/fast-price-feed.js.map +0 -1
- package/build/dex/quick-perps/pool.d.ts +0 -21
- package/build/dex/quick-perps/pool.js +0 -229
- package/build/dex/quick-perps/pool.js.map +0 -1
- package/build/dex/quick-perps/quick-perps.d.ts +0 -53
- package/build/dex/quick-perps/quick-perps.js +0 -247
- package/build/dex/quick-perps/quick-perps.js.map +0 -1
- package/build/dex/quick-perps/types.d.ts +0 -98
- package/build/dex/quick-perps/types.js.map +0 -1
- package/build/dex/quick-perps/usdq.d.ts +0 -15
- package/build/dex/quick-perps/usdq.js +0 -62
- package/build/dex/quick-perps/usdq.js.map +0 -1
- package/build/dex/quick-perps/vault-price-feed.d.ts +0 -43
- package/build/dex/quick-perps/vault-price-feed.js +0 -203
- package/build/dex/quick-perps/vault-price-feed.js.map +0 -1
- package/build/dex/quick-perps/vault-utils.d.ts +0 -8
- package/build/dex/quick-perps/vault-utils.js +0 -42
- package/build/dex/quick-perps/vault-utils.js.map +0 -1
- package/build/dex/quick-perps/vault.d.ts +0 -46
- package/build/dex/quick-perps/vault.js +0 -182
- package/build/dex/quick-perps/vault.js.map +0 -1
- package/build/dex/se-vlr/config.d.ts +0 -3
- package/build/dex/se-vlr/config.js +0 -24
- package/build/dex/se-vlr/config.js.map +0 -1
- package/build/dex/se-vlr/se-vlr-pool.d.ts +0 -39
- package/build/dex/se-vlr/se-vlr-pool.js +0 -70
- package/build/dex/se-vlr/se-vlr-pool.js.map +0 -1
- package/build/dex/se-vlr/se-vlr.d.ts +0 -35
- package/build/dex/se-vlr/se-vlr.js +0 -131
- package/build/dex/se-vlr/se-vlr.js.map +0 -1
- package/build/dex/se-vlr/types.d.ts +0 -6
- package/build/dex/se-vlr/types.js +0 -3
- package/build/dex/se-vlr/types.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/solidly/forks-override/aerodrome.d.ts +0 -14
- package/build/dex/solidly/forks-override/aerodrome.js +0 -46
- package/build/dex/solidly/forks-override/aerodrome.js.map +0 -1
- package/build/dex/solidly/forks-override/chronos.d.ts +0 -23
- package/build/dex/solidly/forks-override/chronos.js +0 -141
- package/build/dex/solidly/forks-override/chronos.js.map +0 -1
- package/build/dex/solidly/forks-override/usdfi.d.ts +0 -8
- package/build/dex/solidly/forks-override/usdfi.js +0 -15
- package/build/dex/solidly/forks-override/usdfi.js.map +0 -1
- package/build/dex/solidly/forks-override/velocimeter.d.ts +0 -23
- package/build/dex/solidly/forks-override/velocimeter.js +0 -77
- package/build/dex/solidly/forks-override/velocimeter.js.map +0 -1
- package/build/dex/tessera/types.d.ts +0 -3
- package/build/dex/tessera/types.js +0 -3
- package/build/dex/tessera/types.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/uniswap-v2/dfyn.d.ts +0 -19
- package/build/dex/uniswap-v2/dfyn.js +0 -61
- package/build/dex/uniswap-v2/dfyn.js.map +0 -1
- package/build/dex/uniswap-v2/excalibur.d.ts +0 -24
- package/build/dex/uniswap-v2/excalibur.js +0 -47
- package/build/dex/uniswap-v2/excalibur.js.map +0 -1
- package/build/dex/uniswap-v2/mdex.d.ts +0 -24
- package/build/dex/uniswap-v2/mdex.js +0 -50
- package/build/dex/uniswap-v2/mdex.js.map +0 -1
- package/build/dex/uniswap-v2/nomiswap-v2.d.ts +0 -24
- package/build/dex/uniswap-v2/nomiswap-v2.js +0 -57
- package/build/dex/uniswap-v2/nomiswap-v2.js.map +0 -1
- package/build/dex/uniswap-v3/scripts/bench-all-dexes.js +0 -160
- package/build/dex/uniswap-v3/scripts/bench-all-dexes.js.map +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +0 -94
- package/build/dex/uniswap-v3/uniswap-v3-new.js +0 -923
- package/build/dex/uniswap-v3/uniswap-v3-new.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/Position.d.ts +0 -3
- package/build/dex/uniswap-v4/contract-math/Position.js +0 -10
- package/build/dex/uniswap-v4/contract-math/Position.js.map +0 -1
- package/build/dex/usual-bond/config.d.ts +0 -3
- package/build/dex/usual-bond/config.js +0 -13
- package/build/dex/usual-bond/config.js.map +0 -1
- package/build/dex/usual-bond/types.d.ts +0 -7
- package/build/dex/usual-bond/types.js +0 -3
- package/build/dex/usual-bond/types.js.map +0 -1
- package/build/dex/usual-bond/usual-bond.d.ts +0 -35
- package/build/dex/usual-bond/usual-bond.js +0 -176
- package/build/dex/usual-bond/usual-bond.js.map +0 -1
- package/build/dex/wusdm/config.d.ts +0 -3
- package/build/dex/wusdm/config.js +0 -43
- package/build/dex/wusdm/config.js.map +0 -1
- package/build/dex/wusdm/constants.d.ts +0 -2
- package/build/dex/wusdm/constants.js +0 -6
- package/build/dex/wusdm/constants.js.map +0 -1
- package/build/dex/wusdm/types.d.ts +0 -18
- package/build/dex/wusdm/types.js +0 -11
- package/build/dex/wusdm/types.js.map +0 -1
- package/build/dex/wusdm/wusdm-pool.d.ts +0 -21
- package/build/dex/wusdm/wusdm-pool.js +0 -74
- package/build/dex/wusdm/wusdm-pool.js.map +0 -1
- package/build/dex/wusdm/wusdm.d.ts +0 -46
- package/build/dex/wusdm/wusdm.js +0 -243
- package/build/dex/wusdm/wusdm.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/dex/{uniswap-v3/scripts/bench-all-dexes.d.ts → fluid-dex/scripts/measure-calc-time.d.ts} +0 -0
- /package/build/{dex/infusion → generic-swap-transaction-builder/resolved}/types.js +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"components": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "Currency",
|
|
8
|
+
"name": "currency0",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"internalType": "Currency",
|
|
13
|
+
"name": "currency1",
|
|
14
|
+
"type": "address"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"internalType": "contract IHooks",
|
|
18
|
+
"name": "hooks",
|
|
19
|
+
"type": "address"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"internalType": "contract IPoolManager",
|
|
23
|
+
"name": "poolManager",
|
|
24
|
+
"type": "address"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"internalType": "uint24",
|
|
28
|
+
"name": "fee",
|
|
29
|
+
"type": "uint24"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"internalType": "bytes32",
|
|
33
|
+
"name": "parameters",
|
|
34
|
+
"type": "bytes32"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"internalType": "struct PoolKey",
|
|
38
|
+
"name": "key",
|
|
39
|
+
"type": "tuple"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"components": [
|
|
43
|
+
{
|
|
44
|
+
"internalType": "bool",
|
|
45
|
+
"name": "zeroForOne",
|
|
46
|
+
"type": "bool"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"internalType": "int256",
|
|
50
|
+
"name": "amountSpecified",
|
|
51
|
+
"type": "int256"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"internalType": "uint160",
|
|
55
|
+
"name": "sqrtPriceLimitX96",
|
|
56
|
+
"type": "uint160"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"internalType": "struct ICLPoolManager.SwapParams",
|
|
60
|
+
"name": "params",
|
|
61
|
+
"type": "tuple"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"internalType": "bytes",
|
|
65
|
+
"name": "hookData",
|
|
66
|
+
"type": "bytes"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"name": "swap",
|
|
70
|
+
"outputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "BalanceDelta",
|
|
73
|
+
"name": "delta",
|
|
74
|
+
"type": "int256"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"stateMutability": "nonpayable",
|
|
78
|
+
"type": "function"
|
|
79
|
+
}
|
|
80
|
+
]
|
package/build/config.js
CHANGED
|
@@ -20,8 +20,8 @@ const baseConfigs = {
|
|
|
20
20
|
privateHttpProvider: process.env.HTTP_PROVIDER_1,
|
|
21
21
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
22
22
|
executorsAddresses: {
|
|
23
|
-
Executor01: '
|
|
24
|
-
Executor02: '
|
|
23
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
24
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
25
25
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
26
26
|
},
|
|
27
27
|
adapterAddresses: {
|
|
@@ -117,8 +117,8 @@ const baseConfigs = {
|
|
|
117
117
|
bebopAuthName: process.env.API_KEY_BEBOP_AUTH_NAME || '',
|
|
118
118
|
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
119
119
|
executorsAddresses: {
|
|
120
|
-
Executor01: '
|
|
121
|
-
Executor02: '
|
|
120
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
121
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
122
122
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
123
123
|
},
|
|
124
124
|
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
@@ -152,8 +152,8 @@ const baseConfigs = {
|
|
|
152
152
|
privateHttpProvider: process.env.HTTP_PROVIDER_137,
|
|
153
153
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
154
154
|
executorsAddresses: {
|
|
155
|
-
Executor01: '
|
|
156
|
-
Executor02: '
|
|
155
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
156
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
157
157
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
158
158
|
},
|
|
159
159
|
bebopAuthName: process.env.API_KEY_BEBOP_AUTH_NAME || '',
|
|
@@ -194,8 +194,8 @@ const baseConfigs = {
|
|
|
194
194
|
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
195
195
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
196
196
|
executorsAddresses: {
|
|
197
|
-
Executor01: '
|
|
198
|
-
Executor02: '
|
|
197
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
198
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
199
199
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
200
200
|
},
|
|
201
201
|
adapterAddresses: {
|
|
@@ -227,8 +227,8 @@ const baseConfigs = {
|
|
|
227
227
|
hashFlowDisabledMMs: process.env[`HASHFLOW_DISABLED_MMS_146`]?.split(',') || [],
|
|
228
228
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
229
229
|
executorsAddresses: {
|
|
230
|
-
Executor01: '
|
|
231
|
-
Executor02: '
|
|
230
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
231
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
232
232
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
233
233
|
},
|
|
234
234
|
adapterAddresses: {},
|
|
@@ -257,8 +257,8 @@ const baseConfigs = {
|
|
|
257
257
|
hashFlowDisabledMMs: process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
|
|
258
258
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
259
259
|
executorsAddresses: {
|
|
260
|
-
Executor01: '
|
|
261
|
-
Executor02: '
|
|
260
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
261
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
262
262
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
263
263
|
},
|
|
264
264
|
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
@@ -293,8 +293,8 @@ const baseConfigs = {
|
|
|
293
293
|
privateHttpProvider: process.env.HTTP_PROVIDER_10,
|
|
294
294
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
295
295
|
executorsAddresses: {
|
|
296
|
-
Executor01: '
|
|
297
|
-
Executor02: '
|
|
296
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
297
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
298
298
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
299
299
|
},
|
|
300
300
|
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
@@ -330,8 +330,8 @@ const baseConfigs = {
|
|
|
330
330
|
augustusRFQAddress: '0x92EaD5bACf6F0E995FA46Ad8215A9b11f67ca241',
|
|
331
331
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
332
332
|
executorsAddresses: {
|
|
333
|
-
Executor01: '
|
|
334
|
-
Executor02: '
|
|
333
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
334
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
335
335
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
336
336
|
},
|
|
337
337
|
rpcPollingMaxAllowedStateDelayInBlocks: 0,
|
|
@@ -364,8 +364,8 @@ const baseConfigs = {
|
|
|
364
364
|
hashFlowDisabledMMs: [],
|
|
365
365
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
366
366
|
executorsAddresses: {
|
|
367
|
-
Executor01: '
|
|
368
|
-
Executor02: '
|
|
367
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
368
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
369
369
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
370
370
|
},
|
|
371
371
|
adapterAddresses: {
|
|
@@ -396,8 +396,8 @@ const baseConfigs = {
|
|
|
396
396
|
augustusRFQAddress: '0x92EaD5bACf6F0E995FA46Ad8215A9b11f67ca241',
|
|
397
397
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
398
398
|
executorsAddresses: {
|
|
399
|
-
Executor01: '
|
|
400
|
-
Executor02: '
|
|
399
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
400
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
401
401
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
402
402
|
},
|
|
403
403
|
rpcPollingMaxAllowedStateDelayInBlocks: 0,
|
|
@@ -426,8 +426,8 @@ const baseConfigs = {
|
|
|
426
426
|
rfqConfigs: {},
|
|
427
427
|
hashFlowDisabledMMs: [],
|
|
428
428
|
executorsAddresses: {
|
|
429
|
-
Executor01: '
|
|
430
|
-
Executor02: '
|
|
429
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
430
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
431
431
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
432
432
|
},
|
|
433
433
|
uniswapV2ExchangeRouterAddress: '0x0000000000000000000000000000000000000000',
|
|
@@ -452,8 +452,8 @@ const baseConfigs = {
|
|
|
452
452
|
augustusRFQAddress: '0x92EaD5bACf6F0E995FA46Ad8215A9b11f67ca241',
|
|
453
453
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
454
454
|
executorsAddresses: {
|
|
455
|
-
Executor01: '
|
|
456
|
-
Executor02: '
|
|
455
|
+
Executor01: '0x8faa0000c10015610005ca010ee000d006e0e820',
|
|
456
|
+
Executor02: '0x6f0538001f90d0a5f0000060d01d34c002030900',
|
|
457
457
|
Executor03: '0xa000b020c290d000020aac04026b5306d60050f0',
|
|
458
458
|
},
|
|
459
459
|
rpcPollingMaxAllowedStateDelayInBlocks: 0,
|
|
@@ -0,0 +1,178 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
/*
|
|
37
|
+
|
|
38
|
+
Measures real calculation time for FluidDex swap math.
|
|
39
|
+
Uses performance.now() for sub-millisecond precision.
|
|
40
|
+
|
|
41
|
+
*/
|
|
42
|
+
const dotenv = __importStar(require("dotenv"));
|
|
43
|
+
const log4js_1 = require("../../../lib/log4js");
|
|
44
|
+
dotenv.config();
|
|
45
|
+
const constants_1 = require("../../../constants");
|
|
46
|
+
const dex_helper_1 = require("../../../dex-helper");
|
|
47
|
+
const fluid_dex_1 = require("../fluid-dex");
|
|
48
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
49
|
+
const logger = (0, log4js_1.getLogger)('FluidDexMeasureScript');
|
|
50
|
+
const runsNumber = 1000;
|
|
51
|
+
const printFrequency = 100;
|
|
52
|
+
const network = constants_1.Network.MAINNET;
|
|
53
|
+
const dexHelper = new dex_helper_1.DummyDexHelper(network);
|
|
54
|
+
const fluidDex = new fluid_dex_1.FluidDex(network, 'FluidDex', dexHelper);
|
|
55
|
+
const side = constants_1.SwapSide.SELL;
|
|
56
|
+
// USDC
|
|
57
|
+
const srcToken = {
|
|
58
|
+
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
59
|
+
decimals: 6,
|
|
60
|
+
};
|
|
61
|
+
// ETH
|
|
62
|
+
const destToken = {
|
|
63
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
64
|
+
decimals: 18,
|
|
65
|
+
};
|
|
66
|
+
// 50 amounts from 0 to 1,000,000 USDC
|
|
67
|
+
const amounts = [0n];
|
|
68
|
+
{
|
|
69
|
+
const min = 0.001;
|
|
70
|
+
const max = 1_000_000;
|
|
71
|
+
const steps = 49;
|
|
72
|
+
const seen = new Set([0n]);
|
|
73
|
+
for (let i = 0; i < steps; i++) {
|
|
74
|
+
const value = min * Math.pow(max / min, i / (steps - 1));
|
|
75
|
+
const raw = BigInt(Math.round(value * 1e6));
|
|
76
|
+
if (!seen.has(raw)) {
|
|
77
|
+
seen.add(raw);
|
|
78
|
+
amounts.push(raw);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const aggregateAndPrintMeasures = (measures, label) => {
|
|
83
|
+
const sorted = [...measures].sort((a, b) => a - b);
|
|
84
|
+
const sum = sorted.reduce((a, b) => a + b);
|
|
85
|
+
const avg = sum / sorted.length;
|
|
86
|
+
const p50 = sorted[Math.floor(sorted.length * 0.5)];
|
|
87
|
+
const p95 = sorted[Math.floor(sorted.length * 0.95)];
|
|
88
|
+
const p99 = sorted[Math.floor(sorted.length * 0.99)];
|
|
89
|
+
const max = sorted[sorted.length - 1];
|
|
90
|
+
logger.info(` ${label ? `[${label}] ` : ''}n=${measures.length} | avg=${avg.toFixed(3)}ms | p50=${p50.toFixed(3)}ms | ` +
|
|
91
|
+
`p95=${p95.toFixed(3)}ms | p99=${p99.toFixed(3)}ms | max=${max.toFixed(3)}ms`);
|
|
92
|
+
};
|
|
93
|
+
const executeGetPricesVolume = async (blockNumber, limitPools) => {
|
|
94
|
+
return fluidDex.getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools);
|
|
95
|
+
};
|
|
96
|
+
const executeSwapInDirect = (poolData) => {
|
|
97
|
+
const syncTime = Math.floor(Date.now() / 1000);
|
|
98
|
+
for (const amount of amounts) {
|
|
99
|
+
fluidDex.swapIn(poolData.swap0To1, amount, poolData.colReserves, poolData.debtReserves, poolData.inDecimals, poolData.outDecimals, poolData.fee, poolData.dexLimits, poolData.centerPrice, syncTime);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
(async function main() {
|
|
103
|
+
logger.info(`Started FluidDex benchmark (${runsNumber} runs, ${amounts.length} amounts)\n`);
|
|
104
|
+
const blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
105
|
+
logger.info(`Block: ${blockNumber}`);
|
|
106
|
+
await fluidDex.initializePricing(blockNumber);
|
|
107
|
+
// Warm-up: fetch state & discover pools
|
|
108
|
+
const warmupResult = await executeGetPricesVolume(blockNumber);
|
|
109
|
+
if (!warmupResult || warmupResult.length === 0) {
|
|
110
|
+
logger.error('No pools found for USDC -> ETH on FluidDex');
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const poolIds = warmupResult.map(p => p.poolIdentifiers[0]);
|
|
114
|
+
logger.info(`Found ${poolIds.length} pool(s): ${poolIds.join(', ')}\n`);
|
|
115
|
+
// === Benchmark 1: Full getPricesVolume (all pools) ===
|
|
116
|
+
logger.info(`\n${'='.repeat(60)}`);
|
|
117
|
+
logger.info('BENCHMARK: Full getPricesVolume (all pools)');
|
|
118
|
+
logger.info(`${'='.repeat(60)}\n`);
|
|
119
|
+
{
|
|
120
|
+
const measures = [];
|
|
121
|
+
for (let i = 0; i < runsNumber; i++) {
|
|
122
|
+
const start = perf_hooks_1.performance.now();
|
|
123
|
+
await executeGetPricesVolume(blockNumber);
|
|
124
|
+
measures.push(perf_hooks_1.performance.now() - start);
|
|
125
|
+
if (measures.length % printFrequency === 0) {
|
|
126
|
+
aggregateAndPrintMeasures(measures);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
logger.info('');
|
|
130
|
+
aggregateAndPrintMeasures(measures, 'FINAL - all pools');
|
|
131
|
+
}
|
|
132
|
+
// === Benchmark 2: getPricesVolume per pool ===
|
|
133
|
+
logger.info(`\n${'='.repeat(60)}`);
|
|
134
|
+
logger.info('BENCHMARK: getPricesVolume per pool');
|
|
135
|
+
logger.info(`${'='.repeat(60)}\n`);
|
|
136
|
+
for (const poolId of poolIds) {
|
|
137
|
+
const measures = [];
|
|
138
|
+
for (let i = 0; i < runsNumber; i++) {
|
|
139
|
+
const start = perf_hooks_1.performance.now();
|
|
140
|
+
await executeGetPricesVolume(blockNumber, [poolId]);
|
|
141
|
+
measures.push(perf_hooks_1.performance.now() - start);
|
|
142
|
+
}
|
|
143
|
+
aggregateAndPrintMeasures(measures, poolId);
|
|
144
|
+
}
|
|
145
|
+
// === Benchmark 3: Pure sync swapIn (no async overhead) ===
|
|
146
|
+
logger.info(`\n${'='.repeat(60)}`);
|
|
147
|
+
logger.info('BENCHMARK: Pure sync swapIn per pool');
|
|
148
|
+
logger.info(`${'='.repeat(60)}\n`);
|
|
149
|
+
const liquidityProxyState = await fluidDex.liquidityProxy.getState();
|
|
150
|
+
if (liquidityProxyState) {
|
|
151
|
+
for (const pool of fluidDex.pools) {
|
|
152
|
+
const reserves = liquidityProxyState.poolsReserves.find((r) => r.pool.toLowerCase() === pool.address.toLowerCase());
|
|
153
|
+
if (!reserves)
|
|
154
|
+
continue;
|
|
155
|
+
const swap0To1 = srcToken.address.toLowerCase() === pool.token0.toLowerCase();
|
|
156
|
+
const poolData = {
|
|
157
|
+
swap0To1,
|
|
158
|
+
colReserves: reserves.collateralReserves,
|
|
159
|
+
debtReserves: reserves.debtReserves,
|
|
160
|
+
fee: BigInt(reserves.fee),
|
|
161
|
+
dexLimits: reserves.dexLimits,
|
|
162
|
+
centerPrice: BigInt(reserves.centerPrice),
|
|
163
|
+
inDecimals: srcToken.decimals,
|
|
164
|
+
outDecimals: destToken.decimals,
|
|
165
|
+
};
|
|
166
|
+
const measures = [];
|
|
167
|
+
for (let i = 0; i < runsNumber; i++) {
|
|
168
|
+
const start = perf_hooks_1.performance.now();
|
|
169
|
+
executeSwapInDirect(poolData);
|
|
170
|
+
measures.push(perf_hooks_1.performance.now() - start);
|
|
171
|
+
}
|
|
172
|
+
aggregateAndPrintMeasures(measures, `sync ${pool.address.slice(0, 10)}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
logger.info(`\nBenchmark complete.`);
|
|
176
|
+
process.exit(0);
|
|
177
|
+
})();
|
|
178
|
+
//# sourceMappingURL=measure-calc-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-calc-time.js","sourceRoot":"","sources":["../../../../src/dex/fluid-dex/scripts/measure-calc-time.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AAClB,CAAC,CAAC,EAAE,CAAC"}
|
package/build/dex/idex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncOrSync } from 'ts-essentials';
|
|
2
|
-
import { Address, SimpleExchangeParam, AdapterExchangeParam, DexExchangeParam, TxInfo, NumberAsString, Token, ExchangePrices, PoolPrices, PoolLiquidity, OptimalSwapExchange, ExchangeTxInfo, PreprocessTransactionOptions, TransferFeeParams, Config } from '../types';
|
|
2
|
+
import { Address, SimpleExchangeParam, AdapterExchangeParam, DexExchangeParam, TxInfo, NumberAsString, Token, ExchangePrices, PoolPrices, PoolLiquidity, OptimalSwapExchange, ExchangeTxInfo, PreprocessTransactionOptions, TransferFeeParams, Config, GetDexParamOptions } from '../types';
|
|
3
3
|
import { SwapSide, Network } from '../constants';
|
|
4
4
|
import { IDexHelper } from '../dex-helper/idex-helper';
|
|
5
5
|
import { OptimalRate, OptimalSwap } from '@paraswap/core';
|
|
@@ -11,7 +11,7 @@ export interface IDexTxBuilderV5<ExchangeData, DirectParam = null> {
|
|
|
11
11
|
getDirectParam?(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, expectedAmount: NumberAsString, data: ExchangeData, side: SwapSide, permit: string, uuid: string, feePercent: NumberAsString, deadline: NumberAsString, partner: string, beneficiary: string, contractMethod: string): TxInfo<DirectParam>;
|
|
12
12
|
}
|
|
13
13
|
export interface IDexTxBuilderV6<ExchangeData, DirectParam = null> {
|
|
14
|
-
getDexParam?(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: ExchangeData, side: SwapSide, executorAddress: Address): AsyncOrSync<DexExchangeParam>;
|
|
14
|
+
getDexParam?(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: ExchangeData, side: SwapSide, executorAddress: Address, options?: GetDexParamOptions): AsyncOrSync<DexExchangeParam>;
|
|
15
15
|
getDirectParamV6?(srcToken: Address, destToken: Address, fromAmount: NumberAsString, toAmount: NumberAsString, quotedAmount: NumberAsString, data: ExchangeData, side: SwapSide, permit: string, uuid: string, partnerAndFee: string, beneficiary: string, blockNumber: number, contractMethod: string): TxInfo<DirectParam>;
|
|
16
16
|
}
|
|
17
17
|
export interface IDexTxBuilder<ExchangeData, DirectParam = null> extends IDexTxBuilderV5<ExchangeData, DirectParam>, IDexTxBuilderV6<ExchangeData, DirectParam> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
2
|
import { SwapSide } from '../../constants';
|
|
3
|
-
import { AdapterExchangeParam, Address, DexExchangeParam, NumberAsString } from '../../types';
|
|
3
|
+
import { AdapterExchangeParam, Address, DexExchangeParam, GetDexParamOptions, NumberAsString } from '../../types';
|
|
4
4
|
import { IDexTxBuilder } from '../idex';
|
|
5
5
|
import { SimpleExchange } from '../simple-exchange';
|
|
6
6
|
import { IDexHelper } from '../../dex-helper';
|
|
@@ -14,5 +14,5 @@ export declare class Metric extends SimpleExchange implements IDexTxBuilder<Metr
|
|
|
14
14
|
constructor(dexHelper: IDexHelper);
|
|
15
15
|
private getPriceLimit;
|
|
16
16
|
getAdapterParam(): AdapterExchangeParam;
|
|
17
|
-
getDexParam(_srcToken: Address, _destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: MetricData, side: SwapSide): DexExchangeParam;
|
|
17
|
+
getDexParam(_srcToken: Address, _destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: MetricData, side: SwapSide, _executorAddress?: Address, options?: GetDexParamOptions): DexExchangeParam;
|
|
18
18
|
}
|
|
@@ -32,8 +32,8 @@ class Metric extends simple_exchange_1.SimpleExchange {
|
|
|
32
32
|
getAdapterParam() {
|
|
33
33
|
throw new Error('Metric: V5 not supported');
|
|
34
34
|
}
|
|
35
|
-
getDexParam(_srcToken, _destToken, srcAmount, destAmount, recipient, data, side) {
|
|
36
|
-
const deadline = (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)();
|
|
35
|
+
getDexParam(_srcToken, _destToken, srcAmount, destAmount, recipient, data, side, _executorAddress, options) {
|
|
36
|
+
const deadline = (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(options?.nowTimestampMs);
|
|
37
37
|
const priceLimit = this.getPriceLimit(data.zeroForOne);
|
|
38
38
|
const swapFunction = side === constants_1.SwapSide.SELL ? 'swapExactInput' : 'swapExactOutput';
|
|
39
39
|
const swapData = this.routerInterface.encodeFunctionData(swapFunction, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/dex/metric/metric.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,+CAA2C;
|
|
1
|
+
{"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/dex/metric/metric.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,+CAA2C;AAS3C,wDAG4B;AAC5B,yGAA+E;AAG/E,qCAIkB;AAClB,gDAAmE;AAEnE,MAAa,MACX,SAAQ,gCAAc;IASD;IANrB,MAAM,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,cAAc,GAAG,IAAI,CAAC;IAEb,eAAe,CAAY;IAC3B,aAAa,CAAU;IAEhC,YAAqB,SAAqB;QACxC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QADR,cAAS,GAAT,SAAS,CAAY;QAExC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAS,CAClC,kCAAwC,CACzC,CAAC;QAEF,MAAM,MAAM,GAAG,qBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IA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AC,CAAC,SAAS;SAChB,CAAC;IACJ,CAAC;;AA1EH,wBA2EC"}
|
|
@@ -5,7 +5,7 @@ import { Address, SimpleExchangeParam, NumberAsString } from '../types';
|
|
|
5
5
|
import { IDexHelper } from '../dex-helper';
|
|
6
6
|
import { NeedWrapNativeFunc } from './idex';
|
|
7
7
|
export declare const FRIENDLY_LOCAL_DEADLINE: number;
|
|
8
|
-
export declare const getLocalDeadlineAsFriendlyPlaceholder: () => string;
|
|
8
|
+
export declare const getLocalDeadlineAsFriendlyPlaceholder: (nowTimestampMs?: number) => string;
|
|
9
9
|
export declare class SimpleExchange {
|
|
10
10
|
protected readonly dexHelper: IDexHelper;
|
|
11
11
|
dexKey: string;
|
|
@@ -22,7 +22,7 @@ const ABI_json_1 = __importDefault(require("../abi/augustus-v6/ABI.json"));
|
|
|
22
22
|
* Here we decide to go with a high enough default so that the local deadline rarely supersedes the global router deadline.
|
|
23
23
|
*/
|
|
24
24
|
exports.FRIENDLY_LOCAL_DEADLINE = 7 * 24 * 60 * 60;
|
|
25
|
-
const getLocalDeadlineAsFriendlyPlaceholder = () => String(Math.floor(
|
|
25
|
+
const getLocalDeadlineAsFriendlyPlaceholder = (nowTimestampMs) => String(Math.floor((nowTimestampMs ?? Date.now()) / 1000) + exports.FRIENDLY_LOCAL_DEADLINE);
|
|
26
26
|
exports.getLocalDeadlineAsFriendlyPlaceholder = getLocalDeadlineAsFriendlyPlaceholder;
|
|
27
27
|
class SimpleExchange {
|
|
28
28
|
dexHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-exchange.js","sourceRoot":"","sources":["../../src/dex/simple-exchange.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,gEAAiD;AAQjD,4CAA2D;AAC3D,qGAAqE;AACrE,mEAAyC;AACzC,yEAA+C;AAC/C,oCAAwC;AACxC,4CAAwC;AAKxC,2EAAwD;AAIxD;;;;;;;GAOG;AACU,QAAA,uBAAuB,GAAG,CAAC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I,CAAC;IAC7C,CAAC;CACF;AA9GD,wCA8GC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, ExchangeTxInfo, Logger, NumberAsString, PoolLiquidity, PoolPrices, PreprocessTransactionOptions, SimpleExchangeParam, Token, TransferFeeParams, TxInfo } from '../../types';
|
|
2
|
+
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, ExchangeTxInfo, GetDexParamOptions, Logger, NumberAsString, PoolLiquidity, PoolPrices, PreprocessTransactionOptions, SimpleExchangeParam, Token, TransferFeeParams, TxInfo } from '../../types';
|
|
3
3
|
import { Network, SwapSide } from '../../constants';
|
|
4
4
|
import { IDex } from '../idex';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper';
|
|
@@ -79,7 +79,7 @@ export declare class UniswapV3 extends SimpleExchange implements IDex<UniswapV3D
|
|
|
79
79
|
};
|
|
80
80
|
static getDirectFunctionNameV6(): string[];
|
|
81
81
|
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV3Data, side: SwapSide): AdapterExchangeParam;
|
|
82
|
-
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UniswapV3Data, side: SwapSide): DexExchangeParam;
|
|
82
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UniswapV3Data, side: SwapSide, _executorAddress?: Address, options?: GetDexParamOptions): DexExchangeParam;
|
|
83
83
|
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV3Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
84
84
|
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
85
85
|
protected _getPoolBalances(pools: [pool: string, token0: string, token1: string][]): Promise<[balanceToken0: bigint | null, balanceToken1: bigint | null][]>;
|
|
@@ -719,7 +719,8 @@ class UniswapV3 extends simple_exchange_1.SimpleExchange {
|
|
|
719
719
|
networkFee: '0',
|
|
720
720
|
};
|
|
721
721
|
}
|
|
722
|
-
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
722
|
+
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side, _executorAddress, options) {
|
|
723
|
+
const deadline = (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(options?.nowTimestampMs);
|
|
723
724
|
const swapFunction = side === constants_1.SwapSide.SELL
|
|
724
725
|
? types_1.UniswapV3Functions.exactInput
|
|
725
726
|
: types_1.UniswapV3Functions.exactOutput;
|
|
@@ -727,14 +728,14 @@ class UniswapV3 extends simple_exchange_1.SimpleExchange {
|
|
|
727
728
|
const swapFunctionParams = side === constants_1.SwapSide.SELL
|
|
728
729
|
? {
|
|
729
730
|
recipient,
|
|
730
|
-
deadline
|
|
731
|
+
deadline,
|
|
731
732
|
amountIn: srcAmount,
|
|
732
733
|
amountOutMinimum: destAmount,
|
|
733
734
|
path,
|
|
734
735
|
}
|
|
735
736
|
: {
|
|
736
737
|
recipient,
|
|
737
|
-
deadline
|
|
738
|
+
deadline,
|
|
738
739
|
amountOut: destAmount,
|
|
739
740
|
amountInMaximum: srcAmount,
|
|
740
741
|
path,
|