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