@paraswap/dex-lib 4.8.36-metric.0 → 4.8.37-native-dex-math.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/metric/MetricOmmSwapRouter.json +0 -628
- package/build/dex/aave-gsm/config.js +2 -2
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.d.ts +2 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js +5 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +6 -3
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +85 -9
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/solidly-v3/solidly-v3-pool.d.ts +3 -0
- package/build/dex/solidly-v3/solidly-v3-pool.js +8 -0
- package/build/dex/solidly-v3/solidly-v3-pool.js.map +1 -1
- package/build/dex/solidly-v3/solidly-v3.d.ts +5 -2
- package/build/dex/solidly-v3/solidly-v3.js +84 -8
- package/build/dex/solidly-v3/solidly-v3.js.map +1 -1
- package/build/dex/uniswap-v3/scripts/measure-calc-time.js +222 -110
- package/build/dex/uniswap-v3/scripts/measure-calc-time.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +1 -0
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +2 -0
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +5 -0
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +11 -3
- package/build/dex/uniswap-v3/uniswap-v3.js +86 -9
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/uniswap-v4/types.d.ts +1 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +2 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +3 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -1
- package/build/dex/uniswap-v4/uniswap-v4-pool.d.ts +3 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool.js +18 -0
- package/build/dex/uniswap-v4/uniswap-v4-pool.js.map +1 -1
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +3 -1
- package/build/dex/uniswap-v4/uniswap-v4.js +74 -14
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
- package/build/pricing-helper.d.ts +1 -1
- package/build/pricing-helper.js +2 -2
- package/build/pricing-helper.js.map +1 -1
- package/native/Cargo.lock +331 -0
- package/native/Cargo.toml +22 -0
- package/native/build.rs +5 -0
- package/native/package-lock.json +32 -0
- package/native/package.json +20 -0
- package/native/src/config.rs +73 -0
- package/native/src/lib.rs +528 -0
- package/native/src/math/bit_math.rs +177 -0
- package/native/src/math/full_math.rs +217 -0
- package/native/src/math/liquidity_math.rs +72 -0
- package/native/src/math/mod.rs +10 -0
- package/native/src/math/oracle.rs +493 -0
- package/native/src/math/sqrt_price_math.rs +272 -0
- package/native/src/math/swap_math.rs +306 -0
- package/native/src/math/tick.rs +239 -0
- package/native/src/math/tick_bitmap.rs +312 -0
- package/native/src/math/tick_math.rs +321 -0
- package/native/src/math/unsafe_math.rs +67 -0
- package/native/src/pool_state.rs +41 -0
- package/native/src/query_outputs.rs +379 -0
- package/native/src/v4_query_outputs.rs +255 -0
- package/package.json +1 -1
|
@@ -1,358 +1,4 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{
|
|
5
|
-
"internalType": "address",
|
|
6
|
-
"name": "_weth",
|
|
7
|
-
"type": "address"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
"stateMutability": "nonpayable",
|
|
11
|
-
"type": "constructor"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"inputs": [
|
|
15
|
-
{
|
|
16
|
-
"internalType": "uint256",
|
|
17
|
-
"name": "amountIn",
|
|
18
|
-
"type": "uint256"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"internalType": "uint256",
|
|
22
|
-
"name": "maxAmountIn",
|
|
23
|
-
"type": "uint256"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"name": "InputTooHigh",
|
|
27
|
-
"type": "error"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"inputs": [
|
|
31
|
-
{
|
|
32
|
-
"internalType": "uint256",
|
|
33
|
-
"name": "required",
|
|
34
|
-
"type": "uint256"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"internalType": "uint256",
|
|
38
|
-
"name": "available",
|
|
39
|
-
"type": "uint256"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"name": "InsufficientNativeValue",
|
|
43
|
-
"type": "error"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"inputs": [
|
|
47
|
-
{
|
|
48
|
-
"internalType": "uint256",
|
|
49
|
-
"name": "amountOut",
|
|
50
|
-
"type": "uint256"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"internalType": "uint256",
|
|
54
|
-
"name": "minAmountOut",
|
|
55
|
-
"type": "uint256"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"name": "InsufficientOutput",
|
|
59
|
-
"type": "error"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"inputs": [],
|
|
63
|
-
"name": "InvalidCallbackCaller",
|
|
64
|
-
"type": "error"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"inputs": [],
|
|
68
|
-
"name": "InvalidSwapDeltas",
|
|
69
|
-
"type": "error"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"inputs": [],
|
|
73
|
-
"name": "InvalidWETH",
|
|
74
|
-
"type": "error"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"inputs": [
|
|
78
|
-
{
|
|
79
|
-
"internalType": "address",
|
|
80
|
-
"name": "token",
|
|
81
|
-
"type": "address"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"name": "NativeInputNotSupported",
|
|
85
|
-
"type": "error"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"inputs": [
|
|
89
|
-
{
|
|
90
|
-
"internalType": "address",
|
|
91
|
-
"name": "token",
|
|
92
|
-
"type": "address"
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"name": "NativeOutputNotSupported",
|
|
96
|
-
"type": "error"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"inputs": [],
|
|
100
|
-
"name": "NativeTransferFailed",
|
|
101
|
-
"type": "error"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"inputs": [],
|
|
105
|
-
"name": "NativeValueNotExpected",
|
|
106
|
-
"type": "error"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"inputs": [],
|
|
110
|
-
"name": "SwapInProgress",
|
|
111
|
-
"type": "error"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"inputs": [
|
|
115
|
-
{
|
|
116
|
-
"internalType": "uint256",
|
|
117
|
-
"name": "deadline",
|
|
118
|
-
"type": "uint256"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"internalType": "uint256",
|
|
122
|
-
"name": "timestamp",
|
|
123
|
-
"type": "uint256"
|
|
124
|
-
}
|
|
125
|
-
],
|
|
126
|
-
"name": "TransactionExpired",
|
|
127
|
-
"type": "error"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"inputs": [
|
|
131
|
-
{
|
|
132
|
-
"internalType": "address",
|
|
133
|
-
"name": "target",
|
|
134
|
-
"type": "address"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"internalType": "bytes4",
|
|
138
|
-
"name": "selector",
|
|
139
|
-
"type": "bytes4"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"internalType": "bytes",
|
|
143
|
-
"name": "reason",
|
|
144
|
-
"type": "bytes"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"internalType": "bytes",
|
|
148
|
-
"name": "additionalInfo",
|
|
149
|
-
"type": "bytes"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"name": "WrappedError",
|
|
153
|
-
"type": "error"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"inputs": [
|
|
157
|
-
{
|
|
158
|
-
"internalType": "address",
|
|
159
|
-
"name": "target",
|
|
160
|
-
"type": "address"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"internalType": "bytes4",
|
|
164
|
-
"name": "selector",
|
|
165
|
-
"type": "bytes4"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"internalType": "bytes",
|
|
169
|
-
"name": "reason",
|
|
170
|
-
"type": "bytes"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"internalType": "bytes",
|
|
174
|
-
"name": "details",
|
|
175
|
-
"type": "bytes"
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
"name": "WrappedError",
|
|
179
|
-
"type": "error"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"inputs": [
|
|
183
|
-
{
|
|
184
|
-
"internalType": "int256",
|
|
185
|
-
"name": "amount0Delta",
|
|
186
|
-
"type": "int256"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"internalType": "int256",
|
|
190
|
-
"name": "amount1Delta",
|
|
191
|
-
"type": "int256"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"internalType": "bytes",
|
|
195
|
-
"name": "",
|
|
196
|
-
"type": "bytes"
|
|
197
|
-
}
|
|
198
|
-
],
|
|
199
|
-
"name": "metricOmmSwapCallback",
|
|
200
|
-
"outputs": [],
|
|
201
|
-
"stateMutability": "nonpayable",
|
|
202
|
-
"type": "function"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
"inputs": [
|
|
206
|
-
{
|
|
207
|
-
"internalType": "address",
|
|
208
|
-
"name": "pool",
|
|
209
|
-
"type": "address"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"internalType": "bool",
|
|
213
|
-
"name": "zeroForOne",
|
|
214
|
-
"type": "bool"
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
"internalType": "int128",
|
|
218
|
-
"name": "amountSpecified",
|
|
219
|
-
"type": "int128"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"internalType": "uint128",
|
|
223
|
-
"name": "priceLimitX64",
|
|
224
|
-
"type": "uint128"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"internalType": "uint128",
|
|
228
|
-
"name": "bidPriceX64",
|
|
229
|
-
"type": "uint128"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"internalType": "uint128",
|
|
233
|
-
"name": "askPriceX64",
|
|
234
|
-
"type": "uint128"
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"name": "quoteSwap",
|
|
238
|
-
"outputs": [
|
|
239
|
-
{
|
|
240
|
-
"internalType": "int128",
|
|
241
|
-
"name": "amount0Delta",
|
|
242
|
-
"type": "int128"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"internalType": "int128",
|
|
246
|
-
"name": "amount1Delta",
|
|
247
|
-
"type": "int128"
|
|
248
|
-
}
|
|
249
|
-
],
|
|
250
|
-
"stateMutability": "nonpayable",
|
|
251
|
-
"type": "function"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"inputs": [
|
|
255
|
-
{
|
|
256
|
-
"internalType": "address",
|
|
257
|
-
"name": "pool",
|
|
258
|
-
"type": "address"
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
"internalType": "address",
|
|
262
|
-
"name": "recipient",
|
|
263
|
-
"type": "address"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"internalType": "bool",
|
|
267
|
-
"name": "zeroForOne",
|
|
268
|
-
"type": "bool"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"internalType": "int128",
|
|
272
|
-
"name": "amountSpecified",
|
|
273
|
-
"type": "int128"
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"internalType": "uint128",
|
|
277
|
-
"name": "priceLimitX64",
|
|
278
|
-
"type": "uint128"
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
"internalType": "uint256",
|
|
282
|
-
"name": "deadline",
|
|
283
|
-
"type": "uint256"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"internalType": "bytes",
|
|
287
|
-
"name": "data",
|
|
288
|
-
"type": "bytes"
|
|
289
|
-
}
|
|
290
|
-
],
|
|
291
|
-
"name": "swap",
|
|
292
|
-
"outputs": [
|
|
293
|
-
{
|
|
294
|
-
"internalType": "int128",
|
|
295
|
-
"name": "amount0Delta",
|
|
296
|
-
"type": "int128"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"internalType": "int128",
|
|
300
|
-
"name": "amount1Delta",
|
|
301
|
-
"type": "int128"
|
|
302
|
-
}
|
|
303
|
-
],
|
|
304
|
-
"stateMutability": "payable",
|
|
305
|
-
"type": "function"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"inputs": [
|
|
309
|
-
{
|
|
310
|
-
"internalType": "address",
|
|
311
|
-
"name": "pool",
|
|
312
|
-
"type": "address"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"internalType": "address",
|
|
316
|
-
"name": "recipient",
|
|
317
|
-
"type": "address"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"internalType": "bool",
|
|
321
|
-
"name": "zeroForOne",
|
|
322
|
-
"type": "bool"
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
"internalType": "int128",
|
|
326
|
-
"name": "amountSpecified",
|
|
327
|
-
"type": "int128"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"internalType": "uint128",
|
|
331
|
-
"name": "priceLimitX64",
|
|
332
|
-
"type": "uint128"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"internalType": "uint256",
|
|
336
|
-
"name": "deadline",
|
|
337
|
-
"type": "uint256"
|
|
338
|
-
}
|
|
339
|
-
],
|
|
340
|
-
"name": "swap",
|
|
341
|
-
"outputs": [
|
|
342
|
-
{
|
|
343
|
-
"internalType": "int128",
|
|
344
|
-
"name": "amount0Delta",
|
|
345
|
-
"type": "int128"
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"internalType": "int128",
|
|
349
|
-
"name": "amount1Delta",
|
|
350
|
-
"type": "int128"
|
|
351
|
-
}
|
|
352
|
-
],
|
|
353
|
-
"stateMutability": "payable",
|
|
354
|
-
"type": "function"
|
|
355
|
-
},
|
|
356
2
|
{
|
|
357
3
|
"inputs": [
|
|
358
4
|
{
|
|
@@ -406,279 +52,5 @@
|
|
|
406
52
|
],
|
|
407
53
|
"stateMutability": "payable",
|
|
408
54
|
"type": "function"
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
"inputs": [
|
|
412
|
-
{
|
|
413
|
-
"internalType": "address",
|
|
414
|
-
"name": "pool",
|
|
415
|
-
"type": "address"
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
"internalType": "address",
|
|
419
|
-
"name": "recipient",
|
|
420
|
-
"type": "address"
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"internalType": "bool",
|
|
424
|
-
"name": "zeroForOne",
|
|
425
|
-
"type": "bool"
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
"internalType": "uint128",
|
|
429
|
-
"name": "amountIn",
|
|
430
|
-
"type": "uint128"
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"internalType": "uint128",
|
|
434
|
-
"name": "priceLimitX64",
|
|
435
|
-
"type": "uint128"
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
"internalType": "uint256",
|
|
439
|
-
"name": "minAmountOut",
|
|
440
|
-
"type": "uint256"
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
"internalType": "uint256",
|
|
444
|
-
"name": "deadline",
|
|
445
|
-
"type": "uint256"
|
|
446
|
-
}
|
|
447
|
-
],
|
|
448
|
-
"name": "swapExactInputNativeForTokens",
|
|
449
|
-
"outputs": [
|
|
450
|
-
{
|
|
451
|
-
"internalType": "uint256",
|
|
452
|
-
"name": "amountOut",
|
|
453
|
-
"type": "uint256"
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
"internalType": "uint256",
|
|
457
|
-
"name": "amountInUsed",
|
|
458
|
-
"type": "uint256"
|
|
459
|
-
}
|
|
460
|
-
],
|
|
461
|
-
"stateMutability": "payable",
|
|
462
|
-
"type": "function"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
"inputs": [
|
|
466
|
-
{
|
|
467
|
-
"internalType": "address",
|
|
468
|
-
"name": "pool",
|
|
469
|
-
"type": "address"
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
"internalType": "address",
|
|
473
|
-
"name": "recipient",
|
|
474
|
-
"type": "address"
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
"internalType": "bool",
|
|
478
|
-
"name": "zeroForOne",
|
|
479
|
-
"type": "bool"
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
"internalType": "uint128",
|
|
483
|
-
"name": "amountIn",
|
|
484
|
-
"type": "uint128"
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
"internalType": "uint128",
|
|
488
|
-
"name": "priceLimitX64",
|
|
489
|
-
"type": "uint128"
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
"internalType": "uint256",
|
|
493
|
-
"name": "minAmountOut",
|
|
494
|
-
"type": "uint256"
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
"internalType": "uint256",
|
|
498
|
-
"name": "deadline",
|
|
499
|
-
"type": "uint256"
|
|
500
|
-
}
|
|
501
|
-
],
|
|
502
|
-
"name": "swapExactInputTokensForNative",
|
|
503
|
-
"outputs": [
|
|
504
|
-
{
|
|
505
|
-
"internalType": "uint256",
|
|
506
|
-
"name": "amountOut",
|
|
507
|
-
"type": "uint256"
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
"internalType": "uint256",
|
|
511
|
-
"name": "amountInUsed",
|
|
512
|
-
"type": "uint256"
|
|
513
|
-
}
|
|
514
|
-
],
|
|
515
|
-
"stateMutability": "nonpayable",
|
|
516
|
-
"type": "function"
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
"inputs": [
|
|
520
|
-
{
|
|
521
|
-
"internalType": "address",
|
|
522
|
-
"name": "pool",
|
|
523
|
-
"type": "address"
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
"internalType": "address",
|
|
527
|
-
"name": "recipient",
|
|
528
|
-
"type": "address"
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
"internalType": "bool",
|
|
532
|
-
"name": "zeroForOne",
|
|
533
|
-
"type": "bool"
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
"internalType": "uint128",
|
|
537
|
-
"name": "amountOutDesired",
|
|
538
|
-
"type": "uint128"
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
"internalType": "uint128",
|
|
542
|
-
"name": "priceLimitX64",
|
|
543
|
-
"type": "uint128"
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
"internalType": "uint256",
|
|
547
|
-
"name": "maxAmountIn",
|
|
548
|
-
"type": "uint256"
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
"internalType": "uint256",
|
|
552
|
-
"name": "deadline",
|
|
553
|
-
"type": "uint256"
|
|
554
|
-
}
|
|
555
|
-
],
|
|
556
|
-
"name": "swapExactOutput",
|
|
557
|
-
"outputs": [
|
|
558
|
-
{
|
|
559
|
-
"internalType": "uint256",
|
|
560
|
-
"name": "amountOut",
|
|
561
|
-
"type": "uint256"
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
"internalType": "uint256",
|
|
565
|
-
"name": "amountInUsed",
|
|
566
|
-
"type": "uint256"
|
|
567
|
-
}
|
|
568
|
-
],
|
|
569
|
-
"stateMutability": "payable",
|
|
570
|
-
"type": "function"
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
"inputs": [
|
|
574
|
-
{
|
|
575
|
-
"internalType": "address",
|
|
576
|
-
"name": "pool",
|
|
577
|
-
"type": "address"
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
"internalType": "address",
|
|
581
|
-
"name": "recipient",
|
|
582
|
-
"type": "address"
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
"internalType": "bool",
|
|
586
|
-
"name": "zeroForOne",
|
|
587
|
-
"type": "bool"
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
"internalType": "uint128",
|
|
591
|
-
"name": "amountOutDesired",
|
|
592
|
-
"type": "uint128"
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
"internalType": "uint128",
|
|
596
|
-
"name": "priceLimitX64",
|
|
597
|
-
"type": "uint128"
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
"internalType": "uint256",
|
|
601
|
-
"name": "maxAmountIn",
|
|
602
|
-
"type": "uint256"
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
"internalType": "uint256",
|
|
606
|
-
"name": "deadline",
|
|
607
|
-
"type": "uint256"
|
|
608
|
-
}
|
|
609
|
-
],
|
|
610
|
-
"name": "swapExactOutputNativeForTokens",
|
|
611
|
-
"outputs": [
|
|
612
|
-
{
|
|
613
|
-
"internalType": "uint256",
|
|
614
|
-
"name": "amountOut",
|
|
615
|
-
"type": "uint256"
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
"internalType": "uint256",
|
|
619
|
-
"name": "amountInUsed",
|
|
620
|
-
"type": "uint256"
|
|
621
|
-
}
|
|
622
|
-
],
|
|
623
|
-
"stateMutability": "payable",
|
|
624
|
-
"type": "function"
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"inputs": [
|
|
628
|
-
{
|
|
629
|
-
"internalType": "address",
|
|
630
|
-
"name": "pool",
|
|
631
|
-
"type": "address"
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
"internalType": "address",
|
|
635
|
-
"name": "recipient",
|
|
636
|
-
"type": "address"
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
"internalType": "bool",
|
|
640
|
-
"name": "zeroForOne",
|
|
641
|
-
"type": "bool"
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
"internalType": "uint128",
|
|
645
|
-
"name": "amountOutDesired",
|
|
646
|
-
"type": "uint128"
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
"internalType": "uint128",
|
|
650
|
-
"name": "priceLimitX64",
|
|
651
|
-
"type": "uint128"
|
|
652
|
-
},
|
|
653
|
-
{
|
|
654
|
-
"internalType": "uint256",
|
|
655
|
-
"name": "maxAmountIn",
|
|
656
|
-
"type": "uint256"
|
|
657
|
-
},
|
|
658
|
-
{
|
|
659
|
-
"internalType": "uint256",
|
|
660
|
-
"name": "deadline",
|
|
661
|
-
"type": "uint256"
|
|
662
|
-
}
|
|
663
|
-
],
|
|
664
|
-
"name": "swapExactOutputTokensForNative",
|
|
665
|
-
"outputs": [
|
|
666
|
-
{
|
|
667
|
-
"internalType": "uint256",
|
|
668
|
-
"name": "amountOut",
|
|
669
|
-
"type": "uint256"
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
"internalType": "uint256",
|
|
673
|
-
"name": "amountInUsed",
|
|
674
|
-
"type": "uint256"
|
|
675
|
-
}
|
|
676
|
-
],
|
|
677
|
-
"stateMutability": "nonpayable",
|
|
678
|
-
"type": "function"
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
"stateMutability": "payable",
|
|
682
|
-
"type": "receive"
|
|
683
55
|
}
|
|
684
56
|
]
|
|
@@ -7,8 +7,8 @@ exports.AaveGsmConfig = {
|
|
|
7
7
|
AaveGsm: {
|
|
8
8
|
[constants_1.Network.MAINNET]: {
|
|
9
9
|
POOL: aave_address_book_1.AaveV3Ethereum.POOL.toLowerCase(),
|
|
10
|
-
GSM_USDT: '
|
|
11
|
-
GSM_USDC: '
|
|
10
|
+
GSM_USDT: '0x882285E62656b9623AF136Ce3078c6BdCc33F5E3'.toLowerCase(),
|
|
11
|
+
GSM_USDC: '0x3A3868898305f04beC7FEa77BecFf04C13444112'.toLowerCase(),
|
|
12
12
|
waEthUSDT: aave_address_book_1.AaveV3Ethereum.ASSETS.USDT.STATA_TOKEN.toLowerCase(),
|
|
13
13
|
waEthUSDC: aave_address_book_1.AaveV3Ethereum.ASSETS.USDC.STATA_TOKEN.toLowerCase(),
|
|
14
14
|
GHO: aave_address_book_1.AaveV3Ethereum.ASSETS.GHO.UNDERLYING.toLowerCase(),
|
package/build/dex/idex.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface IDexPricing<ExchangeData> {
|
|
|
46
46
|
readonly cacheStateKey: string;
|
|
47
47
|
readonly isStatePollingDex?: boolean;
|
|
48
48
|
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
49
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams, isFirstSwap?: boolean): Promise<ExchangePrices<ExchangeData> | null>;
|
|
49
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams, isFirstSwap?: boolean, useRust?: boolean): Promise<ExchangePrices<ExchangeData> | null>;
|
|
50
50
|
getCalldataGasCost(poolPrices: PoolPrices<ExchangeData>): number | number[];
|
|
51
51
|
initializePricing?(blockNumber: number): AsyncOrSync<void>;
|
|
52
52
|
getAdapters(side: SwapSide): {
|
|
@@ -5,6 +5,7 @@ import { Log, Logger, BlockHeader, Address } from '../../types';
|
|
|
5
5
|
import { InitializeStateOptions, StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
6
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
7
7
|
import { DecodedStateMultiCallResultWithRelativeBitmaps, PoolState } from '../uniswap-v3/types';
|
|
8
|
+
import { RustPoolRegistryType } from '../uniswap-v3/contract-math/native-bridge';
|
|
8
9
|
export declare class PancakeSwapV3EventPool extends StatefulEventSubscriber<PoolState> {
|
|
9
10
|
readonly dexHelper: IDexHelper;
|
|
10
11
|
readonly stateMultiContract: Contract;
|
|
@@ -24,6 +25,7 @@ export declare class PancakeSwapV3EventPool extends StatefulEventSubscriber<Pool
|
|
|
24
25
|
readonly poolIface: Interface;
|
|
25
26
|
initFailed: boolean;
|
|
26
27
|
initRetryAttemptCount: number;
|
|
28
|
+
registry: RustPoolRegistryType | null;
|
|
27
29
|
readonly feeCodeAsString: string;
|
|
28
30
|
constructor(dexHelper: IDexHelper, parentName: string, stateMultiContract: Contract, erc20Interface: Interface, factoryAddress: Address, feeCode: bigint, token0: Address, token1: Address, logger: Logger, mapKey: string | undefined, poolInitCodeHash: string, poolDeployer?: string | undefined);
|
|
29
31
|
get poolAddress(): Address;
|
|
@@ -18,6 +18,7 @@ const decoders_1 = require("../../lib/decoders");
|
|
|
18
18
|
const utils_2 = require("./utils");
|
|
19
19
|
const utils_3 = require("../uniswap-v3/contract-math/utils");
|
|
20
20
|
const constants_2 = require("./constants");
|
|
21
|
+
const native_bridge_1 = require("../uniswap-v3/contract-math/native-bridge");
|
|
21
22
|
class PancakeSwapV3EventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
22
23
|
dexHelper;
|
|
23
24
|
stateMultiContract;
|
|
@@ -35,6 +36,7 @@ class PancakeSwapV3EventPool extends stateful_event_subscriber_1.StatefulEventSu
|
|
|
35
36
|
poolIface = new abi_1.Interface(PancakeswapV3Pool_abi_json_1.default);
|
|
36
37
|
initFailed = false;
|
|
37
38
|
initRetryAttemptCount = 0;
|
|
39
|
+
registry = null;
|
|
38
40
|
feeCodeAsString;
|
|
39
41
|
constructor(dexHelper, parentName, stateMultiContract, erc20Interface, factoryAddress, feeCode, token0, token1, logger, mapKey = '', poolInitCodeHash, poolDeployer) {
|
|
40
42
|
super(parentName, `${token0}_${token1}_${feeCode}`, dexHelper, logger, true, mapKey);
|
|
@@ -178,6 +180,9 @@ class PancakeSwapV3EventPool extends stateful_event_subscriber_1.StatefulEventSu
|
|
|
178
180
|
// );
|
|
179
181
|
// }
|
|
180
182
|
super._setState(state, blockNumber);
|
|
183
|
+
if (this.registry && state) {
|
|
184
|
+
(0, native_bridge_1.registrySetPool)(this.registry, this.name, state, 'pancakeswap_v3', 12);
|
|
185
|
+
}
|
|
181
186
|
}
|
|
182
187
|
async generateState(blockNumber) {
|
|
183
188
|
const callData = this._getStateRequestCallData();
|