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