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