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