@paraswap/dex-lib 2.33.4-balancer-v2-multihop.2 → 2.34.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/abi/algebra/AlgebraPool.abi.json +727 -0
- package/build/config.js +27 -0
- package/build/config.js.map +1 -1
- package/build/dex/algebra/algebra-pool-v1_1.d.ts +16 -2
- package/build/dex/algebra/algebra-pool-v1_1.js +166 -4
- package/build/dex/algebra/algebra-pool-v1_1.js.map +1 -1
- package/build/dex/algebra/algebra-pool.d.ts +46 -0
- package/build/dex/algebra/algebra-pool.js +336 -0
- package/build/dex/algebra/algebra-pool.js.map +1 -0
- package/build/dex/algebra/algebra.js +9 -7
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +1 -0
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/algebra/types.d.ts +3 -2
- package/build/dex/algebra/utils.d.ts +3 -1
- package/build/dex/algebra/utils.js +59 -1
- package/build/dex/algebra/utils.js.map +1 -1
- package/build/dex/balancer-v2/optimizer.d.ts +0 -1
- package/build/dex/balancer-v2/optimizer.js +21 -29
- package/build/dex/balancer-v2/optimizer.js.map +1 -1
- package/build/dex/solidly/forks-override/velodromeV2.js +4 -1
- package/build/dex/solidly/forks-override/velodromeV2.js.map +1 -1
- package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +7 -1
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/lib/decoders.d.ts +3 -0
- package/build/lib/decoders.js +9 -1
- package/build/lib/decoders.js.map +1 -1
- package/build/stateful-event-subscriber.d.ts +1 -0
- package/build/stateful-event-subscriber.js +6 -0
- package/build/stateful-event-subscriber.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/algebra/AlgebraFactory-v1_1.abi.json +250 -0
- package/src/config.ts +30 -0
- package/src/dex/algebra/algebra-integration.test.ts +122 -0
- package/src/dex/algebra/algebra-pool-v1_1.ts +259 -8
- package/src/dex/algebra/algebra.ts +9 -6
- package/src/dex/algebra/config.ts +1 -0
- package/src/dex/algebra/types.ts +3 -2
- package/src/dex/algebra/utils.ts +83 -2
- package/src/dex/balancer-v2/optimizer.ts +23 -38
- package/src/dex/solidly/forks-override/velodromeV2.ts +4 -2
- package/src/dex/uniswap-v2/nomiswap-v2.ts +2 -1
- package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +6 -8
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +52 -47
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +1 -9
- package/src/dex/uniswap-v3/uniswap-v3.ts +7 -1
- package/src/lib/decoders.ts +13 -0
- package/src/stateful-event-subscriber.ts +8 -0
- package/build/abi/api3-proxy.json +0 -46
- package/build/abi/api3-server-v1.json +0 -463
- 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/quickPerps/fast-price-events.json +0 -70
- package/build/abi/quickPerps/fast-price-feed.json +0 -748
- package/build/abi/quickPerps/reader.json +0 -313
- package/build/abi/quickPerps/vault-price-feed.json +0 -477
- package/build/abi/quickPerps/vault.json +0 -1953
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
- package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
- package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/build/abi/woo-fi/WooPP.abi.json +0 -548
- package/build/abi/woo-fi/Wooracle.abi.json +0 -260
- package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
- package/build/dex/aave-v3/tokens/avalanche.json +0 -74
- package/build/dex/aave-v3/tokens/fantom.json +0 -62
- package/build/dex/aave-v3/tokens/optimism.json +0 -50
- package/build/dex/aave-v3/tokens/polygon.json +0 -116
- package/build/dex/balancer-v2/LinearMath.d.ts +0 -19
- package/build/dex/balancer-v2/LinearMath.js +0 -179
- package/build/dex/balancer-v2/LinearMath.js.map +0 -1
- package/build/dex/balancer-v2/LinearPool.d.ts +0 -47
- package/build/dex/balancer-v2/LinearPool.js +0 -324
- package/build/dex/balancer-v2/LinearPool.js.map +0 -1
- package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -47
- package/build/dex/balancer-v2/PhantomStablePool.js +0 -294
- package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
- package/build/dex/balancer-v2/StableMath.d.ts +0 -9
- package/build/dex/balancer-v2/StableMath.js +0 -272
- package/build/dex/balancer-v2/StableMath.js.map +0 -1
- package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -75
- package/build/dex/balancer-v2/balancer-v2-pool.js +0 -417
- package/build/dex/balancer-v2/balancer-v2-pool.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 -176
- 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 -210
- package/build/dex/quick-perps/pool.js.map +0 -1
- package/build/dex/quick-perps/quick-perps.d.ts +0 -52
- package/build/dex/quick-perps/quick-perps.js +0 -205
- 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 +0 -3
- 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 -61
- 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 -194
- 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 -41
- 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 -166
- package/build/dex/quick-perps/vault.js.map +0 -1
- package/build/dex/quickswap-v3.d.ts +0 -21
- package/build/dex/quickswap-v3.js +0 -40
- package/build/dex/quickswap-v3.js.map +0 -1
- package/build/dex/test-dex/config.d.ts +0 -4
- package/build/dex/test-dex/config.js +0 -15
- package/build/dex/test-dex/config.js.map +0 -1
- package/build/dex/test-dex/test-dex-pool.d.ts +0 -39
- package/build/dex/test-dex/test-dex-pool.js +0 -63
- package/build/dex/test-dex/test-dex-pool.js.map +0 -1
- package/build/dex/test-dex/test-dex.d.ts +0 -37
- package/build/dex/test-dex/test-dex.js +0 -126
- package/build/dex/test-dex/test-dex.js.map +0 -1
- package/build/dex/test-dex/types.d.ts +0 -6
- package/build/dex/test-dex/types.js +0 -3
- package/build/dex/test-dex/types.js.map +0 -1
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
- package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
- package/build/dex/woo-fi/config.d.ts +0 -4
- package/build/dex/woo-fi/config.js +0 -141
- package/build/dex/woo-fi/config.js.map +0 -1
- package/build/dex/woo-fi/constants.d.ts +0 -5
- package/build/dex/woo-fi/constants.js +0 -20
- package/build/dex/woo-fi/constants.js.map +0 -1
- package/build/dex/woo-fi/types.d.ts +0 -48
- package/build/dex/woo-fi/types.js +0 -3
- package/build/dex/woo-fi/types.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
- package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
- package/build/dex/woo-fi/woo-fi-math.js +0 -300
- package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
- package/build/dex/woo-fi/woo-fi.d.ts +0 -65
- package/build/dex/woo-fi/woo-fi.js +0 -480
- package/build/dex/woo-fi/woo-fi.js.map +0 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +0 -16
- package/build/dex/woo-fi-v2/woo-fi-math.js +0 -137
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +0 -1
- package/build/lib/api3-feed.d.ts +0 -26
- package/build/lib/api3-feed.js +0 -82
- package/build/lib/api3-feed.js.map +0 -1
- package/src/dex/balancer-v2/balancer-v2-optimizer.test.ts +0 -226
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "_poolDeployer", "type": "address" },
|
|
5
|
+
{ "internalType": "address", "name": "_vaultAddress", "type": "address" }
|
|
6
|
+
],
|
|
7
|
+
"stateMutability": "nonpayable",
|
|
8
|
+
"type": "constructor"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"anonymous": false,
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"indexed": true,
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "newFarmingAddress",
|
|
17
|
+
"type": "address"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"name": "FarmingAddress",
|
|
21
|
+
"type": "event"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"anonymous": false,
|
|
25
|
+
"inputs": [
|
|
26
|
+
{
|
|
27
|
+
"indexed": false,
|
|
28
|
+
"internalType": "uint16",
|
|
29
|
+
"name": "alpha1",
|
|
30
|
+
"type": "uint16"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": false,
|
|
34
|
+
"internalType": "uint16",
|
|
35
|
+
"name": "alpha2",
|
|
36
|
+
"type": "uint16"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "uint32",
|
|
41
|
+
"name": "beta1",
|
|
42
|
+
"type": "uint32"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"indexed": false,
|
|
46
|
+
"internalType": "uint32",
|
|
47
|
+
"name": "beta2",
|
|
48
|
+
"type": "uint32"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"indexed": false,
|
|
52
|
+
"internalType": "uint16",
|
|
53
|
+
"name": "gamma1",
|
|
54
|
+
"type": "uint16"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"indexed": false,
|
|
58
|
+
"internalType": "uint16",
|
|
59
|
+
"name": "gamma2",
|
|
60
|
+
"type": "uint16"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": false,
|
|
64
|
+
"internalType": "uint32",
|
|
65
|
+
"name": "volumeBeta",
|
|
66
|
+
"type": "uint32"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "uint16",
|
|
71
|
+
"name": "volumeGamma",
|
|
72
|
+
"type": "uint16"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"indexed": false,
|
|
76
|
+
"internalType": "uint16",
|
|
77
|
+
"name": "baseFee",
|
|
78
|
+
"type": "uint16"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"name": "FeeConfiguration",
|
|
82
|
+
"type": "event"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"anonymous": false,
|
|
86
|
+
"inputs": [
|
|
87
|
+
{
|
|
88
|
+
"indexed": true,
|
|
89
|
+
"internalType": "address",
|
|
90
|
+
"name": "newOwner",
|
|
91
|
+
"type": "address"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"name": "Owner",
|
|
95
|
+
"type": "event"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"anonymous": false,
|
|
99
|
+
"inputs": [
|
|
100
|
+
{
|
|
101
|
+
"indexed": true,
|
|
102
|
+
"internalType": "address",
|
|
103
|
+
"name": "token0",
|
|
104
|
+
"type": "address"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"indexed": true,
|
|
108
|
+
"internalType": "address",
|
|
109
|
+
"name": "token1",
|
|
110
|
+
"type": "address"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"indexed": false,
|
|
114
|
+
"internalType": "address",
|
|
115
|
+
"name": "pool",
|
|
116
|
+
"type": "address"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"name": "Pool",
|
|
120
|
+
"type": "event"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"anonymous": false,
|
|
124
|
+
"inputs": [
|
|
125
|
+
{
|
|
126
|
+
"indexed": true,
|
|
127
|
+
"internalType": "address",
|
|
128
|
+
"name": "newVaultAddress",
|
|
129
|
+
"type": "address"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"name": "VaultAddress",
|
|
133
|
+
"type": "event"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [],
|
|
137
|
+
"name": "baseFeeConfiguration",
|
|
138
|
+
"outputs": [
|
|
139
|
+
{ "internalType": "uint16", "name": "alpha1", "type": "uint16" },
|
|
140
|
+
{ "internalType": "uint16", "name": "alpha2", "type": "uint16" },
|
|
141
|
+
{ "internalType": "uint32", "name": "beta1", "type": "uint32" },
|
|
142
|
+
{ "internalType": "uint32", "name": "beta2", "type": "uint32" },
|
|
143
|
+
{ "internalType": "uint16", "name": "gamma1", "type": "uint16" },
|
|
144
|
+
{ "internalType": "uint16", "name": "gamma2", "type": "uint16" },
|
|
145
|
+
{ "internalType": "uint32", "name": "volumeBeta", "type": "uint32" },
|
|
146
|
+
{ "internalType": "uint16", "name": "volumeGamma", "type": "uint16" },
|
|
147
|
+
{ "internalType": "uint16", "name": "baseFee", "type": "uint16" }
|
|
148
|
+
],
|
|
149
|
+
"stateMutability": "view",
|
|
150
|
+
"type": "function"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"inputs": [
|
|
154
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
155
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" }
|
|
156
|
+
],
|
|
157
|
+
"name": "createPool",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{ "internalType": "address", "name": "pool", "type": "address" }
|
|
160
|
+
],
|
|
161
|
+
"stateMutability": "nonpayable",
|
|
162
|
+
"type": "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [],
|
|
166
|
+
"name": "farmingAddress",
|
|
167
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [],
|
|
173
|
+
"name": "owner",
|
|
174
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
175
|
+
"stateMutability": "view",
|
|
176
|
+
"type": "function"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"inputs": [
|
|
180
|
+
{ "internalType": "address", "name": "", "type": "address" },
|
|
181
|
+
{ "internalType": "address", "name": "", "type": "address" }
|
|
182
|
+
],
|
|
183
|
+
"name": "poolByPair",
|
|
184
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
185
|
+
"stateMutability": "view",
|
|
186
|
+
"type": "function"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"inputs": [],
|
|
190
|
+
"name": "poolDeployer",
|
|
191
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
192
|
+
"stateMutability": "view",
|
|
193
|
+
"type": "function"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"inputs": [
|
|
197
|
+
{ "internalType": "uint16", "name": "alpha1", "type": "uint16" },
|
|
198
|
+
{ "internalType": "uint16", "name": "alpha2", "type": "uint16" },
|
|
199
|
+
{ "internalType": "uint32", "name": "beta1", "type": "uint32" },
|
|
200
|
+
{ "internalType": "uint32", "name": "beta2", "type": "uint32" },
|
|
201
|
+
{ "internalType": "uint16", "name": "gamma1", "type": "uint16" },
|
|
202
|
+
{ "internalType": "uint16", "name": "gamma2", "type": "uint16" },
|
|
203
|
+
{ "internalType": "uint32", "name": "volumeBeta", "type": "uint32" },
|
|
204
|
+
{ "internalType": "uint16", "name": "volumeGamma", "type": "uint16" },
|
|
205
|
+
{ "internalType": "uint16", "name": "baseFee", "type": "uint16" }
|
|
206
|
+
],
|
|
207
|
+
"name": "setBaseFeeConfiguration",
|
|
208
|
+
"outputs": [],
|
|
209
|
+
"stateMutability": "nonpayable",
|
|
210
|
+
"type": "function"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"inputs": [
|
|
214
|
+
{
|
|
215
|
+
"internalType": "address",
|
|
216
|
+
"name": "_farmingAddress",
|
|
217
|
+
"type": "address"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"name": "setFarmingAddress",
|
|
221
|
+
"outputs": [],
|
|
222
|
+
"stateMutability": "nonpayable",
|
|
223
|
+
"type": "function"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"inputs": [
|
|
227
|
+
{ "internalType": "address", "name": "_owner", "type": "address" }
|
|
228
|
+
],
|
|
229
|
+
"name": "setOwner",
|
|
230
|
+
"outputs": [],
|
|
231
|
+
"stateMutability": "nonpayable",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [
|
|
236
|
+
{ "internalType": "address", "name": "_vaultAddress", "type": "address" }
|
|
237
|
+
],
|
|
238
|
+
"name": "setVaultAddress",
|
|
239
|
+
"outputs": [],
|
|
240
|
+
"stateMutability": "nonpayable",
|
|
241
|
+
"type": "function"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"inputs": [],
|
|
245
|
+
"name": "vaultAddress",
|
|
246
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
247
|
+
"stateMutability": "view",
|
|
248
|
+
"type": "function"
|
|
249
|
+
}
|
|
250
|
+
]
|
package/src/config.ts
CHANGED
|
@@ -317,6 +317,36 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
317
317
|
rpcPollingBlocksBackToTriggerUpdate: 3,
|
|
318
318
|
forceRpcFallbackDexs: [],
|
|
319
319
|
},
|
|
320
|
+
|
|
321
|
+
[Network.ZKEVM]: {
|
|
322
|
+
network: Network.ZKEVM,
|
|
323
|
+
networkName: 'Polygon zkEVM',
|
|
324
|
+
isTestnet: false,
|
|
325
|
+
nativeTokenName: 'Ether',
|
|
326
|
+
nativeTokenSymbol: 'ETH',
|
|
327
|
+
wrappedNativeTokenAddress: '0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9',
|
|
328
|
+
hasEIP1559: true,
|
|
329
|
+
augustusAddress: '0xB83B554730d29cE4Cb55BB42206c3E2c03E4A40A',
|
|
330
|
+
augustusRFQAddress: '0x7Ee1F7fa4C0b2eDB0Fdd5944c14A07167700486E',
|
|
331
|
+
tokenTransferProxyAddress: '0xc8a21fcd5a100c3ecc037c97e2f9c53a8d3a02a1',
|
|
332
|
+
multicallV2Address: '0x6cA478C852DfA8941FC819fDf248606eA04780B6',
|
|
333
|
+
privateHttpProvider: process.env.HTTP_PROVIDER_1101,
|
|
334
|
+
adapterAddresses: {
|
|
335
|
+
PolygonZkEvmAdapter01: '0x760870be538e7b4E2110e2890473CC17ADB1fdC1',
|
|
336
|
+
PolygonZkEvmBuyAdapter: '0x61bFA60A992472869F8d7b4705609A6E0BCf383f',
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
rpcPollingMaxAllowedStateDelayInBlocks: 0,
|
|
340
|
+
rpcPollingBlocksBackToTriggerUpdate: 0,
|
|
341
|
+
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
342
|
+
hashFlowDisabledMMs:
|
|
343
|
+
process.env[`HASHFLOW_DISABLED_MMS_10`]?.split(',') || [],
|
|
344
|
+
uniswapV3EventLoggingSampleRate: 0,
|
|
345
|
+
rfqConfigs: {},
|
|
346
|
+
forceRpcFallbackDexs: [],
|
|
347
|
+
// FIXME: Not set properly
|
|
348
|
+
uniswapV2ExchangeRouterAddress: '',
|
|
349
|
+
},
|
|
320
350
|
};
|
|
321
351
|
|
|
322
352
|
// Should not be used, except by internal test code
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
} from '../../../tests/utils';
|
|
15
15
|
import { Tokens } from '../../../tests/constants-e2e';
|
|
16
16
|
import { Address } from '@paraswap/core';
|
|
17
|
+
import { AlgebraEventPoolV1_1 } from './algebra-pool-v1_1';
|
|
18
|
+
import { DecodedStateMultiCallResultWithRelativeBitmapsV1_1 } from './types';
|
|
17
19
|
|
|
18
20
|
function getReaderCalldata(
|
|
19
21
|
exchangeAddress: string,
|
|
@@ -432,5 +434,125 @@ describe('Algebra', function () {
|
|
|
432
434
|
);
|
|
433
435
|
}
|
|
434
436
|
});
|
|
437
|
+
|
|
438
|
+
it('both generate state result match', async function () {
|
|
439
|
+
const pool = (await algebra.getPool(
|
|
440
|
+
tokens[srcTokenSymbol].address,
|
|
441
|
+
tokens[destTokenSymbol].address,
|
|
442
|
+
blockNumber,
|
|
443
|
+
)) as AlgebraEventPoolV1_1;
|
|
444
|
+
|
|
445
|
+
const [balance0, balance1, stateMulticallFull] =
|
|
446
|
+
await pool.fetchPoolStateSingleStep(blockNumber);
|
|
447
|
+
|
|
448
|
+
const stateMulticall = {
|
|
449
|
+
pool: stateMulticallFull.pool.toLowerCase(),
|
|
450
|
+
globalState: {
|
|
451
|
+
price: stateMulticallFull.globalState.price,
|
|
452
|
+
tick: stateMulticallFull.globalState.tick,
|
|
453
|
+
fee: stateMulticallFull.globalState.fee,
|
|
454
|
+
communityFeeToken0: stateMulticallFull.globalState.communityFeeToken0,
|
|
455
|
+
communityFeeToken1: stateMulticallFull.globalState.communityFeeToken1,
|
|
456
|
+
},
|
|
457
|
+
liquidity: stateMulticallFull.liquidity,
|
|
458
|
+
tickSpacing: stateMulticallFull.tickSpacing,
|
|
459
|
+
maxLiquidityPerTick: stateMulticallFull.maxLiquidityPerTick,
|
|
460
|
+
tickBitmap: stateMulticallFull.tickBitmap.map(t => ({
|
|
461
|
+
index: t.index,
|
|
462
|
+
value: t.value,
|
|
463
|
+
})),
|
|
464
|
+
ticks: stateMulticallFull.ticks.map(t => ({
|
|
465
|
+
index: t.index,
|
|
466
|
+
value: {
|
|
467
|
+
liquidityNet: t.value.liquidityNet,
|
|
468
|
+
liquidityGross: t.value.liquidityGross,
|
|
469
|
+
secondsOutside: t.value.secondsOutside,
|
|
470
|
+
secondsPerLiquidityOutsideX128:
|
|
471
|
+
t.value.secondsPerLiquidityOutsideX128,
|
|
472
|
+
tickCumulativeOutside: t.value.tickCumulativeOutside,
|
|
473
|
+
initialized: t.value.initialized,
|
|
474
|
+
},
|
|
475
|
+
})),
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
const stateMulticallWithBalance = [balance0, balance1, stateMulticall];
|
|
479
|
+
const stateManually = await pool.fetchStateManually(blockNumber);
|
|
480
|
+
// @ts-ignore
|
|
481
|
+
delete stateManually[2]['blockTimestamp'];
|
|
482
|
+
stateManually[2].pool = stateManually[2].pool.toLowerCase();
|
|
483
|
+
|
|
484
|
+
expect(stateMulticallWithBalance).toStrictEqual(stateManually);
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
describe('ZKEVM', () => {
|
|
489
|
+
const network = Network.ZKEVM;
|
|
490
|
+
const dexHelper = new DummyDexHelper(network);
|
|
491
|
+
|
|
492
|
+
beforeAll(async () => {
|
|
493
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
494
|
+
algebra = new Algebra(network, dexKey, dexHelper);
|
|
495
|
+
if (algebra.initializePricing) {
|
|
496
|
+
await algebra.initializePricing(blockNumber);
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
it('WETH/DAI generate state is working for problematic pool', async function () {
|
|
501
|
+
const pool = (await algebra.getPool(
|
|
502
|
+
'0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9',
|
|
503
|
+
'0xc5015b9d9161dca7e18e32f6f25c4ad850731fd4',
|
|
504
|
+
blockNumber,
|
|
505
|
+
)) as AlgebraEventPoolV1_1;
|
|
506
|
+
|
|
507
|
+
const stateManually = await pool.fetchStateManually(blockNumber);
|
|
508
|
+
// We can not compare with usual way, because this pool can not be requested normally
|
|
509
|
+
expect(Array.isArray(stateManually)).toBeTruthy();
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it('WETH/MATIC generate state is working for problematic pool', async function () {
|
|
513
|
+
const pool = (await algebra.getPool(
|
|
514
|
+
'0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9',
|
|
515
|
+
'0xa2036f0538221a77a3937f1379699f44945018d0',
|
|
516
|
+
blockNumber,
|
|
517
|
+
)) as AlgebraEventPoolV1_1;
|
|
518
|
+
|
|
519
|
+
const stateManually = await pool.fetchStateManually(blockNumber);
|
|
520
|
+
// We can not compare with usual way, because this pool can not be requested normally
|
|
521
|
+
expect(Array.isArray(stateManually)).toBeTruthy();
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it('stMATIC/WETH generate state is working for problematic pool', async function () {
|
|
525
|
+
const pool = (await algebra.getPool(
|
|
526
|
+
'0x83b874c1e09d316059d929da402dcb1a98e92082',
|
|
527
|
+
'0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9',
|
|
528
|
+
blockNumber,
|
|
529
|
+
)) as AlgebraEventPoolV1_1;
|
|
530
|
+
|
|
531
|
+
const stateManually = await pool.fetchStateManually(blockNumber);
|
|
532
|
+
// We can not compare with usual way, because this pool can not be requested normally
|
|
533
|
+
expect(Array.isArray(stateManually)).toBeTruthy();
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it('WETH/USDC generate state is working for problematic pool', async function () {
|
|
537
|
+
const pool = (await algebra.getPool(
|
|
538
|
+
'0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9',
|
|
539
|
+
'0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035',
|
|
540
|
+
blockNumber,
|
|
541
|
+
)) as AlgebraEventPoolV1_1;
|
|
542
|
+
|
|
543
|
+
const stateManually = await pool.fetchStateManually(blockNumber);
|
|
544
|
+
// We can not compare with usual way, because this pool can not be requested normally
|
|
545
|
+
expect(Array.isArray(stateManually)).toBeTruthy();
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('recognize pool does not exist error', async function () {
|
|
549
|
+
const pool = (await algebra.getPool(
|
|
550
|
+
'0x8aaebb46e1742f4623e6e1621f909f01846ca5e2',
|
|
551
|
+
'0xf9ed88937b2d82707d0eabd8c3d9aa4870b714d3',
|
|
552
|
+
blockNumber,
|
|
553
|
+
)) as AlgebraEventPoolV1_1;
|
|
554
|
+
|
|
555
|
+
expect(pool).toBeNull();
|
|
556
|
+
});
|
|
435
557
|
});
|
|
436
558
|
});
|