@gitmyabi-stg/usdn 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/contracts/Usdn.d.ts +1812 -0
- package/contracts/Usdn.js +1956 -0
- package/contracts/Usdn.ts +2402 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1956 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Usdn = exports.UsdnAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* Usdn ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.UsdnAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "minter",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "rebaser",
|
|
21
|
+
"type": "address"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"stateMutability": "nonpayable",
|
|
25
|
+
"type": "constructor"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"inputs": [],
|
|
29
|
+
"name": "AccessControlBadConfirmation",
|
|
30
|
+
"type": "error"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"internalType": "address",
|
|
36
|
+
"name": "account",
|
|
37
|
+
"type": "address"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"internalType": "bytes32",
|
|
41
|
+
"name": "neededRole",
|
|
42
|
+
"type": "bytes32"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "AccessControlUnauthorizedAccount",
|
|
46
|
+
"type": "error"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"inputs": [],
|
|
50
|
+
"name": "ECDSAInvalidSignature",
|
|
51
|
+
"type": "error"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [
|
|
55
|
+
{
|
|
56
|
+
"internalType": "uint256",
|
|
57
|
+
"name": "length",
|
|
58
|
+
"type": "uint256"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
62
|
+
"type": "error"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [
|
|
66
|
+
{
|
|
67
|
+
"internalType": "bytes32",
|
|
68
|
+
"name": "s",
|
|
69
|
+
"type": "bytes32"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "ECDSAInvalidSignatureS",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"inputs": [
|
|
77
|
+
{
|
|
78
|
+
"internalType": "address",
|
|
79
|
+
"name": "spender",
|
|
80
|
+
"type": "address"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"internalType": "uint256",
|
|
84
|
+
"name": "allowance",
|
|
85
|
+
"type": "uint256"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"internalType": "uint256",
|
|
89
|
+
"name": "needed",
|
|
90
|
+
"type": "uint256"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"name": "ERC20InsufficientAllowance",
|
|
94
|
+
"type": "error"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"internalType": "address",
|
|
100
|
+
"name": "sender",
|
|
101
|
+
"type": "address"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"internalType": "uint256",
|
|
105
|
+
"name": "balance",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"internalType": "uint256",
|
|
110
|
+
"name": "needed",
|
|
111
|
+
"type": "uint256"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"name": "ERC20InsufficientBalance",
|
|
115
|
+
"type": "error"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"inputs": [
|
|
119
|
+
{
|
|
120
|
+
"internalType": "address",
|
|
121
|
+
"name": "approver",
|
|
122
|
+
"type": "address"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"name": "ERC20InvalidApprover",
|
|
126
|
+
"type": "error"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"inputs": [
|
|
130
|
+
{
|
|
131
|
+
"internalType": "address",
|
|
132
|
+
"name": "receiver",
|
|
133
|
+
"type": "address"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"name": "ERC20InvalidReceiver",
|
|
137
|
+
"type": "error"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"inputs": [
|
|
141
|
+
{
|
|
142
|
+
"internalType": "address",
|
|
143
|
+
"name": "sender",
|
|
144
|
+
"type": "address"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"name": "ERC20InvalidSender",
|
|
148
|
+
"type": "error"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"inputs": [
|
|
152
|
+
{
|
|
153
|
+
"internalType": "address",
|
|
154
|
+
"name": "spender",
|
|
155
|
+
"type": "address"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"name": "ERC20InvalidSpender",
|
|
159
|
+
"type": "error"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"inputs": [
|
|
163
|
+
{
|
|
164
|
+
"internalType": "uint256",
|
|
165
|
+
"name": "deadline",
|
|
166
|
+
"type": "uint256"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"name": "ERC2612ExpiredSignature",
|
|
170
|
+
"type": "error"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"inputs": [
|
|
174
|
+
{
|
|
175
|
+
"internalType": "address",
|
|
176
|
+
"name": "signer",
|
|
177
|
+
"type": "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"internalType": "address",
|
|
181
|
+
"name": "owner",
|
|
182
|
+
"type": "address"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"name": "ERC2612InvalidSigner",
|
|
186
|
+
"type": "error"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"inputs": [
|
|
190
|
+
{
|
|
191
|
+
"internalType": "address",
|
|
192
|
+
"name": "account",
|
|
193
|
+
"type": "address"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"internalType": "uint256",
|
|
197
|
+
"name": "currentNonce",
|
|
198
|
+
"type": "uint256"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"name": "InvalidAccountNonce",
|
|
202
|
+
"type": "error"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"inputs": [],
|
|
206
|
+
"name": "InvalidShortString",
|
|
207
|
+
"type": "error"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"inputs": [
|
|
211
|
+
{
|
|
212
|
+
"internalType": "string",
|
|
213
|
+
"name": "str",
|
|
214
|
+
"type": "string"
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"name": "StringTooLong",
|
|
218
|
+
"type": "error"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [
|
|
222
|
+
{
|
|
223
|
+
"internalType": "address",
|
|
224
|
+
"name": "sender",
|
|
225
|
+
"type": "address"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"internalType": "uint256",
|
|
229
|
+
"name": "balance",
|
|
230
|
+
"type": "uint256"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"internalType": "uint256",
|
|
234
|
+
"name": "needed",
|
|
235
|
+
"type": "uint256"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"name": "UsdnInsufficientSharesBalance",
|
|
239
|
+
"type": "error"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"inputs": [],
|
|
243
|
+
"name": "UsdnInvalidDivisor",
|
|
244
|
+
"type": "error"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"inputs": [
|
|
248
|
+
{
|
|
249
|
+
"internalType": "uint256",
|
|
250
|
+
"name": "value",
|
|
251
|
+
"type": "uint256"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"name": "UsdnMaxTokensExceeded",
|
|
255
|
+
"type": "error"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"anonymous": false,
|
|
259
|
+
"inputs": [
|
|
260
|
+
{
|
|
261
|
+
"indexed": true,
|
|
262
|
+
"internalType": "address",
|
|
263
|
+
"name": "owner",
|
|
264
|
+
"type": "address"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"indexed": true,
|
|
268
|
+
"internalType": "address",
|
|
269
|
+
"name": "spender",
|
|
270
|
+
"type": "address"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"indexed": false,
|
|
274
|
+
"internalType": "uint256",
|
|
275
|
+
"name": "value",
|
|
276
|
+
"type": "uint256"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"name": "Approval",
|
|
280
|
+
"type": "event"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"anonymous": false,
|
|
284
|
+
"inputs": [],
|
|
285
|
+
"name": "EIP712DomainChanged",
|
|
286
|
+
"type": "event"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"anonymous": false,
|
|
290
|
+
"inputs": [
|
|
291
|
+
{
|
|
292
|
+
"indexed": false,
|
|
293
|
+
"internalType": "uint256",
|
|
294
|
+
"name": "oldDivisor",
|
|
295
|
+
"type": "uint256"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"indexed": false,
|
|
299
|
+
"internalType": "uint256",
|
|
300
|
+
"name": "newDivisor",
|
|
301
|
+
"type": "uint256"
|
|
302
|
+
}
|
|
303
|
+
],
|
|
304
|
+
"name": "Rebase",
|
|
305
|
+
"type": "event"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"anonymous": false,
|
|
309
|
+
"inputs": [
|
|
310
|
+
{
|
|
311
|
+
"indexed": false,
|
|
312
|
+
"internalType": "contract IRebaseCallback",
|
|
313
|
+
"name": "newHandler",
|
|
314
|
+
"type": "address"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"name": "RebaseHandlerUpdated",
|
|
318
|
+
"type": "event"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"anonymous": false,
|
|
322
|
+
"inputs": [
|
|
323
|
+
{
|
|
324
|
+
"indexed": true,
|
|
325
|
+
"internalType": "bytes32",
|
|
326
|
+
"name": "role",
|
|
327
|
+
"type": "bytes32"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"indexed": true,
|
|
331
|
+
"internalType": "bytes32",
|
|
332
|
+
"name": "previousAdminRole",
|
|
333
|
+
"type": "bytes32"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"indexed": true,
|
|
337
|
+
"internalType": "bytes32",
|
|
338
|
+
"name": "newAdminRole",
|
|
339
|
+
"type": "bytes32"
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
"name": "RoleAdminChanged",
|
|
343
|
+
"type": "event"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"anonymous": false,
|
|
347
|
+
"inputs": [
|
|
348
|
+
{
|
|
349
|
+
"indexed": true,
|
|
350
|
+
"internalType": "bytes32",
|
|
351
|
+
"name": "role",
|
|
352
|
+
"type": "bytes32"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"indexed": true,
|
|
356
|
+
"internalType": "address",
|
|
357
|
+
"name": "account",
|
|
358
|
+
"type": "address"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"indexed": true,
|
|
362
|
+
"internalType": "address",
|
|
363
|
+
"name": "sender",
|
|
364
|
+
"type": "address"
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
"name": "RoleGranted",
|
|
368
|
+
"type": "event"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"anonymous": false,
|
|
372
|
+
"inputs": [
|
|
373
|
+
{
|
|
374
|
+
"indexed": true,
|
|
375
|
+
"internalType": "bytes32",
|
|
376
|
+
"name": "role",
|
|
377
|
+
"type": "bytes32"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"indexed": true,
|
|
381
|
+
"internalType": "address",
|
|
382
|
+
"name": "account",
|
|
383
|
+
"type": "address"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"indexed": true,
|
|
387
|
+
"internalType": "address",
|
|
388
|
+
"name": "sender",
|
|
389
|
+
"type": "address"
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
"name": "RoleRevoked",
|
|
393
|
+
"type": "event"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"anonymous": false,
|
|
397
|
+
"inputs": [
|
|
398
|
+
{
|
|
399
|
+
"indexed": true,
|
|
400
|
+
"internalType": "address",
|
|
401
|
+
"name": "from",
|
|
402
|
+
"type": "address"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"indexed": true,
|
|
406
|
+
"internalType": "address",
|
|
407
|
+
"name": "to",
|
|
408
|
+
"type": "address"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"indexed": false,
|
|
412
|
+
"internalType": "uint256",
|
|
413
|
+
"name": "value",
|
|
414
|
+
"type": "uint256"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"name": "Transfer",
|
|
418
|
+
"type": "event"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"inputs": [],
|
|
422
|
+
"name": "DEFAULT_ADMIN_ROLE",
|
|
423
|
+
"outputs": [
|
|
424
|
+
{
|
|
425
|
+
"internalType": "bytes32",
|
|
426
|
+
"name": "",
|
|
427
|
+
"type": "bytes32"
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
"stateMutability": "view",
|
|
431
|
+
"type": "function"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"inputs": [],
|
|
435
|
+
"name": "DOMAIN_SEPARATOR",
|
|
436
|
+
"outputs": [
|
|
437
|
+
{
|
|
438
|
+
"internalType": "bytes32",
|
|
439
|
+
"name": "",
|
|
440
|
+
"type": "bytes32"
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"stateMutability": "view",
|
|
444
|
+
"type": "function"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"inputs": [],
|
|
448
|
+
"name": "MAX_DIVISOR",
|
|
449
|
+
"outputs": [
|
|
450
|
+
{
|
|
451
|
+
"internalType": "uint256",
|
|
452
|
+
"name": "",
|
|
453
|
+
"type": "uint256"
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"stateMutability": "view",
|
|
457
|
+
"type": "function"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"inputs": [],
|
|
461
|
+
"name": "MINTER_ROLE",
|
|
462
|
+
"outputs": [
|
|
463
|
+
{
|
|
464
|
+
"internalType": "bytes32",
|
|
465
|
+
"name": "",
|
|
466
|
+
"type": "bytes32"
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"stateMutability": "view",
|
|
470
|
+
"type": "function"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"inputs": [],
|
|
474
|
+
"name": "MIN_DIVISOR",
|
|
475
|
+
"outputs": [
|
|
476
|
+
{
|
|
477
|
+
"internalType": "uint256",
|
|
478
|
+
"name": "",
|
|
479
|
+
"type": "uint256"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
"stateMutability": "view",
|
|
483
|
+
"type": "function"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"inputs": [],
|
|
487
|
+
"name": "REBASER_ROLE",
|
|
488
|
+
"outputs": [
|
|
489
|
+
{
|
|
490
|
+
"internalType": "bytes32",
|
|
491
|
+
"name": "",
|
|
492
|
+
"type": "bytes32"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"stateMutability": "view",
|
|
496
|
+
"type": "function"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"inputs": [
|
|
500
|
+
{
|
|
501
|
+
"internalType": "address",
|
|
502
|
+
"name": "owner",
|
|
503
|
+
"type": "address"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"internalType": "address",
|
|
507
|
+
"name": "spender",
|
|
508
|
+
"type": "address"
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
"name": "allowance",
|
|
512
|
+
"outputs": [
|
|
513
|
+
{
|
|
514
|
+
"internalType": "uint256",
|
|
515
|
+
"name": "",
|
|
516
|
+
"type": "uint256"
|
|
517
|
+
}
|
|
518
|
+
],
|
|
519
|
+
"stateMutability": "view",
|
|
520
|
+
"type": "function"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"inputs": [
|
|
524
|
+
{
|
|
525
|
+
"internalType": "address",
|
|
526
|
+
"name": "spender",
|
|
527
|
+
"type": "address"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"internalType": "uint256",
|
|
531
|
+
"name": "value",
|
|
532
|
+
"type": "uint256"
|
|
533
|
+
}
|
|
534
|
+
],
|
|
535
|
+
"name": "approve",
|
|
536
|
+
"outputs": [
|
|
537
|
+
{
|
|
538
|
+
"internalType": "bool",
|
|
539
|
+
"name": "",
|
|
540
|
+
"type": "bool"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"stateMutability": "nonpayable",
|
|
544
|
+
"type": "function"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"inputs": [
|
|
548
|
+
{
|
|
549
|
+
"internalType": "address",
|
|
550
|
+
"name": "account",
|
|
551
|
+
"type": "address"
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
"name": "balanceOf",
|
|
555
|
+
"outputs": [
|
|
556
|
+
{
|
|
557
|
+
"internalType": "uint256",
|
|
558
|
+
"name": "balance_",
|
|
559
|
+
"type": "uint256"
|
|
560
|
+
}
|
|
561
|
+
],
|
|
562
|
+
"stateMutability": "view",
|
|
563
|
+
"type": "function"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"inputs": [
|
|
567
|
+
{
|
|
568
|
+
"internalType": "uint256",
|
|
569
|
+
"name": "value",
|
|
570
|
+
"type": "uint256"
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
"name": "burn",
|
|
574
|
+
"outputs": [],
|
|
575
|
+
"stateMutability": "nonpayable",
|
|
576
|
+
"type": "function"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"inputs": [
|
|
580
|
+
{
|
|
581
|
+
"internalType": "address",
|
|
582
|
+
"name": "account",
|
|
583
|
+
"type": "address"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"internalType": "uint256",
|
|
587
|
+
"name": "value",
|
|
588
|
+
"type": "uint256"
|
|
589
|
+
}
|
|
590
|
+
],
|
|
591
|
+
"name": "burnFrom",
|
|
592
|
+
"outputs": [],
|
|
593
|
+
"stateMutability": "nonpayable",
|
|
594
|
+
"type": "function"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"inputs": [
|
|
598
|
+
{
|
|
599
|
+
"internalType": "uint256",
|
|
600
|
+
"name": "value",
|
|
601
|
+
"type": "uint256"
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
"name": "burnShares",
|
|
605
|
+
"outputs": [],
|
|
606
|
+
"stateMutability": "nonpayable",
|
|
607
|
+
"type": "function"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"inputs": [
|
|
611
|
+
{
|
|
612
|
+
"internalType": "address",
|
|
613
|
+
"name": "account",
|
|
614
|
+
"type": "address"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"internalType": "uint256",
|
|
618
|
+
"name": "value",
|
|
619
|
+
"type": "uint256"
|
|
620
|
+
}
|
|
621
|
+
],
|
|
622
|
+
"name": "burnSharesFrom",
|
|
623
|
+
"outputs": [],
|
|
624
|
+
"stateMutability": "nonpayable",
|
|
625
|
+
"type": "function"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"inputs": [
|
|
629
|
+
{
|
|
630
|
+
"internalType": "uint256",
|
|
631
|
+
"name": "amountTokens",
|
|
632
|
+
"type": "uint256"
|
|
633
|
+
}
|
|
634
|
+
],
|
|
635
|
+
"name": "convertToShares",
|
|
636
|
+
"outputs": [
|
|
637
|
+
{
|
|
638
|
+
"internalType": "uint256",
|
|
639
|
+
"name": "shares_",
|
|
640
|
+
"type": "uint256"
|
|
641
|
+
}
|
|
642
|
+
],
|
|
643
|
+
"stateMutability": "view",
|
|
644
|
+
"type": "function"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"inputs": [
|
|
648
|
+
{
|
|
649
|
+
"internalType": "uint256",
|
|
650
|
+
"name": "amountShares",
|
|
651
|
+
"type": "uint256"
|
|
652
|
+
}
|
|
653
|
+
],
|
|
654
|
+
"name": "convertToTokens",
|
|
655
|
+
"outputs": [
|
|
656
|
+
{
|
|
657
|
+
"internalType": "uint256",
|
|
658
|
+
"name": "tokens_",
|
|
659
|
+
"type": "uint256"
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
"stateMutability": "view",
|
|
663
|
+
"type": "function"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"inputs": [
|
|
667
|
+
{
|
|
668
|
+
"internalType": "uint256",
|
|
669
|
+
"name": "amountShares",
|
|
670
|
+
"type": "uint256"
|
|
671
|
+
}
|
|
672
|
+
],
|
|
673
|
+
"name": "convertToTokensRoundUp",
|
|
674
|
+
"outputs": [
|
|
675
|
+
{
|
|
676
|
+
"internalType": "uint256",
|
|
677
|
+
"name": "tokens_",
|
|
678
|
+
"type": "uint256"
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
"stateMutability": "view",
|
|
682
|
+
"type": "function"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"inputs": [],
|
|
686
|
+
"name": "decimals",
|
|
687
|
+
"outputs": [
|
|
688
|
+
{
|
|
689
|
+
"internalType": "uint8",
|
|
690
|
+
"name": "",
|
|
691
|
+
"type": "uint8"
|
|
692
|
+
}
|
|
693
|
+
],
|
|
694
|
+
"stateMutability": "view",
|
|
695
|
+
"type": "function"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"inputs": [],
|
|
699
|
+
"name": "divisor",
|
|
700
|
+
"outputs": [
|
|
701
|
+
{
|
|
702
|
+
"internalType": "uint256",
|
|
703
|
+
"name": "divisor_",
|
|
704
|
+
"type": "uint256"
|
|
705
|
+
}
|
|
706
|
+
],
|
|
707
|
+
"stateMutability": "view",
|
|
708
|
+
"type": "function"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
"inputs": [],
|
|
712
|
+
"name": "eip712Domain",
|
|
713
|
+
"outputs": [
|
|
714
|
+
{
|
|
715
|
+
"internalType": "bytes1",
|
|
716
|
+
"name": "fields",
|
|
717
|
+
"type": "bytes1"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"internalType": "string",
|
|
721
|
+
"name": "name",
|
|
722
|
+
"type": "string"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"internalType": "string",
|
|
726
|
+
"name": "version",
|
|
727
|
+
"type": "string"
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"internalType": "uint256",
|
|
731
|
+
"name": "chainId",
|
|
732
|
+
"type": "uint256"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
"internalType": "address",
|
|
736
|
+
"name": "verifyingContract",
|
|
737
|
+
"type": "address"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"internalType": "bytes32",
|
|
741
|
+
"name": "salt",
|
|
742
|
+
"type": "bytes32"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"internalType": "uint256[]",
|
|
746
|
+
"name": "extensions",
|
|
747
|
+
"type": "uint256[]"
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
"stateMutability": "view",
|
|
751
|
+
"type": "function"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"inputs": [
|
|
755
|
+
{
|
|
756
|
+
"internalType": "bytes32",
|
|
757
|
+
"name": "role",
|
|
758
|
+
"type": "bytes32"
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"name": "getRoleAdmin",
|
|
762
|
+
"outputs": [
|
|
763
|
+
{
|
|
764
|
+
"internalType": "bytes32",
|
|
765
|
+
"name": "",
|
|
766
|
+
"type": "bytes32"
|
|
767
|
+
}
|
|
768
|
+
],
|
|
769
|
+
"stateMutability": "view",
|
|
770
|
+
"type": "function"
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"inputs": [
|
|
774
|
+
{
|
|
775
|
+
"internalType": "bytes32",
|
|
776
|
+
"name": "role",
|
|
777
|
+
"type": "bytes32"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"internalType": "address",
|
|
781
|
+
"name": "account",
|
|
782
|
+
"type": "address"
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
"name": "grantRole",
|
|
786
|
+
"outputs": [],
|
|
787
|
+
"stateMutability": "nonpayable",
|
|
788
|
+
"type": "function"
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
"inputs": [
|
|
792
|
+
{
|
|
793
|
+
"internalType": "bytes32",
|
|
794
|
+
"name": "role",
|
|
795
|
+
"type": "bytes32"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"internalType": "address",
|
|
799
|
+
"name": "account",
|
|
800
|
+
"type": "address"
|
|
801
|
+
}
|
|
802
|
+
],
|
|
803
|
+
"name": "hasRole",
|
|
804
|
+
"outputs": [
|
|
805
|
+
{
|
|
806
|
+
"internalType": "bool",
|
|
807
|
+
"name": "",
|
|
808
|
+
"type": "bool"
|
|
809
|
+
}
|
|
810
|
+
],
|
|
811
|
+
"stateMutability": "view",
|
|
812
|
+
"type": "function"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"inputs": [],
|
|
816
|
+
"name": "maxTokens",
|
|
817
|
+
"outputs": [
|
|
818
|
+
{
|
|
819
|
+
"internalType": "uint256",
|
|
820
|
+
"name": "maxTokens_",
|
|
821
|
+
"type": "uint256"
|
|
822
|
+
}
|
|
823
|
+
],
|
|
824
|
+
"stateMutability": "view",
|
|
825
|
+
"type": "function"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"inputs": [
|
|
829
|
+
{
|
|
830
|
+
"internalType": "address",
|
|
831
|
+
"name": "to",
|
|
832
|
+
"type": "address"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"internalType": "uint256",
|
|
836
|
+
"name": "amount",
|
|
837
|
+
"type": "uint256"
|
|
838
|
+
}
|
|
839
|
+
],
|
|
840
|
+
"name": "mint",
|
|
841
|
+
"outputs": [],
|
|
842
|
+
"stateMutability": "nonpayable",
|
|
843
|
+
"type": "function"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
"inputs": [
|
|
847
|
+
{
|
|
848
|
+
"internalType": "address",
|
|
849
|
+
"name": "to",
|
|
850
|
+
"type": "address"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"internalType": "uint256",
|
|
854
|
+
"name": "amount",
|
|
855
|
+
"type": "uint256"
|
|
856
|
+
}
|
|
857
|
+
],
|
|
858
|
+
"name": "mintShares",
|
|
859
|
+
"outputs": [
|
|
860
|
+
{
|
|
861
|
+
"internalType": "uint256",
|
|
862
|
+
"name": "mintedTokens_",
|
|
863
|
+
"type": "uint256"
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
"stateMutability": "nonpayable",
|
|
867
|
+
"type": "function"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"inputs": [],
|
|
871
|
+
"name": "name",
|
|
872
|
+
"outputs": [
|
|
873
|
+
{
|
|
874
|
+
"internalType": "string",
|
|
875
|
+
"name": "",
|
|
876
|
+
"type": "string"
|
|
877
|
+
}
|
|
878
|
+
],
|
|
879
|
+
"stateMutability": "view",
|
|
880
|
+
"type": "function"
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
"inputs": [
|
|
884
|
+
{
|
|
885
|
+
"internalType": "address",
|
|
886
|
+
"name": "owner",
|
|
887
|
+
"type": "address"
|
|
888
|
+
}
|
|
889
|
+
],
|
|
890
|
+
"name": "nonces",
|
|
891
|
+
"outputs": [
|
|
892
|
+
{
|
|
893
|
+
"internalType": "uint256",
|
|
894
|
+
"name": "",
|
|
895
|
+
"type": "uint256"
|
|
896
|
+
}
|
|
897
|
+
],
|
|
898
|
+
"stateMutability": "view",
|
|
899
|
+
"type": "function"
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"inputs": [
|
|
903
|
+
{
|
|
904
|
+
"internalType": "address",
|
|
905
|
+
"name": "owner",
|
|
906
|
+
"type": "address"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"internalType": "address",
|
|
910
|
+
"name": "spender",
|
|
911
|
+
"type": "address"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
"internalType": "uint256",
|
|
915
|
+
"name": "value",
|
|
916
|
+
"type": "uint256"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"internalType": "uint256",
|
|
920
|
+
"name": "deadline",
|
|
921
|
+
"type": "uint256"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"internalType": "uint8",
|
|
925
|
+
"name": "v",
|
|
926
|
+
"type": "uint8"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
"internalType": "bytes32",
|
|
930
|
+
"name": "r",
|
|
931
|
+
"type": "bytes32"
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
"internalType": "bytes32",
|
|
935
|
+
"name": "s",
|
|
936
|
+
"type": "bytes32"
|
|
937
|
+
}
|
|
938
|
+
],
|
|
939
|
+
"name": "permit",
|
|
940
|
+
"outputs": [],
|
|
941
|
+
"stateMutability": "nonpayable",
|
|
942
|
+
"type": "function"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"inputs": [
|
|
946
|
+
{
|
|
947
|
+
"internalType": "uint256",
|
|
948
|
+
"name": "newDivisor",
|
|
949
|
+
"type": "uint256"
|
|
950
|
+
}
|
|
951
|
+
],
|
|
952
|
+
"name": "rebase",
|
|
953
|
+
"outputs": [
|
|
954
|
+
{
|
|
955
|
+
"internalType": "bool",
|
|
956
|
+
"name": "rebased_",
|
|
957
|
+
"type": "bool"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
"internalType": "uint256",
|
|
961
|
+
"name": "oldDivisor_",
|
|
962
|
+
"type": "uint256"
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
"internalType": "bytes",
|
|
966
|
+
"name": "callbackResult_",
|
|
967
|
+
"type": "bytes"
|
|
968
|
+
}
|
|
969
|
+
],
|
|
970
|
+
"stateMutability": "nonpayable",
|
|
971
|
+
"type": "function"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
"inputs": [],
|
|
975
|
+
"name": "rebaseHandler",
|
|
976
|
+
"outputs": [
|
|
977
|
+
{
|
|
978
|
+
"internalType": "contract IRebaseCallback",
|
|
979
|
+
"name": "rebaseHandler_",
|
|
980
|
+
"type": "address"
|
|
981
|
+
}
|
|
982
|
+
],
|
|
983
|
+
"stateMutability": "view",
|
|
984
|
+
"type": "function"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"inputs": [
|
|
988
|
+
{
|
|
989
|
+
"internalType": "bytes32",
|
|
990
|
+
"name": "role",
|
|
991
|
+
"type": "bytes32"
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
"internalType": "address",
|
|
995
|
+
"name": "callerConfirmation",
|
|
996
|
+
"type": "address"
|
|
997
|
+
}
|
|
998
|
+
],
|
|
999
|
+
"name": "renounceRole",
|
|
1000
|
+
"outputs": [],
|
|
1001
|
+
"stateMutability": "nonpayable",
|
|
1002
|
+
"type": "function"
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
"inputs": [
|
|
1006
|
+
{
|
|
1007
|
+
"internalType": "bytes32",
|
|
1008
|
+
"name": "role",
|
|
1009
|
+
"type": "bytes32"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"internalType": "address",
|
|
1013
|
+
"name": "account",
|
|
1014
|
+
"type": "address"
|
|
1015
|
+
}
|
|
1016
|
+
],
|
|
1017
|
+
"name": "revokeRole",
|
|
1018
|
+
"outputs": [],
|
|
1019
|
+
"stateMutability": "nonpayable",
|
|
1020
|
+
"type": "function"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"inputs": [
|
|
1024
|
+
{
|
|
1025
|
+
"internalType": "contract IRebaseCallback",
|
|
1026
|
+
"name": "newHandler",
|
|
1027
|
+
"type": "address"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
1030
|
+
"name": "setRebaseHandler",
|
|
1031
|
+
"outputs": [],
|
|
1032
|
+
"stateMutability": "nonpayable",
|
|
1033
|
+
"type": "function"
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
"inputs": [
|
|
1037
|
+
{
|
|
1038
|
+
"internalType": "address",
|
|
1039
|
+
"name": "account",
|
|
1040
|
+
"type": "address"
|
|
1041
|
+
}
|
|
1042
|
+
],
|
|
1043
|
+
"name": "sharesOf",
|
|
1044
|
+
"outputs": [
|
|
1045
|
+
{
|
|
1046
|
+
"internalType": "uint256",
|
|
1047
|
+
"name": "shares_",
|
|
1048
|
+
"type": "uint256"
|
|
1049
|
+
}
|
|
1050
|
+
],
|
|
1051
|
+
"stateMutability": "view",
|
|
1052
|
+
"type": "function"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
"inputs": [
|
|
1056
|
+
{
|
|
1057
|
+
"internalType": "bytes4",
|
|
1058
|
+
"name": "interfaceId",
|
|
1059
|
+
"type": "bytes4"
|
|
1060
|
+
}
|
|
1061
|
+
],
|
|
1062
|
+
"name": "supportsInterface",
|
|
1063
|
+
"outputs": [
|
|
1064
|
+
{
|
|
1065
|
+
"internalType": "bool",
|
|
1066
|
+
"name": "",
|
|
1067
|
+
"type": "bool"
|
|
1068
|
+
}
|
|
1069
|
+
],
|
|
1070
|
+
"stateMutability": "view",
|
|
1071
|
+
"type": "function"
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
"inputs": [],
|
|
1075
|
+
"name": "symbol",
|
|
1076
|
+
"outputs": [
|
|
1077
|
+
{
|
|
1078
|
+
"internalType": "string",
|
|
1079
|
+
"name": "",
|
|
1080
|
+
"type": "string"
|
|
1081
|
+
}
|
|
1082
|
+
],
|
|
1083
|
+
"stateMutability": "view",
|
|
1084
|
+
"type": "function"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"inputs": [],
|
|
1088
|
+
"name": "totalShares",
|
|
1089
|
+
"outputs": [
|
|
1090
|
+
{
|
|
1091
|
+
"internalType": "uint256",
|
|
1092
|
+
"name": "shares_",
|
|
1093
|
+
"type": "uint256"
|
|
1094
|
+
}
|
|
1095
|
+
],
|
|
1096
|
+
"stateMutability": "view",
|
|
1097
|
+
"type": "function"
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
"inputs": [],
|
|
1101
|
+
"name": "totalSupply",
|
|
1102
|
+
"outputs": [
|
|
1103
|
+
{
|
|
1104
|
+
"internalType": "uint256",
|
|
1105
|
+
"name": "totalSupply_",
|
|
1106
|
+
"type": "uint256"
|
|
1107
|
+
}
|
|
1108
|
+
],
|
|
1109
|
+
"stateMutability": "view",
|
|
1110
|
+
"type": "function"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
"inputs": [
|
|
1114
|
+
{
|
|
1115
|
+
"internalType": "address",
|
|
1116
|
+
"name": "to",
|
|
1117
|
+
"type": "address"
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
"internalType": "uint256",
|
|
1121
|
+
"name": "value",
|
|
1122
|
+
"type": "uint256"
|
|
1123
|
+
}
|
|
1124
|
+
],
|
|
1125
|
+
"name": "transfer",
|
|
1126
|
+
"outputs": [
|
|
1127
|
+
{
|
|
1128
|
+
"internalType": "bool",
|
|
1129
|
+
"name": "",
|
|
1130
|
+
"type": "bool"
|
|
1131
|
+
}
|
|
1132
|
+
],
|
|
1133
|
+
"stateMutability": "nonpayable",
|
|
1134
|
+
"type": "function"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"inputs": [
|
|
1138
|
+
{
|
|
1139
|
+
"internalType": "address",
|
|
1140
|
+
"name": "from",
|
|
1141
|
+
"type": "address"
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
"internalType": "address",
|
|
1145
|
+
"name": "to",
|
|
1146
|
+
"type": "address"
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
"internalType": "uint256",
|
|
1150
|
+
"name": "value",
|
|
1151
|
+
"type": "uint256"
|
|
1152
|
+
}
|
|
1153
|
+
],
|
|
1154
|
+
"name": "transferFrom",
|
|
1155
|
+
"outputs": [
|
|
1156
|
+
{
|
|
1157
|
+
"internalType": "bool",
|
|
1158
|
+
"name": "",
|
|
1159
|
+
"type": "bool"
|
|
1160
|
+
}
|
|
1161
|
+
],
|
|
1162
|
+
"stateMutability": "nonpayable",
|
|
1163
|
+
"type": "function"
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
"inputs": [
|
|
1167
|
+
{
|
|
1168
|
+
"internalType": "address",
|
|
1169
|
+
"name": "to",
|
|
1170
|
+
"type": "address"
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
"internalType": "uint256",
|
|
1174
|
+
"name": "value",
|
|
1175
|
+
"type": "uint256"
|
|
1176
|
+
}
|
|
1177
|
+
],
|
|
1178
|
+
"name": "transferShares",
|
|
1179
|
+
"outputs": [
|
|
1180
|
+
{
|
|
1181
|
+
"internalType": "bool",
|
|
1182
|
+
"name": "success_",
|
|
1183
|
+
"type": "bool"
|
|
1184
|
+
}
|
|
1185
|
+
],
|
|
1186
|
+
"stateMutability": "nonpayable",
|
|
1187
|
+
"type": "function"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"inputs": [
|
|
1191
|
+
{
|
|
1192
|
+
"internalType": "address",
|
|
1193
|
+
"name": "from",
|
|
1194
|
+
"type": "address"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
"internalType": "address",
|
|
1198
|
+
"name": "to",
|
|
1199
|
+
"type": "address"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"internalType": "uint256",
|
|
1203
|
+
"name": "value",
|
|
1204
|
+
"type": "uint256"
|
|
1205
|
+
}
|
|
1206
|
+
],
|
|
1207
|
+
"name": "transferSharesFrom",
|
|
1208
|
+
"outputs": [
|
|
1209
|
+
{
|
|
1210
|
+
"internalType": "bool",
|
|
1211
|
+
"name": "success_",
|
|
1212
|
+
"type": "bool"
|
|
1213
|
+
}
|
|
1214
|
+
],
|
|
1215
|
+
"stateMutability": "nonpayable",
|
|
1216
|
+
"type": "function"
|
|
1217
|
+
}
|
|
1218
|
+
];
|
|
1219
|
+
/**
|
|
1220
|
+
* Usdn Contract Class
|
|
1221
|
+
*
|
|
1222
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
1223
|
+
*
|
|
1224
|
+
* @example
|
|
1225
|
+
* ```typescript
|
|
1226
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
1227
|
+
* import { mainnet } from 'viem/chains';
|
|
1228
|
+
* import { Usdn } from 'Usdn';
|
|
1229
|
+
*
|
|
1230
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
1231
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
1232
|
+
*
|
|
1233
|
+
* const contract = new Usdn('0x...', { publicClient, walletClient });
|
|
1234
|
+
*
|
|
1235
|
+
* // Read functions
|
|
1236
|
+
* const result = await contract.balanceOf('0x...');
|
|
1237
|
+
*
|
|
1238
|
+
* // Write functions
|
|
1239
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
1240
|
+
*
|
|
1241
|
+
* // Simulate transactions (dry-run)
|
|
1242
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
1243
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
1244
|
+
*
|
|
1245
|
+
* // Watch events
|
|
1246
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1247
|
+
* console.log('Transfer event:', event);
|
|
1248
|
+
* });
|
|
1249
|
+
* ```
|
|
1250
|
+
*/
|
|
1251
|
+
class Usdn {
|
|
1252
|
+
constructor(address, clients) {
|
|
1253
|
+
this.contractAddress = address;
|
|
1254
|
+
this.publicClient = clients.publicClient;
|
|
1255
|
+
this.contract = (0, viem_1.getContract)({
|
|
1256
|
+
address,
|
|
1257
|
+
abi: exports.UsdnAbi,
|
|
1258
|
+
client: {
|
|
1259
|
+
public: clients.publicClient,
|
|
1260
|
+
wallet: clients.walletClient,
|
|
1261
|
+
},
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Get the contract address
|
|
1266
|
+
*/
|
|
1267
|
+
get address() {
|
|
1268
|
+
return this.contractAddress;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Get the underlying viem contract instance.
|
|
1272
|
+
*/
|
|
1273
|
+
getContract() {
|
|
1274
|
+
return this.contract;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* DEFAULT_ADMIN_ROLE
|
|
1278
|
+
* view
|
|
1279
|
+
*/
|
|
1280
|
+
async DEFAULT_ADMIN_ROLE() {
|
|
1281
|
+
return this.contract.read.DEFAULT_ADMIN_ROLE();
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* DOMAIN_SEPARATOR
|
|
1285
|
+
* view
|
|
1286
|
+
*/
|
|
1287
|
+
async DOMAIN_SEPARATOR() {
|
|
1288
|
+
return this.contract.read.DOMAIN_SEPARATOR();
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* MAX_DIVISOR
|
|
1292
|
+
* view
|
|
1293
|
+
*/
|
|
1294
|
+
async MAX_DIVISOR() {
|
|
1295
|
+
return this.contract.read.MAX_DIVISOR();
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* MINTER_ROLE
|
|
1299
|
+
* view
|
|
1300
|
+
*/
|
|
1301
|
+
async MINTER_ROLE() {
|
|
1302
|
+
return this.contract.read.MINTER_ROLE();
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* MIN_DIVISOR
|
|
1306
|
+
* view
|
|
1307
|
+
*/
|
|
1308
|
+
async MIN_DIVISOR() {
|
|
1309
|
+
return this.contract.read.MIN_DIVISOR();
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* REBASER_ROLE
|
|
1313
|
+
* view
|
|
1314
|
+
*/
|
|
1315
|
+
async REBASER_ROLE() {
|
|
1316
|
+
return this.contract.read.REBASER_ROLE();
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* allowance
|
|
1320
|
+
* view
|
|
1321
|
+
*/
|
|
1322
|
+
async allowance(owner, spender) {
|
|
1323
|
+
return this.contract.read.allowance([owner, spender]);
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* balanceOf
|
|
1327
|
+
* view
|
|
1328
|
+
*/
|
|
1329
|
+
async balanceOf(account) {
|
|
1330
|
+
return this.contract.read.balanceOf([account]);
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* convertToShares
|
|
1334
|
+
* view
|
|
1335
|
+
*/
|
|
1336
|
+
async convertToShares(amountTokens) {
|
|
1337
|
+
return this.contract.read.convertToShares([amountTokens]);
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* convertToTokens
|
|
1341
|
+
* view
|
|
1342
|
+
*/
|
|
1343
|
+
async convertToTokens(amountShares) {
|
|
1344
|
+
return this.contract.read.convertToTokens([amountShares]);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* convertToTokensRoundUp
|
|
1348
|
+
* view
|
|
1349
|
+
*/
|
|
1350
|
+
async convertToTokensRoundUp(amountShares) {
|
|
1351
|
+
return this.contract.read.convertToTokensRoundUp([amountShares]);
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* decimals
|
|
1355
|
+
* view
|
|
1356
|
+
*/
|
|
1357
|
+
async decimals() {
|
|
1358
|
+
return this.contract.read.decimals();
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* divisor
|
|
1362
|
+
* view
|
|
1363
|
+
*/
|
|
1364
|
+
async divisor() {
|
|
1365
|
+
return this.contract.read.divisor();
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* eip712Domain
|
|
1369
|
+
* view
|
|
1370
|
+
*/
|
|
1371
|
+
async eip712Domain() {
|
|
1372
|
+
return this.contract.read.eip712Domain();
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* getRoleAdmin
|
|
1376
|
+
* view
|
|
1377
|
+
*/
|
|
1378
|
+
async getRoleAdmin(role) {
|
|
1379
|
+
return this.contract.read.getRoleAdmin([role]);
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* hasRole
|
|
1383
|
+
* view
|
|
1384
|
+
*/
|
|
1385
|
+
async hasRole(role, account) {
|
|
1386
|
+
return this.contract.read.hasRole([role, account]);
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* maxTokens
|
|
1390
|
+
* view
|
|
1391
|
+
*/
|
|
1392
|
+
async maxTokens() {
|
|
1393
|
+
return this.contract.read.maxTokens();
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* name
|
|
1397
|
+
* view
|
|
1398
|
+
*/
|
|
1399
|
+
async name() {
|
|
1400
|
+
return this.contract.read.name();
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* nonces
|
|
1404
|
+
* view
|
|
1405
|
+
*/
|
|
1406
|
+
async nonces(owner) {
|
|
1407
|
+
return this.contract.read.nonces([owner]);
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* rebaseHandler
|
|
1411
|
+
* view
|
|
1412
|
+
*/
|
|
1413
|
+
async rebaseHandler() {
|
|
1414
|
+
return this.contract.read.rebaseHandler();
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* sharesOf
|
|
1418
|
+
* view
|
|
1419
|
+
*/
|
|
1420
|
+
async sharesOf(account) {
|
|
1421
|
+
return this.contract.read.sharesOf([account]);
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* supportsInterface
|
|
1425
|
+
* view
|
|
1426
|
+
*/
|
|
1427
|
+
async supportsInterface(interfaceId) {
|
|
1428
|
+
return this.contract.read.supportsInterface([interfaceId]);
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* symbol
|
|
1432
|
+
* view
|
|
1433
|
+
*/
|
|
1434
|
+
async symbol() {
|
|
1435
|
+
return this.contract.read.symbol();
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* totalShares
|
|
1439
|
+
* view
|
|
1440
|
+
*/
|
|
1441
|
+
async totalShares() {
|
|
1442
|
+
return this.contract.read.totalShares();
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* totalSupply
|
|
1446
|
+
* view
|
|
1447
|
+
*/
|
|
1448
|
+
async totalSupply() {
|
|
1449
|
+
return this.contract.read.totalSupply();
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* approve
|
|
1453
|
+
* nonpayable
|
|
1454
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1455
|
+
*/
|
|
1456
|
+
async approve(spender, value, options) {
|
|
1457
|
+
if (!this.contract.write) {
|
|
1458
|
+
throw new Error('Wallet client is required for write operations');
|
|
1459
|
+
}
|
|
1460
|
+
return this.contract.write.approve([spender, value], options);
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* burn
|
|
1464
|
+
* nonpayable
|
|
1465
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1466
|
+
*/
|
|
1467
|
+
async burn(value, options) {
|
|
1468
|
+
if (!this.contract.write) {
|
|
1469
|
+
throw new Error('Wallet client is required for write operations');
|
|
1470
|
+
}
|
|
1471
|
+
return this.contract.write.burn([value], options);
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* burnFrom
|
|
1475
|
+
* nonpayable
|
|
1476
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1477
|
+
*/
|
|
1478
|
+
async burnFrom(account, value, options) {
|
|
1479
|
+
if (!this.contract.write) {
|
|
1480
|
+
throw new Error('Wallet client is required for write operations');
|
|
1481
|
+
}
|
|
1482
|
+
return this.contract.write.burnFrom([account, value], options);
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* burnShares
|
|
1486
|
+
* nonpayable
|
|
1487
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1488
|
+
*/
|
|
1489
|
+
async burnShares(value, options) {
|
|
1490
|
+
if (!this.contract.write) {
|
|
1491
|
+
throw new Error('Wallet client is required for write operations');
|
|
1492
|
+
}
|
|
1493
|
+
return this.contract.write.burnShares([value], options);
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* burnSharesFrom
|
|
1497
|
+
* nonpayable
|
|
1498
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1499
|
+
*/
|
|
1500
|
+
async burnSharesFrom(account, value, options) {
|
|
1501
|
+
if (!this.contract.write) {
|
|
1502
|
+
throw new Error('Wallet client is required for write operations');
|
|
1503
|
+
}
|
|
1504
|
+
return this.contract.write.burnSharesFrom([account, value], options);
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* grantRole
|
|
1508
|
+
* nonpayable
|
|
1509
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1510
|
+
*/
|
|
1511
|
+
async grantRole(role, account, options) {
|
|
1512
|
+
if (!this.contract.write) {
|
|
1513
|
+
throw new Error('Wallet client is required for write operations');
|
|
1514
|
+
}
|
|
1515
|
+
return this.contract.write.grantRole([role, account], options);
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* mint
|
|
1519
|
+
* nonpayable
|
|
1520
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1521
|
+
*/
|
|
1522
|
+
async mint(to, amount, options) {
|
|
1523
|
+
if (!this.contract.write) {
|
|
1524
|
+
throw new Error('Wallet client is required for write operations');
|
|
1525
|
+
}
|
|
1526
|
+
return this.contract.write.mint([to, amount], options);
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* mintShares
|
|
1530
|
+
* nonpayable
|
|
1531
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1532
|
+
*/
|
|
1533
|
+
async mintShares(to, amount, options) {
|
|
1534
|
+
if (!this.contract.write) {
|
|
1535
|
+
throw new Error('Wallet client is required for write operations');
|
|
1536
|
+
}
|
|
1537
|
+
return this.contract.write.mintShares([to, amount], options);
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* permit
|
|
1541
|
+
* nonpayable
|
|
1542
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1543
|
+
*/
|
|
1544
|
+
async permit(owner, spender, value, deadline, v, r, s, options) {
|
|
1545
|
+
if (!this.contract.write) {
|
|
1546
|
+
throw new Error('Wallet client is required for write operations');
|
|
1547
|
+
}
|
|
1548
|
+
return this.contract.write.permit([owner, spender, value, deadline, v, r, s], options);
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* rebase
|
|
1552
|
+
* nonpayable
|
|
1553
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1554
|
+
*/
|
|
1555
|
+
async rebase(newDivisor, options) {
|
|
1556
|
+
if (!this.contract.write) {
|
|
1557
|
+
throw new Error('Wallet client is required for write operations');
|
|
1558
|
+
}
|
|
1559
|
+
return this.contract.write.rebase([newDivisor], options);
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* renounceRole
|
|
1563
|
+
* nonpayable
|
|
1564
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1565
|
+
*/
|
|
1566
|
+
async renounceRole(role, callerConfirmation, options) {
|
|
1567
|
+
if (!this.contract.write) {
|
|
1568
|
+
throw new Error('Wallet client is required for write operations');
|
|
1569
|
+
}
|
|
1570
|
+
return this.contract.write.renounceRole([role, callerConfirmation], options);
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* revokeRole
|
|
1574
|
+
* nonpayable
|
|
1575
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1576
|
+
*/
|
|
1577
|
+
async revokeRole(role, account, options) {
|
|
1578
|
+
if (!this.contract.write) {
|
|
1579
|
+
throw new Error('Wallet client is required for write operations');
|
|
1580
|
+
}
|
|
1581
|
+
return this.contract.write.revokeRole([role, account], options);
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* setRebaseHandler
|
|
1585
|
+
* nonpayable
|
|
1586
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1587
|
+
*/
|
|
1588
|
+
async setRebaseHandler(newHandler, options) {
|
|
1589
|
+
if (!this.contract.write) {
|
|
1590
|
+
throw new Error('Wallet client is required for write operations');
|
|
1591
|
+
}
|
|
1592
|
+
return this.contract.write.setRebaseHandler([newHandler], options);
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* transfer
|
|
1596
|
+
* nonpayable
|
|
1597
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1598
|
+
*/
|
|
1599
|
+
async transfer(to, value, options) {
|
|
1600
|
+
if (!this.contract.write) {
|
|
1601
|
+
throw new Error('Wallet client is required for write operations');
|
|
1602
|
+
}
|
|
1603
|
+
return this.contract.write.transfer([to, value], options);
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* transferFrom
|
|
1607
|
+
* nonpayable
|
|
1608
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1609
|
+
*/
|
|
1610
|
+
async transferFrom(from, to, value, options) {
|
|
1611
|
+
if (!this.contract.write) {
|
|
1612
|
+
throw new Error('Wallet client is required for write operations');
|
|
1613
|
+
}
|
|
1614
|
+
return this.contract.write.transferFrom([from, to, value], options);
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* transferShares
|
|
1618
|
+
* nonpayable
|
|
1619
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1620
|
+
*/
|
|
1621
|
+
async transferShares(to, value, options) {
|
|
1622
|
+
if (!this.contract.write) {
|
|
1623
|
+
throw new Error('Wallet client is required for write operations');
|
|
1624
|
+
}
|
|
1625
|
+
return this.contract.write.transferShares([to, value], options);
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* transferSharesFrom
|
|
1629
|
+
* nonpayable
|
|
1630
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1631
|
+
*/
|
|
1632
|
+
async transferSharesFrom(from, to, value, options) {
|
|
1633
|
+
if (!this.contract.write) {
|
|
1634
|
+
throw new Error('Wallet client is required for write operations');
|
|
1635
|
+
}
|
|
1636
|
+
return this.contract.write.transferSharesFrom([from, to, value], options);
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1640
|
+
*
|
|
1641
|
+
* @example
|
|
1642
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1643
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1644
|
+
* console.log('Would succeed:', result.result);
|
|
1645
|
+
*/
|
|
1646
|
+
get simulate() {
|
|
1647
|
+
const contract = this.contract;
|
|
1648
|
+
if (!contract.simulate) {
|
|
1649
|
+
throw new Error('Public client is required for simulation');
|
|
1650
|
+
}
|
|
1651
|
+
return {
|
|
1652
|
+
/**
|
|
1653
|
+
* Simulate approve
|
|
1654
|
+
* Returns gas estimate and result without sending transaction
|
|
1655
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1656
|
+
*/
|
|
1657
|
+
async approve(spender, value, options) {
|
|
1658
|
+
return contract.simulate.approve([spender, value], options);
|
|
1659
|
+
},
|
|
1660
|
+
/**
|
|
1661
|
+
* Simulate burn
|
|
1662
|
+
* Returns gas estimate and result without sending transaction
|
|
1663
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1664
|
+
*/
|
|
1665
|
+
async burn(value, options) {
|
|
1666
|
+
return contract.simulate.burn([value], options);
|
|
1667
|
+
},
|
|
1668
|
+
/**
|
|
1669
|
+
* Simulate burnFrom
|
|
1670
|
+
* Returns gas estimate and result without sending transaction
|
|
1671
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1672
|
+
*/
|
|
1673
|
+
async burnFrom(account, value, options) {
|
|
1674
|
+
return contract.simulate.burnFrom([account, value], options);
|
|
1675
|
+
},
|
|
1676
|
+
/**
|
|
1677
|
+
* Simulate burnShares
|
|
1678
|
+
* Returns gas estimate and result without sending transaction
|
|
1679
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1680
|
+
*/
|
|
1681
|
+
async burnShares(value, options) {
|
|
1682
|
+
return contract.simulate.burnShares([value], options);
|
|
1683
|
+
},
|
|
1684
|
+
/**
|
|
1685
|
+
* Simulate burnSharesFrom
|
|
1686
|
+
* Returns gas estimate and result without sending transaction
|
|
1687
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1688
|
+
*/
|
|
1689
|
+
async burnSharesFrom(account, value, options) {
|
|
1690
|
+
return contract.simulate.burnSharesFrom([account, value], options);
|
|
1691
|
+
},
|
|
1692
|
+
/**
|
|
1693
|
+
* Simulate grantRole
|
|
1694
|
+
* Returns gas estimate and result without sending transaction
|
|
1695
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1696
|
+
*/
|
|
1697
|
+
async grantRole(role, account, options) {
|
|
1698
|
+
return contract.simulate.grantRole([role, account], options);
|
|
1699
|
+
},
|
|
1700
|
+
/**
|
|
1701
|
+
* Simulate mint
|
|
1702
|
+
* Returns gas estimate and result without sending transaction
|
|
1703
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1704
|
+
*/
|
|
1705
|
+
async mint(to, amount, options) {
|
|
1706
|
+
return contract.simulate.mint([to, amount], options);
|
|
1707
|
+
},
|
|
1708
|
+
/**
|
|
1709
|
+
* Simulate mintShares
|
|
1710
|
+
* Returns gas estimate and result without sending transaction
|
|
1711
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1712
|
+
*/
|
|
1713
|
+
async mintShares(to, amount, options) {
|
|
1714
|
+
return contract.simulate.mintShares([to, amount], options);
|
|
1715
|
+
},
|
|
1716
|
+
/**
|
|
1717
|
+
* Simulate permit
|
|
1718
|
+
* Returns gas estimate and result without sending transaction
|
|
1719
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1720
|
+
*/
|
|
1721
|
+
async permit(owner, spender, value, deadline, v, r, s, options) {
|
|
1722
|
+
return contract.simulate.permit([owner, spender, value, deadline, v, r, s], options);
|
|
1723
|
+
},
|
|
1724
|
+
/**
|
|
1725
|
+
* Simulate rebase
|
|
1726
|
+
* Returns gas estimate and result without sending transaction
|
|
1727
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1728
|
+
*/
|
|
1729
|
+
async rebase(newDivisor, options) {
|
|
1730
|
+
return contract.simulate.rebase([newDivisor], options);
|
|
1731
|
+
},
|
|
1732
|
+
/**
|
|
1733
|
+
* Simulate renounceRole
|
|
1734
|
+
* Returns gas estimate and result without sending transaction
|
|
1735
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1736
|
+
*/
|
|
1737
|
+
async renounceRole(role, callerConfirmation, options) {
|
|
1738
|
+
return contract.simulate.renounceRole([role, callerConfirmation], options);
|
|
1739
|
+
},
|
|
1740
|
+
/**
|
|
1741
|
+
* Simulate revokeRole
|
|
1742
|
+
* Returns gas estimate and result without sending transaction
|
|
1743
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1744
|
+
*/
|
|
1745
|
+
async revokeRole(role, account, options) {
|
|
1746
|
+
return contract.simulate.revokeRole([role, account], options);
|
|
1747
|
+
},
|
|
1748
|
+
/**
|
|
1749
|
+
* Simulate setRebaseHandler
|
|
1750
|
+
* Returns gas estimate and result without sending transaction
|
|
1751
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1752
|
+
*/
|
|
1753
|
+
async setRebaseHandler(newHandler, options) {
|
|
1754
|
+
return contract.simulate.setRebaseHandler([newHandler], options);
|
|
1755
|
+
},
|
|
1756
|
+
/**
|
|
1757
|
+
* Simulate transfer
|
|
1758
|
+
* Returns gas estimate and result without sending transaction
|
|
1759
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1760
|
+
*/
|
|
1761
|
+
async transfer(to, value, options) {
|
|
1762
|
+
return contract.simulate.transfer([to, value], options);
|
|
1763
|
+
},
|
|
1764
|
+
/**
|
|
1765
|
+
* Simulate transferFrom
|
|
1766
|
+
* Returns gas estimate and result without sending transaction
|
|
1767
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1768
|
+
*/
|
|
1769
|
+
async transferFrom(from, to, value, options) {
|
|
1770
|
+
return contract.simulate.transferFrom([from, to, value], options);
|
|
1771
|
+
},
|
|
1772
|
+
/**
|
|
1773
|
+
* Simulate transferShares
|
|
1774
|
+
* Returns gas estimate and result without sending transaction
|
|
1775
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1776
|
+
*/
|
|
1777
|
+
async transferShares(to, value, options) {
|
|
1778
|
+
return contract.simulate.transferShares([to, value], options);
|
|
1779
|
+
},
|
|
1780
|
+
/**
|
|
1781
|
+
* Simulate transferSharesFrom
|
|
1782
|
+
* Returns gas estimate and result without sending transaction
|
|
1783
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1784
|
+
*/
|
|
1785
|
+
async transferSharesFrom(from, to, value, options) {
|
|
1786
|
+
return contract.simulate.transferSharesFrom([from, to, value], options);
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Watch contract events
|
|
1792
|
+
*
|
|
1793
|
+
* @example
|
|
1794
|
+
* // Watch all Transfer events
|
|
1795
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1796
|
+
* console.log('Transfer:', event);
|
|
1797
|
+
* });
|
|
1798
|
+
*
|
|
1799
|
+
* // Stop watching
|
|
1800
|
+
* unwatch();
|
|
1801
|
+
*/
|
|
1802
|
+
get watch() {
|
|
1803
|
+
return {
|
|
1804
|
+
/**
|
|
1805
|
+
* Watch Approval events
|
|
1806
|
+
* @param callback Function to call when event is emitted
|
|
1807
|
+
* @param filter Optional filter for indexed parameters
|
|
1808
|
+
* @returns Unwatch function to stop listening
|
|
1809
|
+
*/
|
|
1810
|
+
Approval: (callback, filter) => {
|
|
1811
|
+
return this.publicClient.watchContractEvent({
|
|
1812
|
+
address: this.contractAddress,
|
|
1813
|
+
abi: exports.UsdnAbi,
|
|
1814
|
+
eventName: 'Approval',
|
|
1815
|
+
args: filter,
|
|
1816
|
+
onLogs: (logs) => {
|
|
1817
|
+
logs.forEach((log) => {
|
|
1818
|
+
callback(log.args);
|
|
1819
|
+
});
|
|
1820
|
+
},
|
|
1821
|
+
});
|
|
1822
|
+
},
|
|
1823
|
+
/**
|
|
1824
|
+
* Watch EIP712DomainChanged events
|
|
1825
|
+
* @param callback Function to call when event is emitted
|
|
1826
|
+
* @param filter Optional filter for indexed parameters
|
|
1827
|
+
* @returns Unwatch function to stop listening
|
|
1828
|
+
*/
|
|
1829
|
+
EIP712DomainChanged: (callback) => {
|
|
1830
|
+
return this.publicClient.watchContractEvent({
|
|
1831
|
+
address: this.contractAddress,
|
|
1832
|
+
abi: exports.UsdnAbi,
|
|
1833
|
+
eventName: 'EIP712DomainChanged',
|
|
1834
|
+
onLogs: (logs) => {
|
|
1835
|
+
logs.forEach((log) => {
|
|
1836
|
+
callback(log.args);
|
|
1837
|
+
});
|
|
1838
|
+
},
|
|
1839
|
+
});
|
|
1840
|
+
},
|
|
1841
|
+
/**
|
|
1842
|
+
* Watch Rebase events
|
|
1843
|
+
* @param callback Function to call when event is emitted
|
|
1844
|
+
* @param filter Optional filter for indexed parameters
|
|
1845
|
+
* @returns Unwatch function to stop listening
|
|
1846
|
+
*/
|
|
1847
|
+
Rebase: (callback) => {
|
|
1848
|
+
return this.publicClient.watchContractEvent({
|
|
1849
|
+
address: this.contractAddress,
|
|
1850
|
+
abi: exports.UsdnAbi,
|
|
1851
|
+
eventName: 'Rebase',
|
|
1852
|
+
onLogs: (logs) => {
|
|
1853
|
+
logs.forEach((log) => {
|
|
1854
|
+
callback(log.args);
|
|
1855
|
+
});
|
|
1856
|
+
},
|
|
1857
|
+
});
|
|
1858
|
+
},
|
|
1859
|
+
/**
|
|
1860
|
+
* Watch RebaseHandlerUpdated events
|
|
1861
|
+
* @param callback Function to call when event is emitted
|
|
1862
|
+
* @param filter Optional filter for indexed parameters
|
|
1863
|
+
* @returns Unwatch function to stop listening
|
|
1864
|
+
*/
|
|
1865
|
+
RebaseHandlerUpdated: (callback) => {
|
|
1866
|
+
return this.publicClient.watchContractEvent({
|
|
1867
|
+
address: this.contractAddress,
|
|
1868
|
+
abi: exports.UsdnAbi,
|
|
1869
|
+
eventName: 'RebaseHandlerUpdated',
|
|
1870
|
+
onLogs: (logs) => {
|
|
1871
|
+
logs.forEach((log) => {
|
|
1872
|
+
callback(log.args);
|
|
1873
|
+
});
|
|
1874
|
+
},
|
|
1875
|
+
});
|
|
1876
|
+
},
|
|
1877
|
+
/**
|
|
1878
|
+
* Watch RoleAdminChanged events
|
|
1879
|
+
* @param callback Function to call when event is emitted
|
|
1880
|
+
* @param filter Optional filter for indexed parameters
|
|
1881
|
+
* @returns Unwatch function to stop listening
|
|
1882
|
+
*/
|
|
1883
|
+
RoleAdminChanged: (callback, filter) => {
|
|
1884
|
+
return this.publicClient.watchContractEvent({
|
|
1885
|
+
address: this.contractAddress,
|
|
1886
|
+
abi: exports.UsdnAbi,
|
|
1887
|
+
eventName: 'RoleAdminChanged',
|
|
1888
|
+
args: filter,
|
|
1889
|
+
onLogs: (logs) => {
|
|
1890
|
+
logs.forEach((log) => {
|
|
1891
|
+
callback(log.args);
|
|
1892
|
+
});
|
|
1893
|
+
},
|
|
1894
|
+
});
|
|
1895
|
+
},
|
|
1896
|
+
/**
|
|
1897
|
+
* Watch RoleGranted events
|
|
1898
|
+
* @param callback Function to call when event is emitted
|
|
1899
|
+
* @param filter Optional filter for indexed parameters
|
|
1900
|
+
* @returns Unwatch function to stop listening
|
|
1901
|
+
*/
|
|
1902
|
+
RoleGranted: (callback, filter) => {
|
|
1903
|
+
return this.publicClient.watchContractEvent({
|
|
1904
|
+
address: this.contractAddress,
|
|
1905
|
+
abi: exports.UsdnAbi,
|
|
1906
|
+
eventName: 'RoleGranted',
|
|
1907
|
+
args: filter,
|
|
1908
|
+
onLogs: (logs) => {
|
|
1909
|
+
logs.forEach((log) => {
|
|
1910
|
+
callback(log.args);
|
|
1911
|
+
});
|
|
1912
|
+
},
|
|
1913
|
+
});
|
|
1914
|
+
},
|
|
1915
|
+
/**
|
|
1916
|
+
* Watch RoleRevoked events
|
|
1917
|
+
* @param callback Function to call when event is emitted
|
|
1918
|
+
* @param filter Optional filter for indexed parameters
|
|
1919
|
+
* @returns Unwatch function to stop listening
|
|
1920
|
+
*/
|
|
1921
|
+
RoleRevoked: (callback, filter) => {
|
|
1922
|
+
return this.publicClient.watchContractEvent({
|
|
1923
|
+
address: this.contractAddress,
|
|
1924
|
+
abi: exports.UsdnAbi,
|
|
1925
|
+
eventName: 'RoleRevoked',
|
|
1926
|
+
args: filter,
|
|
1927
|
+
onLogs: (logs) => {
|
|
1928
|
+
logs.forEach((log) => {
|
|
1929
|
+
callback(log.args);
|
|
1930
|
+
});
|
|
1931
|
+
},
|
|
1932
|
+
});
|
|
1933
|
+
},
|
|
1934
|
+
/**
|
|
1935
|
+
* Watch Transfer events
|
|
1936
|
+
* @param callback Function to call when event is emitted
|
|
1937
|
+
* @param filter Optional filter for indexed parameters
|
|
1938
|
+
* @returns Unwatch function to stop listening
|
|
1939
|
+
*/
|
|
1940
|
+
Transfer: (callback, filter) => {
|
|
1941
|
+
return this.publicClient.watchContractEvent({
|
|
1942
|
+
address: this.contractAddress,
|
|
1943
|
+
abi: exports.UsdnAbi,
|
|
1944
|
+
eventName: 'Transfer',
|
|
1945
|
+
args: filter,
|
|
1946
|
+
onLogs: (logs) => {
|
|
1947
|
+
logs.forEach((log) => {
|
|
1948
|
+
callback(log.args);
|
|
1949
|
+
});
|
|
1950
|
+
},
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
exports.Usdn = Usdn;
|