@luxfi/dex 1.2.1 → 1.3.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/dist/client/clob.d.ts +52 -0
- package/dist/client/clob.d.ts.map +1 -0
- package/dist/client/clob.js +196 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/types.d.ts +126 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +5 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/use-quote.d.ts +18 -0
- package/dist/hooks/use-quote.d.ts.map +1 -0
- package/dist/hooks/use-quote.js +65 -0
- package/dist/hooks/use-swap.d.ts +17 -0
- package/dist/hooks/use-swap.d.ts.map +1 -0
- package/dist/hooks/use-swap.js +75 -0
- package/dist/index.d.ts +33 -115
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -225
- package/dist/precompile/abis.d.ts +400 -0
- package/dist/precompile/abis.d.ts.map +1 -0
- package/dist/precompile/abis.js +287 -0
- package/dist/precompile/addresses.d.ts +65 -0
- package/dist/precompile/addresses.d.ts.map +1 -0
- package/dist/precompile/addresses.js +52 -0
- package/dist/precompile/index.d.ts +8 -0
- package/dist/precompile/index.d.ts.map +1 -0
- package/dist/precompile/index.js +7 -0
- package/dist/precompile/types.d.ts +76 -0
- package/dist/precompile/types.d.ts.map +1 -0
- package/dist/precompile/types.js +17 -0
- package/dist/router/index.d.ts +7 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +6 -0
- package/dist/router/router.d.ts +58 -0
- package/dist/router/router.d.ts.map +1 -0
- package/dist/router/router.js +272 -0
- package/dist/router/types.d.ts +76 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +1 -0
- package/package.json +55 -29
- package/src/client/clob.ts +256 -0
- package/src/client/index.ts +6 -0
- package/src/client/types.ts +148 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-quote.ts +92 -0
- package/src/hooks/use-swap.ts +103 -0
- package/src/index.ts +76 -309
- package/src/precompile/abis.ts +291 -0
- package/src/precompile/addresses.ts +72 -0
- package/src/precompile/index.ts +7 -0
- package/src/precompile/types.ts +96 -0
- package/src/router/index.ts +6 -0
- package/src/router/router.ts +338 -0
- package/src/router/types.ts +87 -0
- package/dist/marketData.d.ts +0 -152
- package/dist/marketData.d.ts.map +0 -1
- package/dist/marketData.js +0 -253
- package/src/marketData.ts +0 -351
- package/tsconfig.json +0 -19
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEX Precompile ABIs
|
|
3
|
+
* Native Go implementation at 0x0400-0x0403
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* PoolManager ABI (0x0400)
|
|
7
|
+
* Singleton contract managing all pools
|
|
8
|
+
*/
|
|
9
|
+
export declare const POOL_MANAGER_ABI: readonly [{
|
|
10
|
+
readonly type: "function";
|
|
11
|
+
readonly name: "initialize";
|
|
12
|
+
readonly inputs: readonly [{
|
|
13
|
+
readonly name: "key";
|
|
14
|
+
readonly type: "tuple";
|
|
15
|
+
readonly components: readonly [{
|
|
16
|
+
readonly name: "currency0";
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "currency1";
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "fee";
|
|
23
|
+
readonly type: "uint24";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "tickSpacing";
|
|
26
|
+
readonly type: "int24";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "hooks";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}];
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "sqrtPriceX96";
|
|
33
|
+
readonly type: "uint160";
|
|
34
|
+
}];
|
|
35
|
+
readonly outputs: readonly [{
|
|
36
|
+
readonly name: "tick";
|
|
37
|
+
readonly type: "int24";
|
|
38
|
+
}];
|
|
39
|
+
readonly stateMutability: "nonpayable";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
readonly name: "swap";
|
|
43
|
+
readonly inputs: readonly [{
|
|
44
|
+
readonly name: "key";
|
|
45
|
+
readonly type: "tuple";
|
|
46
|
+
readonly components: readonly [{
|
|
47
|
+
readonly name: "currency0";
|
|
48
|
+
readonly type: "address";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "currency1";
|
|
51
|
+
readonly type: "address";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "fee";
|
|
54
|
+
readonly type: "uint24";
|
|
55
|
+
}, {
|
|
56
|
+
readonly name: "tickSpacing";
|
|
57
|
+
readonly type: "int24";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "hooks";
|
|
60
|
+
readonly type: "address";
|
|
61
|
+
}];
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "params";
|
|
64
|
+
readonly type: "tuple";
|
|
65
|
+
readonly components: readonly [{
|
|
66
|
+
readonly name: "zeroForOne";
|
|
67
|
+
readonly type: "bool";
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "amountSpecified";
|
|
70
|
+
readonly type: "int256";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "sqrtPriceLimitX96";
|
|
73
|
+
readonly type: "uint160";
|
|
74
|
+
}];
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "hookData";
|
|
77
|
+
readonly type: "bytes";
|
|
78
|
+
}];
|
|
79
|
+
readonly outputs: readonly [{
|
|
80
|
+
readonly name: "delta";
|
|
81
|
+
readonly type: "int256";
|
|
82
|
+
}];
|
|
83
|
+
readonly stateMutability: "nonpayable";
|
|
84
|
+
}, {
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
readonly name: "modifyLiquidity";
|
|
87
|
+
readonly inputs: readonly [{
|
|
88
|
+
readonly name: "key";
|
|
89
|
+
readonly type: "tuple";
|
|
90
|
+
readonly components: readonly [{
|
|
91
|
+
readonly name: "currency0";
|
|
92
|
+
readonly type: "address";
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "currency1";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "fee";
|
|
98
|
+
readonly type: "uint24";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "tickSpacing";
|
|
101
|
+
readonly type: "int24";
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "hooks";
|
|
104
|
+
readonly type: "address";
|
|
105
|
+
}];
|
|
106
|
+
}, {
|
|
107
|
+
readonly name: "params";
|
|
108
|
+
readonly type: "tuple";
|
|
109
|
+
readonly components: readonly [{
|
|
110
|
+
readonly name: "tickLower";
|
|
111
|
+
readonly type: "int24";
|
|
112
|
+
}, {
|
|
113
|
+
readonly name: "tickUpper";
|
|
114
|
+
readonly type: "int24";
|
|
115
|
+
}, {
|
|
116
|
+
readonly name: "liquidityDelta";
|
|
117
|
+
readonly type: "int256";
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "salt";
|
|
120
|
+
readonly type: "bytes32";
|
|
121
|
+
}];
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "hookData";
|
|
124
|
+
readonly type: "bytes";
|
|
125
|
+
}];
|
|
126
|
+
readonly outputs: readonly [{
|
|
127
|
+
readonly name: "callerDelta";
|
|
128
|
+
readonly type: "int256";
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "feesAccrued";
|
|
131
|
+
readonly type: "int256";
|
|
132
|
+
}];
|
|
133
|
+
readonly stateMutability: "nonpayable";
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "function";
|
|
136
|
+
readonly name: "settle";
|
|
137
|
+
readonly inputs: readonly [{
|
|
138
|
+
readonly name: "currency";
|
|
139
|
+
readonly type: "address";
|
|
140
|
+
}];
|
|
141
|
+
readonly outputs: readonly [{
|
|
142
|
+
readonly name: "amount";
|
|
143
|
+
readonly type: "uint256";
|
|
144
|
+
}];
|
|
145
|
+
readonly stateMutability: "payable";
|
|
146
|
+
}, {
|
|
147
|
+
readonly type: "function";
|
|
148
|
+
readonly name: "take";
|
|
149
|
+
readonly inputs: readonly [{
|
|
150
|
+
readonly name: "currency";
|
|
151
|
+
readonly type: "address";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "to";
|
|
154
|
+
readonly type: "address";
|
|
155
|
+
}, {
|
|
156
|
+
readonly name: "amount";
|
|
157
|
+
readonly type: "uint256";
|
|
158
|
+
}];
|
|
159
|
+
readonly outputs: readonly [];
|
|
160
|
+
readonly stateMutability: "nonpayable";
|
|
161
|
+
}, {
|
|
162
|
+
readonly type: "function";
|
|
163
|
+
readonly name: "getSlot0";
|
|
164
|
+
readonly inputs: readonly [{
|
|
165
|
+
readonly name: "key";
|
|
166
|
+
readonly type: "tuple";
|
|
167
|
+
readonly components: readonly [{
|
|
168
|
+
readonly name: "currency0";
|
|
169
|
+
readonly type: "address";
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "currency1";
|
|
172
|
+
readonly type: "address";
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "fee";
|
|
175
|
+
readonly type: "uint24";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "tickSpacing";
|
|
178
|
+
readonly type: "int24";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "hooks";
|
|
181
|
+
readonly type: "address";
|
|
182
|
+
}];
|
|
183
|
+
}];
|
|
184
|
+
readonly outputs: readonly [{
|
|
185
|
+
readonly name: "sqrtPriceX96";
|
|
186
|
+
readonly type: "uint160";
|
|
187
|
+
}, {
|
|
188
|
+
readonly name: "tick";
|
|
189
|
+
readonly type: "int24";
|
|
190
|
+
}, {
|
|
191
|
+
readonly name: "protocolFee";
|
|
192
|
+
readonly type: "uint24";
|
|
193
|
+
}, {
|
|
194
|
+
readonly name: "lpFee";
|
|
195
|
+
readonly type: "uint24";
|
|
196
|
+
}];
|
|
197
|
+
readonly stateMutability: "view";
|
|
198
|
+
}, {
|
|
199
|
+
readonly type: "function";
|
|
200
|
+
readonly name: "getLiquidity";
|
|
201
|
+
readonly inputs: readonly [{
|
|
202
|
+
readonly name: "key";
|
|
203
|
+
readonly type: "tuple";
|
|
204
|
+
readonly components: readonly [{
|
|
205
|
+
readonly name: "currency0";
|
|
206
|
+
readonly type: "address";
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "currency1";
|
|
209
|
+
readonly type: "address";
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "fee";
|
|
212
|
+
readonly type: "uint24";
|
|
213
|
+
}, {
|
|
214
|
+
readonly name: "tickSpacing";
|
|
215
|
+
readonly type: "int24";
|
|
216
|
+
}, {
|
|
217
|
+
readonly name: "hooks";
|
|
218
|
+
readonly type: "address";
|
|
219
|
+
}];
|
|
220
|
+
}];
|
|
221
|
+
readonly outputs: readonly [{
|
|
222
|
+
readonly name: "liquidity";
|
|
223
|
+
readonly type: "uint128";
|
|
224
|
+
}];
|
|
225
|
+
readonly stateMutability: "view";
|
|
226
|
+
}];
|
|
227
|
+
/**
|
|
228
|
+
* SwapRouter ABI (0x0401)
|
|
229
|
+
* Optimized swap routing
|
|
230
|
+
*/
|
|
231
|
+
export declare const SWAP_ROUTER_ABI: readonly [{
|
|
232
|
+
readonly type: "function";
|
|
233
|
+
readonly name: "exactInputSingle";
|
|
234
|
+
readonly inputs: readonly [{
|
|
235
|
+
readonly name: "params";
|
|
236
|
+
readonly type: "tuple";
|
|
237
|
+
readonly components: readonly [{
|
|
238
|
+
readonly name: "poolKey";
|
|
239
|
+
readonly type: "tuple";
|
|
240
|
+
readonly components: readonly [{
|
|
241
|
+
readonly name: "currency0";
|
|
242
|
+
readonly type: "address";
|
|
243
|
+
}, {
|
|
244
|
+
readonly name: "currency1";
|
|
245
|
+
readonly type: "address";
|
|
246
|
+
}, {
|
|
247
|
+
readonly name: "fee";
|
|
248
|
+
readonly type: "uint24";
|
|
249
|
+
}, {
|
|
250
|
+
readonly name: "tickSpacing";
|
|
251
|
+
readonly type: "int24";
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "hooks";
|
|
254
|
+
readonly type: "address";
|
|
255
|
+
}];
|
|
256
|
+
}, {
|
|
257
|
+
readonly name: "zeroForOne";
|
|
258
|
+
readonly type: "bool";
|
|
259
|
+
}, {
|
|
260
|
+
readonly name: "amountIn";
|
|
261
|
+
readonly type: "uint256";
|
|
262
|
+
}, {
|
|
263
|
+
readonly name: "amountOutMinimum";
|
|
264
|
+
readonly type: "uint256";
|
|
265
|
+
}, {
|
|
266
|
+
readonly name: "sqrtPriceLimitX96";
|
|
267
|
+
readonly type: "uint160";
|
|
268
|
+
}, {
|
|
269
|
+
readonly name: "hookData";
|
|
270
|
+
readonly type: "bytes";
|
|
271
|
+
}];
|
|
272
|
+
}];
|
|
273
|
+
readonly outputs: readonly [{
|
|
274
|
+
readonly name: "amountOut";
|
|
275
|
+
readonly type: "uint256";
|
|
276
|
+
}];
|
|
277
|
+
readonly stateMutability: "payable";
|
|
278
|
+
}, {
|
|
279
|
+
readonly type: "function";
|
|
280
|
+
readonly name: "exactOutputSingle";
|
|
281
|
+
readonly inputs: readonly [{
|
|
282
|
+
readonly name: "params";
|
|
283
|
+
readonly type: "tuple";
|
|
284
|
+
readonly components: readonly [{
|
|
285
|
+
readonly name: "poolKey";
|
|
286
|
+
readonly type: "tuple";
|
|
287
|
+
readonly components: readonly [{
|
|
288
|
+
readonly name: "currency0";
|
|
289
|
+
readonly type: "address";
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "currency1";
|
|
292
|
+
readonly type: "address";
|
|
293
|
+
}, {
|
|
294
|
+
readonly name: "fee";
|
|
295
|
+
readonly type: "uint24";
|
|
296
|
+
}, {
|
|
297
|
+
readonly name: "tickSpacing";
|
|
298
|
+
readonly type: "int24";
|
|
299
|
+
}, {
|
|
300
|
+
readonly name: "hooks";
|
|
301
|
+
readonly type: "address";
|
|
302
|
+
}];
|
|
303
|
+
}, {
|
|
304
|
+
readonly name: "zeroForOne";
|
|
305
|
+
readonly type: "bool";
|
|
306
|
+
}, {
|
|
307
|
+
readonly name: "amountOut";
|
|
308
|
+
readonly type: "uint256";
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "amountInMaximum";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
}, {
|
|
313
|
+
readonly name: "sqrtPriceLimitX96";
|
|
314
|
+
readonly type: "uint160";
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "hookData";
|
|
317
|
+
readonly type: "bytes";
|
|
318
|
+
}];
|
|
319
|
+
}];
|
|
320
|
+
readonly outputs: readonly [{
|
|
321
|
+
readonly name: "amountIn";
|
|
322
|
+
readonly type: "uint256";
|
|
323
|
+
}];
|
|
324
|
+
readonly stateMutability: "payable";
|
|
325
|
+
}, {
|
|
326
|
+
readonly type: "function";
|
|
327
|
+
readonly name: "exactInput";
|
|
328
|
+
readonly inputs: readonly [{
|
|
329
|
+
readonly name: "params";
|
|
330
|
+
readonly type: "tuple";
|
|
331
|
+
readonly components: readonly [{
|
|
332
|
+
readonly name: "path";
|
|
333
|
+
readonly type: "bytes";
|
|
334
|
+
}, {
|
|
335
|
+
readonly name: "amountIn";
|
|
336
|
+
readonly type: "uint256";
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "amountOutMinimum";
|
|
339
|
+
readonly type: "uint256";
|
|
340
|
+
}];
|
|
341
|
+
}];
|
|
342
|
+
readonly outputs: readonly [{
|
|
343
|
+
readonly name: "amountOut";
|
|
344
|
+
readonly type: "uint256";
|
|
345
|
+
}];
|
|
346
|
+
readonly stateMutability: "payable";
|
|
347
|
+
}];
|
|
348
|
+
/**
|
|
349
|
+
* HooksRegistry ABI (0x0402)
|
|
350
|
+
* Registry for hook contracts
|
|
351
|
+
*/
|
|
352
|
+
export declare const HOOKS_REGISTRY_ABI: readonly [{
|
|
353
|
+
readonly type: "function";
|
|
354
|
+
readonly name: "registerHook";
|
|
355
|
+
readonly inputs: readonly [{
|
|
356
|
+
readonly name: "hook";
|
|
357
|
+
readonly type: "address";
|
|
358
|
+
}, {
|
|
359
|
+
readonly name: "permissions";
|
|
360
|
+
readonly type: "uint256";
|
|
361
|
+
}];
|
|
362
|
+
readonly outputs: readonly [];
|
|
363
|
+
readonly stateMutability: "nonpayable";
|
|
364
|
+
}, {
|
|
365
|
+
readonly type: "function";
|
|
366
|
+
readonly name: "getHookPermissions";
|
|
367
|
+
readonly inputs: readonly [{
|
|
368
|
+
readonly name: "hook";
|
|
369
|
+
readonly type: "address";
|
|
370
|
+
}];
|
|
371
|
+
readonly outputs: readonly [{
|
|
372
|
+
readonly name: "permissions";
|
|
373
|
+
readonly type: "uint256";
|
|
374
|
+
}];
|
|
375
|
+
readonly stateMutability: "view";
|
|
376
|
+
}];
|
|
377
|
+
/**
|
|
378
|
+
* FlashLoan ABI (0x0403)
|
|
379
|
+
* Flash loan facility
|
|
380
|
+
*/
|
|
381
|
+
export declare const FLASH_LOAN_ABI: readonly [{
|
|
382
|
+
readonly type: "function";
|
|
383
|
+
readonly name: "flash";
|
|
384
|
+
readonly inputs: readonly [{
|
|
385
|
+
readonly name: "recipient";
|
|
386
|
+
readonly type: "address";
|
|
387
|
+
}, {
|
|
388
|
+
readonly name: "currency";
|
|
389
|
+
readonly type: "address";
|
|
390
|
+
}, {
|
|
391
|
+
readonly name: "amount";
|
|
392
|
+
readonly type: "uint256";
|
|
393
|
+
}, {
|
|
394
|
+
readonly name: "data";
|
|
395
|
+
readonly type: "bytes";
|
|
396
|
+
}];
|
|
397
|
+
readonly outputs: readonly [];
|
|
398
|
+
readonly stateMutability: "nonpayable";
|
|
399
|
+
}];
|
|
400
|
+
//# sourceMappingURL=abis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../src/precompile/abis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuJnB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFlB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAkBrB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAajB,CAAA"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEX Precompile ABIs
|
|
3
|
+
* Native Go implementation at 0x0400-0x0403
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* PoolManager ABI (0x0400)
|
|
7
|
+
* Singleton contract managing all pools
|
|
8
|
+
*/
|
|
9
|
+
export const POOL_MANAGER_ABI = [
|
|
10
|
+
// Initialize a new pool
|
|
11
|
+
{
|
|
12
|
+
type: 'function',
|
|
13
|
+
name: 'initialize',
|
|
14
|
+
inputs: [
|
|
15
|
+
{
|
|
16
|
+
name: 'key',
|
|
17
|
+
type: 'tuple',
|
|
18
|
+
components: [
|
|
19
|
+
{ name: 'currency0', type: 'address' },
|
|
20
|
+
{ name: 'currency1', type: 'address' },
|
|
21
|
+
{ name: 'fee', type: 'uint24' },
|
|
22
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
23
|
+
{ name: 'hooks', type: 'address' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{ name: 'sqrtPriceX96', type: 'uint160' },
|
|
27
|
+
],
|
|
28
|
+
outputs: [{ name: 'tick', type: 'int24' }],
|
|
29
|
+
stateMutability: 'nonpayable',
|
|
30
|
+
},
|
|
31
|
+
// Execute a swap
|
|
32
|
+
{
|
|
33
|
+
type: 'function',
|
|
34
|
+
name: 'swap',
|
|
35
|
+
inputs: [
|
|
36
|
+
{
|
|
37
|
+
name: 'key',
|
|
38
|
+
type: 'tuple',
|
|
39
|
+
components: [
|
|
40
|
+
{ name: 'currency0', type: 'address' },
|
|
41
|
+
{ name: 'currency1', type: 'address' },
|
|
42
|
+
{ name: 'fee', type: 'uint24' },
|
|
43
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
44
|
+
{ name: 'hooks', type: 'address' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'params',
|
|
49
|
+
type: 'tuple',
|
|
50
|
+
components: [
|
|
51
|
+
{ name: 'zeroForOne', type: 'bool' },
|
|
52
|
+
{ name: 'amountSpecified', type: 'int256' },
|
|
53
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{ name: 'hookData', type: 'bytes' },
|
|
57
|
+
],
|
|
58
|
+
outputs: [{ name: 'delta', type: 'int256' }],
|
|
59
|
+
stateMutability: 'nonpayable',
|
|
60
|
+
},
|
|
61
|
+
// Modify liquidity
|
|
62
|
+
{
|
|
63
|
+
type: 'function',
|
|
64
|
+
name: 'modifyLiquidity',
|
|
65
|
+
inputs: [
|
|
66
|
+
{
|
|
67
|
+
name: 'key',
|
|
68
|
+
type: 'tuple',
|
|
69
|
+
components: [
|
|
70
|
+
{ name: 'currency0', type: 'address' },
|
|
71
|
+
{ name: 'currency1', type: 'address' },
|
|
72
|
+
{ name: 'fee', type: 'uint24' },
|
|
73
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
74
|
+
{ name: 'hooks', type: 'address' },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'params',
|
|
79
|
+
type: 'tuple',
|
|
80
|
+
components: [
|
|
81
|
+
{ name: 'tickLower', type: 'int24' },
|
|
82
|
+
{ name: 'tickUpper', type: 'int24' },
|
|
83
|
+
{ name: 'liquidityDelta', type: 'int256' },
|
|
84
|
+
{ name: 'salt', type: 'bytes32' },
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{ name: 'hookData', type: 'bytes' },
|
|
88
|
+
],
|
|
89
|
+
outputs: [
|
|
90
|
+
{ name: 'callerDelta', type: 'int256' },
|
|
91
|
+
{ name: 'feesAccrued', type: 'int256' },
|
|
92
|
+
],
|
|
93
|
+
stateMutability: 'nonpayable',
|
|
94
|
+
},
|
|
95
|
+
// Settle outstanding balance
|
|
96
|
+
{
|
|
97
|
+
type: 'function',
|
|
98
|
+
name: 'settle',
|
|
99
|
+
inputs: [{ name: 'currency', type: 'address' }],
|
|
100
|
+
outputs: [{ name: 'amount', type: 'uint256' }],
|
|
101
|
+
stateMutability: 'payable',
|
|
102
|
+
},
|
|
103
|
+
// Take tokens from pool
|
|
104
|
+
{
|
|
105
|
+
type: 'function',
|
|
106
|
+
name: 'take',
|
|
107
|
+
inputs: [
|
|
108
|
+
{ name: 'currency', type: 'address' },
|
|
109
|
+
{ name: 'to', type: 'address' },
|
|
110
|
+
{ name: 'amount', type: 'uint256' },
|
|
111
|
+
],
|
|
112
|
+
outputs: [],
|
|
113
|
+
stateMutability: 'nonpayable',
|
|
114
|
+
},
|
|
115
|
+
// Get pool state
|
|
116
|
+
{
|
|
117
|
+
type: 'function',
|
|
118
|
+
name: 'getSlot0',
|
|
119
|
+
inputs: [
|
|
120
|
+
{
|
|
121
|
+
name: 'key',
|
|
122
|
+
type: 'tuple',
|
|
123
|
+
components: [
|
|
124
|
+
{ name: 'currency0', type: 'address' },
|
|
125
|
+
{ name: 'currency1', type: 'address' },
|
|
126
|
+
{ name: 'fee', type: 'uint24' },
|
|
127
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
128
|
+
{ name: 'hooks', type: 'address' },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
outputs: [
|
|
133
|
+
{ name: 'sqrtPriceX96', type: 'uint160' },
|
|
134
|
+
{ name: 'tick', type: 'int24' },
|
|
135
|
+
{ name: 'protocolFee', type: 'uint24' },
|
|
136
|
+
{ name: 'lpFee', type: 'uint24' },
|
|
137
|
+
],
|
|
138
|
+
stateMutability: 'view',
|
|
139
|
+
},
|
|
140
|
+
// Get liquidity
|
|
141
|
+
{
|
|
142
|
+
type: 'function',
|
|
143
|
+
name: 'getLiquidity',
|
|
144
|
+
inputs: [
|
|
145
|
+
{
|
|
146
|
+
name: 'key',
|
|
147
|
+
type: 'tuple',
|
|
148
|
+
components: [
|
|
149
|
+
{ name: 'currency0', type: 'address' },
|
|
150
|
+
{ name: 'currency1', type: 'address' },
|
|
151
|
+
{ name: 'fee', type: 'uint24' },
|
|
152
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
153
|
+
{ name: 'hooks', type: 'address' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
outputs: [{ name: 'liquidity', type: 'uint128' }],
|
|
158
|
+
stateMutability: 'view',
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
/**
|
|
162
|
+
* SwapRouter ABI (0x0401)
|
|
163
|
+
* Optimized swap routing
|
|
164
|
+
*/
|
|
165
|
+
export const SWAP_ROUTER_ABI = [
|
|
166
|
+
// Single swap (exact input)
|
|
167
|
+
{
|
|
168
|
+
type: 'function',
|
|
169
|
+
name: 'exactInputSingle',
|
|
170
|
+
inputs: [
|
|
171
|
+
{
|
|
172
|
+
name: 'params',
|
|
173
|
+
type: 'tuple',
|
|
174
|
+
components: [
|
|
175
|
+
{
|
|
176
|
+
name: 'poolKey',
|
|
177
|
+
type: 'tuple',
|
|
178
|
+
components: [
|
|
179
|
+
{ name: 'currency0', type: 'address' },
|
|
180
|
+
{ name: 'currency1', type: 'address' },
|
|
181
|
+
{ name: 'fee', type: 'uint24' },
|
|
182
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
183
|
+
{ name: 'hooks', type: 'address' },
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{ name: 'zeroForOne', type: 'bool' },
|
|
187
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
188
|
+
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
189
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
190
|
+
{ name: 'hookData', type: 'bytes' },
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
195
|
+
stateMutability: 'payable',
|
|
196
|
+
},
|
|
197
|
+
// Single swap (exact output)
|
|
198
|
+
{
|
|
199
|
+
type: 'function',
|
|
200
|
+
name: 'exactOutputSingle',
|
|
201
|
+
inputs: [
|
|
202
|
+
{
|
|
203
|
+
name: 'params',
|
|
204
|
+
type: 'tuple',
|
|
205
|
+
components: [
|
|
206
|
+
{
|
|
207
|
+
name: 'poolKey',
|
|
208
|
+
type: 'tuple',
|
|
209
|
+
components: [
|
|
210
|
+
{ name: 'currency0', type: 'address' },
|
|
211
|
+
{ name: 'currency1', type: 'address' },
|
|
212
|
+
{ name: 'fee', type: 'uint24' },
|
|
213
|
+
{ name: 'tickSpacing', type: 'int24' },
|
|
214
|
+
{ name: 'hooks', type: 'address' },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
{ name: 'zeroForOne', type: 'bool' },
|
|
218
|
+
{ name: 'amountOut', type: 'uint256' },
|
|
219
|
+
{ name: 'amountInMaximum', type: 'uint256' },
|
|
220
|
+
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
221
|
+
{ name: 'hookData', type: 'bytes' },
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
outputs: [{ name: 'amountIn', type: 'uint256' }],
|
|
226
|
+
stateMutability: 'payable',
|
|
227
|
+
},
|
|
228
|
+
// Multi-hop swap
|
|
229
|
+
{
|
|
230
|
+
type: 'function',
|
|
231
|
+
name: 'exactInput',
|
|
232
|
+
inputs: [
|
|
233
|
+
{
|
|
234
|
+
name: 'params',
|
|
235
|
+
type: 'tuple',
|
|
236
|
+
components: [
|
|
237
|
+
{ name: 'path', type: 'bytes' },
|
|
238
|
+
{ name: 'amountIn', type: 'uint256' },
|
|
239
|
+
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
244
|
+
stateMutability: 'payable',
|
|
245
|
+
},
|
|
246
|
+
];
|
|
247
|
+
/**
|
|
248
|
+
* HooksRegistry ABI (0x0402)
|
|
249
|
+
* Registry for hook contracts
|
|
250
|
+
*/
|
|
251
|
+
export const HOOKS_REGISTRY_ABI = [
|
|
252
|
+
{
|
|
253
|
+
type: 'function',
|
|
254
|
+
name: 'registerHook',
|
|
255
|
+
inputs: [
|
|
256
|
+
{ name: 'hook', type: 'address' },
|
|
257
|
+
{ name: 'permissions', type: 'uint256' },
|
|
258
|
+
],
|
|
259
|
+
outputs: [],
|
|
260
|
+
stateMutability: 'nonpayable',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: 'function',
|
|
264
|
+
name: 'getHookPermissions',
|
|
265
|
+
inputs: [{ name: 'hook', type: 'address' }],
|
|
266
|
+
outputs: [{ name: 'permissions', type: 'uint256' }],
|
|
267
|
+
stateMutability: 'view',
|
|
268
|
+
},
|
|
269
|
+
];
|
|
270
|
+
/**
|
|
271
|
+
* FlashLoan ABI (0x0403)
|
|
272
|
+
* Flash loan facility
|
|
273
|
+
*/
|
|
274
|
+
export const FLASH_LOAN_ABI = [
|
|
275
|
+
{
|
|
276
|
+
type: 'function',
|
|
277
|
+
name: 'flash',
|
|
278
|
+
inputs: [
|
|
279
|
+
{ name: 'recipient', type: 'address' },
|
|
280
|
+
{ name: 'currency', type: 'address' },
|
|
281
|
+
{ name: 'amount', type: 'uint256' },
|
|
282
|
+
{ name: 'data', type: 'bytes' },
|
|
283
|
+
],
|
|
284
|
+
outputs: [],
|
|
285
|
+
stateMutability: 'nonpayable',
|
|
286
|
+
},
|
|
287
|
+
];
|