@paraswap/dex-lib 4.1.15-0 → 4.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/aws.xml +17 -0
- package/.idea/codeStyles/Project.xml +19 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/paraswap-dex-lib.iml +9 -0
- package/.idea/prettier.xml +7 -0
- package/.idea/vcs.xml +6 -0
- package/build/abi/integral/factory.json +333 -0
- package/build/abi/integral/oracle.json +501 -0
- package/build/abi/{inception/inception-ineth-pool.json → integral/pool.json} +522 -543
- package/build/abi/{wombat/pool.json → integral/relayer.json} +720 -473
- package/build/abi/uniswap-v4/pool-manager.abi.json +1366 -0
- package/build/abi/uniswap-v4/state-view.abi.json +365 -0
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -23
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +49 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +104 -0
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +1 -0
- package/build/dex/integral/config.d.ts +4 -0
- package/build/dex/integral/config.js +20 -0
- package/build/dex/integral/config.js.map +1 -0
- package/build/dex/integral/context.d.ts +40 -0
- package/build/dex/integral/context.js +158 -0
- package/build/dex/integral/context.js.map +1 -0
- package/build/dex/integral/integral-factory.d.ts +24 -0
- package/build/dex/integral/integral-factory.js +95 -0
- package/build/dex/integral/integral-factory.js.map +1 -0
- package/build/dex/integral/integral-pool.d.ts +50 -0
- package/build/dex/integral/integral-pool.js +149 -0
- package/build/dex/integral/integral-pool.js.map +1 -0
- package/build/dex/integral/integral-pricing.d.ts +18 -0
- package/build/dex/integral/integral-pricing.js +114 -0
- package/build/dex/integral/integral-pricing.js.map +1 -0
- package/build/dex/integral/integral-relayer.d.ts +42 -0
- package/build/dex/integral/integral-relayer.js +192 -0
- package/build/dex/integral/integral-relayer.js.map +1 -0
- package/build/dex/integral/integral-token.d.ts +27 -0
- package/build/dex/integral/integral-token.js +59 -0
- package/build/dex/integral/integral-token.js.map +1 -0
- package/build/dex/integral/integral.d.ts +41 -0
- package/build/dex/integral/integral.js +376 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +85 -0
- package/build/dex/integral/types.js +9 -0
- package/build/dex/integral/types.js.map +1 -0
- package/build/dex/integral/utils-e2e.d.ts +9 -0
- package/build/dex/integral/utils-e2e.js +131 -0
- package/build/dex/integral/utils-e2e.js.map +1 -0
- package/build/dex/integral/utils.d.ts +17 -0
- package/build/dex/integral/utils.js +94 -0
- package/build/dex/integral/utils.js.map +1 -0
- package/build/dex/jarvis.d.ts +1 -2
- package/build/dex/jarvis.js +0 -58
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/{usual-m-usd0 → m-token}/config.d.ts +2 -2
- package/build/dex/m-token/config.js +19 -0
- package/build/dex/m-token/config.js.map +1 -0
- package/build/dex/m-token/m-token.d.ts +29 -0
- package/build/dex/m-token/m-token.js +145 -0
- package/build/dex/m-token/m-token.js.map +1 -0
- package/build/dex/m-token/m-wrapped-m.d.ts +17 -0
- package/build/dex/m-token/m-wrapped-m.js +50 -0
- package/build/dex/m-token/m-wrapped-m.js.map +1 -0
- package/build/dex/m-token/types.d.ts +12 -0
- package/build/dex/{inception → m-token}/types.js.map +1 -1
- package/build/dex/maverick-v2/maverick-v2-pool.js +2 -2
- package/build/dex/maverick-v2/maverick-v2-pool.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -45
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/spark/spark-psm.js +2 -2
- package/build/dex/spark/spark-psm.js.map +1 -1
- package/build/dex/spark/spark.js +1 -1
- package/build/dex/spark/spark.js.map +1 -1
- package/build/dex/spark/susds-psm.d.ts +49 -0
- package/build/dex/spark/susds-psm.js +245 -0
- package/build/dex/spark/susds-psm.js.map +1 -0
- package/build/dex/stable-pool.js +8 -1
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -14
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
- package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
- package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
- package/build/dex/uniswap-v4/config.js +43 -0
- package/build/dex/uniswap-v4/config.js.map +1 -1
- package/build/dex/uniswap-v4/constants.d.ts +7 -0
- package/build/dex/uniswap-v4/constants.js +18 -0
- package/build/dex/uniswap-v4/constants.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js +53 -0
- package/build/dex/uniswap-v4/contract-math/BitMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js +8 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js +9 -0
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js +19 -0
- package/build/dex/uniswap-v4/contract-math/FullMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.d.ts +3 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js +18 -0
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/Position.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/Position.js +39 -0
- package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.d.ts +11 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js +80 -0
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js +70 -0
- package/build/dex/uniswap-v4/contract-math/SwapMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/Tick.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/Tick.js +40 -0
- package/build/dex/uniswap-v4/contract-math/Tick.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js +40 -0
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.d.ts +9 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js +164 -0
- package/build/dex/uniswap-v4/contract-math/TickMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js +16 -0
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.d.ts +8 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js +11 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.d.ts +15 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js +108 -0
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js.map +1 -0
- package/build/dex/uniswap-v4/contract-math/utils.d.ts +4 -0
- package/build/dex/uniswap-v4/contract-math/utils.js +23 -0
- package/build/dex/uniswap-v4/contract-math/utils.js.map +1 -0
- package/build/dex/uniswap-v4/encoder.js +12 -2
- package/build/dex/uniswap-v4/encoder.js.map +1 -1
- package/build/dex/uniswap-v4/subgraph.d.ts +5 -0
- package/build/dex/uniswap-v4/subgraph.js +80 -0
- package/build/dex/uniswap-v4/subgraph.js.map +1 -0
- package/build/dex/uniswap-v4/types.d.ts +72 -4
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +33 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +260 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -0
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +6 -6
- package/build/dex/uniswap-v4/uniswap-v4.js +29 -47
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
- package/build/dex/uniswap-v4/utils.d.ts +2 -0
- package/build/dex/uniswap-v4/utils.js +15 -0
- package/build/dex/uniswap-v4/utils.js.map +1 -0
- package/build/dex/zerox/index.d.ts +26 -4
- package/build/dex/zerox/index.js +42 -50
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +0 -29
- package/build/dex/zerox/types.js +1 -8
- package/build/dex/zerox/types.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/maverick-v2/maverick-v2-pool.ts +2 -2
- package/src/dex/spark/spark-psm.ts +2 -2
- package/src/dex/spark/spark.ts +1 -1
- package/.vscode/launch.json +0 -53
- package/.vscode/settings.json +0 -2
- package/.vscode/tasks.json +0 -15
- package/build/abi/inception/inception-ratio-feed.json +0 -329
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- package/build/abi/usual-m-smart-m/usualM.abi.json +0 -483
- package/build/dex/aave-v2/tokens-avalanche.json +0 -44
- package/build/dex/aave-v2/tokens-mainnet.json +0 -188
- package/build/dex/aave-v2/tokens-polygon.json +0 -44
- package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +0 -729
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js +0 -732
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +0 -1
- package/build/dex/balancer-v3/abi/balancerRouter.d.ts +0 -1406
- package/build/dex/balancer-v3/abi/balancerRouter.js +0 -1175
- package/build/dex/balancer-v3/abi/balancerRouter.js.map +0 -1
- package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +0 -2081
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js +0 -1851
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +0 -1
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +0 -34
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +0 -406
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +0 -1
- package/build/dex/balancer-v3/gyroECLPPool.d.ts +0 -11
- package/build/dex/balancer-v3/gyroECLPPool.js +0 -6
- package/build/dex/balancer-v3/gyroECLPPool.js.map +0 -1
- package/build/dex/balancer-v3/utils.d.ts +0 -2
- package/build/dex/balancer-v3/utils.js +0 -11
- package/build/dex/balancer-v3/utils.js.map +0 -1
- package/build/dex/erc4626/scripts/validate-state.d.ts +0 -0
- package/build/dex/erc4626/scripts/validate-state.js +0 -146
- package/build/dex/erc4626/scripts/validate-state.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -4
- package/build/dex/inception/config.js +0 -109
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -16
- package/build/dex/inception/inception-event-pool.js +0 -49
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -43
- package/build/dex/inception/inception.js +0 -180
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/utils.d.ts +0 -7
- package/build/dex/inception/utils.js +0 -58
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +0 -185
- package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
- package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +0 -4
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js +0 -43
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +0 -1
- package/build/dex/uniswap-v3/uniswap-v3-worker.js +0 -10
- package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +0 -1
- package/build/dex/usual/usual-m-smart-m.d.ts +0 -17
- package/build/dex/usual/usual-m-smart-m.js +0 -50
- package/build/dex/usual/usual-m-smart-m.js.map +0 -1
- package/build/dex/usual-m-smart-m/config.d.ts +0 -3
- package/build/dex/usual-m-smart-m/config.js +0 -13
- package/build/dex/usual-m-smart-m/config.js.map +0 -1
- package/build/dex/usual-m-smart-m/types.d.ts +0 -7
- package/build/dex/usual-m-smart-m/types.js +0 -3
- package/build/dex/usual-m-smart-m/types.js.map +0 -1
- package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +0 -35
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js +0 -161
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +0 -1
- package/build/dex/usual-m-usd0/config.js +0 -14
- package/build/dex/usual-m-usd0/config.js.map +0 -1
- package/build/dex/usual-m-usd0/types.d.ts +0 -8
- package/build/dex/usual-m-usd0/types.js +0 -3
- package/build/dex/usual-m-usd0/types.js.map +0 -1
- package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +0 -35
- package/build/dex/usual-m-usd0/usual-m-usd0.js +0 -159
- package/build/dex/usual-m-usd0/usual-m-usd0.js.map +0 -1
- /package/build/dex/{inception → m-token}/types.js +0 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "contract IPoolManager",
|
|
6
|
+
"name": "_poolManager",
|
|
7
|
+
"type": "address"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"stateMutability": "nonpayable",
|
|
11
|
+
"type": "constructor"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"inputs": [
|
|
15
|
+
{
|
|
16
|
+
"internalType": "PoolId",
|
|
17
|
+
"name": "poolId",
|
|
18
|
+
"type": "bytes32"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"name": "getFeeGrowthGlobals",
|
|
22
|
+
"outputs": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "uint256",
|
|
25
|
+
"name": "feeGrowthGlobal0",
|
|
26
|
+
"type": "uint256"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"internalType": "uint256",
|
|
30
|
+
"name": "feeGrowthGlobal1",
|
|
31
|
+
"type": "uint256"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"stateMutability": "view",
|
|
35
|
+
"type": "function"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"inputs": [
|
|
39
|
+
{
|
|
40
|
+
"internalType": "PoolId",
|
|
41
|
+
"name": "poolId",
|
|
42
|
+
"type": "bytes32"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"internalType": "int24",
|
|
46
|
+
"name": "tickLower",
|
|
47
|
+
"type": "int24"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"internalType": "int24",
|
|
51
|
+
"name": "tickUpper",
|
|
52
|
+
"type": "int24"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"name": "getFeeGrowthInside",
|
|
56
|
+
"outputs": [
|
|
57
|
+
{
|
|
58
|
+
"internalType": "uint256",
|
|
59
|
+
"name": "feeGrowthInside0X128",
|
|
60
|
+
"type": "uint256"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"internalType": "uint256",
|
|
64
|
+
"name": "feeGrowthInside1X128",
|
|
65
|
+
"type": "uint256"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"stateMutability": "view",
|
|
69
|
+
"type": "function"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"inputs": [
|
|
73
|
+
{
|
|
74
|
+
"internalType": "PoolId",
|
|
75
|
+
"name": "poolId",
|
|
76
|
+
"type": "bytes32"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "getLiquidity",
|
|
80
|
+
"outputs": [
|
|
81
|
+
{
|
|
82
|
+
"internalType": "uint128",
|
|
83
|
+
"name": "liquidity",
|
|
84
|
+
"type": "uint128"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"stateMutability": "view",
|
|
88
|
+
"type": "function"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"inputs": [
|
|
92
|
+
{
|
|
93
|
+
"internalType": "PoolId",
|
|
94
|
+
"name": "poolId",
|
|
95
|
+
"type": "bytes32"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"internalType": "bytes32",
|
|
99
|
+
"name": "positionId",
|
|
100
|
+
"type": "bytes32"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"name": "getPositionInfo",
|
|
104
|
+
"outputs": [
|
|
105
|
+
{
|
|
106
|
+
"internalType": "uint128",
|
|
107
|
+
"name": "liquidity",
|
|
108
|
+
"type": "uint128"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"internalType": "uint256",
|
|
112
|
+
"name": "feeGrowthInside0LastX128",
|
|
113
|
+
"type": "uint256"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"internalType": "uint256",
|
|
117
|
+
"name": "feeGrowthInside1LastX128",
|
|
118
|
+
"type": "uint256"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"stateMutability": "view",
|
|
122
|
+
"type": "function"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"inputs": [
|
|
126
|
+
{
|
|
127
|
+
"internalType": "PoolId",
|
|
128
|
+
"name": "poolId",
|
|
129
|
+
"type": "bytes32"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"internalType": "address",
|
|
133
|
+
"name": "owner",
|
|
134
|
+
"type": "address"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"internalType": "int24",
|
|
138
|
+
"name": "tickLower",
|
|
139
|
+
"type": "int24"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"internalType": "int24",
|
|
143
|
+
"name": "tickUpper",
|
|
144
|
+
"type": "int24"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"internalType": "bytes32",
|
|
148
|
+
"name": "salt",
|
|
149
|
+
"type": "bytes32"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"name": "getPositionInfo",
|
|
153
|
+
"outputs": [
|
|
154
|
+
{
|
|
155
|
+
"internalType": "uint128",
|
|
156
|
+
"name": "liquidity",
|
|
157
|
+
"type": "uint128"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"internalType": "uint256",
|
|
161
|
+
"name": "feeGrowthInside0LastX128",
|
|
162
|
+
"type": "uint256"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"internalType": "uint256",
|
|
166
|
+
"name": "feeGrowthInside1LastX128",
|
|
167
|
+
"type": "uint256"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"stateMutability": "view",
|
|
171
|
+
"type": "function"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"inputs": [
|
|
175
|
+
{
|
|
176
|
+
"internalType": "PoolId",
|
|
177
|
+
"name": "poolId",
|
|
178
|
+
"type": "bytes32"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"internalType": "bytes32",
|
|
182
|
+
"name": "positionId",
|
|
183
|
+
"type": "bytes32"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "getPositionLiquidity",
|
|
187
|
+
"outputs": [
|
|
188
|
+
{
|
|
189
|
+
"internalType": "uint128",
|
|
190
|
+
"name": "liquidity",
|
|
191
|
+
"type": "uint128"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"stateMutability": "view",
|
|
195
|
+
"type": "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [
|
|
199
|
+
{
|
|
200
|
+
"internalType": "PoolId",
|
|
201
|
+
"name": "poolId",
|
|
202
|
+
"type": "bytes32"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"name": "getSlot0",
|
|
206
|
+
"outputs": [
|
|
207
|
+
{
|
|
208
|
+
"internalType": "uint160",
|
|
209
|
+
"name": "sqrtPriceX96",
|
|
210
|
+
"type": "uint160"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"internalType": "int24",
|
|
214
|
+
"name": "tick",
|
|
215
|
+
"type": "int24"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"internalType": "uint24",
|
|
219
|
+
"name": "protocolFee",
|
|
220
|
+
"type": "uint24"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"internalType": "uint24",
|
|
224
|
+
"name": "lpFee",
|
|
225
|
+
"type": "uint24"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"stateMutability": "view",
|
|
229
|
+
"type": "function"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"inputs": [
|
|
233
|
+
{
|
|
234
|
+
"internalType": "PoolId",
|
|
235
|
+
"name": "poolId",
|
|
236
|
+
"type": "bytes32"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"internalType": "int16",
|
|
240
|
+
"name": "tick",
|
|
241
|
+
"type": "int16"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"name": "getTickBitmap",
|
|
245
|
+
"outputs": [
|
|
246
|
+
{
|
|
247
|
+
"internalType": "uint256",
|
|
248
|
+
"name": "tickBitmap",
|
|
249
|
+
"type": "uint256"
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"stateMutability": "view",
|
|
253
|
+
"type": "function"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"inputs": [
|
|
257
|
+
{
|
|
258
|
+
"internalType": "PoolId",
|
|
259
|
+
"name": "poolId",
|
|
260
|
+
"type": "bytes32"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"internalType": "int24",
|
|
264
|
+
"name": "tick",
|
|
265
|
+
"type": "int24"
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"name": "getTickFeeGrowthOutside",
|
|
269
|
+
"outputs": [
|
|
270
|
+
{
|
|
271
|
+
"internalType": "uint256",
|
|
272
|
+
"name": "feeGrowthOutside0X128",
|
|
273
|
+
"type": "uint256"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"internalType": "uint256",
|
|
277
|
+
"name": "feeGrowthOutside1X128",
|
|
278
|
+
"type": "uint256"
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
"stateMutability": "view",
|
|
282
|
+
"type": "function"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"inputs": [
|
|
286
|
+
{
|
|
287
|
+
"internalType": "PoolId",
|
|
288
|
+
"name": "poolId",
|
|
289
|
+
"type": "bytes32"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"internalType": "int24",
|
|
293
|
+
"name": "tick",
|
|
294
|
+
"type": "int24"
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"name": "getTickInfo",
|
|
298
|
+
"outputs": [
|
|
299
|
+
{
|
|
300
|
+
"internalType": "uint128",
|
|
301
|
+
"name": "liquidityGross",
|
|
302
|
+
"type": "uint128"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"internalType": "int128",
|
|
306
|
+
"name": "liquidityNet",
|
|
307
|
+
"type": "int128"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"internalType": "uint256",
|
|
311
|
+
"name": "feeGrowthOutside0X128",
|
|
312
|
+
"type": "uint256"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"internalType": "uint256",
|
|
316
|
+
"name": "feeGrowthOutside1X128",
|
|
317
|
+
"type": "uint256"
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"stateMutability": "view",
|
|
321
|
+
"type": "function"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"inputs": [
|
|
325
|
+
{
|
|
326
|
+
"internalType": "PoolId",
|
|
327
|
+
"name": "poolId",
|
|
328
|
+
"type": "bytes32"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"internalType": "int24",
|
|
332
|
+
"name": "tick",
|
|
333
|
+
"type": "int24"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"name": "getTickLiquidity",
|
|
337
|
+
"outputs": [
|
|
338
|
+
{
|
|
339
|
+
"internalType": "uint128",
|
|
340
|
+
"name": "liquidityGross",
|
|
341
|
+
"type": "uint128"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"internalType": "int128",
|
|
345
|
+
"name": "liquidityNet",
|
|
346
|
+
"type": "int128"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"stateMutability": "view",
|
|
350
|
+
"type": "function"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"inputs": [],
|
|
354
|
+
"name": "poolManager",
|
|
355
|
+
"outputs": [
|
|
356
|
+
{
|
|
357
|
+
"internalType": "contract IPoolManager",
|
|
358
|
+
"name": "",
|
|
359
|
+
"type": "address"
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
"stateMutability": "view",
|
|
363
|
+
"type": "function"
|
|
364
|
+
}
|
|
365
|
+
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger
|
|
2
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger } from '../../types';
|
|
3
3
|
import { SwapSide, Network } from '../../constants';
|
|
4
4
|
import { IDex } from '../../dex/idex';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
@@ -28,7 +28,6 @@ export declare class AaveV1 extends SimpleExchange implements IDex<AaveV1Data, A
|
|
|
28
28
|
getCalldataGasCost(poolPrices: PoolPrices<AaveV1Data>): number | number[];
|
|
29
29
|
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): AdapterExchangeParam;
|
|
30
30
|
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
31
|
-
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: AaveV1Data, side: SwapSide): DexExchangeParam;
|
|
32
31
|
updatePoolState(): Promise<void>;
|
|
33
32
|
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
34
33
|
}
|
|
@@ -139,29 +139,6 @@ class AaveV1 extends simple_exchange_1.SimpleExchange {
|
|
|
139
139
|
const swapData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
140
140
|
return this.buildSimpleParamWithoutWETHConversion(srcToken, amount, destToken, destAmount, swapData, swapCallee, spender);
|
|
141
141
|
}
|
|
142
|
-
// DEAD
|
|
143
|
-
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
144
|
-
const amount = side === constants_1.SwapSide.SELL ? srcAmount : destAmount;
|
|
145
|
-
const [Interface, swapFunction, swapFunctionParams, swapCallee] = (() => {
|
|
146
|
-
if (data.fromAToken) {
|
|
147
|
-
return [this.aContract, AaveV1Functions.redeem, [amount], srcToken];
|
|
148
|
-
}
|
|
149
|
-
return [
|
|
150
|
-
this.aavePool,
|
|
151
|
-
AaveV1Functions.deposit,
|
|
152
|
-
[srcToken, amount, REF_CODE],
|
|
153
|
-
AAVE_LENDING_POOL,
|
|
154
|
-
];
|
|
155
|
-
})();
|
|
156
|
-
const exchangeData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
157
|
-
return {
|
|
158
|
-
needWrapNative: this.needWrapNative,
|
|
159
|
-
dexFuncHasRecipient: false,
|
|
160
|
-
exchangeData,
|
|
161
|
-
targetExchange: swapCallee,
|
|
162
|
-
returnAmountPos: undefined,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
142
|
// This is called once before getTopPoolsForToken is
|
|
166
143
|
// called for multiple tokens. This can be helpful to
|
|
167
144
|
// update common state required for calculating
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aave-v1.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/aave-v1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;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,CAAC;gBAC5B,iBAAiB;gBACjB,UAAU,EAAE,UAAU;aACvB,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;QAEP,MAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAC3C,YAAY,EACZ,kBAAkB,CACnB,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,qDAAqD;IACrD,+CAA+C;IAC/C,gDAAgD;IAChD,oBAAoB;IACpB,eAAe;QACb,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,oDAAoD;IACpD,yCAAyC;IACzC,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO,EAAE,CAAC;IACZ,CAAC;;AApLH,wBAqLC;AA9Ke,yBAAkB,GAC9B,IAAA,6BAAqB,EAAC,qBAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BytesLike } from 'ethers/lib/utils';
|
|
3
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
4
|
+
import { Log, Logger } from '../../types';
|
|
5
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
7
|
+
import { CommonAddresses, Pool } from './types';
|
|
8
|
+
import { MultiResult } from '../../lib/multi-wrapper';
|
|
9
|
+
import { Address } from '../../types';
|
|
10
|
+
export declare class FluidDexCommonAddresses extends StatefulEventSubscriber<Pool[]> {
|
|
11
|
+
readonly parentName: string;
|
|
12
|
+
readonly commonAddresses: CommonAddresses;
|
|
13
|
+
protected network: number;
|
|
14
|
+
protected dexHelper: IDexHelper;
|
|
15
|
+
handlers: {
|
|
16
|
+
[event: string]: (event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>) => Promise<DeepReadonly<Pool[]> | null>;
|
|
17
|
+
};
|
|
18
|
+
logDecoder: (log: Log) => any;
|
|
19
|
+
addressesSubscribed: Address[];
|
|
20
|
+
protected dexFactoryIface: Interface;
|
|
21
|
+
protected resolverIface: Interface;
|
|
22
|
+
constructor(parentName: string, commonAddresses: CommonAddresses, network: number, dexHelper: IDexHelper, logger: Logger);
|
|
23
|
+
/**
|
|
24
|
+
* Handle a trade rate change on the pool.
|
|
25
|
+
*/
|
|
26
|
+
handleDexDeployed(event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
|
|
27
|
+
decodePool: (result: MultiResult<BytesLike> | BytesLike) => Pool;
|
|
28
|
+
/**
|
|
29
|
+
* The function is called every time any of the subscribed
|
|
30
|
+
* addresses release log. The function accepts the current
|
|
31
|
+
* state, updates the state according to the log, and returns
|
|
32
|
+
* the updated state.
|
|
33
|
+
* @param state - Current state of event subscriber
|
|
34
|
+
* @param log - Log released by one of the subscribed addresses
|
|
35
|
+
* @returns Updates state of the event subscriber after the log
|
|
36
|
+
*/
|
|
37
|
+
processLog(state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
|
|
38
|
+
getStateOrGenerate(blockNumber: number, readonly?: boolean): Promise<DeepReadonly<Pool[]>>;
|
|
39
|
+
/**
|
|
40
|
+
* The function generates state using on-chain calls. This
|
|
41
|
+
* function is called to regenerate state if the event based
|
|
42
|
+
* system fails to fetch events and the local state is no
|
|
43
|
+
* more correct.
|
|
44
|
+
* @param blockNumber - Blocknumber for which the state should
|
|
45
|
+
* should be generated
|
|
46
|
+
* @returns state of the event subscriber at blocknumber
|
|
47
|
+
*/
|
|
48
|
+
generateState(blockNumber: number): Promise<DeepReadonly<Pool[]>>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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.FluidDexCommonAddresses = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
10
|
+
const resolver_abi_json_1 = __importDefault(require("../../abi/fluid-dex/resolver.abi.json"));
|
|
11
|
+
const dexFactory_abi_json_1 = __importDefault(require("../../abi/fluid-dex/dexFactory.abi.json"));
|
|
12
|
+
const decoders_1 = require("../../lib/decoders");
|
|
13
|
+
const ethers_1 = require("ethers");
|
|
14
|
+
class FluidDexCommonAddresses extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
15
|
+
constructor(parentName, commonAddresses, network, dexHelper, logger) {
|
|
16
|
+
super(parentName, 'getAllPools', dexHelper, logger);
|
|
17
|
+
this.parentName = parentName;
|
|
18
|
+
this.commonAddresses = commonAddresses;
|
|
19
|
+
this.network = network;
|
|
20
|
+
this.dexHelper = dexHelper;
|
|
21
|
+
this.handlers = {};
|
|
22
|
+
this.dexFactoryIface = new abi_1.Interface(dexFactory_abi_json_1.default);
|
|
23
|
+
this.resolverIface = new abi_1.Interface(resolver_abi_json_1.default);
|
|
24
|
+
this.decodePool = (result) => {
|
|
25
|
+
return (0, decoders_1.generalDecoder)(result, ['tuple(address pool, address token0, address token1, uint256 fee)'], undefined, decoded => {
|
|
26
|
+
return {
|
|
27
|
+
address: decoded[0].toLowerCase(),
|
|
28
|
+
token0: decoded[1].toLowerCase(),
|
|
29
|
+
token1: decoded[2].toLowerCase(),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
this.logDecoder = (log) => this.dexFactoryIface.parseLog(log);
|
|
34
|
+
this.addressesSubscribed = [commonAddresses.dexFactory];
|
|
35
|
+
// Add handlers
|
|
36
|
+
this.handlers['DexDeployed'] = this.handleDexDeployed.bind(this);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Handle a trade rate change on the pool.
|
|
40
|
+
*/
|
|
41
|
+
async handleDexDeployed(event, state, log) {
|
|
42
|
+
const blockNumber_ = await this.dexHelper.provider.getBlockNumber();
|
|
43
|
+
return this.getStateOrGenerate(blockNumber_, false);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The function is called every time any of the subscribed
|
|
47
|
+
* addresses release log. The function accepts the current
|
|
48
|
+
* state, updates the state according to the log, and returns
|
|
49
|
+
* the updated state.
|
|
50
|
+
* @param state - Current state of event subscriber
|
|
51
|
+
* @param log - Log released by one of the subscribed addresses
|
|
52
|
+
* @returns Updates state of the event subscriber after the log
|
|
53
|
+
*/
|
|
54
|
+
async processLog(state, log) {
|
|
55
|
+
try {
|
|
56
|
+
let event;
|
|
57
|
+
try {
|
|
58
|
+
event = this.logDecoder(log);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (event.name in this.handlers) {
|
|
64
|
+
return await this.handlers[event.name](event, state, log);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
async getStateOrGenerate(blockNumber, readonly = false) {
|
|
73
|
+
let state = this.getState(blockNumber);
|
|
74
|
+
if (!state) {
|
|
75
|
+
state = await this.generateState(blockNumber);
|
|
76
|
+
if (!readonly)
|
|
77
|
+
this.setState(state, blockNumber);
|
|
78
|
+
}
|
|
79
|
+
return state;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The function generates state using on-chain calls. This
|
|
83
|
+
* function is called to regenerate state if the event based
|
|
84
|
+
* system fails to fetch events and the local state is no
|
|
85
|
+
* more correct.
|
|
86
|
+
* @param blockNumber - Blocknumber for which the state should
|
|
87
|
+
* should be generated
|
|
88
|
+
* @returns state of the event subscriber at blocknumber
|
|
89
|
+
*/
|
|
90
|
+
async generateState(blockNumber) {
|
|
91
|
+
const resolverContract = new ethers_1.Contract(this.commonAddresses.resolver, resolver_abi_json_1.default, this.dexHelper.provider);
|
|
92
|
+
const rawResult = await resolverContract.callStatic.getAllPools({
|
|
93
|
+
blockTag: blockNumber,
|
|
94
|
+
});
|
|
95
|
+
const pools = rawResult.map((result) => ({
|
|
96
|
+
address: result[0],
|
|
97
|
+
token0: result[1],
|
|
98
|
+
token1: result[2],
|
|
99
|
+
}));
|
|
100
|
+
return pools;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.FluidDexCommonAddresses = FluidDexCommonAddresses;
|
|
104
|
+
//# sourceMappingURL=fluid-dex-generate-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluid-dex-generate-pool.js","sourceRoot":"","sources":["../../../src/dex/fluid-dex/fluid-dex-generate-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAI/C,uCAAiD;AACjD,+EAA0E;AAE1E,8FAAgE;AAChE,kGAAoE;AAIpE,iDAAoD;AACpD,mCAAkC;AAElC,MAAa,uBAAwB,SAAQ,mDAA+B;IAe1E,YACW,UAAkB,EAClB,eAAgC,EAC/B,OAAe,EACf,SAAqB,EAC/B,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN3C,eAAU,GAAV,UAAU,CAAQ;QAClB,oBAAe,GAAf,eAAe,CAAiB;QAC/B,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAlBjC,aAAQ,GAMJ,EAAE,CAAC;QAKG,oBAAe,GAAG,IAAI,eAAS,CAAC,6BAAa,CAAC,CAAC;QAC/C,kBAAa,GAAG,IAAI,eAAS,CAAC,2BAAW,CAA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C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Adapters = exports.IntegralConfig = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
exports.IntegralConfig = {
|
|
6
|
+
Integral: {
|
|
7
|
+
[constants_1.Network.MAINNET]: {
|
|
8
|
+
factoryAddress: '0xC480b33eE5229DE3FbDFAD1D2DCD3F3BAD0C56c6',
|
|
9
|
+
relayerAddress: '0xd17b3c9784510E33cD5B87b490E79253BcD81e2E',
|
|
10
|
+
subgraphURL: 'ANd5QJuYtyfngmXvBMu9kZAv935vhcqp4xAGBkmCADN3',
|
|
11
|
+
},
|
|
12
|
+
[constants_1.Network.ARBITRUM]: {
|
|
13
|
+
factoryAddress: '0x717EF162cf831db83c51134734A15D1EBe9E516a',
|
|
14
|
+
relayerAddress: '0x3c6951FDB433b5b8442e7aa126D50fBFB54b5f42',
|
|
15
|
+
subgraphURL: 'HXeVedRK7VgogXwbK5Sc4mjyLkhBAS5akskRvbSYnkHU',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
exports.Adapters = {};
|
|
20
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/integral/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,cAAc,GAA4B;IACrD,QAAQ,EAAE;QACR,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Address } from '@paraswap/core';
|
|
2
|
+
import { IntegralFactory } from './integral-factory';
|
|
3
|
+
import { IntegralRelayer } from './integral-relayer';
|
|
4
|
+
import { Network } from '../../constants';
|
|
5
|
+
import { IDexHelper } from '../../dex-helper';
|
|
6
|
+
import { Logger } from 'log4js';
|
|
7
|
+
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
import { IntegralPool, PoolInitProps, RelayerPoolState } from './types';
|
|
9
|
+
import { IntegralToken } from './integral-token';
|
|
10
|
+
export declare class IntegralContext {
|
|
11
|
+
readonly network: Network;
|
|
12
|
+
readonly dexKey: string;
|
|
13
|
+
readonly dexHelper: IDexHelper;
|
|
14
|
+
readonly erc20Interface: Interface;
|
|
15
|
+
readonly factoryAddress: Address;
|
|
16
|
+
readonly relayerAddress: Address;
|
|
17
|
+
static instances: {
|
|
18
|
+
[network: number]: IntegralContext;
|
|
19
|
+
};
|
|
20
|
+
pools: {
|
|
21
|
+
[poolId: string]: IntegralPool;
|
|
22
|
+
};
|
|
23
|
+
tokens: {
|
|
24
|
+
[tokenAddress: Address]: IntegralToken;
|
|
25
|
+
};
|
|
26
|
+
factory: IntegralFactory;
|
|
27
|
+
relayer: IntegralRelayer;
|
|
28
|
+
logger: Logger;
|
|
29
|
+
private constructor();
|
|
30
|
+
addPools(pools: PoolInitProps, blockNumber: number, initPhase?: boolean): Promise<void>;
|
|
31
|
+
getPoolAddresses(): string[];
|
|
32
|
+
private removeDisabledPoolInitProps;
|
|
33
|
+
static initialize(network: Network, dexKey: string, dexHelper: IDexHelper, erc20Interface: Interface, factoryAddress: Address, relayerAddress: Address): IntegralContext;
|
|
34
|
+
static getInstance(network: Network): IntegralContext;
|
|
35
|
+
onRelayerPoolEnabledSet(poolAddress: Address, state: RelayerPoolState, blockNumber: number): Promise<void>;
|
|
36
|
+
onRebalanceSellOrderExecuted(blockNumber: number, orderId: bigint): void;
|
|
37
|
+
onPoolCreatedAddPool(token0: Address, token1: Address, poolAddress: Address, blockNumber: number): Promise<void>;
|
|
38
|
+
onPoolSwapForRelayer(blockNumber: number, poolAddress: Address, recipient: Address, amount0Out: bigint, amount1Out: bigint): Promise<void>;
|
|
39
|
+
onTransferUpdateBalance(token: Address, from: Address, to: Address, amount: bigint, blockNumber: number): Promise<void>;
|
|
40
|
+
}
|