@bgd-labs/toolbox 0.0.53 → 0.0.55
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.
- package/dist/index.d.mts +42855 -25122
- package/dist/index.d.ts +42855 -25122
- package/dist/index.js +580 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +559 -27
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +6 -1
- package/dist/node.d.ts +6 -1
- package/dist/node.js +580 -41
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +559 -27
- package/dist/node.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -7,18 +7,27 @@ function bitmapToIndexes(bitmap) {
|
|
|
7
7
|
}
|
|
8
8
|
return indexes;
|
|
9
9
|
}
|
|
10
|
-
function getBits(uint256, startBit,
|
|
11
|
-
|
|
10
|
+
function getBits(uint256, startBit, endBit) {
|
|
11
|
+
if (uint256 < 0n) {
|
|
12
|
+
throw new Error("uint256 must be non-negative");
|
|
13
|
+
}
|
|
14
|
+
if (startBit < 0n || endBit < 0n) {
|
|
15
|
+
throw new Error("Bit positions must be non-negative");
|
|
16
|
+
}
|
|
12
17
|
if (startBit > endBit) {
|
|
13
18
|
throw new Error(
|
|
14
19
|
"Invalid bit range: startBit must be less than or equal to endBit"
|
|
15
20
|
);
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
endBit = BigInt(bitLength - 1);
|
|
22
|
+
if (uint256 === 0n) {
|
|
23
|
+
return 0n;
|
|
20
24
|
}
|
|
21
|
-
const
|
|
25
|
+
const bitLength = uint256.toString(2).length;
|
|
26
|
+
if (startBit >= bitLength) {
|
|
27
|
+
return 0n;
|
|
28
|
+
}
|
|
29
|
+
const actualEndBit = endBit >= bitLength ? BigInt(bitLength - 1) : endBit;
|
|
30
|
+
const mask = (1n << actualEndBit - startBit + 1n) - 1n;
|
|
22
31
|
return uint256 >> startBit & mask;
|
|
23
32
|
}
|
|
24
33
|
function setBits(input, startBit, endBit, replaceValue) {
|
|
@@ -46,10 +55,10 @@ function decodeUserConfiguration(userConfiguration) {
|
|
|
46
55
|
|
|
47
56
|
// src/aave/reserve.ts
|
|
48
57
|
function decodeReserveConfiguration(data) {
|
|
49
|
-
const ltv =
|
|
50
|
-
const liquidationThreshold =
|
|
51
|
-
const liquidationBonus =
|
|
52
|
-
const decimals =
|
|
58
|
+
const ltv = getBits(data, 0n, 15n);
|
|
59
|
+
const liquidationThreshold = getBits(data, 16n, 31n);
|
|
60
|
+
const liquidationBonus = getBits(data, 32n, 47n);
|
|
61
|
+
const decimals = getBits(data, 48n, 55n);
|
|
53
62
|
const active = getBits(data, 56n, 56n);
|
|
54
63
|
const frozen = getBits(data, 57n, 57n);
|
|
55
64
|
const borrowingEnabled = getBits(data, 58n, 58n);
|
|
@@ -61,26 +70,25 @@ function decodeReserveConfiguration(data) {
|
|
|
61
70
|
const borrowCap = getBits(data, 80n, 115n);
|
|
62
71
|
const supplyCap = getBits(data, 116n, 151n);
|
|
63
72
|
const liquidationProtocolFee = Number(getBits(data, 152n, 167n));
|
|
64
|
-
const unbackedMintCap = getBits(data, 176n, 211n);
|
|
65
73
|
const debtCeiling = getBits(data, 212n, 251n);
|
|
66
74
|
const virtualAccountingEnabled = getBits(data, 252n, 252n);
|
|
67
75
|
return {
|
|
68
|
-
ltv,
|
|
69
|
-
liquidationThreshold,
|
|
70
|
-
liquidationBonus,
|
|
71
|
-
decimals,
|
|
76
|
+
ltv: Number(ltv),
|
|
77
|
+
liquidationThreshold: Number(liquidationThreshold),
|
|
78
|
+
liquidationBonus: Number(liquidationBonus),
|
|
79
|
+
decimals: Number(decimals),
|
|
72
80
|
active: !!active,
|
|
73
81
|
frozen: !!frozen,
|
|
74
82
|
borrowingEnabled: !!borrowingEnabled,
|
|
75
83
|
// stableRateBorrowingEnabled: !!stableRateBorrowingEnabled,
|
|
76
84
|
paused: !!paused,
|
|
77
85
|
borrowingInIsolation: !!borrowingInIsolation,
|
|
78
|
-
reserveFactor,
|
|
86
|
+
reserveFactor: Number(reserveFactor),
|
|
79
87
|
borrowCap,
|
|
80
88
|
supplyCap,
|
|
81
|
-
liquidationProtocolFee,
|
|
89
|
+
liquidationProtocolFee: Number(liquidationProtocolFee),
|
|
82
90
|
// eModeCategory,
|
|
83
|
-
unbackedMintCap,
|
|
91
|
+
// unbackedMintCap,
|
|
84
92
|
debtCeiling,
|
|
85
93
|
siloedBorrowingEnabled: !!siloedBorrowingEnabled,
|
|
86
94
|
flashloaningEnabled: !!flashloaningEnabled,
|
|
@@ -13412,6 +13420,400 @@ var IUmbrellaStakeToken_ABI = [
|
|
|
13412
13420
|
}
|
|
13413
13421
|
];
|
|
13414
13422
|
|
|
13423
|
+
// src/abis/IDefaultInterestRateStrategyV2.ts
|
|
13424
|
+
var IDefaultInterestRateStrategyV2_ABI = [
|
|
13425
|
+
{
|
|
13426
|
+
"type": "function",
|
|
13427
|
+
"name": "ADDRESSES_PROVIDER",
|
|
13428
|
+
"inputs": [],
|
|
13429
|
+
"outputs": [
|
|
13430
|
+
{
|
|
13431
|
+
"name": "",
|
|
13432
|
+
"type": "address",
|
|
13433
|
+
"internalType": "contract IPoolAddressesProvider"
|
|
13434
|
+
}
|
|
13435
|
+
],
|
|
13436
|
+
"stateMutability": "view"
|
|
13437
|
+
},
|
|
13438
|
+
{
|
|
13439
|
+
"type": "function",
|
|
13440
|
+
"name": "MAX_BORROW_RATE",
|
|
13441
|
+
"inputs": [],
|
|
13442
|
+
"outputs": [
|
|
13443
|
+
{
|
|
13444
|
+
"name": "",
|
|
13445
|
+
"type": "uint256",
|
|
13446
|
+
"internalType": "uint256"
|
|
13447
|
+
}
|
|
13448
|
+
],
|
|
13449
|
+
"stateMutability": "view"
|
|
13450
|
+
},
|
|
13451
|
+
{
|
|
13452
|
+
"type": "function",
|
|
13453
|
+
"name": "MAX_OPTIMAL_POINT",
|
|
13454
|
+
"inputs": [],
|
|
13455
|
+
"outputs": [
|
|
13456
|
+
{
|
|
13457
|
+
"name": "",
|
|
13458
|
+
"type": "uint256",
|
|
13459
|
+
"internalType": "uint256"
|
|
13460
|
+
}
|
|
13461
|
+
],
|
|
13462
|
+
"stateMutability": "view"
|
|
13463
|
+
},
|
|
13464
|
+
{
|
|
13465
|
+
"type": "function",
|
|
13466
|
+
"name": "MIN_OPTIMAL_POINT",
|
|
13467
|
+
"inputs": [],
|
|
13468
|
+
"outputs": [
|
|
13469
|
+
{
|
|
13470
|
+
"name": "",
|
|
13471
|
+
"type": "uint256",
|
|
13472
|
+
"internalType": "uint256"
|
|
13473
|
+
}
|
|
13474
|
+
],
|
|
13475
|
+
"stateMutability": "view"
|
|
13476
|
+
},
|
|
13477
|
+
{
|
|
13478
|
+
"type": "function",
|
|
13479
|
+
"name": "calculateInterestRates",
|
|
13480
|
+
"inputs": [
|
|
13481
|
+
{
|
|
13482
|
+
"name": "params",
|
|
13483
|
+
"type": "tuple",
|
|
13484
|
+
"internalType": "struct DataTypes.CalculateInterestRatesParams",
|
|
13485
|
+
"components": [
|
|
13486
|
+
{
|
|
13487
|
+
"name": "unbacked",
|
|
13488
|
+
"type": "uint256",
|
|
13489
|
+
"internalType": "uint256"
|
|
13490
|
+
},
|
|
13491
|
+
{
|
|
13492
|
+
"name": "liquidityAdded",
|
|
13493
|
+
"type": "uint256",
|
|
13494
|
+
"internalType": "uint256"
|
|
13495
|
+
},
|
|
13496
|
+
{
|
|
13497
|
+
"name": "liquidityTaken",
|
|
13498
|
+
"type": "uint256",
|
|
13499
|
+
"internalType": "uint256"
|
|
13500
|
+
},
|
|
13501
|
+
{
|
|
13502
|
+
"name": "totalDebt",
|
|
13503
|
+
"type": "uint256",
|
|
13504
|
+
"internalType": "uint256"
|
|
13505
|
+
},
|
|
13506
|
+
{
|
|
13507
|
+
"name": "reserveFactor",
|
|
13508
|
+
"type": "uint256",
|
|
13509
|
+
"internalType": "uint256"
|
|
13510
|
+
},
|
|
13511
|
+
{
|
|
13512
|
+
"name": "reserve",
|
|
13513
|
+
"type": "address",
|
|
13514
|
+
"internalType": "address"
|
|
13515
|
+
},
|
|
13516
|
+
{
|
|
13517
|
+
"name": "usingVirtualBalance",
|
|
13518
|
+
"type": "bool",
|
|
13519
|
+
"internalType": "bool"
|
|
13520
|
+
},
|
|
13521
|
+
{
|
|
13522
|
+
"name": "virtualUnderlyingBalance",
|
|
13523
|
+
"type": "uint256",
|
|
13524
|
+
"internalType": "uint256"
|
|
13525
|
+
}
|
|
13526
|
+
]
|
|
13527
|
+
}
|
|
13528
|
+
],
|
|
13529
|
+
"outputs": [
|
|
13530
|
+
{
|
|
13531
|
+
"name": "",
|
|
13532
|
+
"type": "uint256",
|
|
13533
|
+
"internalType": "uint256"
|
|
13534
|
+
},
|
|
13535
|
+
{
|
|
13536
|
+
"name": "",
|
|
13537
|
+
"type": "uint256",
|
|
13538
|
+
"internalType": "uint256"
|
|
13539
|
+
}
|
|
13540
|
+
],
|
|
13541
|
+
"stateMutability": "view"
|
|
13542
|
+
},
|
|
13543
|
+
{
|
|
13544
|
+
"type": "function",
|
|
13545
|
+
"name": "getBaseVariableBorrowRate",
|
|
13546
|
+
"inputs": [
|
|
13547
|
+
{
|
|
13548
|
+
"name": "reserve",
|
|
13549
|
+
"type": "address",
|
|
13550
|
+
"internalType": "address"
|
|
13551
|
+
}
|
|
13552
|
+
],
|
|
13553
|
+
"outputs": [
|
|
13554
|
+
{
|
|
13555
|
+
"name": "",
|
|
13556
|
+
"type": "uint256",
|
|
13557
|
+
"internalType": "uint256"
|
|
13558
|
+
}
|
|
13559
|
+
],
|
|
13560
|
+
"stateMutability": "view"
|
|
13561
|
+
},
|
|
13562
|
+
{
|
|
13563
|
+
"type": "function",
|
|
13564
|
+
"name": "getInterestRateData",
|
|
13565
|
+
"inputs": [
|
|
13566
|
+
{
|
|
13567
|
+
"name": "reserve",
|
|
13568
|
+
"type": "address",
|
|
13569
|
+
"internalType": "address"
|
|
13570
|
+
}
|
|
13571
|
+
],
|
|
13572
|
+
"outputs": [
|
|
13573
|
+
{
|
|
13574
|
+
"name": "",
|
|
13575
|
+
"type": "tuple",
|
|
13576
|
+
"internalType": "struct IDefaultInterestRateStrategyV2.InterestRateDataRay",
|
|
13577
|
+
"components": [
|
|
13578
|
+
{
|
|
13579
|
+
"name": "optimalUsageRatio",
|
|
13580
|
+
"type": "uint256",
|
|
13581
|
+
"internalType": "uint256"
|
|
13582
|
+
},
|
|
13583
|
+
{
|
|
13584
|
+
"name": "baseVariableBorrowRate",
|
|
13585
|
+
"type": "uint256",
|
|
13586
|
+
"internalType": "uint256"
|
|
13587
|
+
},
|
|
13588
|
+
{
|
|
13589
|
+
"name": "variableRateSlope1",
|
|
13590
|
+
"type": "uint256",
|
|
13591
|
+
"internalType": "uint256"
|
|
13592
|
+
},
|
|
13593
|
+
{
|
|
13594
|
+
"name": "variableRateSlope2",
|
|
13595
|
+
"type": "uint256",
|
|
13596
|
+
"internalType": "uint256"
|
|
13597
|
+
}
|
|
13598
|
+
]
|
|
13599
|
+
}
|
|
13600
|
+
],
|
|
13601
|
+
"stateMutability": "view"
|
|
13602
|
+
},
|
|
13603
|
+
{
|
|
13604
|
+
"type": "function",
|
|
13605
|
+
"name": "getInterestRateDataBps",
|
|
13606
|
+
"inputs": [
|
|
13607
|
+
{
|
|
13608
|
+
"name": "reserve",
|
|
13609
|
+
"type": "address",
|
|
13610
|
+
"internalType": "address"
|
|
13611
|
+
}
|
|
13612
|
+
],
|
|
13613
|
+
"outputs": [
|
|
13614
|
+
{
|
|
13615
|
+
"name": "",
|
|
13616
|
+
"type": "tuple",
|
|
13617
|
+
"internalType": "struct IDefaultInterestRateStrategyV2.InterestRateData",
|
|
13618
|
+
"components": [
|
|
13619
|
+
{
|
|
13620
|
+
"name": "optimalUsageRatio",
|
|
13621
|
+
"type": "uint16",
|
|
13622
|
+
"internalType": "uint16"
|
|
13623
|
+
},
|
|
13624
|
+
{
|
|
13625
|
+
"name": "baseVariableBorrowRate",
|
|
13626
|
+
"type": "uint32",
|
|
13627
|
+
"internalType": "uint32"
|
|
13628
|
+
},
|
|
13629
|
+
{
|
|
13630
|
+
"name": "variableRateSlope1",
|
|
13631
|
+
"type": "uint32",
|
|
13632
|
+
"internalType": "uint32"
|
|
13633
|
+
},
|
|
13634
|
+
{
|
|
13635
|
+
"name": "variableRateSlope2",
|
|
13636
|
+
"type": "uint32",
|
|
13637
|
+
"internalType": "uint32"
|
|
13638
|
+
}
|
|
13639
|
+
]
|
|
13640
|
+
}
|
|
13641
|
+
],
|
|
13642
|
+
"stateMutability": "view"
|
|
13643
|
+
},
|
|
13644
|
+
{
|
|
13645
|
+
"type": "function",
|
|
13646
|
+
"name": "getMaxVariableBorrowRate",
|
|
13647
|
+
"inputs": [
|
|
13648
|
+
{
|
|
13649
|
+
"name": "reserve",
|
|
13650
|
+
"type": "address",
|
|
13651
|
+
"internalType": "address"
|
|
13652
|
+
}
|
|
13653
|
+
],
|
|
13654
|
+
"outputs": [
|
|
13655
|
+
{
|
|
13656
|
+
"name": "",
|
|
13657
|
+
"type": "uint256",
|
|
13658
|
+
"internalType": "uint256"
|
|
13659
|
+
}
|
|
13660
|
+
],
|
|
13661
|
+
"stateMutability": "view"
|
|
13662
|
+
},
|
|
13663
|
+
{
|
|
13664
|
+
"type": "function",
|
|
13665
|
+
"name": "getOptimalUsageRatio",
|
|
13666
|
+
"inputs": [
|
|
13667
|
+
{
|
|
13668
|
+
"name": "reserve",
|
|
13669
|
+
"type": "address",
|
|
13670
|
+
"internalType": "address"
|
|
13671
|
+
}
|
|
13672
|
+
],
|
|
13673
|
+
"outputs": [
|
|
13674
|
+
{
|
|
13675
|
+
"name": "",
|
|
13676
|
+
"type": "uint256",
|
|
13677
|
+
"internalType": "uint256"
|
|
13678
|
+
}
|
|
13679
|
+
],
|
|
13680
|
+
"stateMutability": "view"
|
|
13681
|
+
},
|
|
13682
|
+
{
|
|
13683
|
+
"type": "function",
|
|
13684
|
+
"name": "getVariableRateSlope1",
|
|
13685
|
+
"inputs": [
|
|
13686
|
+
{
|
|
13687
|
+
"name": "reserve",
|
|
13688
|
+
"type": "address",
|
|
13689
|
+
"internalType": "address"
|
|
13690
|
+
}
|
|
13691
|
+
],
|
|
13692
|
+
"outputs": [
|
|
13693
|
+
{
|
|
13694
|
+
"name": "",
|
|
13695
|
+
"type": "uint256",
|
|
13696
|
+
"internalType": "uint256"
|
|
13697
|
+
}
|
|
13698
|
+
],
|
|
13699
|
+
"stateMutability": "view"
|
|
13700
|
+
},
|
|
13701
|
+
{
|
|
13702
|
+
"type": "function",
|
|
13703
|
+
"name": "getVariableRateSlope2",
|
|
13704
|
+
"inputs": [
|
|
13705
|
+
{
|
|
13706
|
+
"name": "reserve",
|
|
13707
|
+
"type": "address",
|
|
13708
|
+
"internalType": "address"
|
|
13709
|
+
}
|
|
13710
|
+
],
|
|
13711
|
+
"outputs": [
|
|
13712
|
+
{
|
|
13713
|
+
"name": "",
|
|
13714
|
+
"type": "uint256",
|
|
13715
|
+
"internalType": "uint256"
|
|
13716
|
+
}
|
|
13717
|
+
],
|
|
13718
|
+
"stateMutability": "view"
|
|
13719
|
+
},
|
|
13720
|
+
{
|
|
13721
|
+
"type": "function",
|
|
13722
|
+
"name": "setInterestRateParams",
|
|
13723
|
+
"inputs": [
|
|
13724
|
+
{
|
|
13725
|
+
"name": "reserve",
|
|
13726
|
+
"type": "address",
|
|
13727
|
+
"internalType": "address"
|
|
13728
|
+
},
|
|
13729
|
+
{
|
|
13730
|
+
"name": "rateData",
|
|
13731
|
+
"type": "bytes",
|
|
13732
|
+
"internalType": "bytes"
|
|
13733
|
+
}
|
|
13734
|
+
],
|
|
13735
|
+
"outputs": [],
|
|
13736
|
+
"stateMutability": "nonpayable"
|
|
13737
|
+
},
|
|
13738
|
+
{
|
|
13739
|
+
"type": "function",
|
|
13740
|
+
"name": "setInterestRateParams",
|
|
13741
|
+
"inputs": [
|
|
13742
|
+
{
|
|
13743
|
+
"name": "reserve",
|
|
13744
|
+
"type": "address",
|
|
13745
|
+
"internalType": "address"
|
|
13746
|
+
},
|
|
13747
|
+
{
|
|
13748
|
+
"name": "rateData",
|
|
13749
|
+
"type": "tuple",
|
|
13750
|
+
"internalType": "struct IDefaultInterestRateStrategyV2.InterestRateData",
|
|
13751
|
+
"components": [
|
|
13752
|
+
{
|
|
13753
|
+
"name": "optimalUsageRatio",
|
|
13754
|
+
"type": "uint16",
|
|
13755
|
+
"internalType": "uint16"
|
|
13756
|
+
},
|
|
13757
|
+
{
|
|
13758
|
+
"name": "baseVariableBorrowRate",
|
|
13759
|
+
"type": "uint32",
|
|
13760
|
+
"internalType": "uint32"
|
|
13761
|
+
},
|
|
13762
|
+
{
|
|
13763
|
+
"name": "variableRateSlope1",
|
|
13764
|
+
"type": "uint32",
|
|
13765
|
+
"internalType": "uint32"
|
|
13766
|
+
},
|
|
13767
|
+
{
|
|
13768
|
+
"name": "variableRateSlope2",
|
|
13769
|
+
"type": "uint32",
|
|
13770
|
+
"internalType": "uint32"
|
|
13771
|
+
}
|
|
13772
|
+
]
|
|
13773
|
+
}
|
|
13774
|
+
],
|
|
13775
|
+
"outputs": [],
|
|
13776
|
+
"stateMutability": "nonpayable"
|
|
13777
|
+
},
|
|
13778
|
+
{
|
|
13779
|
+
"type": "event",
|
|
13780
|
+
"name": "RateDataUpdate",
|
|
13781
|
+
"inputs": [
|
|
13782
|
+
{
|
|
13783
|
+
"name": "reserve",
|
|
13784
|
+
"type": "address",
|
|
13785
|
+
"indexed": true,
|
|
13786
|
+
"internalType": "address"
|
|
13787
|
+
},
|
|
13788
|
+
{
|
|
13789
|
+
"name": "optimalUsageRatio",
|
|
13790
|
+
"type": "uint256",
|
|
13791
|
+
"indexed": false,
|
|
13792
|
+
"internalType": "uint256"
|
|
13793
|
+
},
|
|
13794
|
+
{
|
|
13795
|
+
"name": "baseVariableBorrowRate",
|
|
13796
|
+
"type": "uint256",
|
|
13797
|
+
"indexed": false,
|
|
13798
|
+
"internalType": "uint256"
|
|
13799
|
+
},
|
|
13800
|
+
{
|
|
13801
|
+
"name": "variableRateSlope1",
|
|
13802
|
+
"type": "uint256",
|
|
13803
|
+
"indexed": false,
|
|
13804
|
+
"internalType": "uint256"
|
|
13805
|
+
},
|
|
13806
|
+
{
|
|
13807
|
+
"name": "variableRateSlope2",
|
|
13808
|
+
"type": "uint256",
|
|
13809
|
+
"indexed": false,
|
|
13810
|
+
"internalType": "uint256"
|
|
13811
|
+
}
|
|
13812
|
+
],
|
|
13813
|
+
"anonymous": false
|
|
13814
|
+
}
|
|
13815
|
+
];
|
|
13816
|
+
|
|
13415
13817
|
// src/abis/IAccessControl.ts
|
|
13416
13818
|
var IAccessControl_ABI = [
|
|
13417
13819
|
{
|
|
@@ -15820,7 +16222,84 @@ async function getReserveConfigurations(client, pool, reserves) {
|
|
|
15820
16222
|
};
|
|
15821
16223
|
}
|
|
15822
16224
|
|
|
15823
|
-
//
|
|
16225
|
+
// src/aave/pool/configurations.ts
|
|
16226
|
+
import { readContract as readContract2 } from "viem/actions";
|
|
16227
|
+
async function getCompleteReserveConfiguration(client, poolAddress, reserve) {
|
|
16228
|
+
const [
|
|
16229
|
+
reserveData,
|
|
16230
|
+
deficit,
|
|
16231
|
+
virtualUnderlyingBalance,
|
|
16232
|
+
liquidationGracePeriod
|
|
16233
|
+
] = await Promise.all([
|
|
16234
|
+
readContract2(client, {
|
|
16235
|
+
address: poolAddress,
|
|
16236
|
+
abi: IPool_ABI,
|
|
16237
|
+
functionName: "getReserveData",
|
|
16238
|
+
args: [reserve]
|
|
16239
|
+
}),
|
|
16240
|
+
readContract2(client, {
|
|
16241
|
+
address: poolAddress,
|
|
16242
|
+
abi: IPool_ABI,
|
|
16243
|
+
functionName: "getReserveDeficit",
|
|
16244
|
+
args: [reserve]
|
|
16245
|
+
}),
|
|
16246
|
+
readContract2(client, {
|
|
16247
|
+
address: poolAddress,
|
|
16248
|
+
abi: IPool_ABI,
|
|
16249
|
+
functionName: "getVirtualUnderlyingBalance",
|
|
16250
|
+
args: [reserve]
|
|
16251
|
+
}),
|
|
16252
|
+
readContract2(client, {
|
|
16253
|
+
address: poolAddress,
|
|
16254
|
+
abi: IPool_ABI,
|
|
16255
|
+
functionName: "getLiquidationGracePeriod",
|
|
16256
|
+
args: [reserve]
|
|
16257
|
+
})
|
|
16258
|
+
]);
|
|
16259
|
+
const [
|
|
16260
|
+
scaledATokenTotalSupply,
|
|
16261
|
+
scaledVTokenTotalSupply,
|
|
16262
|
+
availableLiquidity,
|
|
16263
|
+
irParams
|
|
16264
|
+
] = await Promise.all([
|
|
16265
|
+
readContract2(client, {
|
|
16266
|
+
address: reserveData.aTokenAddress,
|
|
16267
|
+
abi: IAToken_ABI,
|
|
16268
|
+
functionName: "scaledTotalSupply"
|
|
16269
|
+
}),
|
|
16270
|
+
readContract2(client, {
|
|
16271
|
+
address: reserveData.variableDebtTokenAddress,
|
|
16272
|
+
abi: IAToken_ABI,
|
|
16273
|
+
functionName: "scaledTotalSupply"
|
|
16274
|
+
}),
|
|
16275
|
+
readContract2(client, {
|
|
16276
|
+
address: reserve,
|
|
16277
|
+
abi: IAToken_ABI,
|
|
16278
|
+
functionName: "balanceOf",
|
|
16279
|
+
args: [reserveData.aTokenAddress]
|
|
16280
|
+
}),
|
|
16281
|
+
readContract2(client, {
|
|
16282
|
+
address: reserveData.interestRateStrategyAddress,
|
|
16283
|
+
abi: IDefaultInterestRateStrategyV2_ABI,
|
|
16284
|
+
functionName: "getInterestRateDataBps",
|
|
16285
|
+
args: [reserve]
|
|
16286
|
+
})
|
|
16287
|
+
]);
|
|
16288
|
+
const config = decodeReserveConfiguration(reserveData.configuration.data);
|
|
16289
|
+
return {
|
|
16290
|
+
...reserveData,
|
|
16291
|
+
...config,
|
|
16292
|
+
deficit,
|
|
16293
|
+
virtualUnderlyingBalance,
|
|
16294
|
+
liquidationGracePeriod,
|
|
16295
|
+
scaledATokenTotalSupply,
|
|
16296
|
+
scaledVTokenTotalSupply,
|
|
16297
|
+
availableLiquidity,
|
|
16298
|
+
...irParams
|
|
16299
|
+
};
|
|
16300
|
+
}
|
|
16301
|
+
|
|
16302
|
+
// ../../node_modules/.pnpm/@bgd-labs+aave-address-book@4.31.0_viem@2.41.2_typescript@5.8.3_zod@3.24.2_/node_modules/@bgd-labs/aave-address-book/dist/abis/IPayloadsControllerCore.mjs
|
|
15824
16303
|
var IPayloadsControllerCore_ABI = [
|
|
15825
16304
|
{
|
|
15826
16305
|
type: "function",
|
|
@@ -16325,7 +16804,7 @@ var IPayloadsControllerCore_ABI = [
|
|
|
16325
16804
|
}
|
|
16326
16805
|
];
|
|
16327
16806
|
|
|
16328
|
-
// ../../node_modules/.pnpm/@bgd-labs+aave-address-book@4.31.0_viem@2.
|
|
16807
|
+
// ../../node_modules/.pnpm/@bgd-labs+aave-address-book@4.31.0_viem@2.41.2_typescript@5.8.3_zod@3.24.2_/node_modules/@bgd-labs/aave-address-book/dist/abis/IGovernanceCore.mjs
|
|
16329
16808
|
var IGovernanceCore_ABI = [
|
|
16330
16809
|
{
|
|
16331
16810
|
type: "function",
|
|
@@ -17358,7 +17837,7 @@ var IGovernanceCore_ABI = [
|
|
|
17358
17837
|
}
|
|
17359
17838
|
];
|
|
17360
17839
|
|
|
17361
|
-
// ../../node_modules/.pnpm/@bgd-labs+aave-address-book@4.31.0_viem@2.
|
|
17840
|
+
// ../../node_modules/.pnpm/@bgd-labs+aave-address-book@4.31.0_viem@2.41.2_typescript@5.8.3_zod@3.24.2_/node_modules/@bgd-labs/aave-address-book/dist/abis/IPool.mjs
|
|
17362
17841
|
var IPool_ABI2 = [
|
|
17363
17842
|
{
|
|
17364
17843
|
type: "function",
|
|
@@ -19401,6 +19880,17 @@ import {
|
|
|
19401
19880
|
toHex,
|
|
19402
19881
|
trim
|
|
19403
19882
|
} from "viem";
|
|
19883
|
+
function getSolidityStorageSlotBytes(mappingSlot, key) {
|
|
19884
|
+
const slot = pad(mappingSlot, { size: 32 });
|
|
19885
|
+
return trim(
|
|
19886
|
+
keccak256(
|
|
19887
|
+
encodeAbiParameters(parseAbiParameters("bytes32, uint256"), [
|
|
19888
|
+
key,
|
|
19889
|
+
BigInt(slot)
|
|
19890
|
+
])
|
|
19891
|
+
)
|
|
19892
|
+
);
|
|
19893
|
+
}
|
|
19404
19894
|
function getSolidityStorageSlotUint(mappingSlot, key) {
|
|
19405
19895
|
return keccak256(
|
|
19406
19896
|
encodeAbiParameters(parseAbiParameters("uint256, uint256"), [
|
|
@@ -19409,6 +19899,39 @@ function getSolidityStorageSlotUint(mappingSlot, key) {
|
|
|
19409
19899
|
])
|
|
19410
19900
|
);
|
|
19411
19901
|
}
|
|
19902
|
+
function getSolidityStorageSlotAddress(mappingSlot, key) {
|
|
19903
|
+
return keccak256(
|
|
19904
|
+
encodeAbiParameters(parseAbiParameters("address, uint256"), [
|
|
19905
|
+
key,
|
|
19906
|
+
BigInt(mappingSlot)
|
|
19907
|
+
])
|
|
19908
|
+
);
|
|
19909
|
+
}
|
|
19910
|
+
function getDynamicArraySlot(baseSlot, arrayIndex, itemSize) {
|
|
19911
|
+
return pad(
|
|
19912
|
+
toHex(
|
|
19913
|
+
fromHex(
|
|
19914
|
+
keccak256(
|
|
19915
|
+
encodeAbiParameters(parseAbiParameters("uint256"), [baseSlot])
|
|
19916
|
+
),
|
|
19917
|
+
"bigint"
|
|
19918
|
+
) + BigInt(arrayIndex * itemSize)
|
|
19919
|
+
),
|
|
19920
|
+
{ size: 32 }
|
|
19921
|
+
);
|
|
19922
|
+
}
|
|
19923
|
+
function getBytesValue(value) {
|
|
19924
|
+
const bytesString = toBytes(value);
|
|
19925
|
+
if (bytesString.length > 31)
|
|
19926
|
+
throw new Error("Error: strings > 31 bytes are not implemented");
|
|
19927
|
+
return concat([
|
|
19928
|
+
toHex(pad(bytesString, { size: 31, dir: "right" })),
|
|
19929
|
+
toHex(bytesString.length * 2, { size: 1 })
|
|
19930
|
+
]);
|
|
19931
|
+
}
|
|
19932
|
+
function bytes32ToAddress(bytes32) {
|
|
19933
|
+
return getAddress(slice(bytes32, 12, 32));
|
|
19934
|
+
}
|
|
19412
19935
|
|
|
19413
19936
|
// src/aave/governance/payloads-controller.ts
|
|
19414
19937
|
import { getBlock } from "viem/actions";
|
|
@@ -20602,7 +21125,8 @@ async function getXLayerSourceCode(params) {
|
|
|
20602
21125
|
import {
|
|
20603
21126
|
createTestClient,
|
|
20604
21127
|
createWalletClient,
|
|
20605
|
-
http
|
|
21128
|
+
http,
|
|
21129
|
+
publicActions
|
|
20606
21130
|
} from "viem";
|
|
20607
21131
|
|
|
20608
21132
|
// src/ecosystem/chainIds.ts
|
|
@@ -20831,7 +21355,7 @@ async function tenderly_createVnet({
|
|
|
20831
21355
|
},
|
|
20832
21356
|
mode: "tenderly",
|
|
20833
21357
|
transport: http(rpc.url, { timeout: 2e5 })
|
|
20834
|
-
}),
|
|
21358
|
+
}).extend(publicActions),
|
|
20835
21359
|
walletClient: createWalletClient({
|
|
20836
21360
|
chain: {
|
|
20837
21361
|
...ChainList[baseChainId],
|
|
@@ -20967,7 +21491,7 @@ var EVENT_DB = [];
|
|
|
20967
21491
|
// src/ecosystem/rpcs.ts
|
|
20968
21492
|
import {
|
|
20969
21493
|
http as http2,
|
|
20970
|
-
|
|
21494
|
+
createPublicClient
|
|
20971
21495
|
} from "viem";
|
|
20972
21496
|
|
|
20973
21497
|
// src/ecosystem/generated/alchemyNetworkMap.ts
|
|
@@ -21508,7 +22032,7 @@ function getClient(chainId, {
|
|
|
21508
22032
|
} = {}) {
|
|
21509
22033
|
if (!clientCache[chainId] || forceRebuildClient) {
|
|
21510
22034
|
const rpcURL = getRPCUrl(chainId, providerConfig);
|
|
21511
|
-
clientCache[chainId] =
|
|
22035
|
+
clientCache[chainId] = createPublicClient({
|
|
21512
22036
|
chain: ChainList[chainId],
|
|
21513
22037
|
transport: http2(rpcURL, httpConfig),
|
|
21514
22038
|
...clientConfig
|
|
@@ -38448,7 +38972,7 @@ async function getVerificationStatus({
|
|
|
38448
38972
|
|
|
38449
38973
|
// src/seatbelt/state.ts
|
|
38450
38974
|
import { getAddress as getAddress3, zeroAddress as zeroAddress2 } from "viem";
|
|
38451
|
-
import { readContract as
|
|
38975
|
+
import { readContract as readContract3 } from "viem/actions";
|
|
38452
38976
|
function isChangeOfType(change, name) {
|
|
38453
38977
|
return change.name === name;
|
|
38454
38978
|
}
|
|
@@ -38657,7 +39181,7 @@ async function enhanceStateDiff(client, diff) {
|
|
|
38657
39181
|
if (isChangeOfType(change, "_reserves")) {
|
|
38658
39182
|
let method = decodeReserveConfigurationV2;
|
|
38659
39183
|
try {
|
|
38660
|
-
await
|
|
39184
|
+
await readContract3(client, {
|
|
38661
39185
|
abi: IPool_ABI,
|
|
38662
39186
|
functionName: "getUserEMode",
|
|
38663
39187
|
args: [zeroAddress2],
|
|
@@ -38959,6 +39483,7 @@ export {
|
|
|
38959
39483
|
IAccessControl_ABI,
|
|
38960
39484
|
IAuthorizedForwarder_ABI,
|
|
38961
39485
|
ICollector_ABI,
|
|
39486
|
+
IDefaultInterestRateStrategyV2_ABI,
|
|
38962
39487
|
IDualAggregator_ABI,
|
|
38963
39488
|
IERC1967_ABI,
|
|
38964
39489
|
IERC20Metadata_ABI,
|
|
@@ -39000,6 +39525,7 @@ export {
|
|
|
39000
39525
|
assetToBase,
|
|
39001
39526
|
bitmapToIndexes,
|
|
39002
39527
|
blockscoutExplorers,
|
|
39528
|
+
bytes32ToAddress,
|
|
39003
39529
|
calculateAvailableBorrowsMarketReferenceCurrency,
|
|
39004
39530
|
calculateCompoundedInterest,
|
|
39005
39531
|
calculateHealthFactor,
|
|
@@ -39026,10 +39552,13 @@ export {
|
|
|
39026
39552
|
genericIndexer,
|
|
39027
39553
|
getAlchemyRPC,
|
|
39028
39554
|
getBits,
|
|
39555
|
+
getBytesValue,
|
|
39029
39556
|
getClient,
|
|
39557
|
+
getCompleteReserveConfiguration,
|
|
39030
39558
|
getContractDeploymentBlock,
|
|
39031
39559
|
getCurrentDebtBalance,
|
|
39032
39560
|
getCurrentLiquidityBalance,
|
|
39561
|
+
getDynamicArraySlot,
|
|
39033
39562
|
getExplicitRPC,
|
|
39034
39563
|
getExplorer,
|
|
39035
39564
|
getGovernance,
|
|
@@ -39051,6 +39580,9 @@ export {
|
|
|
39051
39580
|
getRPCUrl,
|
|
39052
39581
|
getReserveConfigurations,
|
|
39053
39582
|
getReserveTokens,
|
|
39583
|
+
getSolidityStorageSlotAddress,
|
|
39584
|
+
getSolidityStorageSlotBytes,
|
|
39585
|
+
getSolidityStorageSlotUint,
|
|
39054
39586
|
getSourceCode,
|
|
39055
39587
|
getTenderlyRpc,
|
|
39056
39588
|
getVerificationStatus,
|