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