@gitmyabi/uniswapv3pool 0.0.0-stage → 1.0.90
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/README.md +107 -2
- package/contracts/UniswapV3Pool.d.ts +1389 -0
- package/contracts/UniswapV3Pool.js +1546 -0
- package/contracts/UniswapV3Pool.ts +1800 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +40 -3
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UniswapV3Pool = exports.UniswapV3PoolAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* UniswapV3Pool ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.UniswapV3PoolAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"stateMutability": "nonpayable",
|
|
14
|
+
"type": "constructor"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"anonymous": false,
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"indexed": true,
|
|
21
|
+
"internalType": "address",
|
|
22
|
+
"name": "owner",
|
|
23
|
+
"type": "address"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"indexed": true,
|
|
27
|
+
"internalType": "int24",
|
|
28
|
+
"name": "tickLower",
|
|
29
|
+
"type": "int24"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"indexed": true,
|
|
33
|
+
"internalType": "int24",
|
|
34
|
+
"name": "tickUpper",
|
|
35
|
+
"type": "int24"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"indexed": false,
|
|
39
|
+
"internalType": "uint128",
|
|
40
|
+
"name": "amount",
|
|
41
|
+
"type": "uint128"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"indexed": false,
|
|
45
|
+
"internalType": "uint256",
|
|
46
|
+
"name": "amount0",
|
|
47
|
+
"type": "uint256"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"indexed": false,
|
|
51
|
+
"internalType": "uint256",
|
|
52
|
+
"name": "amount1",
|
|
53
|
+
"type": "uint256"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"name": "Burn",
|
|
57
|
+
"type": "event"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"anonymous": false,
|
|
61
|
+
"inputs": [
|
|
62
|
+
{
|
|
63
|
+
"indexed": true,
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "owner",
|
|
66
|
+
"type": "address"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "address",
|
|
71
|
+
"name": "recipient",
|
|
72
|
+
"type": "address"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"indexed": true,
|
|
76
|
+
"internalType": "int24",
|
|
77
|
+
"name": "tickLower",
|
|
78
|
+
"type": "int24"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"indexed": true,
|
|
82
|
+
"internalType": "int24",
|
|
83
|
+
"name": "tickUpper",
|
|
84
|
+
"type": "int24"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"indexed": false,
|
|
88
|
+
"internalType": "uint128",
|
|
89
|
+
"name": "amount0",
|
|
90
|
+
"type": "uint128"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"indexed": false,
|
|
94
|
+
"internalType": "uint128",
|
|
95
|
+
"name": "amount1",
|
|
96
|
+
"type": "uint128"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"name": "Collect",
|
|
100
|
+
"type": "event"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"anonymous": false,
|
|
104
|
+
"inputs": [
|
|
105
|
+
{
|
|
106
|
+
"indexed": true,
|
|
107
|
+
"internalType": "address",
|
|
108
|
+
"name": "sender",
|
|
109
|
+
"type": "address"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"indexed": true,
|
|
113
|
+
"internalType": "address",
|
|
114
|
+
"name": "recipient",
|
|
115
|
+
"type": "address"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"indexed": false,
|
|
119
|
+
"internalType": "uint128",
|
|
120
|
+
"name": "amount0",
|
|
121
|
+
"type": "uint128"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"indexed": false,
|
|
125
|
+
"internalType": "uint128",
|
|
126
|
+
"name": "amount1",
|
|
127
|
+
"type": "uint128"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"name": "CollectProtocol",
|
|
131
|
+
"type": "event"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"anonymous": false,
|
|
135
|
+
"inputs": [
|
|
136
|
+
{
|
|
137
|
+
"indexed": true,
|
|
138
|
+
"internalType": "address",
|
|
139
|
+
"name": "sender",
|
|
140
|
+
"type": "address"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"indexed": true,
|
|
144
|
+
"internalType": "address",
|
|
145
|
+
"name": "recipient",
|
|
146
|
+
"type": "address"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"indexed": false,
|
|
150
|
+
"internalType": "uint256",
|
|
151
|
+
"name": "amount0",
|
|
152
|
+
"type": "uint256"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"indexed": false,
|
|
156
|
+
"internalType": "uint256",
|
|
157
|
+
"name": "amount1",
|
|
158
|
+
"type": "uint256"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"indexed": false,
|
|
162
|
+
"internalType": "uint256",
|
|
163
|
+
"name": "paid0",
|
|
164
|
+
"type": "uint256"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"indexed": false,
|
|
168
|
+
"internalType": "uint256",
|
|
169
|
+
"name": "paid1",
|
|
170
|
+
"type": "uint256"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"name": "Flash",
|
|
174
|
+
"type": "event"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"anonymous": false,
|
|
178
|
+
"inputs": [
|
|
179
|
+
{
|
|
180
|
+
"indexed": false,
|
|
181
|
+
"internalType": "uint16",
|
|
182
|
+
"name": "observationCardinalityNextOld",
|
|
183
|
+
"type": "uint16"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"indexed": false,
|
|
187
|
+
"internalType": "uint16",
|
|
188
|
+
"name": "observationCardinalityNextNew",
|
|
189
|
+
"type": "uint16"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"name": "IncreaseObservationCardinalityNext",
|
|
193
|
+
"type": "event"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"anonymous": false,
|
|
197
|
+
"inputs": [
|
|
198
|
+
{
|
|
199
|
+
"indexed": false,
|
|
200
|
+
"internalType": "uint160",
|
|
201
|
+
"name": "sqrtPriceX96",
|
|
202
|
+
"type": "uint160"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"indexed": false,
|
|
206
|
+
"internalType": "int24",
|
|
207
|
+
"name": "tick",
|
|
208
|
+
"type": "int24"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"name": "Initialize",
|
|
212
|
+
"type": "event"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"anonymous": false,
|
|
216
|
+
"inputs": [
|
|
217
|
+
{
|
|
218
|
+
"indexed": false,
|
|
219
|
+
"internalType": "address",
|
|
220
|
+
"name": "sender",
|
|
221
|
+
"type": "address"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"indexed": true,
|
|
225
|
+
"internalType": "address",
|
|
226
|
+
"name": "owner",
|
|
227
|
+
"type": "address"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"indexed": true,
|
|
231
|
+
"internalType": "int24",
|
|
232
|
+
"name": "tickLower",
|
|
233
|
+
"type": "int24"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"indexed": true,
|
|
237
|
+
"internalType": "int24",
|
|
238
|
+
"name": "tickUpper",
|
|
239
|
+
"type": "int24"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"indexed": false,
|
|
243
|
+
"internalType": "uint128",
|
|
244
|
+
"name": "amount",
|
|
245
|
+
"type": "uint128"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"indexed": false,
|
|
249
|
+
"internalType": "uint256",
|
|
250
|
+
"name": "amount0",
|
|
251
|
+
"type": "uint256"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"indexed": false,
|
|
255
|
+
"internalType": "uint256",
|
|
256
|
+
"name": "amount1",
|
|
257
|
+
"type": "uint256"
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"name": "Mint",
|
|
261
|
+
"type": "event"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"anonymous": false,
|
|
265
|
+
"inputs": [
|
|
266
|
+
{
|
|
267
|
+
"indexed": false,
|
|
268
|
+
"internalType": "uint8",
|
|
269
|
+
"name": "feeProtocol0Old",
|
|
270
|
+
"type": "uint8"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"indexed": false,
|
|
274
|
+
"internalType": "uint8",
|
|
275
|
+
"name": "feeProtocol1Old",
|
|
276
|
+
"type": "uint8"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"indexed": false,
|
|
280
|
+
"internalType": "uint8",
|
|
281
|
+
"name": "feeProtocol0New",
|
|
282
|
+
"type": "uint8"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"indexed": false,
|
|
286
|
+
"internalType": "uint8",
|
|
287
|
+
"name": "feeProtocol1New",
|
|
288
|
+
"type": "uint8"
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"name": "SetFeeProtocol",
|
|
292
|
+
"type": "event"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"anonymous": false,
|
|
296
|
+
"inputs": [
|
|
297
|
+
{
|
|
298
|
+
"indexed": true,
|
|
299
|
+
"internalType": "address",
|
|
300
|
+
"name": "sender",
|
|
301
|
+
"type": "address"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"indexed": true,
|
|
305
|
+
"internalType": "address",
|
|
306
|
+
"name": "recipient",
|
|
307
|
+
"type": "address"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"indexed": false,
|
|
311
|
+
"internalType": "int256",
|
|
312
|
+
"name": "amount0",
|
|
313
|
+
"type": "int256"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"indexed": false,
|
|
317
|
+
"internalType": "int256",
|
|
318
|
+
"name": "amount1",
|
|
319
|
+
"type": "int256"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"indexed": false,
|
|
323
|
+
"internalType": "uint160",
|
|
324
|
+
"name": "sqrtPriceX96",
|
|
325
|
+
"type": "uint160"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"indexed": false,
|
|
329
|
+
"internalType": "uint128",
|
|
330
|
+
"name": "liquidity",
|
|
331
|
+
"type": "uint128"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"indexed": false,
|
|
335
|
+
"internalType": "int24",
|
|
336
|
+
"name": "tick",
|
|
337
|
+
"type": "int24"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"name": "Swap",
|
|
341
|
+
"type": "event"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"inputs": [
|
|
345
|
+
{
|
|
346
|
+
"internalType": "int24",
|
|
347
|
+
"name": "tickLower",
|
|
348
|
+
"type": "int24"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"internalType": "int24",
|
|
352
|
+
"name": "tickUpper",
|
|
353
|
+
"type": "int24"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"internalType": "uint128",
|
|
357
|
+
"name": "amount",
|
|
358
|
+
"type": "uint128"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"name": "burn",
|
|
362
|
+
"outputs": [
|
|
363
|
+
{
|
|
364
|
+
"internalType": "uint256",
|
|
365
|
+
"name": "amount0",
|
|
366
|
+
"type": "uint256"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"internalType": "uint256",
|
|
370
|
+
"name": "amount1",
|
|
371
|
+
"type": "uint256"
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
"stateMutability": "nonpayable",
|
|
375
|
+
"type": "function"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"inputs": [
|
|
379
|
+
{
|
|
380
|
+
"internalType": "address",
|
|
381
|
+
"name": "recipient",
|
|
382
|
+
"type": "address"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"internalType": "int24",
|
|
386
|
+
"name": "tickLower",
|
|
387
|
+
"type": "int24"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"internalType": "int24",
|
|
391
|
+
"name": "tickUpper",
|
|
392
|
+
"type": "int24"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"internalType": "uint128",
|
|
396
|
+
"name": "amount0Requested",
|
|
397
|
+
"type": "uint128"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"internalType": "uint128",
|
|
401
|
+
"name": "amount1Requested",
|
|
402
|
+
"type": "uint128"
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
"name": "collect",
|
|
406
|
+
"outputs": [
|
|
407
|
+
{
|
|
408
|
+
"internalType": "uint128",
|
|
409
|
+
"name": "amount0",
|
|
410
|
+
"type": "uint128"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"internalType": "uint128",
|
|
414
|
+
"name": "amount1",
|
|
415
|
+
"type": "uint128"
|
|
416
|
+
}
|
|
417
|
+
],
|
|
418
|
+
"stateMutability": "nonpayable",
|
|
419
|
+
"type": "function"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"inputs": [
|
|
423
|
+
{
|
|
424
|
+
"internalType": "address",
|
|
425
|
+
"name": "recipient",
|
|
426
|
+
"type": "address"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"internalType": "uint128",
|
|
430
|
+
"name": "amount0Requested",
|
|
431
|
+
"type": "uint128"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"internalType": "uint128",
|
|
435
|
+
"name": "amount1Requested",
|
|
436
|
+
"type": "uint128"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"name": "collectProtocol",
|
|
440
|
+
"outputs": [
|
|
441
|
+
{
|
|
442
|
+
"internalType": "uint128",
|
|
443
|
+
"name": "amount0",
|
|
444
|
+
"type": "uint128"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"internalType": "uint128",
|
|
448
|
+
"name": "amount1",
|
|
449
|
+
"type": "uint128"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"stateMutability": "nonpayable",
|
|
453
|
+
"type": "function"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"inputs": [],
|
|
457
|
+
"name": "factory",
|
|
458
|
+
"outputs": [
|
|
459
|
+
{
|
|
460
|
+
"internalType": "address",
|
|
461
|
+
"name": "",
|
|
462
|
+
"type": "address"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"stateMutability": "view",
|
|
466
|
+
"type": "function"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"inputs": [],
|
|
470
|
+
"name": "fee",
|
|
471
|
+
"outputs": [
|
|
472
|
+
{
|
|
473
|
+
"internalType": "uint24",
|
|
474
|
+
"name": "",
|
|
475
|
+
"type": "uint24"
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
"stateMutability": "view",
|
|
479
|
+
"type": "function"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"inputs": [],
|
|
483
|
+
"name": "feeGrowthGlobal0X128",
|
|
484
|
+
"outputs": [
|
|
485
|
+
{
|
|
486
|
+
"internalType": "uint256",
|
|
487
|
+
"name": "",
|
|
488
|
+
"type": "uint256"
|
|
489
|
+
}
|
|
490
|
+
],
|
|
491
|
+
"stateMutability": "view",
|
|
492
|
+
"type": "function"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"inputs": [],
|
|
496
|
+
"name": "feeGrowthGlobal1X128",
|
|
497
|
+
"outputs": [
|
|
498
|
+
{
|
|
499
|
+
"internalType": "uint256",
|
|
500
|
+
"name": "",
|
|
501
|
+
"type": "uint256"
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
"stateMutability": "view",
|
|
505
|
+
"type": "function"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"inputs": [
|
|
509
|
+
{
|
|
510
|
+
"internalType": "address",
|
|
511
|
+
"name": "recipient",
|
|
512
|
+
"type": "address"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"internalType": "uint256",
|
|
516
|
+
"name": "amount0",
|
|
517
|
+
"type": "uint256"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"internalType": "uint256",
|
|
521
|
+
"name": "amount1",
|
|
522
|
+
"type": "uint256"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"internalType": "bytes",
|
|
526
|
+
"name": "data",
|
|
527
|
+
"type": "bytes"
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
"name": "flash",
|
|
531
|
+
"outputs": [],
|
|
532
|
+
"stateMutability": "nonpayable",
|
|
533
|
+
"type": "function"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"inputs": [
|
|
537
|
+
{
|
|
538
|
+
"internalType": "uint16",
|
|
539
|
+
"name": "observationCardinalityNext",
|
|
540
|
+
"type": "uint16"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"name": "increaseObservationCardinalityNext",
|
|
544
|
+
"outputs": [],
|
|
545
|
+
"stateMutability": "nonpayable",
|
|
546
|
+
"type": "function"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"inputs": [
|
|
550
|
+
{
|
|
551
|
+
"internalType": "uint160",
|
|
552
|
+
"name": "sqrtPriceX96",
|
|
553
|
+
"type": "uint160"
|
|
554
|
+
}
|
|
555
|
+
],
|
|
556
|
+
"name": "initialize",
|
|
557
|
+
"outputs": [],
|
|
558
|
+
"stateMutability": "nonpayable",
|
|
559
|
+
"type": "function"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"inputs": [],
|
|
563
|
+
"name": "liquidity",
|
|
564
|
+
"outputs": [
|
|
565
|
+
{
|
|
566
|
+
"internalType": "uint128",
|
|
567
|
+
"name": "",
|
|
568
|
+
"type": "uint128"
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
"stateMutability": "view",
|
|
572
|
+
"type": "function"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"inputs": [],
|
|
576
|
+
"name": "maxLiquidityPerTick",
|
|
577
|
+
"outputs": [
|
|
578
|
+
{
|
|
579
|
+
"internalType": "uint128",
|
|
580
|
+
"name": "",
|
|
581
|
+
"type": "uint128"
|
|
582
|
+
}
|
|
583
|
+
],
|
|
584
|
+
"stateMutability": "view",
|
|
585
|
+
"type": "function"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
"inputs": [
|
|
589
|
+
{
|
|
590
|
+
"internalType": "address",
|
|
591
|
+
"name": "recipient",
|
|
592
|
+
"type": "address"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"internalType": "int24",
|
|
596
|
+
"name": "tickLower",
|
|
597
|
+
"type": "int24"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"internalType": "int24",
|
|
601
|
+
"name": "tickUpper",
|
|
602
|
+
"type": "int24"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"internalType": "uint128",
|
|
606
|
+
"name": "amount",
|
|
607
|
+
"type": "uint128"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"internalType": "bytes",
|
|
611
|
+
"name": "data",
|
|
612
|
+
"type": "bytes"
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
"name": "mint",
|
|
616
|
+
"outputs": [
|
|
617
|
+
{
|
|
618
|
+
"internalType": "uint256",
|
|
619
|
+
"name": "amount0",
|
|
620
|
+
"type": "uint256"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"internalType": "uint256",
|
|
624
|
+
"name": "amount1",
|
|
625
|
+
"type": "uint256"
|
|
626
|
+
}
|
|
627
|
+
],
|
|
628
|
+
"stateMutability": "nonpayable",
|
|
629
|
+
"type": "function"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
"inputs": [
|
|
633
|
+
{
|
|
634
|
+
"internalType": "uint256",
|
|
635
|
+
"name": "",
|
|
636
|
+
"type": "uint256"
|
|
637
|
+
}
|
|
638
|
+
],
|
|
639
|
+
"name": "observations",
|
|
640
|
+
"outputs": [
|
|
641
|
+
{
|
|
642
|
+
"internalType": "uint32",
|
|
643
|
+
"name": "blockTimestamp",
|
|
644
|
+
"type": "uint32"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"internalType": "int56",
|
|
648
|
+
"name": "tickCumulative",
|
|
649
|
+
"type": "int56"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"internalType": "uint160",
|
|
653
|
+
"name": "secondsPerLiquidityCumulativeX128",
|
|
654
|
+
"type": "uint160"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
"internalType": "bool",
|
|
658
|
+
"name": "initialized",
|
|
659
|
+
"type": "bool"
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
"stateMutability": "view",
|
|
663
|
+
"type": "function"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"inputs": [
|
|
667
|
+
{
|
|
668
|
+
"internalType": "uint32[]",
|
|
669
|
+
"name": "secondsAgos",
|
|
670
|
+
"type": "uint32[]"
|
|
671
|
+
}
|
|
672
|
+
],
|
|
673
|
+
"name": "observe",
|
|
674
|
+
"outputs": [
|
|
675
|
+
{
|
|
676
|
+
"internalType": "int56[]",
|
|
677
|
+
"name": "tickCumulatives",
|
|
678
|
+
"type": "int56[]"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"internalType": "uint160[]",
|
|
682
|
+
"name": "secondsPerLiquidityCumulativeX128s",
|
|
683
|
+
"type": "uint160[]"
|
|
684
|
+
}
|
|
685
|
+
],
|
|
686
|
+
"stateMutability": "view",
|
|
687
|
+
"type": "function"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"inputs": [
|
|
691
|
+
{
|
|
692
|
+
"internalType": "bytes32",
|
|
693
|
+
"name": "",
|
|
694
|
+
"type": "bytes32"
|
|
695
|
+
}
|
|
696
|
+
],
|
|
697
|
+
"name": "positions",
|
|
698
|
+
"outputs": [
|
|
699
|
+
{
|
|
700
|
+
"internalType": "uint128",
|
|
701
|
+
"name": "liquidity",
|
|
702
|
+
"type": "uint128"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"internalType": "uint256",
|
|
706
|
+
"name": "feeGrowthInside0LastX128",
|
|
707
|
+
"type": "uint256"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"internalType": "uint256",
|
|
711
|
+
"name": "feeGrowthInside1LastX128",
|
|
712
|
+
"type": "uint256"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"internalType": "uint128",
|
|
716
|
+
"name": "tokensOwed0",
|
|
717
|
+
"type": "uint128"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"internalType": "uint128",
|
|
721
|
+
"name": "tokensOwed1",
|
|
722
|
+
"type": "uint128"
|
|
723
|
+
}
|
|
724
|
+
],
|
|
725
|
+
"stateMutability": "view",
|
|
726
|
+
"type": "function"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"inputs": [],
|
|
730
|
+
"name": "protocolFees",
|
|
731
|
+
"outputs": [
|
|
732
|
+
{
|
|
733
|
+
"internalType": "uint128",
|
|
734
|
+
"name": "token0",
|
|
735
|
+
"type": "uint128"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"internalType": "uint128",
|
|
739
|
+
"name": "token1",
|
|
740
|
+
"type": "uint128"
|
|
741
|
+
}
|
|
742
|
+
],
|
|
743
|
+
"stateMutability": "view",
|
|
744
|
+
"type": "function"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"inputs": [
|
|
748
|
+
{
|
|
749
|
+
"internalType": "uint8",
|
|
750
|
+
"name": "feeProtocol0",
|
|
751
|
+
"type": "uint8"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"internalType": "uint8",
|
|
755
|
+
"name": "feeProtocol1",
|
|
756
|
+
"type": "uint8"
|
|
757
|
+
}
|
|
758
|
+
],
|
|
759
|
+
"name": "setFeeProtocol",
|
|
760
|
+
"outputs": [],
|
|
761
|
+
"stateMutability": "nonpayable",
|
|
762
|
+
"type": "function"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
"inputs": [],
|
|
766
|
+
"name": "slot0",
|
|
767
|
+
"outputs": [
|
|
768
|
+
{
|
|
769
|
+
"internalType": "uint160",
|
|
770
|
+
"name": "sqrtPriceX96",
|
|
771
|
+
"type": "uint160"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
"internalType": "int24",
|
|
775
|
+
"name": "tick",
|
|
776
|
+
"type": "int24"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"internalType": "uint16",
|
|
780
|
+
"name": "observationIndex",
|
|
781
|
+
"type": "uint16"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"internalType": "uint16",
|
|
785
|
+
"name": "observationCardinality",
|
|
786
|
+
"type": "uint16"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"internalType": "uint16",
|
|
790
|
+
"name": "observationCardinalityNext",
|
|
791
|
+
"type": "uint16"
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"internalType": "uint8",
|
|
795
|
+
"name": "feeProtocol",
|
|
796
|
+
"type": "uint8"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"internalType": "bool",
|
|
800
|
+
"name": "unlocked",
|
|
801
|
+
"type": "bool"
|
|
802
|
+
}
|
|
803
|
+
],
|
|
804
|
+
"stateMutability": "view",
|
|
805
|
+
"type": "function"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"inputs": [
|
|
809
|
+
{
|
|
810
|
+
"internalType": "int24",
|
|
811
|
+
"name": "tickLower",
|
|
812
|
+
"type": "int24"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"internalType": "int24",
|
|
816
|
+
"name": "tickUpper",
|
|
817
|
+
"type": "int24"
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
"name": "snapshotCumulativesInside",
|
|
821
|
+
"outputs": [
|
|
822
|
+
{
|
|
823
|
+
"internalType": "int56",
|
|
824
|
+
"name": "tickCumulativeInside",
|
|
825
|
+
"type": "int56"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"internalType": "uint160",
|
|
829
|
+
"name": "secondsPerLiquidityInsideX128",
|
|
830
|
+
"type": "uint160"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"internalType": "uint32",
|
|
834
|
+
"name": "secondsInside",
|
|
835
|
+
"type": "uint32"
|
|
836
|
+
}
|
|
837
|
+
],
|
|
838
|
+
"stateMutability": "view",
|
|
839
|
+
"type": "function"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"inputs": [
|
|
843
|
+
{
|
|
844
|
+
"internalType": "address",
|
|
845
|
+
"name": "recipient",
|
|
846
|
+
"type": "address"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"internalType": "bool",
|
|
850
|
+
"name": "zeroForOne",
|
|
851
|
+
"type": "bool"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
"internalType": "int256",
|
|
855
|
+
"name": "amountSpecified",
|
|
856
|
+
"type": "int256"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"internalType": "uint160",
|
|
860
|
+
"name": "sqrtPriceLimitX96",
|
|
861
|
+
"type": "uint160"
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"internalType": "bytes",
|
|
865
|
+
"name": "data",
|
|
866
|
+
"type": "bytes"
|
|
867
|
+
}
|
|
868
|
+
],
|
|
869
|
+
"name": "swap",
|
|
870
|
+
"outputs": [
|
|
871
|
+
{
|
|
872
|
+
"internalType": "int256",
|
|
873
|
+
"name": "amount0",
|
|
874
|
+
"type": "int256"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"internalType": "int256",
|
|
878
|
+
"name": "amount1",
|
|
879
|
+
"type": "int256"
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
"stateMutability": "nonpayable",
|
|
883
|
+
"type": "function"
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"inputs": [
|
|
887
|
+
{
|
|
888
|
+
"internalType": "int16",
|
|
889
|
+
"name": "",
|
|
890
|
+
"type": "int16"
|
|
891
|
+
}
|
|
892
|
+
],
|
|
893
|
+
"name": "tickBitmap",
|
|
894
|
+
"outputs": [
|
|
895
|
+
{
|
|
896
|
+
"internalType": "uint256",
|
|
897
|
+
"name": "",
|
|
898
|
+
"type": "uint256"
|
|
899
|
+
}
|
|
900
|
+
],
|
|
901
|
+
"stateMutability": "view",
|
|
902
|
+
"type": "function"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"inputs": [],
|
|
906
|
+
"name": "tickSpacing",
|
|
907
|
+
"outputs": [
|
|
908
|
+
{
|
|
909
|
+
"internalType": "int24",
|
|
910
|
+
"name": "",
|
|
911
|
+
"type": "int24"
|
|
912
|
+
}
|
|
913
|
+
],
|
|
914
|
+
"stateMutability": "view",
|
|
915
|
+
"type": "function"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
"inputs": [
|
|
919
|
+
{
|
|
920
|
+
"internalType": "int24",
|
|
921
|
+
"name": "",
|
|
922
|
+
"type": "int24"
|
|
923
|
+
}
|
|
924
|
+
],
|
|
925
|
+
"name": "ticks",
|
|
926
|
+
"outputs": [
|
|
927
|
+
{
|
|
928
|
+
"internalType": "uint128",
|
|
929
|
+
"name": "liquidityGross",
|
|
930
|
+
"type": "uint128"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"internalType": "int128",
|
|
934
|
+
"name": "liquidityNet",
|
|
935
|
+
"type": "int128"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"internalType": "uint256",
|
|
939
|
+
"name": "feeGrowthOutside0X128",
|
|
940
|
+
"type": "uint256"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
"internalType": "uint256",
|
|
944
|
+
"name": "feeGrowthOutside1X128",
|
|
945
|
+
"type": "uint256"
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
"internalType": "int56",
|
|
949
|
+
"name": "tickCumulativeOutside",
|
|
950
|
+
"type": "int56"
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"internalType": "uint160",
|
|
954
|
+
"name": "secondsPerLiquidityOutsideX128",
|
|
955
|
+
"type": "uint160"
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
"internalType": "uint32",
|
|
959
|
+
"name": "secondsOutside",
|
|
960
|
+
"type": "uint32"
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
"internalType": "bool",
|
|
964
|
+
"name": "initialized",
|
|
965
|
+
"type": "bool"
|
|
966
|
+
}
|
|
967
|
+
],
|
|
968
|
+
"stateMutability": "view",
|
|
969
|
+
"type": "function"
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"inputs": [],
|
|
973
|
+
"name": "token0",
|
|
974
|
+
"outputs": [
|
|
975
|
+
{
|
|
976
|
+
"internalType": "address",
|
|
977
|
+
"name": "",
|
|
978
|
+
"type": "address"
|
|
979
|
+
}
|
|
980
|
+
],
|
|
981
|
+
"stateMutability": "view",
|
|
982
|
+
"type": "function"
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
"inputs": [],
|
|
986
|
+
"name": "token1",
|
|
987
|
+
"outputs": [
|
|
988
|
+
{
|
|
989
|
+
"internalType": "address",
|
|
990
|
+
"name": "",
|
|
991
|
+
"type": "address"
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
"stateMutability": "view",
|
|
995
|
+
"type": "function"
|
|
996
|
+
}
|
|
997
|
+
];
|
|
998
|
+
/**
|
|
999
|
+
* UniswapV3Pool Contract Class
|
|
1000
|
+
*
|
|
1001
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
1002
|
+
*
|
|
1003
|
+
* @example
|
|
1004
|
+
* ```typescript
|
|
1005
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
1006
|
+
* import { mainnet } from 'viem/chains';
|
|
1007
|
+
* import { UniswapV3Pool } from 'UniswapV3Pool';
|
|
1008
|
+
*
|
|
1009
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
1010
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
1011
|
+
*
|
|
1012
|
+
* const contract = new UniswapV3Pool('0x...', { publicClient, walletClient });
|
|
1013
|
+
*
|
|
1014
|
+
* // Read functions
|
|
1015
|
+
* const result = await contract.balanceOf('0x...');
|
|
1016
|
+
*
|
|
1017
|
+
* // Write functions
|
|
1018
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
1019
|
+
*
|
|
1020
|
+
* // Simulate transactions (dry-run)
|
|
1021
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
1022
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
1023
|
+
*
|
|
1024
|
+
* // Watch events
|
|
1025
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1026
|
+
* console.log('Transfer event:', event);
|
|
1027
|
+
* });
|
|
1028
|
+
* ```
|
|
1029
|
+
*/
|
|
1030
|
+
class UniswapV3Pool {
|
|
1031
|
+
constructor(address, clients) {
|
|
1032
|
+
this.contractAddress = address;
|
|
1033
|
+
this.publicClient = clients.publicClient;
|
|
1034
|
+
this.contract = (0, viem_1.getContract)({
|
|
1035
|
+
address,
|
|
1036
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1037
|
+
client: {
|
|
1038
|
+
public: clients.publicClient,
|
|
1039
|
+
wallet: clients.walletClient,
|
|
1040
|
+
},
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Get the contract address
|
|
1045
|
+
*/
|
|
1046
|
+
get address() {
|
|
1047
|
+
return this.contractAddress;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Get the underlying viem contract instance.
|
|
1051
|
+
*/
|
|
1052
|
+
getContract() {
|
|
1053
|
+
return this.contract;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* factory
|
|
1057
|
+
* view
|
|
1058
|
+
*/
|
|
1059
|
+
async factory() {
|
|
1060
|
+
return this.contract.read.factory();
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* fee
|
|
1064
|
+
* view
|
|
1065
|
+
*/
|
|
1066
|
+
async fee() {
|
|
1067
|
+
return this.contract.read.fee();
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* feeGrowthGlobal0X128
|
|
1071
|
+
* view
|
|
1072
|
+
*/
|
|
1073
|
+
async feeGrowthGlobal0X128() {
|
|
1074
|
+
return this.contract.read.feeGrowthGlobal0X128();
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* feeGrowthGlobal1X128
|
|
1078
|
+
* view
|
|
1079
|
+
*/
|
|
1080
|
+
async feeGrowthGlobal1X128() {
|
|
1081
|
+
return this.contract.read.feeGrowthGlobal1X128();
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* liquidity
|
|
1085
|
+
* view
|
|
1086
|
+
*/
|
|
1087
|
+
async liquidity() {
|
|
1088
|
+
return this.contract.read.liquidity();
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* maxLiquidityPerTick
|
|
1092
|
+
* view
|
|
1093
|
+
*/
|
|
1094
|
+
async maxLiquidityPerTick() {
|
|
1095
|
+
return this.contract.read.maxLiquidityPerTick();
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* observations
|
|
1099
|
+
* view
|
|
1100
|
+
*/
|
|
1101
|
+
async observations(arg0) {
|
|
1102
|
+
return this.contract.read.observations([arg0]);
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* observe
|
|
1106
|
+
* view
|
|
1107
|
+
*/
|
|
1108
|
+
async observe(secondsAgos) {
|
|
1109
|
+
return this.contract.read.observe([secondsAgos]);
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* positions
|
|
1113
|
+
* view
|
|
1114
|
+
*/
|
|
1115
|
+
async positions(arg0) {
|
|
1116
|
+
return this.contract.read.positions([arg0]);
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* protocolFees
|
|
1120
|
+
* view
|
|
1121
|
+
*/
|
|
1122
|
+
async protocolFees() {
|
|
1123
|
+
return this.contract.read.protocolFees();
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* slot0
|
|
1127
|
+
* view
|
|
1128
|
+
*/
|
|
1129
|
+
async slot0() {
|
|
1130
|
+
return this.contract.read.slot0();
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* snapshotCumulativesInside
|
|
1134
|
+
* view
|
|
1135
|
+
*/
|
|
1136
|
+
async snapshotCumulativesInside(tickLower, tickUpper) {
|
|
1137
|
+
return this.contract.read.snapshotCumulativesInside([tickLower, tickUpper]);
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* tickBitmap
|
|
1141
|
+
* view
|
|
1142
|
+
*/
|
|
1143
|
+
async tickBitmap(arg0) {
|
|
1144
|
+
return this.contract.read.tickBitmap([arg0]);
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* tickSpacing
|
|
1148
|
+
* view
|
|
1149
|
+
*/
|
|
1150
|
+
async tickSpacing() {
|
|
1151
|
+
return this.contract.read.tickSpacing();
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* ticks
|
|
1155
|
+
* view
|
|
1156
|
+
*/
|
|
1157
|
+
async ticks(arg0) {
|
|
1158
|
+
return this.contract.read.ticks([arg0]);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* token0
|
|
1162
|
+
* view
|
|
1163
|
+
*/
|
|
1164
|
+
async token0() {
|
|
1165
|
+
return this.contract.read.token0();
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* token1
|
|
1169
|
+
* view
|
|
1170
|
+
*/
|
|
1171
|
+
async token1() {
|
|
1172
|
+
return this.contract.read.token1();
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* burn
|
|
1176
|
+
* nonpayable
|
|
1177
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1178
|
+
*/
|
|
1179
|
+
async burn(tickLower, tickUpper, amount, options) {
|
|
1180
|
+
if (!this.contract.write) {
|
|
1181
|
+
throw new Error('Wallet client is required for write operations');
|
|
1182
|
+
}
|
|
1183
|
+
return this.contract.write.burn([tickLower, tickUpper, amount], options);
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* collect
|
|
1187
|
+
* nonpayable
|
|
1188
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1189
|
+
*/
|
|
1190
|
+
async collect(recipient, tickLower, tickUpper, amount0Requested, amount1Requested, options) {
|
|
1191
|
+
if (!this.contract.write) {
|
|
1192
|
+
throw new Error('Wallet client is required for write operations');
|
|
1193
|
+
}
|
|
1194
|
+
return this.contract.write.collect([recipient, tickLower, tickUpper, amount0Requested, amount1Requested], options);
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* collectProtocol
|
|
1198
|
+
* nonpayable
|
|
1199
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1200
|
+
*/
|
|
1201
|
+
async collectProtocol(recipient, amount0Requested, amount1Requested, options) {
|
|
1202
|
+
if (!this.contract.write) {
|
|
1203
|
+
throw new Error('Wallet client is required for write operations');
|
|
1204
|
+
}
|
|
1205
|
+
return this.contract.write.collectProtocol([recipient, amount0Requested, amount1Requested], options);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* flash
|
|
1209
|
+
* nonpayable
|
|
1210
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1211
|
+
*/
|
|
1212
|
+
async flash(recipient, amount0, amount1, data, options) {
|
|
1213
|
+
if (!this.contract.write) {
|
|
1214
|
+
throw new Error('Wallet client is required for write operations');
|
|
1215
|
+
}
|
|
1216
|
+
return this.contract.write.flash([recipient, amount0, amount1, data], options);
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* increaseObservationCardinalityNext
|
|
1220
|
+
* nonpayable
|
|
1221
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1222
|
+
*/
|
|
1223
|
+
async increaseObservationCardinalityNext(observationCardinalityNext, options) {
|
|
1224
|
+
if (!this.contract.write) {
|
|
1225
|
+
throw new Error('Wallet client is required for write operations');
|
|
1226
|
+
}
|
|
1227
|
+
return this.contract.write.increaseObservationCardinalityNext([observationCardinalityNext], options);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* initialize
|
|
1231
|
+
* nonpayable
|
|
1232
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1233
|
+
*/
|
|
1234
|
+
async initialize(sqrtPriceX96, options) {
|
|
1235
|
+
if (!this.contract.write) {
|
|
1236
|
+
throw new Error('Wallet client is required for write operations');
|
|
1237
|
+
}
|
|
1238
|
+
return this.contract.write.initialize([sqrtPriceX96], options);
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* mint
|
|
1242
|
+
* nonpayable
|
|
1243
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1244
|
+
*/
|
|
1245
|
+
async mint(recipient, tickLower, tickUpper, amount, data, options) {
|
|
1246
|
+
if (!this.contract.write) {
|
|
1247
|
+
throw new Error('Wallet client is required for write operations');
|
|
1248
|
+
}
|
|
1249
|
+
return this.contract.write.mint([recipient, tickLower, tickUpper, amount, data], options);
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* setFeeProtocol
|
|
1253
|
+
* nonpayable
|
|
1254
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1255
|
+
*/
|
|
1256
|
+
async setFeeProtocol(feeProtocol0, feeProtocol1, options) {
|
|
1257
|
+
if (!this.contract.write) {
|
|
1258
|
+
throw new Error('Wallet client is required for write operations');
|
|
1259
|
+
}
|
|
1260
|
+
return this.contract.write.setFeeProtocol([feeProtocol0, feeProtocol1], options);
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* swap
|
|
1264
|
+
* nonpayable
|
|
1265
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1266
|
+
*/
|
|
1267
|
+
async swap(recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data, options) {
|
|
1268
|
+
if (!this.contract.write) {
|
|
1269
|
+
throw new Error('Wallet client is required for write operations');
|
|
1270
|
+
}
|
|
1271
|
+
return this.contract.write.swap([recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data], options);
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1275
|
+
*
|
|
1276
|
+
* @example
|
|
1277
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1278
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1279
|
+
* console.log('Would succeed:', result.result);
|
|
1280
|
+
*/
|
|
1281
|
+
get simulate() {
|
|
1282
|
+
const contract = this.contract;
|
|
1283
|
+
if (!contract.simulate) {
|
|
1284
|
+
throw new Error('Public client is required for simulation');
|
|
1285
|
+
}
|
|
1286
|
+
return {
|
|
1287
|
+
/**
|
|
1288
|
+
* Simulate burn
|
|
1289
|
+
* Returns gas estimate and result without sending transaction
|
|
1290
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1291
|
+
*/
|
|
1292
|
+
async burn(tickLower, tickUpper, amount, options) {
|
|
1293
|
+
return contract.simulate.burn([tickLower, tickUpper, amount], options);
|
|
1294
|
+
},
|
|
1295
|
+
/**
|
|
1296
|
+
* Simulate collect
|
|
1297
|
+
* Returns gas estimate and result without sending transaction
|
|
1298
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1299
|
+
*/
|
|
1300
|
+
async collect(recipient, tickLower, tickUpper, amount0Requested, amount1Requested, options) {
|
|
1301
|
+
return contract.simulate.collect([recipient, tickLower, tickUpper, amount0Requested, amount1Requested], options);
|
|
1302
|
+
},
|
|
1303
|
+
/**
|
|
1304
|
+
* Simulate collectProtocol
|
|
1305
|
+
* Returns gas estimate and result without sending transaction
|
|
1306
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1307
|
+
*/
|
|
1308
|
+
async collectProtocol(recipient, amount0Requested, amount1Requested, options) {
|
|
1309
|
+
return contract.simulate.collectProtocol([recipient, amount0Requested, amount1Requested], options);
|
|
1310
|
+
},
|
|
1311
|
+
/**
|
|
1312
|
+
* Simulate flash
|
|
1313
|
+
* Returns gas estimate and result without sending transaction
|
|
1314
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1315
|
+
*/
|
|
1316
|
+
async flash(recipient, amount0, amount1, data, options) {
|
|
1317
|
+
return contract.simulate.flash([recipient, amount0, amount1, data], options);
|
|
1318
|
+
},
|
|
1319
|
+
/**
|
|
1320
|
+
* Simulate increaseObservationCardinalityNext
|
|
1321
|
+
* Returns gas estimate and result without sending transaction
|
|
1322
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1323
|
+
*/
|
|
1324
|
+
async increaseObservationCardinalityNext(observationCardinalityNext, options) {
|
|
1325
|
+
return contract.simulate.increaseObservationCardinalityNext([observationCardinalityNext], options);
|
|
1326
|
+
},
|
|
1327
|
+
/**
|
|
1328
|
+
* Simulate initialize
|
|
1329
|
+
* Returns gas estimate and result without sending transaction
|
|
1330
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1331
|
+
*/
|
|
1332
|
+
async initialize(sqrtPriceX96, options) {
|
|
1333
|
+
return contract.simulate.initialize([sqrtPriceX96], options);
|
|
1334
|
+
},
|
|
1335
|
+
/**
|
|
1336
|
+
* Simulate mint
|
|
1337
|
+
* Returns gas estimate and result without sending transaction
|
|
1338
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1339
|
+
*/
|
|
1340
|
+
async mint(recipient, tickLower, tickUpper, amount, data, options) {
|
|
1341
|
+
return contract.simulate.mint([recipient, tickLower, tickUpper, amount, data], options);
|
|
1342
|
+
},
|
|
1343
|
+
/**
|
|
1344
|
+
* Simulate setFeeProtocol
|
|
1345
|
+
* Returns gas estimate and result without sending transaction
|
|
1346
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1347
|
+
*/
|
|
1348
|
+
async setFeeProtocol(feeProtocol0, feeProtocol1, options) {
|
|
1349
|
+
return contract.simulate.setFeeProtocol([feeProtocol0, feeProtocol1], options);
|
|
1350
|
+
},
|
|
1351
|
+
/**
|
|
1352
|
+
* Simulate swap
|
|
1353
|
+
* Returns gas estimate and result without sending transaction
|
|
1354
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1355
|
+
*/
|
|
1356
|
+
async swap(recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data, options) {
|
|
1357
|
+
return contract.simulate.swap([recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data], options);
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Watch contract events
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* // Watch all Transfer events
|
|
1366
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1367
|
+
* console.log('Transfer:', event);
|
|
1368
|
+
* });
|
|
1369
|
+
*
|
|
1370
|
+
* // Stop watching
|
|
1371
|
+
* unwatch();
|
|
1372
|
+
*/
|
|
1373
|
+
get watch() {
|
|
1374
|
+
return {
|
|
1375
|
+
/**
|
|
1376
|
+
* Watch Burn events
|
|
1377
|
+
* @param callback Function to call when event is emitted
|
|
1378
|
+
* @param filter Optional filter for indexed parameters
|
|
1379
|
+
* @returns Unwatch function to stop listening
|
|
1380
|
+
*/
|
|
1381
|
+
Burn: (callback, filter) => {
|
|
1382
|
+
return this.publicClient.watchContractEvent({
|
|
1383
|
+
address: this.contractAddress,
|
|
1384
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1385
|
+
eventName: 'Burn',
|
|
1386
|
+
args: filter,
|
|
1387
|
+
onLogs: (logs) => {
|
|
1388
|
+
logs.forEach((log) => {
|
|
1389
|
+
callback(log.args);
|
|
1390
|
+
});
|
|
1391
|
+
},
|
|
1392
|
+
});
|
|
1393
|
+
},
|
|
1394
|
+
/**
|
|
1395
|
+
* Watch Collect events
|
|
1396
|
+
* @param callback Function to call when event is emitted
|
|
1397
|
+
* @param filter Optional filter for indexed parameters
|
|
1398
|
+
* @returns Unwatch function to stop listening
|
|
1399
|
+
*/
|
|
1400
|
+
Collect: (callback, filter) => {
|
|
1401
|
+
return this.publicClient.watchContractEvent({
|
|
1402
|
+
address: this.contractAddress,
|
|
1403
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1404
|
+
eventName: 'Collect',
|
|
1405
|
+
args: filter,
|
|
1406
|
+
onLogs: (logs) => {
|
|
1407
|
+
logs.forEach((log) => {
|
|
1408
|
+
callback(log.args);
|
|
1409
|
+
});
|
|
1410
|
+
},
|
|
1411
|
+
});
|
|
1412
|
+
},
|
|
1413
|
+
/**
|
|
1414
|
+
* Watch CollectProtocol events
|
|
1415
|
+
* @param callback Function to call when event is emitted
|
|
1416
|
+
* @param filter Optional filter for indexed parameters
|
|
1417
|
+
* @returns Unwatch function to stop listening
|
|
1418
|
+
*/
|
|
1419
|
+
CollectProtocol: (callback, filter) => {
|
|
1420
|
+
return this.publicClient.watchContractEvent({
|
|
1421
|
+
address: this.contractAddress,
|
|
1422
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1423
|
+
eventName: 'CollectProtocol',
|
|
1424
|
+
args: filter,
|
|
1425
|
+
onLogs: (logs) => {
|
|
1426
|
+
logs.forEach((log) => {
|
|
1427
|
+
callback(log.args);
|
|
1428
|
+
});
|
|
1429
|
+
},
|
|
1430
|
+
});
|
|
1431
|
+
},
|
|
1432
|
+
/**
|
|
1433
|
+
* Watch Flash events
|
|
1434
|
+
* @param callback Function to call when event is emitted
|
|
1435
|
+
* @param filter Optional filter for indexed parameters
|
|
1436
|
+
* @returns Unwatch function to stop listening
|
|
1437
|
+
*/
|
|
1438
|
+
Flash: (callback, filter) => {
|
|
1439
|
+
return this.publicClient.watchContractEvent({
|
|
1440
|
+
address: this.contractAddress,
|
|
1441
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1442
|
+
eventName: 'Flash',
|
|
1443
|
+
args: filter,
|
|
1444
|
+
onLogs: (logs) => {
|
|
1445
|
+
logs.forEach((log) => {
|
|
1446
|
+
callback(log.args);
|
|
1447
|
+
});
|
|
1448
|
+
},
|
|
1449
|
+
});
|
|
1450
|
+
},
|
|
1451
|
+
/**
|
|
1452
|
+
* Watch IncreaseObservationCardinalityNext events
|
|
1453
|
+
* @param callback Function to call when event is emitted
|
|
1454
|
+
* @param filter Optional filter for indexed parameters
|
|
1455
|
+
* @returns Unwatch function to stop listening
|
|
1456
|
+
*/
|
|
1457
|
+
IncreaseObservationCardinalityNext: (callback) => {
|
|
1458
|
+
return this.publicClient.watchContractEvent({
|
|
1459
|
+
address: this.contractAddress,
|
|
1460
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1461
|
+
eventName: 'IncreaseObservationCardinalityNext',
|
|
1462
|
+
onLogs: (logs) => {
|
|
1463
|
+
logs.forEach((log) => {
|
|
1464
|
+
callback(log.args);
|
|
1465
|
+
});
|
|
1466
|
+
},
|
|
1467
|
+
});
|
|
1468
|
+
},
|
|
1469
|
+
/**
|
|
1470
|
+
* Watch Initialize events
|
|
1471
|
+
* @param callback Function to call when event is emitted
|
|
1472
|
+
* @param filter Optional filter for indexed parameters
|
|
1473
|
+
* @returns Unwatch function to stop listening
|
|
1474
|
+
*/
|
|
1475
|
+
Initialize: (callback) => {
|
|
1476
|
+
return this.publicClient.watchContractEvent({
|
|
1477
|
+
address: this.contractAddress,
|
|
1478
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1479
|
+
eventName: 'Initialize',
|
|
1480
|
+
onLogs: (logs) => {
|
|
1481
|
+
logs.forEach((log) => {
|
|
1482
|
+
callback(log.args);
|
|
1483
|
+
});
|
|
1484
|
+
},
|
|
1485
|
+
});
|
|
1486
|
+
},
|
|
1487
|
+
/**
|
|
1488
|
+
* Watch Mint events
|
|
1489
|
+
* @param callback Function to call when event is emitted
|
|
1490
|
+
* @param filter Optional filter for indexed parameters
|
|
1491
|
+
* @returns Unwatch function to stop listening
|
|
1492
|
+
*/
|
|
1493
|
+
Mint: (callback, filter) => {
|
|
1494
|
+
return this.publicClient.watchContractEvent({
|
|
1495
|
+
address: this.contractAddress,
|
|
1496
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1497
|
+
eventName: 'Mint',
|
|
1498
|
+
args: filter,
|
|
1499
|
+
onLogs: (logs) => {
|
|
1500
|
+
logs.forEach((log) => {
|
|
1501
|
+
callback(log.args);
|
|
1502
|
+
});
|
|
1503
|
+
},
|
|
1504
|
+
});
|
|
1505
|
+
},
|
|
1506
|
+
/**
|
|
1507
|
+
* Watch SetFeeProtocol events
|
|
1508
|
+
* @param callback Function to call when event is emitted
|
|
1509
|
+
* @param filter Optional filter for indexed parameters
|
|
1510
|
+
* @returns Unwatch function to stop listening
|
|
1511
|
+
*/
|
|
1512
|
+
SetFeeProtocol: (callback) => {
|
|
1513
|
+
return this.publicClient.watchContractEvent({
|
|
1514
|
+
address: this.contractAddress,
|
|
1515
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1516
|
+
eventName: 'SetFeeProtocol',
|
|
1517
|
+
onLogs: (logs) => {
|
|
1518
|
+
logs.forEach((log) => {
|
|
1519
|
+
callback(log.args);
|
|
1520
|
+
});
|
|
1521
|
+
},
|
|
1522
|
+
});
|
|
1523
|
+
},
|
|
1524
|
+
/**
|
|
1525
|
+
* Watch Swap events
|
|
1526
|
+
* @param callback Function to call when event is emitted
|
|
1527
|
+
* @param filter Optional filter for indexed parameters
|
|
1528
|
+
* @returns Unwatch function to stop listening
|
|
1529
|
+
*/
|
|
1530
|
+
Swap: (callback, filter) => {
|
|
1531
|
+
return this.publicClient.watchContractEvent({
|
|
1532
|
+
address: this.contractAddress,
|
|
1533
|
+
abi: exports.UniswapV3PoolAbi,
|
|
1534
|
+
eventName: 'Swap',
|
|
1535
|
+
args: filter,
|
|
1536
|
+
onLogs: (logs) => {
|
|
1537
|
+
logs.forEach((log) => {
|
|
1538
|
+
callback(log.args);
|
|
1539
|
+
});
|
|
1540
|
+
},
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
exports.UniswapV3Pool = UniswapV3Pool;
|