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