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