@gitmyabi-stg/ausd 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/AgoraDollar.d.ts +4199 -0
- package/contracts/AgoraDollar.js +4435 -0
- package/contracts/AgoraDollar.ts +5590 -0
- package/contracts/AgoraDollarErc1967Proxy.d.ts +752 -0
- package/contracts/AgoraDollarErc1967Proxy.js +865 -0
- package/contracts/AgoraDollarErc1967Proxy.ts +1000 -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,865 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgoraDollarErc1967Proxy = exports.AgoraDollarErc1967ProxyAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* AgoraDollarErc1967Proxy ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.AgoraDollarErc1967ProxyAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"components": [
|
|
15
|
+
{
|
|
16
|
+
"internalType": "address",
|
|
17
|
+
"name": "proxyAdminOwnerAddress",
|
|
18
|
+
"type": "address"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"internalType": "string",
|
|
22
|
+
"name": "eip712Name",
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"internalType": "string",
|
|
27
|
+
"name": "eip712Version",
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"internalType": "struct ConstructorParams",
|
|
32
|
+
"name": "_params",
|
|
33
|
+
"type": "tuple"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"stateMutability": "payable",
|
|
37
|
+
"type": "constructor"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"inputs": [
|
|
41
|
+
{
|
|
42
|
+
"internalType": "address",
|
|
43
|
+
"name": "frozenAccount",
|
|
44
|
+
"type": "address"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"name": "AccountIsFrozen",
|
|
48
|
+
"type": "error"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"inputs": [
|
|
52
|
+
{
|
|
53
|
+
"internalType": "address",
|
|
54
|
+
"name": "target",
|
|
55
|
+
"type": "address"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"name": "AddressEmptyCode",
|
|
59
|
+
"type": "error"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"inputs": [],
|
|
63
|
+
"name": "AgoraDollarErc1967NonPayable",
|
|
64
|
+
"type": "error"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"inputs": [
|
|
68
|
+
{
|
|
69
|
+
"internalType": "address",
|
|
70
|
+
"name": "spender",
|
|
71
|
+
"type": "address"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"internalType": "uint256",
|
|
75
|
+
"name": "allowance",
|
|
76
|
+
"type": "uint256"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"internalType": "uint256",
|
|
80
|
+
"name": "needed",
|
|
81
|
+
"type": "uint256"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"name": "ERC20InsufficientAllowance",
|
|
85
|
+
"type": "error"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"inputs": [
|
|
89
|
+
{
|
|
90
|
+
"internalType": "address",
|
|
91
|
+
"name": "sender",
|
|
92
|
+
"type": "address"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"internalType": "uint256",
|
|
96
|
+
"name": "balance",
|
|
97
|
+
"type": "uint256"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"internalType": "uint256",
|
|
101
|
+
"name": "needed",
|
|
102
|
+
"type": "uint256"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"name": "ERC20InsufficientBalance",
|
|
106
|
+
"type": "error"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "address",
|
|
112
|
+
"name": "approver",
|
|
113
|
+
"type": "address"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"name": "ERC20InvalidApprover",
|
|
117
|
+
"type": "error"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [
|
|
121
|
+
{
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "receiver",
|
|
124
|
+
"type": "address"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"name": "ERC20InvalidReceiver",
|
|
128
|
+
"type": "error"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"inputs": [
|
|
132
|
+
{
|
|
133
|
+
"internalType": "address",
|
|
134
|
+
"name": "sender",
|
|
135
|
+
"type": "address"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"name": "ERC20InvalidSender",
|
|
139
|
+
"type": "error"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"inputs": [
|
|
143
|
+
{
|
|
144
|
+
"internalType": "address",
|
|
145
|
+
"name": "spender",
|
|
146
|
+
"type": "address"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"name": "ERC20InvalidSpender",
|
|
150
|
+
"type": "error"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"inputs": [],
|
|
154
|
+
"name": "ExpiredAuthorization",
|
|
155
|
+
"type": "error"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"inputs": [],
|
|
159
|
+
"name": "FailedInnerCall",
|
|
160
|
+
"type": "error"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"inputs": [],
|
|
164
|
+
"name": "ImplementationTargetNotAContract",
|
|
165
|
+
"type": "error"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"inputs": [],
|
|
169
|
+
"name": "InvalidAuthorization",
|
|
170
|
+
"type": "error"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"inputs": [
|
|
174
|
+
{
|
|
175
|
+
"internalType": "address",
|
|
176
|
+
"name": "caller",
|
|
177
|
+
"type": "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"internalType": "address",
|
|
181
|
+
"name": "payee",
|
|
182
|
+
"type": "address"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"name": "InvalidPayee",
|
|
186
|
+
"type": "error"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"inputs": [],
|
|
190
|
+
"name": "InvalidSignature",
|
|
191
|
+
"type": "error"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"inputs": [],
|
|
195
|
+
"name": "ProxyDeniedAdminAccess",
|
|
196
|
+
"type": "error"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"inputs": [],
|
|
200
|
+
"name": "SignatureVerificationPaused",
|
|
201
|
+
"type": "error"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"inputs": [
|
|
205
|
+
{
|
|
206
|
+
"internalType": "string",
|
|
207
|
+
"name": "str",
|
|
208
|
+
"type": "string"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"name": "StringTooLong",
|
|
212
|
+
"type": "error"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"inputs": [],
|
|
216
|
+
"name": "TransferPaused",
|
|
217
|
+
"type": "error"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"inputs": [],
|
|
221
|
+
"name": "UsedOrCanceledAuthorization",
|
|
222
|
+
"type": "error"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"anonymous": false,
|
|
226
|
+
"inputs": [
|
|
227
|
+
{
|
|
228
|
+
"indexed": false,
|
|
229
|
+
"internalType": "address",
|
|
230
|
+
"name": "previousAdmin",
|
|
231
|
+
"type": "address"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"indexed": false,
|
|
235
|
+
"internalType": "address",
|
|
236
|
+
"name": "newAdmin",
|
|
237
|
+
"type": "address"
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"name": "AdminChanged",
|
|
241
|
+
"type": "event"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"anonymous": false,
|
|
245
|
+
"inputs": [
|
|
246
|
+
{
|
|
247
|
+
"indexed": true,
|
|
248
|
+
"internalType": "address",
|
|
249
|
+
"name": "owner",
|
|
250
|
+
"type": "address"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"indexed": true,
|
|
254
|
+
"internalType": "address",
|
|
255
|
+
"name": "spender",
|
|
256
|
+
"type": "address"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"indexed": false,
|
|
260
|
+
"internalType": "uint256",
|
|
261
|
+
"name": "value",
|
|
262
|
+
"type": "uint256"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"name": "Approval",
|
|
266
|
+
"type": "event"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"anonymous": false,
|
|
270
|
+
"inputs": [
|
|
271
|
+
{
|
|
272
|
+
"indexed": true,
|
|
273
|
+
"internalType": "address",
|
|
274
|
+
"name": "authorizer",
|
|
275
|
+
"type": "address"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"indexed": true,
|
|
279
|
+
"internalType": "bytes32",
|
|
280
|
+
"name": "nonce",
|
|
281
|
+
"type": "bytes32"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"name": "AuthorizationCanceled",
|
|
285
|
+
"type": "event"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"anonymous": false,
|
|
289
|
+
"inputs": [
|
|
290
|
+
{
|
|
291
|
+
"indexed": true,
|
|
292
|
+
"internalType": "address",
|
|
293
|
+
"name": "authorizer",
|
|
294
|
+
"type": "address"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"indexed": true,
|
|
298
|
+
"internalType": "bytes32",
|
|
299
|
+
"name": "nonce",
|
|
300
|
+
"type": "bytes32"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"name": "AuthorizationUsed",
|
|
304
|
+
"type": "event"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"anonymous": false,
|
|
308
|
+
"inputs": [
|
|
309
|
+
{
|
|
310
|
+
"indexed": true,
|
|
311
|
+
"internalType": "address",
|
|
312
|
+
"name": "from",
|
|
313
|
+
"type": "address"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"indexed": true,
|
|
317
|
+
"internalType": "address",
|
|
318
|
+
"name": "to",
|
|
319
|
+
"type": "address"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"indexed": false,
|
|
323
|
+
"internalType": "uint256",
|
|
324
|
+
"name": "value",
|
|
325
|
+
"type": "uint256"
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
"name": "Transfer",
|
|
329
|
+
"type": "event"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"anonymous": false,
|
|
333
|
+
"inputs": [
|
|
334
|
+
{
|
|
335
|
+
"indexed": true,
|
|
336
|
+
"internalType": "address",
|
|
337
|
+
"name": "implementation",
|
|
338
|
+
"type": "address"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"name": "Upgraded",
|
|
342
|
+
"type": "event"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"stateMutability": "payable",
|
|
346
|
+
"type": "fallback"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"inputs": [
|
|
350
|
+
{
|
|
351
|
+
"internalType": "address",
|
|
352
|
+
"name": "_from",
|
|
353
|
+
"type": "address"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"internalType": "address",
|
|
357
|
+
"name": "_to",
|
|
358
|
+
"type": "address"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"internalType": "uint256",
|
|
362
|
+
"name": "_value",
|
|
363
|
+
"type": "uint256"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"internalType": "uint256",
|
|
367
|
+
"name": "_validAfter",
|
|
368
|
+
"type": "uint256"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"internalType": "uint256",
|
|
372
|
+
"name": "_validBefore",
|
|
373
|
+
"type": "uint256"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"internalType": "bytes32",
|
|
377
|
+
"name": "_nonce",
|
|
378
|
+
"type": "bytes32"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"internalType": "bytes",
|
|
382
|
+
"name": "_signature",
|
|
383
|
+
"type": "bytes"
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"name": "receiveWithAuthorization",
|
|
387
|
+
"outputs": [],
|
|
388
|
+
"stateMutability": "nonpayable",
|
|
389
|
+
"type": "function"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"inputs": [
|
|
393
|
+
{
|
|
394
|
+
"internalType": "address",
|
|
395
|
+
"name": "_from",
|
|
396
|
+
"type": "address"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"internalType": "address",
|
|
400
|
+
"name": "_to",
|
|
401
|
+
"type": "address"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"internalType": "uint256",
|
|
405
|
+
"name": "_value",
|
|
406
|
+
"type": "uint256"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"internalType": "uint256",
|
|
410
|
+
"name": "_validAfter",
|
|
411
|
+
"type": "uint256"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"internalType": "uint256",
|
|
415
|
+
"name": "_validBefore",
|
|
416
|
+
"type": "uint256"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"internalType": "bytes32",
|
|
420
|
+
"name": "_nonce",
|
|
421
|
+
"type": "bytes32"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"internalType": "uint8",
|
|
425
|
+
"name": "_v",
|
|
426
|
+
"type": "uint8"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"internalType": "bytes32",
|
|
430
|
+
"name": "_r",
|
|
431
|
+
"type": "bytes32"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"internalType": "bytes32",
|
|
435
|
+
"name": "_s",
|
|
436
|
+
"type": "bytes32"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"name": "receiveWithAuthorization",
|
|
440
|
+
"outputs": [],
|
|
441
|
+
"stateMutability": "nonpayable",
|
|
442
|
+
"type": "function"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"inputs": [
|
|
446
|
+
{
|
|
447
|
+
"internalType": "address",
|
|
448
|
+
"name": "_to",
|
|
449
|
+
"type": "address"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"internalType": "uint256",
|
|
453
|
+
"name": "_transferValue",
|
|
454
|
+
"type": "uint256"
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
"name": "transfer",
|
|
458
|
+
"outputs": [
|
|
459
|
+
{
|
|
460
|
+
"internalType": "bool",
|
|
461
|
+
"name": "",
|
|
462
|
+
"type": "bool"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"stateMutability": "nonpayable",
|
|
466
|
+
"type": "function"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"inputs": [
|
|
470
|
+
{
|
|
471
|
+
"internalType": "address",
|
|
472
|
+
"name": "_from",
|
|
473
|
+
"type": "address"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"internalType": "address",
|
|
477
|
+
"name": "_to",
|
|
478
|
+
"type": "address"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"internalType": "uint256",
|
|
482
|
+
"name": "_transferValue",
|
|
483
|
+
"type": "uint256"
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"name": "transferFrom",
|
|
487
|
+
"outputs": [
|
|
488
|
+
{
|
|
489
|
+
"internalType": "bool",
|
|
490
|
+
"name": "",
|
|
491
|
+
"type": "bool"
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"stateMutability": "nonpayable",
|
|
495
|
+
"type": "function"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"inputs": [
|
|
499
|
+
{
|
|
500
|
+
"internalType": "address",
|
|
501
|
+
"name": "_from",
|
|
502
|
+
"type": "address"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"internalType": "address",
|
|
506
|
+
"name": "_to",
|
|
507
|
+
"type": "address"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"internalType": "uint256",
|
|
511
|
+
"name": "_value",
|
|
512
|
+
"type": "uint256"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"internalType": "uint256",
|
|
516
|
+
"name": "_validAfter",
|
|
517
|
+
"type": "uint256"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"internalType": "uint256",
|
|
521
|
+
"name": "_validBefore",
|
|
522
|
+
"type": "uint256"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"internalType": "bytes32",
|
|
526
|
+
"name": "_nonce",
|
|
527
|
+
"type": "bytes32"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"internalType": "bytes",
|
|
531
|
+
"name": "_signature",
|
|
532
|
+
"type": "bytes"
|
|
533
|
+
}
|
|
534
|
+
],
|
|
535
|
+
"name": "transferWithAuthorization",
|
|
536
|
+
"outputs": [],
|
|
537
|
+
"stateMutability": "nonpayable",
|
|
538
|
+
"type": "function"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"inputs": [
|
|
542
|
+
{
|
|
543
|
+
"internalType": "address",
|
|
544
|
+
"name": "_from",
|
|
545
|
+
"type": "address"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"internalType": "address",
|
|
549
|
+
"name": "_to",
|
|
550
|
+
"type": "address"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"internalType": "uint256",
|
|
554
|
+
"name": "_value",
|
|
555
|
+
"type": "uint256"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"internalType": "uint256",
|
|
559
|
+
"name": "_validAfter",
|
|
560
|
+
"type": "uint256"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"internalType": "uint256",
|
|
564
|
+
"name": "_validBefore",
|
|
565
|
+
"type": "uint256"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"internalType": "bytes32",
|
|
569
|
+
"name": "_nonce",
|
|
570
|
+
"type": "bytes32"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"internalType": "uint8",
|
|
574
|
+
"name": "_v",
|
|
575
|
+
"type": "uint8"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"internalType": "bytes32",
|
|
579
|
+
"name": "_r",
|
|
580
|
+
"type": "bytes32"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"internalType": "bytes32",
|
|
584
|
+
"name": "_s",
|
|
585
|
+
"type": "bytes32"
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
"name": "transferWithAuthorization",
|
|
589
|
+
"outputs": [],
|
|
590
|
+
"stateMutability": "nonpayable",
|
|
591
|
+
"type": "function"
|
|
592
|
+
}
|
|
593
|
+
];
|
|
594
|
+
/**
|
|
595
|
+
* AgoraDollarErc1967Proxy Contract Class
|
|
596
|
+
*
|
|
597
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```typescript
|
|
601
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
602
|
+
* import { mainnet } from 'viem/chains';
|
|
603
|
+
* import { AgoraDollarErc1967Proxy } from 'AgoraDollarErc1967Proxy';
|
|
604
|
+
*
|
|
605
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
606
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
607
|
+
*
|
|
608
|
+
* const contract = new AgoraDollarErc1967Proxy('0x...', { publicClient, walletClient });
|
|
609
|
+
*
|
|
610
|
+
* // Read functions
|
|
611
|
+
* const result = await contract.balanceOf('0x...');
|
|
612
|
+
*
|
|
613
|
+
* // Write functions
|
|
614
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
615
|
+
*
|
|
616
|
+
* // Simulate transactions (dry-run)
|
|
617
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
618
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
619
|
+
*
|
|
620
|
+
* // Watch events
|
|
621
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
622
|
+
* console.log('Transfer event:', event);
|
|
623
|
+
* });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
class AgoraDollarErc1967Proxy {
|
|
627
|
+
constructor(address, clients) {
|
|
628
|
+
this.contractAddress = address;
|
|
629
|
+
this.publicClient = clients.publicClient;
|
|
630
|
+
this.contract = (0, viem_1.getContract)({
|
|
631
|
+
address,
|
|
632
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
633
|
+
client: {
|
|
634
|
+
public: clients.publicClient,
|
|
635
|
+
wallet: clients.walletClient,
|
|
636
|
+
},
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Get the contract address
|
|
641
|
+
*/
|
|
642
|
+
get address() {
|
|
643
|
+
return this.contractAddress;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Get the underlying viem contract instance.
|
|
647
|
+
*/
|
|
648
|
+
getContract() {
|
|
649
|
+
return this.contract;
|
|
650
|
+
}
|
|
651
|
+
async receiveWithAuthorization(...args) {
|
|
652
|
+
if (!this.contract.write) {
|
|
653
|
+
throw new Error('Wallet client is required for write operations');
|
|
654
|
+
}
|
|
655
|
+
return this.contract.write.receiveWithAuthorization(args);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* transfer
|
|
659
|
+
* nonpayable
|
|
660
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
661
|
+
*/
|
|
662
|
+
async transfer(_to, _transferValue, options) {
|
|
663
|
+
if (!this.contract.write) {
|
|
664
|
+
throw new Error('Wallet client is required for write operations');
|
|
665
|
+
}
|
|
666
|
+
return this.contract.write.transfer([_to, _transferValue], options);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* transferFrom
|
|
670
|
+
* nonpayable
|
|
671
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
672
|
+
*/
|
|
673
|
+
async transferFrom(_from, _to, _transferValue, options) {
|
|
674
|
+
if (!this.contract.write) {
|
|
675
|
+
throw new Error('Wallet client is required for write operations');
|
|
676
|
+
}
|
|
677
|
+
return this.contract.write.transferFrom([_from, _to, _transferValue], options);
|
|
678
|
+
}
|
|
679
|
+
async transferWithAuthorization(...args) {
|
|
680
|
+
if (!this.contract.write) {
|
|
681
|
+
throw new Error('Wallet client is required for write operations');
|
|
682
|
+
}
|
|
683
|
+
return this.contract.write.transferWithAuthorization(args);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
690
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
691
|
+
* console.log('Would succeed:', result.result);
|
|
692
|
+
*/
|
|
693
|
+
get simulate() {
|
|
694
|
+
const contract = this.contract;
|
|
695
|
+
if (!contract.simulate) {
|
|
696
|
+
throw new Error('Public client is required for simulation');
|
|
697
|
+
}
|
|
698
|
+
return {
|
|
699
|
+
/**
|
|
700
|
+
* Simulate receiveWithAuthorization
|
|
701
|
+
* Returns gas estimate and result without sending transaction
|
|
702
|
+
* Supports multiple overloads: (address, address, uint256, uint256, uint256, bytes32, bytes), (address, address, uint256, uint256, uint256, bytes32, uint8, bytes32, bytes32)
|
|
703
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
704
|
+
*/
|
|
705
|
+
async receiveWithAuthorization(...args) {
|
|
706
|
+
return contract.simulate.receiveWithAuthorization(args);
|
|
707
|
+
},
|
|
708
|
+
/**
|
|
709
|
+
* Simulate transfer
|
|
710
|
+
* Returns gas estimate and result without sending transaction
|
|
711
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
712
|
+
*/
|
|
713
|
+
async transfer(_to, _transferValue, options) {
|
|
714
|
+
return contract.simulate.transfer([_to, _transferValue], options);
|
|
715
|
+
},
|
|
716
|
+
/**
|
|
717
|
+
* Simulate transferFrom
|
|
718
|
+
* Returns gas estimate and result without sending transaction
|
|
719
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
720
|
+
*/
|
|
721
|
+
async transferFrom(_from, _to, _transferValue, options) {
|
|
722
|
+
return contract.simulate.transferFrom([_from, _to, _transferValue], options);
|
|
723
|
+
},
|
|
724
|
+
/**
|
|
725
|
+
* Simulate transferWithAuthorization
|
|
726
|
+
* Returns gas estimate and result without sending transaction
|
|
727
|
+
* Supports multiple overloads: (address, address, uint256, uint256, uint256, bytes32, bytes), (address, address, uint256, uint256, uint256, bytes32, uint8, bytes32, bytes32)
|
|
728
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
729
|
+
*/
|
|
730
|
+
async transferWithAuthorization(...args) {
|
|
731
|
+
return contract.simulate.transferWithAuthorization(args);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Watch contract events
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* // Watch all Transfer events
|
|
740
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
741
|
+
* console.log('Transfer:', event);
|
|
742
|
+
* });
|
|
743
|
+
*
|
|
744
|
+
* // Stop watching
|
|
745
|
+
* unwatch();
|
|
746
|
+
*/
|
|
747
|
+
get watch() {
|
|
748
|
+
return {
|
|
749
|
+
/**
|
|
750
|
+
* Watch AdminChanged events
|
|
751
|
+
* @param callback Function to call when event is emitted
|
|
752
|
+
* @param filter Optional filter for indexed parameters
|
|
753
|
+
* @returns Unwatch function to stop listening
|
|
754
|
+
*/
|
|
755
|
+
AdminChanged: (callback) => {
|
|
756
|
+
return this.publicClient.watchContractEvent({
|
|
757
|
+
address: this.contractAddress,
|
|
758
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
759
|
+
eventName: 'AdminChanged',
|
|
760
|
+
onLogs: (logs) => {
|
|
761
|
+
logs.forEach((log) => {
|
|
762
|
+
callback(log.args);
|
|
763
|
+
});
|
|
764
|
+
},
|
|
765
|
+
});
|
|
766
|
+
},
|
|
767
|
+
/**
|
|
768
|
+
* Watch Approval events
|
|
769
|
+
* @param callback Function to call when event is emitted
|
|
770
|
+
* @param filter Optional filter for indexed parameters
|
|
771
|
+
* @returns Unwatch function to stop listening
|
|
772
|
+
*/
|
|
773
|
+
Approval: (callback, filter) => {
|
|
774
|
+
return this.publicClient.watchContractEvent({
|
|
775
|
+
address: this.contractAddress,
|
|
776
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
777
|
+
eventName: 'Approval',
|
|
778
|
+
args: filter,
|
|
779
|
+
onLogs: (logs) => {
|
|
780
|
+
logs.forEach((log) => {
|
|
781
|
+
callback(log.args);
|
|
782
|
+
});
|
|
783
|
+
},
|
|
784
|
+
});
|
|
785
|
+
},
|
|
786
|
+
/**
|
|
787
|
+
* Watch AuthorizationCanceled events
|
|
788
|
+
* @param callback Function to call when event is emitted
|
|
789
|
+
* @param filter Optional filter for indexed parameters
|
|
790
|
+
* @returns Unwatch function to stop listening
|
|
791
|
+
*/
|
|
792
|
+
AuthorizationCanceled: (callback, filter) => {
|
|
793
|
+
return this.publicClient.watchContractEvent({
|
|
794
|
+
address: this.contractAddress,
|
|
795
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
796
|
+
eventName: 'AuthorizationCanceled',
|
|
797
|
+
args: filter,
|
|
798
|
+
onLogs: (logs) => {
|
|
799
|
+
logs.forEach((log) => {
|
|
800
|
+
callback(log.args);
|
|
801
|
+
});
|
|
802
|
+
},
|
|
803
|
+
});
|
|
804
|
+
},
|
|
805
|
+
/**
|
|
806
|
+
* Watch AuthorizationUsed events
|
|
807
|
+
* @param callback Function to call when event is emitted
|
|
808
|
+
* @param filter Optional filter for indexed parameters
|
|
809
|
+
* @returns Unwatch function to stop listening
|
|
810
|
+
*/
|
|
811
|
+
AuthorizationUsed: (callback, filter) => {
|
|
812
|
+
return this.publicClient.watchContractEvent({
|
|
813
|
+
address: this.contractAddress,
|
|
814
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
815
|
+
eventName: 'AuthorizationUsed',
|
|
816
|
+
args: filter,
|
|
817
|
+
onLogs: (logs) => {
|
|
818
|
+
logs.forEach((log) => {
|
|
819
|
+
callback(log.args);
|
|
820
|
+
});
|
|
821
|
+
},
|
|
822
|
+
});
|
|
823
|
+
},
|
|
824
|
+
/**
|
|
825
|
+
* Watch Transfer events
|
|
826
|
+
* @param callback Function to call when event is emitted
|
|
827
|
+
* @param filter Optional filter for indexed parameters
|
|
828
|
+
* @returns Unwatch function to stop listening
|
|
829
|
+
*/
|
|
830
|
+
Transfer: (callback, filter) => {
|
|
831
|
+
return this.publicClient.watchContractEvent({
|
|
832
|
+
address: this.contractAddress,
|
|
833
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
834
|
+
eventName: 'Transfer',
|
|
835
|
+
args: filter,
|
|
836
|
+
onLogs: (logs) => {
|
|
837
|
+
logs.forEach((log) => {
|
|
838
|
+
callback(log.args);
|
|
839
|
+
});
|
|
840
|
+
},
|
|
841
|
+
});
|
|
842
|
+
},
|
|
843
|
+
/**
|
|
844
|
+
* Watch Upgraded events
|
|
845
|
+
* @param callback Function to call when event is emitted
|
|
846
|
+
* @param filter Optional filter for indexed parameters
|
|
847
|
+
* @returns Unwatch function to stop listening
|
|
848
|
+
*/
|
|
849
|
+
Upgraded: (callback, filter) => {
|
|
850
|
+
return this.publicClient.watchContractEvent({
|
|
851
|
+
address: this.contractAddress,
|
|
852
|
+
abi: exports.AgoraDollarErc1967ProxyAbi,
|
|
853
|
+
eventName: 'Upgraded',
|
|
854
|
+
args: filter,
|
|
855
|
+
onLogs: (logs) => {
|
|
856
|
+
logs.forEach((log) => {
|
|
857
|
+
callback(log.args);
|
|
858
|
+
});
|
|
859
|
+
},
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
exports.AgoraDollarErc1967Proxy = AgoraDollarErc1967Proxy;
|