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