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