@gearbox-protocol/sdk 3.0.0-vfour.2 → 3.0.0-vfour.20

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,1500 @@
1
+ 'use strict';
2
+
3
+ var sdk = require('../sdk');
4
+ var viem = require('viem');
5
+
6
+ // src/dev/calcLiquidatableLTs.ts
7
+ async function calcLiquidatableLTs(sdk$1, ca, factor = 9990n, logger) {
8
+ const cm = sdk$1.marketRegister.findCreditManager(ca.creditManager);
9
+ const market = sdk$1.marketRegister.findByCreditManager(ca.creditManager);
10
+ const weightedBalances = ca.tokens.map((t) => {
11
+ const { token, balance } = t;
12
+ const balanceU = market.priceOracle.convertToUnderlying(token, balance);
13
+ const lt = BigInt(cm.collateralTokens[token]);
14
+ return {
15
+ token,
16
+ weightedBalance: balanceU * lt / sdk.PERCENTAGE_FACTOR,
17
+ lt
18
+ };
19
+ }).sort((a, b) => {
20
+ if (a.token === ca.underlying) return 1;
21
+ if (b.token === ca.underlying) return -1;
22
+ return b.weightedBalance > a.weightedBalance ? 1 : -1;
23
+ });
24
+ let divisor = 0n;
25
+ let dividend = factor * (ca.debt + ca.accruedInterest + ca.accruedFees) / sdk.PERCENTAGE_FACTOR;
26
+ for (const { token, weightedBalance } of weightedBalances) {
27
+ if (token === ca.underlying) {
28
+ dividend -= weightedBalance;
29
+ } else {
30
+ divisor += weightedBalance;
31
+ }
32
+ }
33
+ if (divisor === 0n) {
34
+ throw new Error("warning: assets have zero weighted value in underlying");
35
+ }
36
+ if (dividend <= 0n) {
37
+ throw new Error(`warning: account balance in underlying covers debt`);
38
+ }
39
+ const k = sdk.WAD * dividend / divisor;
40
+ const result = {};
41
+ for (const { token, lt: oldLT } of weightedBalances) {
42
+ if (token !== ca.underlying) {
43
+ const newLT = oldLT * k / sdk.WAD;
44
+ logger?.debug(
45
+ `proposed ${sdk$1.marketRegister.tokensMeta.mustGet(token).symbol} LT change: ${oldLT} => ${newLT} `
46
+ );
47
+ result[token] = Number(newLT);
48
+ }
49
+ }
50
+ return result;
51
+ }
52
+ function createAnvilClient({
53
+ chain,
54
+ transport
55
+ }) {
56
+ return viem.createTestClient(
57
+ {
58
+ chain,
59
+ mode: "anvil",
60
+ transport,
61
+ cacheTime: 0
62
+ }
63
+ ).extend(viem.publicActions).extend(viem.walletActions).extend((client) => ({
64
+ isAnvil: () => isAnvil(client),
65
+ evmMineDetailed: (timestamp) => evmMineDetailed(client, timestamp)
66
+ }));
67
+ }
68
+ async function isAnvil(client) {
69
+ try {
70
+ const resp = await client.request({
71
+ method: "anvil_nodeInfo",
72
+ params: []
73
+ });
74
+ return !!resp.currentBlockNumber;
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ async function evmMineDetailed(client, timestamp) {
80
+ try {
81
+ const [block] = await client.request({
82
+ method: "evm_mine_detailed",
83
+ params: [viem.toHex(timestamp)]
84
+ });
85
+ return block;
86
+ } catch {
87
+ return void 0;
88
+ }
89
+ }
90
+
91
+ // src/dev/abi/v3.ts
92
+ var iaclAbi = [
93
+ {
94
+ type: "function",
95
+ inputs: [{ name: "account", internalType: "address", type: "address" }],
96
+ name: "isConfigurator",
97
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
98
+ stateMutability: "view"
99
+ },
100
+ {
101
+ type: "function",
102
+ inputs: [{ name: "addr", internalType: "address", type: "address" }],
103
+ name: "isPausableAdmin",
104
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
105
+ stateMutability: "view"
106
+ },
107
+ {
108
+ type: "function",
109
+ inputs: [{ name: "addr", internalType: "address", type: "address" }],
110
+ name: "isUnpausableAdmin",
111
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
112
+ stateMutability: "view"
113
+ },
114
+ {
115
+ type: "function",
116
+ inputs: [],
117
+ name: "owner",
118
+ outputs: [{ name: "", internalType: "address", type: "address" }],
119
+ stateMutability: "view"
120
+ },
121
+ {
122
+ type: "function",
123
+ inputs: [],
124
+ name: "version",
125
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
126
+ stateMutability: "view"
127
+ },
128
+ {
129
+ type: "event",
130
+ anonymous: false,
131
+ inputs: [
132
+ {
133
+ name: "newAdmin",
134
+ internalType: "address",
135
+ type: "address",
136
+ indexed: true
137
+ }
138
+ ],
139
+ name: "PausableAdminAdded"
140
+ },
141
+ {
142
+ type: "event",
143
+ anonymous: false,
144
+ inputs: [
145
+ {
146
+ name: "admin",
147
+ internalType: "address",
148
+ type: "address",
149
+ indexed: true
150
+ }
151
+ ],
152
+ name: "PausableAdminRemoved"
153
+ },
154
+ {
155
+ type: "event",
156
+ anonymous: false,
157
+ inputs: [
158
+ {
159
+ name: "newAdmin",
160
+ internalType: "address",
161
+ type: "address",
162
+ indexed: true
163
+ }
164
+ ],
165
+ name: "UnpausableAdminAdded"
166
+ },
167
+ {
168
+ type: "event",
169
+ anonymous: false,
170
+ inputs: [
171
+ {
172
+ name: "admin",
173
+ internalType: "address",
174
+ type: "address",
175
+ indexed: true
176
+ }
177
+ ],
178
+ name: "UnpausableAdminRemoved"
179
+ },
180
+ {
181
+ type: "error",
182
+ inputs: [{ name: "addr", internalType: "address", type: "address" }],
183
+ name: "AddressNotPausableAdminException"
184
+ },
185
+ {
186
+ type: "error",
187
+ inputs: [{ name: "addr", internalType: "address", type: "address" }],
188
+ name: "AddressNotUnpausableAdminException"
189
+ }
190
+ ];
191
+ var iCreditConfiguratorV3Abi = [
192
+ {
193
+ type: "function",
194
+ inputs: [
195
+ { name: "token", internalType: "address", type: "address" },
196
+ { name: "liquidationThreshold", internalType: "uint16", type: "uint16" }
197
+ ],
198
+ name: "addCollateralToken",
199
+ outputs: [],
200
+ stateMutability: "nonpayable"
201
+ },
202
+ {
203
+ type: "function",
204
+ inputs: [{ name: "liquidator", internalType: "address", type: "address" }],
205
+ name: "addEmergencyLiquidator",
206
+ outputs: [],
207
+ stateMutability: "nonpayable"
208
+ },
209
+ {
210
+ type: "function",
211
+ inputs: [],
212
+ name: "addressProvider",
213
+ outputs: [{ name: "", internalType: "address", type: "address" }],
214
+ stateMutability: "view"
215
+ },
216
+ {
217
+ type: "function",
218
+ inputs: [{ name: "adapter", internalType: "address", type: "address" }],
219
+ name: "allowAdapter",
220
+ outputs: [],
221
+ stateMutability: "nonpayable"
222
+ },
223
+ {
224
+ type: "function",
225
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
226
+ name: "allowToken",
227
+ outputs: [],
228
+ stateMutability: "nonpayable"
229
+ },
230
+ {
231
+ type: "function",
232
+ inputs: [],
233
+ name: "allowedAdapters",
234
+ outputs: [{ name: "", internalType: "address[]", type: "address[]" }],
235
+ stateMutability: "view"
236
+ },
237
+ {
238
+ type: "function",
239
+ inputs: [],
240
+ name: "creditFacade",
241
+ outputs: [{ name: "", internalType: "address", type: "address" }],
242
+ stateMutability: "view"
243
+ },
244
+ {
245
+ type: "function",
246
+ inputs: [],
247
+ name: "creditManager",
248
+ outputs: [{ name: "", internalType: "address", type: "address" }],
249
+ stateMutability: "view"
250
+ },
251
+ {
252
+ type: "function",
253
+ inputs: [],
254
+ name: "emergencyLiquidators",
255
+ outputs: [{ name: "", internalType: "address[]", type: "address[]" }],
256
+ stateMutability: "view"
257
+ },
258
+ {
259
+ type: "function",
260
+ inputs: [{ name: "adapter", internalType: "address", type: "address" }],
261
+ name: "forbidAdapter",
262
+ outputs: [],
263
+ stateMutability: "nonpayable"
264
+ },
265
+ {
266
+ type: "function",
267
+ inputs: [],
268
+ name: "forbidBorrowing",
269
+ outputs: [],
270
+ stateMutability: "nonpayable"
271
+ },
272
+ {
273
+ type: "function",
274
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
275
+ name: "forbidToken",
276
+ outputs: [],
277
+ stateMutability: "nonpayable"
278
+ },
279
+ {
280
+ type: "function",
281
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
282
+ name: "makeTokenQuoted",
283
+ outputs: [],
284
+ stateMutability: "nonpayable"
285
+ },
286
+ {
287
+ type: "function",
288
+ inputs: [
289
+ { name: "token", internalType: "address", type: "address" },
290
+ {
291
+ name: "liquidationThresholdFinal",
292
+ internalType: "uint16",
293
+ type: "uint16"
294
+ },
295
+ { name: "rampStart", internalType: "uint40", type: "uint40" },
296
+ { name: "rampDuration", internalType: "uint24", type: "uint24" }
297
+ ],
298
+ name: "rampLiquidationThreshold",
299
+ outputs: [],
300
+ stateMutability: "nonpayable"
301
+ },
302
+ {
303
+ type: "function",
304
+ inputs: [{ name: "liquidator", internalType: "address", type: "address" }],
305
+ name: "removeEmergencyLiquidator",
306
+ outputs: [],
307
+ stateMutability: "nonpayable"
308
+ },
309
+ {
310
+ type: "function",
311
+ inputs: [],
312
+ name: "resetCumulativeLoss",
313
+ outputs: [],
314
+ stateMutability: "nonpayable"
315
+ },
316
+ {
317
+ type: "function",
318
+ inputs: [{ name: "newVersion", internalType: "uint256", type: "uint256" }],
319
+ name: "setBotList",
320
+ outputs: [],
321
+ stateMutability: "nonpayable"
322
+ },
323
+ {
324
+ type: "function",
325
+ inputs: [
326
+ { name: "newCreditFacade", internalType: "address", type: "address" },
327
+ { name: "migrateParams", internalType: "bool", type: "bool" }
328
+ ],
329
+ name: "setCreditFacade",
330
+ outputs: [],
331
+ stateMutability: "nonpayable"
332
+ },
333
+ {
334
+ type: "function",
335
+ inputs: [
336
+ { name: "newExpirationDate", internalType: "uint40", type: "uint40" }
337
+ ],
338
+ name: "setExpirationDate",
339
+ outputs: [],
340
+ stateMutability: "nonpayable"
341
+ },
342
+ {
343
+ type: "function",
344
+ inputs: [
345
+ { name: "feeInterest", internalType: "uint16", type: "uint16" },
346
+ { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
347
+ { name: "liquidationPremium", internalType: "uint16", type: "uint16" },
348
+ { name: "feeLiquidationExpired", internalType: "uint16", type: "uint16" },
349
+ {
350
+ name: "liquidationPremiumExpired",
351
+ internalType: "uint16",
352
+ type: "uint16"
353
+ }
354
+ ],
355
+ name: "setFees",
356
+ outputs: [],
357
+ stateMutability: "nonpayable"
358
+ },
359
+ {
360
+ type: "function",
361
+ inputs: [
362
+ { name: "token", internalType: "address", type: "address" },
363
+ { name: "liquidationThreshold", internalType: "uint16", type: "uint16" }
364
+ ],
365
+ name: "setLiquidationThreshold",
366
+ outputs: [],
367
+ stateMutability: "nonpayable"
368
+ },
369
+ {
370
+ type: "function",
371
+ inputs: [
372
+ {
373
+ name: "newMaxCumulativeLoss",
374
+ internalType: "uint128",
375
+ type: "uint128"
376
+ }
377
+ ],
378
+ name: "setMaxCumulativeLoss",
379
+ outputs: [],
380
+ stateMutability: "nonpayable"
381
+ },
382
+ {
383
+ type: "function",
384
+ inputs: [{ name: "newMaxDebt", internalType: "uint128", type: "uint128" }],
385
+ name: "setMaxDebtLimit",
386
+ outputs: [],
387
+ stateMutability: "nonpayable"
388
+ },
389
+ {
390
+ type: "function",
391
+ inputs: [
392
+ {
393
+ name: "newMaxDebtLimitPerBlockMultiplier",
394
+ internalType: "uint8",
395
+ type: "uint8"
396
+ }
397
+ ],
398
+ name: "setMaxDebtPerBlockMultiplier",
399
+ outputs: [],
400
+ stateMutability: "nonpayable"
401
+ },
402
+ {
403
+ type: "function",
404
+ inputs: [
405
+ { name: "newMaxEnabledTokens", internalType: "uint8", type: "uint8" }
406
+ ],
407
+ name: "setMaxEnabledTokens",
408
+ outputs: [],
409
+ stateMutability: "nonpayable"
410
+ },
411
+ {
412
+ type: "function",
413
+ inputs: [{ name: "newMinDebt", internalType: "uint128", type: "uint128" }],
414
+ name: "setMinDebtLimit",
415
+ outputs: [],
416
+ stateMutability: "nonpayable"
417
+ },
418
+ {
419
+ type: "function",
420
+ inputs: [{ name: "newVersion", internalType: "uint256", type: "uint256" }],
421
+ name: "setPriceOracle",
422
+ outputs: [],
423
+ stateMutability: "nonpayable"
424
+ },
425
+ {
426
+ type: "function",
427
+ inputs: [],
428
+ name: "underlying",
429
+ outputs: [{ name: "", internalType: "address", type: "address" }],
430
+ stateMutability: "view"
431
+ },
432
+ {
433
+ type: "function",
434
+ inputs: [
435
+ {
436
+ name: "newCreditConfigurator",
437
+ internalType: "address",
438
+ type: "address"
439
+ }
440
+ ],
441
+ name: "upgradeCreditConfigurator",
442
+ outputs: [],
443
+ stateMutability: "nonpayable"
444
+ },
445
+ {
446
+ type: "function",
447
+ inputs: [],
448
+ name: "version",
449
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
450
+ stateMutability: "view"
451
+ },
452
+ {
453
+ type: "event",
454
+ anonymous: false,
455
+ inputs: [
456
+ {
457
+ name: "token",
458
+ internalType: "address",
459
+ type: "address",
460
+ indexed: true
461
+ }
462
+ ],
463
+ name: "AddCollateralToken"
464
+ },
465
+ {
466
+ type: "event",
467
+ anonymous: false,
468
+ inputs: [
469
+ {
470
+ name: "liquidator",
471
+ internalType: "address",
472
+ type: "address",
473
+ indexed: true
474
+ }
475
+ ],
476
+ name: "AddEmergencyLiquidator"
477
+ },
478
+ {
479
+ type: "event",
480
+ anonymous: false,
481
+ inputs: [
482
+ {
483
+ name: "targetContract",
484
+ internalType: "address",
485
+ type: "address",
486
+ indexed: true
487
+ },
488
+ {
489
+ name: "adapter",
490
+ internalType: "address",
491
+ type: "address",
492
+ indexed: true
493
+ }
494
+ ],
495
+ name: "AllowAdapter"
496
+ },
497
+ {
498
+ type: "event",
499
+ anonymous: false,
500
+ inputs: [
501
+ {
502
+ name: "token",
503
+ internalType: "address",
504
+ type: "address",
505
+ indexed: true
506
+ }
507
+ ],
508
+ name: "AllowToken"
509
+ },
510
+ {
511
+ type: "event",
512
+ anonymous: false,
513
+ inputs: [
514
+ {
515
+ name: "creditConfigurator",
516
+ internalType: "address",
517
+ type: "address",
518
+ indexed: true
519
+ }
520
+ ],
521
+ name: "CreditConfiguratorUpgraded"
522
+ },
523
+ {
524
+ type: "event",
525
+ anonymous: false,
526
+ inputs: [
527
+ {
528
+ name: "targetContract",
529
+ internalType: "address",
530
+ type: "address",
531
+ indexed: true
532
+ },
533
+ {
534
+ name: "adapter",
535
+ internalType: "address",
536
+ type: "address",
537
+ indexed: true
538
+ }
539
+ ],
540
+ name: "ForbidAdapter"
541
+ },
542
+ {
543
+ type: "event",
544
+ anonymous: false,
545
+ inputs: [
546
+ {
547
+ name: "token",
548
+ internalType: "address",
549
+ type: "address",
550
+ indexed: true
551
+ }
552
+ ],
553
+ name: "ForbidToken"
554
+ },
555
+ {
556
+ type: "event",
557
+ anonymous: false,
558
+ inputs: [
559
+ {
560
+ name: "token",
561
+ internalType: "address",
562
+ type: "address",
563
+ indexed: true
564
+ }
565
+ ],
566
+ name: "QuoteToken"
567
+ },
568
+ {
569
+ type: "event",
570
+ anonymous: false,
571
+ inputs: [
572
+ {
573
+ name: "liquidator",
574
+ internalType: "address",
575
+ type: "address",
576
+ indexed: true
577
+ }
578
+ ],
579
+ name: "RemoveEmergencyLiquidator"
580
+ },
581
+ { type: "event", anonymous: false, inputs: [], name: "ResetCumulativeLoss" },
582
+ {
583
+ type: "event",
584
+ anonymous: false,
585
+ inputs: [
586
+ {
587
+ name: "token",
588
+ internalType: "address",
589
+ type: "address",
590
+ indexed: true
591
+ },
592
+ {
593
+ name: "liquidationThresholdInitial",
594
+ internalType: "uint16",
595
+ type: "uint16",
596
+ indexed: false
597
+ },
598
+ {
599
+ name: "liquidationThresholdFinal",
600
+ internalType: "uint16",
601
+ type: "uint16",
602
+ indexed: false
603
+ },
604
+ {
605
+ name: "timestampRampStart",
606
+ internalType: "uint40",
607
+ type: "uint40",
608
+ indexed: false
609
+ },
610
+ {
611
+ name: "timestampRampEnd",
612
+ internalType: "uint40",
613
+ type: "uint40",
614
+ indexed: false
615
+ }
616
+ ],
617
+ name: "ScheduleTokenLiquidationThresholdRamp"
618
+ },
619
+ {
620
+ type: "event",
621
+ anonymous: false,
622
+ inputs: [
623
+ {
624
+ name: "minDebt",
625
+ internalType: "uint256",
626
+ type: "uint256",
627
+ indexed: false
628
+ },
629
+ {
630
+ name: "maxDebt",
631
+ internalType: "uint256",
632
+ type: "uint256",
633
+ indexed: false
634
+ }
635
+ ],
636
+ name: "SetBorrowingLimits"
637
+ },
638
+ {
639
+ type: "event",
640
+ anonymous: false,
641
+ inputs: [
642
+ {
643
+ name: "botList",
644
+ internalType: "address",
645
+ type: "address",
646
+ indexed: true
647
+ }
648
+ ],
649
+ name: "SetBotList"
650
+ },
651
+ {
652
+ type: "event",
653
+ anonymous: false,
654
+ inputs: [
655
+ {
656
+ name: "creditFacade",
657
+ internalType: "address",
658
+ type: "address",
659
+ indexed: true
660
+ }
661
+ ],
662
+ name: "SetCreditFacade"
663
+ },
664
+ {
665
+ type: "event",
666
+ anonymous: false,
667
+ inputs: [
668
+ {
669
+ name: "expirationDate",
670
+ internalType: "uint40",
671
+ type: "uint40",
672
+ indexed: false
673
+ }
674
+ ],
675
+ name: "SetExpirationDate"
676
+ },
677
+ {
678
+ type: "event",
679
+ anonymous: false,
680
+ inputs: [
681
+ {
682
+ name: "maxCumulativeLoss",
683
+ internalType: "uint128",
684
+ type: "uint128",
685
+ indexed: false
686
+ }
687
+ ],
688
+ name: "SetMaxCumulativeLoss"
689
+ },
690
+ {
691
+ type: "event",
692
+ anonymous: false,
693
+ inputs: [
694
+ {
695
+ name: "maxDebtPerBlockMultiplier",
696
+ internalType: "uint8",
697
+ type: "uint8",
698
+ indexed: false
699
+ }
700
+ ],
701
+ name: "SetMaxDebtPerBlockMultiplier"
702
+ },
703
+ {
704
+ type: "event",
705
+ anonymous: false,
706
+ inputs: [
707
+ {
708
+ name: "maxEnabledTokens",
709
+ internalType: "uint8",
710
+ type: "uint8",
711
+ indexed: false
712
+ }
713
+ ],
714
+ name: "SetMaxEnabledTokens"
715
+ },
716
+ {
717
+ type: "event",
718
+ anonymous: false,
719
+ inputs: [
720
+ {
721
+ name: "priceOracle",
722
+ internalType: "address",
723
+ type: "address",
724
+ indexed: true
725
+ }
726
+ ],
727
+ name: "SetPriceOracle"
728
+ },
729
+ {
730
+ type: "event",
731
+ anonymous: false,
732
+ inputs: [
733
+ {
734
+ name: "token",
735
+ internalType: "address",
736
+ type: "address",
737
+ indexed: true
738
+ },
739
+ {
740
+ name: "liquidationThreshold",
741
+ internalType: "uint16",
742
+ type: "uint16",
743
+ indexed: false
744
+ }
745
+ ],
746
+ name: "SetTokenLiquidationThreshold"
747
+ },
748
+ {
749
+ type: "event",
750
+ anonymous: false,
751
+ inputs: [
752
+ {
753
+ name: "feeInterest",
754
+ internalType: "uint16",
755
+ type: "uint16",
756
+ indexed: false
757
+ },
758
+ {
759
+ name: "feeLiquidation",
760
+ internalType: "uint16",
761
+ type: "uint16",
762
+ indexed: false
763
+ },
764
+ {
765
+ name: "liquidationPremium",
766
+ internalType: "uint16",
767
+ type: "uint16",
768
+ indexed: false
769
+ },
770
+ {
771
+ name: "feeLiquidationExpired",
772
+ internalType: "uint16",
773
+ type: "uint16",
774
+ indexed: false
775
+ },
776
+ {
777
+ name: "liquidationPremiumExpired",
778
+ internalType: "uint16",
779
+ type: "uint16",
780
+ indexed: false
781
+ }
782
+ ],
783
+ name: "UpdateFees"
784
+ }
785
+ ];
786
+ var iCreditManagerV3Abi = [
787
+ {
788
+ type: "function",
789
+ inputs: [],
790
+ name: "accountFactory",
791
+ outputs: [{ name: "", internalType: "address", type: "address" }],
792
+ stateMutability: "view"
793
+ },
794
+ {
795
+ type: "function",
796
+ inputs: [{ name: "adapter", internalType: "address", type: "address" }],
797
+ name: "adapterToContract",
798
+ outputs: [
799
+ { name: "targetContract", internalType: "address", type: "address" }
800
+ ],
801
+ stateMutability: "view"
802
+ },
803
+ {
804
+ type: "function",
805
+ inputs: [
806
+ { name: "payer", internalType: "address", type: "address" },
807
+ { name: "creditAccount", internalType: "address", type: "address" },
808
+ { name: "token", internalType: "address", type: "address" },
809
+ { name: "amount", internalType: "uint256", type: "uint256" }
810
+ ],
811
+ name: "addCollateral",
812
+ outputs: [
813
+ { name: "tokensToEnable", internalType: "uint256", type: "uint256" }
814
+ ],
815
+ stateMutability: "nonpayable"
816
+ },
817
+ {
818
+ type: "function",
819
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
820
+ name: "addToken",
821
+ outputs: [],
822
+ stateMutability: "nonpayable"
823
+ },
824
+ {
825
+ type: "function",
826
+ inputs: [],
827
+ name: "addressProvider",
828
+ outputs: [{ name: "", internalType: "address", type: "address" }],
829
+ stateMutability: "view"
830
+ },
831
+ {
832
+ type: "function",
833
+ inputs: [
834
+ { name: "token", internalType: "address", type: "address" },
835
+ { name: "amount", internalType: "uint256", type: "uint256" }
836
+ ],
837
+ name: "approveCreditAccount",
838
+ outputs: [],
839
+ stateMutability: "nonpayable"
840
+ },
841
+ {
842
+ type: "function",
843
+ inputs: [
844
+ { name: "creditAccount", internalType: "address", type: "address" },
845
+ { name: "token", internalType: "address", type: "address" },
846
+ { name: "spender", internalType: "address", type: "address" },
847
+ { name: "amount", internalType: "uint256", type: "uint256" }
848
+ ],
849
+ name: "approveToken",
850
+ outputs: [],
851
+ stateMutability: "nonpayable"
852
+ },
853
+ {
854
+ type: "function",
855
+ inputs: [
856
+ { name: "creditAccount", internalType: "address", type: "address" },
857
+ { name: "task", internalType: "enum CollateralCalcTask", type: "uint8" }
858
+ ],
859
+ name: "calcDebtAndCollateral",
860
+ outputs: [
861
+ {
862
+ name: "cdd",
863
+ internalType: "struct CollateralDebtData",
864
+ type: "tuple",
865
+ components: [
866
+ { name: "debt", internalType: "uint256", type: "uint256" },
867
+ {
868
+ name: "cumulativeIndexNow",
869
+ internalType: "uint256",
870
+ type: "uint256"
871
+ },
872
+ {
873
+ name: "cumulativeIndexLastUpdate",
874
+ internalType: "uint256",
875
+ type: "uint256"
876
+ },
877
+ {
878
+ name: "cumulativeQuotaInterest",
879
+ internalType: "uint128",
880
+ type: "uint128"
881
+ },
882
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
883
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
884
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
885
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
886
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
887
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
888
+ {
889
+ name: "enabledTokensMask",
890
+ internalType: "uint256",
891
+ type: "uint256"
892
+ },
893
+ {
894
+ name: "quotedTokensMask",
895
+ internalType: "uint256",
896
+ type: "uint256"
897
+ },
898
+ {
899
+ name: "quotedTokens",
900
+ internalType: "address[]",
901
+ type: "address[]"
902
+ },
903
+ {
904
+ name: "_poolQuotaKeeper",
905
+ internalType: "address",
906
+ type: "address"
907
+ }
908
+ ]
909
+ }
910
+ ],
911
+ stateMutability: "view"
912
+ },
913
+ {
914
+ type: "function",
915
+ inputs: [
916
+ { name: "creditAccount", internalType: "address", type: "address" }
917
+ ],
918
+ name: "closeCreditAccount",
919
+ outputs: [],
920
+ stateMutability: "nonpayable"
921
+ },
922
+ {
923
+ type: "function",
924
+ inputs: [{ name: "tokenMask", internalType: "uint256", type: "uint256" }],
925
+ name: "collateralTokenByMask",
926
+ outputs: [
927
+ { name: "token", internalType: "address", type: "address" },
928
+ { name: "liquidationThreshold", internalType: "uint16", type: "uint16" }
929
+ ],
930
+ stateMutability: "view"
931
+ },
932
+ {
933
+ type: "function",
934
+ inputs: [],
935
+ name: "collateralTokensCount",
936
+ outputs: [{ name: "", internalType: "uint8", type: "uint8" }],
937
+ stateMutability: "view"
938
+ },
939
+ {
940
+ type: "function",
941
+ inputs: [
942
+ { name: "targetContract", internalType: "address", type: "address" }
943
+ ],
944
+ name: "contractToAdapter",
945
+ outputs: [{ name: "adapter", internalType: "address", type: "address" }],
946
+ stateMutability: "view"
947
+ },
948
+ {
949
+ type: "function",
950
+ inputs: [
951
+ { name: "creditAccount", internalType: "address", type: "address" }
952
+ ],
953
+ name: "creditAccountInfo",
954
+ outputs: [
955
+ { name: "debt", internalType: "uint256", type: "uint256" },
956
+ {
957
+ name: "cumulativeIndexLastUpdate",
958
+ internalType: "uint256",
959
+ type: "uint256"
960
+ },
961
+ {
962
+ name: "cumulativeQuotaInterest",
963
+ internalType: "uint128",
964
+ type: "uint128"
965
+ },
966
+ { name: "quotaFees", internalType: "uint128", type: "uint128" },
967
+ { name: "enabledTokensMask", internalType: "uint256", type: "uint256" },
968
+ { name: "flags", internalType: "uint16", type: "uint16" },
969
+ { name: "lastDebtUpdate", internalType: "uint64", type: "uint64" },
970
+ { name: "borrower", internalType: "address", type: "address" }
971
+ ],
972
+ stateMutability: "view"
973
+ },
974
+ {
975
+ type: "function",
976
+ inputs: [
977
+ { name: "offset", internalType: "uint256", type: "uint256" },
978
+ { name: "limit", internalType: "uint256", type: "uint256" }
979
+ ],
980
+ name: "creditAccounts",
981
+ outputs: [{ name: "", internalType: "address[]", type: "address[]" }],
982
+ stateMutability: "view"
983
+ },
984
+ {
985
+ type: "function",
986
+ inputs: [],
987
+ name: "creditAccounts",
988
+ outputs: [{ name: "", internalType: "address[]", type: "address[]" }],
989
+ stateMutability: "view"
990
+ },
991
+ {
992
+ type: "function",
993
+ inputs: [],
994
+ name: "creditAccountsLen",
995
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
996
+ stateMutability: "view"
997
+ },
998
+ {
999
+ type: "function",
1000
+ inputs: [],
1001
+ name: "creditConfigurator",
1002
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1003
+ stateMutability: "view"
1004
+ },
1005
+ {
1006
+ type: "function",
1007
+ inputs: [],
1008
+ name: "creditFacade",
1009
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1010
+ stateMutability: "view"
1011
+ },
1012
+ {
1013
+ type: "function",
1014
+ inputs: [
1015
+ { name: "creditAccount", internalType: "address", type: "address" }
1016
+ ],
1017
+ name: "enabledTokensMaskOf",
1018
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
1019
+ stateMutability: "view"
1020
+ },
1021
+ {
1022
+ type: "function",
1023
+ inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
1024
+ name: "execute",
1025
+ outputs: [{ name: "result", internalType: "bytes", type: "bytes" }],
1026
+ stateMutability: "nonpayable"
1027
+ },
1028
+ {
1029
+ type: "function",
1030
+ inputs: [
1031
+ { name: "creditAccount", internalType: "address", type: "address" },
1032
+ { name: "target", internalType: "address", type: "address" },
1033
+ { name: "callData", internalType: "bytes", type: "bytes" }
1034
+ ],
1035
+ name: "externalCall",
1036
+ outputs: [{ name: "result", internalType: "bytes", type: "bytes" }],
1037
+ stateMutability: "nonpayable"
1038
+ },
1039
+ {
1040
+ type: "function",
1041
+ inputs: [],
1042
+ name: "fees",
1043
+ outputs: [
1044
+ { name: "feeInterest", internalType: "uint16", type: "uint16" },
1045
+ { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
1046
+ { name: "liquidationDiscount", internalType: "uint16", type: "uint16" },
1047
+ { name: "feeLiquidationExpired", internalType: "uint16", type: "uint16" },
1048
+ {
1049
+ name: "liquidationDiscountExpired",
1050
+ internalType: "uint16",
1051
+ type: "uint16"
1052
+ }
1053
+ ],
1054
+ stateMutability: "view"
1055
+ },
1056
+ {
1057
+ type: "function",
1058
+ inputs: [
1059
+ { name: "creditAccount", internalType: "address", type: "address" }
1060
+ ],
1061
+ name: "flagsOf",
1062
+ outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
1063
+ stateMutability: "view"
1064
+ },
1065
+ {
1066
+ type: "function",
1067
+ inputs: [
1068
+ { name: "creditAccount", internalType: "address", type: "address" },
1069
+ { name: "enabledTokensMask", internalType: "uint256", type: "uint256" },
1070
+ { name: "collateralHints", internalType: "uint256[]", type: "uint256[]" },
1071
+ { name: "minHealthFactor", internalType: "uint16", type: "uint16" },
1072
+ { name: "useSafePrices", internalType: "bool", type: "bool" }
1073
+ ],
1074
+ name: "fullCollateralCheck",
1075
+ outputs: [
1076
+ {
1077
+ name: "enabledTokensMaskAfter",
1078
+ internalType: "uint256",
1079
+ type: "uint256"
1080
+ }
1081
+ ],
1082
+ stateMutability: "nonpayable"
1083
+ },
1084
+ {
1085
+ type: "function",
1086
+ inputs: [],
1087
+ name: "getActiveCreditAccountOrRevert",
1088
+ outputs: [
1089
+ { name: "creditAccount", internalType: "address", type: "address" }
1090
+ ],
1091
+ stateMutability: "view"
1092
+ },
1093
+ {
1094
+ type: "function",
1095
+ inputs: [
1096
+ { name: "creditAccount", internalType: "address", type: "address" }
1097
+ ],
1098
+ name: "getBorrowerOrRevert",
1099
+ outputs: [{ name: "borrower", internalType: "address", type: "address" }],
1100
+ stateMutability: "view"
1101
+ },
1102
+ {
1103
+ type: "function",
1104
+ inputs: [{ name: "tokenMask", internalType: "uint256", type: "uint256" }],
1105
+ name: "getTokenByMask",
1106
+ outputs: [{ name: "token", internalType: "address", type: "address" }],
1107
+ stateMutability: "view"
1108
+ },
1109
+ {
1110
+ type: "function",
1111
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
1112
+ name: "getTokenMaskOrRevert",
1113
+ outputs: [{ name: "tokenMask", internalType: "uint256", type: "uint256" }],
1114
+ stateMutability: "view"
1115
+ },
1116
+ {
1117
+ type: "function",
1118
+ inputs: [
1119
+ { name: "creditAccount", internalType: "address", type: "address" },
1120
+ { name: "minHealthFactor", internalType: "uint16", type: "uint16" }
1121
+ ],
1122
+ name: "isLiquidatable",
1123
+ outputs: [{ name: "", internalType: "bool", type: "bool" }],
1124
+ stateMutability: "view"
1125
+ },
1126
+ {
1127
+ type: "function",
1128
+ inputs: [
1129
+ { name: "creditAccount", internalType: "address", type: "address" },
1130
+ {
1131
+ name: "collateralDebtData",
1132
+ internalType: "struct CollateralDebtData",
1133
+ type: "tuple",
1134
+ components: [
1135
+ { name: "debt", internalType: "uint256", type: "uint256" },
1136
+ {
1137
+ name: "cumulativeIndexNow",
1138
+ internalType: "uint256",
1139
+ type: "uint256"
1140
+ },
1141
+ {
1142
+ name: "cumulativeIndexLastUpdate",
1143
+ internalType: "uint256",
1144
+ type: "uint256"
1145
+ },
1146
+ {
1147
+ name: "cumulativeQuotaInterest",
1148
+ internalType: "uint128",
1149
+ type: "uint128"
1150
+ },
1151
+ { name: "accruedInterest", internalType: "uint256", type: "uint256" },
1152
+ { name: "accruedFees", internalType: "uint256", type: "uint256" },
1153
+ { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
1154
+ { name: "totalValue", internalType: "uint256", type: "uint256" },
1155
+ { name: "totalValueUSD", internalType: "uint256", type: "uint256" },
1156
+ { name: "twvUSD", internalType: "uint256", type: "uint256" },
1157
+ {
1158
+ name: "enabledTokensMask",
1159
+ internalType: "uint256",
1160
+ type: "uint256"
1161
+ },
1162
+ {
1163
+ name: "quotedTokensMask",
1164
+ internalType: "uint256",
1165
+ type: "uint256"
1166
+ },
1167
+ {
1168
+ name: "quotedTokens",
1169
+ internalType: "address[]",
1170
+ type: "address[]"
1171
+ },
1172
+ {
1173
+ name: "_poolQuotaKeeper",
1174
+ internalType: "address",
1175
+ type: "address"
1176
+ }
1177
+ ]
1178
+ },
1179
+ { name: "to", internalType: "address", type: "address" },
1180
+ { name: "isExpired", internalType: "bool", type: "bool" }
1181
+ ],
1182
+ name: "liquidateCreditAccount",
1183
+ outputs: [
1184
+ { name: "remainingFunds", internalType: "uint256", type: "uint256" },
1185
+ { name: "loss", internalType: "uint256", type: "uint256" }
1186
+ ],
1187
+ stateMutability: "nonpayable"
1188
+ },
1189
+ {
1190
+ type: "function",
1191
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
1192
+ name: "liquidationThresholds",
1193
+ outputs: [{ name: "lt", internalType: "uint16", type: "uint16" }],
1194
+ stateMutability: "view"
1195
+ },
1196
+ {
1197
+ type: "function",
1198
+ inputs: [{ name: "token", internalType: "address", type: "address" }],
1199
+ name: "ltParams",
1200
+ outputs: [
1201
+ { name: "ltInitial", internalType: "uint16", type: "uint16" },
1202
+ { name: "ltFinal", internalType: "uint16", type: "uint16" },
1203
+ { name: "timestampRampStart", internalType: "uint40", type: "uint40" },
1204
+ { name: "rampDuration", internalType: "uint24", type: "uint24" }
1205
+ ],
1206
+ stateMutability: "view"
1207
+ },
1208
+ {
1209
+ type: "function",
1210
+ inputs: [
1211
+ { name: "creditAccount", internalType: "address", type: "address" },
1212
+ { name: "amount", internalType: "uint256", type: "uint256" },
1213
+ { name: "enabledTokensMask", internalType: "uint256", type: "uint256" },
1214
+ { name: "action", internalType: "enum ManageDebtAction", type: "uint8" }
1215
+ ],
1216
+ name: "manageDebt",
1217
+ outputs: [
1218
+ { name: "newDebt", internalType: "uint256", type: "uint256" },
1219
+ { name: "tokensToEnable", internalType: "uint256", type: "uint256" },
1220
+ { name: "tokensToDisable", internalType: "uint256", type: "uint256" }
1221
+ ],
1222
+ stateMutability: "nonpayable"
1223
+ },
1224
+ {
1225
+ type: "function",
1226
+ inputs: [],
1227
+ name: "maxEnabledTokens",
1228
+ outputs: [{ name: "", internalType: "uint8", type: "uint8" }],
1229
+ stateMutability: "view"
1230
+ },
1231
+ {
1232
+ type: "function",
1233
+ inputs: [],
1234
+ name: "name",
1235
+ outputs: [{ name: "", internalType: "string", type: "string" }],
1236
+ stateMutability: "view"
1237
+ },
1238
+ {
1239
+ type: "function",
1240
+ inputs: [{ name: "onBehalfOf", internalType: "address", type: "address" }],
1241
+ name: "openCreditAccount",
1242
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1243
+ stateMutability: "nonpayable"
1244
+ },
1245
+ {
1246
+ type: "function",
1247
+ inputs: [],
1248
+ name: "pool",
1249
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1250
+ stateMutability: "view"
1251
+ },
1252
+ {
1253
+ type: "function",
1254
+ inputs: [],
1255
+ name: "poolQuotaKeeper",
1256
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1257
+ stateMutability: "view"
1258
+ },
1259
+ {
1260
+ type: "function",
1261
+ inputs: [],
1262
+ name: "priceOracle",
1263
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1264
+ stateMutability: "view"
1265
+ },
1266
+ {
1267
+ type: "function",
1268
+ inputs: [],
1269
+ name: "quotedTokensMask",
1270
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
1271
+ stateMutability: "view"
1272
+ },
1273
+ {
1274
+ type: "function",
1275
+ inputs: [
1276
+ { name: "creditAccount", internalType: "address", type: "address" },
1277
+ {
1278
+ name: "revocations",
1279
+ internalType: "struct RevocationPair[]",
1280
+ type: "tuple[]",
1281
+ components: [
1282
+ { name: "spender", internalType: "address", type: "address" },
1283
+ { name: "token", internalType: "address", type: "address" }
1284
+ ]
1285
+ }
1286
+ ],
1287
+ name: "revokeAdapterAllowances",
1288
+ outputs: [],
1289
+ stateMutability: "nonpayable"
1290
+ },
1291
+ {
1292
+ type: "function",
1293
+ inputs: [
1294
+ { name: "creditAccount", internalType: "address", type: "address" }
1295
+ ],
1296
+ name: "setActiveCreditAccount",
1297
+ outputs: [],
1298
+ stateMutability: "nonpayable"
1299
+ },
1300
+ {
1301
+ type: "function",
1302
+ inputs: [
1303
+ { name: "token", internalType: "address", type: "address" },
1304
+ { name: "ltInitial", internalType: "uint16", type: "uint16" },
1305
+ { name: "ltFinal", internalType: "uint16", type: "uint16" },
1306
+ { name: "timestampRampStart", internalType: "uint40", type: "uint40" },
1307
+ { name: "rampDuration", internalType: "uint24", type: "uint24" }
1308
+ ],
1309
+ name: "setCollateralTokenData",
1310
+ outputs: [],
1311
+ stateMutability: "nonpayable"
1312
+ },
1313
+ {
1314
+ type: "function",
1315
+ inputs: [
1316
+ { name: "adapter", internalType: "address", type: "address" },
1317
+ { name: "targetContract", internalType: "address", type: "address" }
1318
+ ],
1319
+ name: "setContractAllowance",
1320
+ outputs: [],
1321
+ stateMutability: "nonpayable"
1322
+ },
1323
+ {
1324
+ type: "function",
1325
+ inputs: [
1326
+ { name: "creditConfigurator", internalType: "address", type: "address" }
1327
+ ],
1328
+ name: "setCreditConfigurator",
1329
+ outputs: [],
1330
+ stateMutability: "nonpayable"
1331
+ },
1332
+ {
1333
+ type: "function",
1334
+ inputs: [
1335
+ { name: "creditFacade", internalType: "address", type: "address" }
1336
+ ],
1337
+ name: "setCreditFacade",
1338
+ outputs: [],
1339
+ stateMutability: "nonpayable"
1340
+ },
1341
+ {
1342
+ type: "function",
1343
+ inputs: [
1344
+ { name: "feeInterest", internalType: "uint16", type: "uint16" },
1345
+ { name: "feeLiquidation", internalType: "uint16", type: "uint16" },
1346
+ { name: "liquidationDiscount", internalType: "uint16", type: "uint16" },
1347
+ { name: "feeLiquidationExpired", internalType: "uint16", type: "uint16" },
1348
+ {
1349
+ name: "liquidationDiscountExpired",
1350
+ internalType: "uint16",
1351
+ type: "uint16"
1352
+ }
1353
+ ],
1354
+ name: "setFees",
1355
+ outputs: [],
1356
+ stateMutability: "nonpayable"
1357
+ },
1358
+ {
1359
+ type: "function",
1360
+ inputs: [
1361
+ { name: "creditAccount", internalType: "address", type: "address" },
1362
+ { name: "flag", internalType: "uint16", type: "uint16" },
1363
+ { name: "value", internalType: "bool", type: "bool" }
1364
+ ],
1365
+ name: "setFlagFor",
1366
+ outputs: [],
1367
+ stateMutability: "nonpayable"
1368
+ },
1369
+ {
1370
+ type: "function",
1371
+ inputs: [
1372
+ { name: "maxEnabledTokens", internalType: "uint8", type: "uint8" }
1373
+ ],
1374
+ name: "setMaxEnabledTokens",
1375
+ outputs: [],
1376
+ stateMutability: "nonpayable"
1377
+ },
1378
+ {
1379
+ type: "function",
1380
+ inputs: [{ name: "priceOracle", internalType: "address", type: "address" }],
1381
+ name: "setPriceOracle",
1382
+ outputs: [],
1383
+ stateMutability: "nonpayable"
1384
+ },
1385
+ {
1386
+ type: "function",
1387
+ inputs: [
1388
+ { name: "quotedTokensMask", internalType: "uint256", type: "uint256" }
1389
+ ],
1390
+ name: "setQuotedMask",
1391
+ outputs: [],
1392
+ stateMutability: "nonpayable"
1393
+ },
1394
+ {
1395
+ type: "function",
1396
+ inputs: [],
1397
+ name: "underlying",
1398
+ outputs: [{ name: "", internalType: "address", type: "address" }],
1399
+ stateMutability: "view"
1400
+ },
1401
+ {
1402
+ type: "function",
1403
+ inputs: [
1404
+ { name: "creditAccount", internalType: "address", type: "address" },
1405
+ { name: "token", internalType: "address", type: "address" },
1406
+ { name: "quotaChange", internalType: "int96", type: "int96" },
1407
+ { name: "minQuota", internalType: "uint96", type: "uint96" },
1408
+ { name: "maxQuota", internalType: "uint96", type: "uint96" }
1409
+ ],
1410
+ name: "updateQuota",
1411
+ outputs: [
1412
+ { name: "tokensToEnable", internalType: "uint256", type: "uint256" },
1413
+ { name: "tokensToDisable", internalType: "uint256", type: "uint256" }
1414
+ ],
1415
+ stateMutability: "nonpayable"
1416
+ },
1417
+ {
1418
+ type: "function",
1419
+ inputs: [],
1420
+ name: "version",
1421
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
1422
+ stateMutability: "view"
1423
+ },
1424
+ {
1425
+ type: "function",
1426
+ inputs: [
1427
+ { name: "creditAccount", internalType: "address", type: "address" },
1428
+ { name: "token", internalType: "address", type: "address" },
1429
+ { name: "amount", internalType: "uint256", type: "uint256" },
1430
+ { name: "to", internalType: "address", type: "address" }
1431
+ ],
1432
+ name: "withdrawCollateral",
1433
+ outputs: [
1434
+ { name: "tokensToDisable", internalType: "uint256", type: "uint256" }
1435
+ ],
1436
+ stateMutability: "nonpayable"
1437
+ },
1438
+ {
1439
+ type: "event",
1440
+ anonymous: false,
1441
+ inputs: [
1442
+ {
1443
+ name: "newConfigurator",
1444
+ internalType: "address",
1445
+ type: "address",
1446
+ indexed: true
1447
+ }
1448
+ ],
1449
+ name: "SetCreditConfigurator"
1450
+ }
1451
+ ];
1452
+
1453
+ // src/dev/setLTs.ts
1454
+ async function setLTs(sdk$1, cm, newLTs, logger) {
1455
+ const aclAddr = sdk$1.addressProvider.getLatestVersion(sdk.AP_ACL);
1456
+ const configuratorAddr = await sdk$1.provider.publicClient.readContract({
1457
+ address: aclAddr,
1458
+ abi: iaclAbi,
1459
+ functionName: "owner"
1460
+ });
1461
+ const anvil = createAnvilClient({
1462
+ transport: sdk$1.provider.transport,
1463
+ chain: sdk$1.provider.chain
1464
+ });
1465
+ await anvil.impersonateAccount({
1466
+ address: configuratorAddr
1467
+ });
1468
+ await anvil.setBalance({
1469
+ address: configuratorAddr,
1470
+ value: viem.parseEther("100")
1471
+ });
1472
+ for (const [t, lt] of Object.entries(newLTs)) {
1473
+ await anvil.writeContract({
1474
+ chain: anvil.chain,
1475
+ address: cm.creditConfigurator.address,
1476
+ account: configuratorAddr,
1477
+ abi: iCreditConfiguratorV3Abi,
1478
+ functionName: "setLiquidationThreshold",
1479
+ args: [t, lt]
1480
+ });
1481
+ const newLT = await anvil.readContract({
1482
+ address: cm.creditManager.address,
1483
+ abi: iCreditManagerV3Abi,
1484
+ functionName: "liquidationThresholds",
1485
+ args: [t]
1486
+ });
1487
+ logger?.debug(
1488
+ `set ${sdk$1.marketRegister.tokensMeta.mustGet(t).symbol} LT to ${newLT}`
1489
+ );
1490
+ }
1491
+ await anvil.stopImpersonatingAccount({
1492
+ address: configuratorAddr
1493
+ });
1494
+ }
1495
+
1496
+ exports.calcLiquidatableLTs = calcLiquidatableLTs;
1497
+ exports.createAnvilClient = createAnvilClient;
1498
+ exports.evmMineDetailed = evmMineDetailed;
1499
+ exports.isAnvil = isAnvil;
1500
+ exports.setLTs = setLTs;