@1delta/margin-fetcher 5.0.76 → 5.0.78
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.ts +71 -1
- package/dist/index.js +606 -393
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6922,6 +6922,65 @@ var buildCompoundV3StyleLenderReserveCall = (chainId, lender) => {
|
|
|
6922
6922
|
return calls;
|
|
6923
6923
|
};
|
|
6924
6924
|
|
|
6925
|
+
// src/lending/public-data/accumulator.ts
|
|
6926
|
+
function scaledToDecimal(raw, decimals) {
|
|
6927
|
+
const neg = raw < 0n;
|
|
6928
|
+
const text = (neg ? -raw : raw).toString().padStart(decimals + 1, "0");
|
|
6929
|
+
const cut = text.length - decimals;
|
|
6930
|
+
const frac = text.slice(cut).replace(/0+$/, "");
|
|
6931
|
+
const out = frac ? `${text.slice(0, cut)}.${frac}` : text.slice(0, cut);
|
|
6932
|
+
return neg ? `-${out}` : out;
|
|
6933
|
+
}
|
|
6934
|
+
function toBigInt(v) {
|
|
6935
|
+
if (v === null || v === void 0) return void 0;
|
|
6936
|
+
try {
|
|
6937
|
+
const b = typeof v === "bigint" ? v : BigInt(String(v));
|
|
6938
|
+
return b;
|
|
6939
|
+
} catch {
|
|
6940
|
+
return void 0;
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
function rayAccumulator(liquidityIndex, variableBorrowIndex) {
|
|
6944
|
+
const s = toBigInt(liquidityIndex);
|
|
6945
|
+
if (s === void 0 || s <= 0n) return void 0;
|
|
6946
|
+
const b = toBigInt(variableBorrowIndex);
|
|
6947
|
+
return {
|
|
6948
|
+
supplyIndex: scaledToDecimal(s, 27),
|
|
6949
|
+
...b !== void 0 && b > 0n ? { borrowIndex: scaledToDecimal(b, 27) } : {},
|
|
6950
|
+
kind: "ray"
|
|
6951
|
+
};
|
|
6952
|
+
}
|
|
6953
|
+
function exchangeRateAccumulator(exchangeRate, borrowIndex) {
|
|
6954
|
+
const s = toBigInt(exchangeRate);
|
|
6955
|
+
if (s === void 0 || s <= 0n) return void 0;
|
|
6956
|
+
const b = toBigInt(borrowIndex);
|
|
6957
|
+
return {
|
|
6958
|
+
supplyIndex: scaledToDecimal(s, 18),
|
|
6959
|
+
...b !== void 0 && b > 0n ? { borrowIndex: scaledToDecimal(b, 18) } : {},
|
|
6960
|
+
kind: "exchange_rate"
|
|
6961
|
+
};
|
|
6962
|
+
}
|
|
6963
|
+
var ASSETS_PER_SHARE_DECIMALS = 30;
|
|
6964
|
+
function assetsPerShareAccumulator(supplyAssets, supplyShares, borrowAssets, borrowShares) {
|
|
6965
|
+
const ratio = (a, s) => {
|
|
6966
|
+
const ab = toBigInt(a);
|
|
6967
|
+
const sb = toBigInt(s);
|
|
6968
|
+
if (ab === void 0 || sb === void 0 || sb <= 0n || ab < 0n) return void 0;
|
|
6969
|
+
return scaledToDecimal(
|
|
6970
|
+
ab * 10n ** BigInt(ASSETS_PER_SHARE_DECIMALS) / sb,
|
|
6971
|
+
ASSETS_PER_SHARE_DECIMALS
|
|
6972
|
+
);
|
|
6973
|
+
};
|
|
6974
|
+
const supplyIndex = ratio(supplyAssets, supplyShares);
|
|
6975
|
+
if (!supplyIndex) return void 0;
|
|
6976
|
+
const borrowIndex = ratio(borrowAssets, borrowShares);
|
|
6977
|
+
return {
|
|
6978
|
+
supplyIndex,
|
|
6979
|
+
...borrowIndex ? { borrowIndex } : {},
|
|
6980
|
+
kind: "assets_per_share"
|
|
6981
|
+
};
|
|
6982
|
+
}
|
|
6983
|
+
|
|
6925
6984
|
// ../../node_modules/.pnpm/viem@2.45.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@6.0.6_zod@4.3.6/node_modules/viem/_esm/utils/abi/encodePacked.js
|
|
6926
6985
|
function encodePacked(types, values) {
|
|
6927
6986
|
if (types.length !== values.length)
|
|
@@ -7202,6 +7261,10 @@ var getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
7202
7261
|
totalVariableDebt,
|
|
7203
7262
|
totalStableDebt
|
|
7204
7263
|
),
|
|
7264
|
+
accumulator: rayAccumulator(
|
|
7265
|
+
reserveData?.[7 /* liquidityIndex */],
|
|
7266
|
+
reserveData?.[8 /* variableBorrowIndex */]
|
|
7267
|
+
),
|
|
7205
7268
|
// rates
|
|
7206
7269
|
depositRate: formatAaveRawApyToApr(
|
|
7207
7270
|
reserveData?.[3 /* liquidityRate */]?.toString()
|
|
@@ -7423,6 +7486,11 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
7423
7486
|
totalDebt,
|
|
7424
7487
|
totalDebtStable
|
|
7425
7488
|
),
|
|
7489
|
+
// the RAY accumulators, already read for the sanity gate above
|
|
7490
|
+
accumulator: rayAccumulator(
|
|
7491
|
+
reserveData?.[9 /* liquidityIndex */],
|
|
7492
|
+
reserveData?.[10 /* variableBorrowIndex */]
|
|
7493
|
+
),
|
|
7426
7494
|
// rates
|
|
7427
7495
|
depositRate: formatAaveRawApyToApr(
|
|
7428
7496
|
reserveData?.[5 /* liquidityRate */]?.toString()
|
|
@@ -7680,6 +7748,10 @@ function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
|
|
|
7680
7748
|
totalLiquidityUSD: liquidity * price2,
|
|
7681
7749
|
borrowLiquidityUSD: liquidity * price2,
|
|
7682
7750
|
utilization: computeUtilization(totalAToken, totalVariableDebt),
|
|
7751
|
+
accumulator: rayAccumulator(
|
|
7752
|
+
reserveData?.[5 /* liquidityIndex */],
|
|
7753
|
+
reserveData?.[6 /* variableBorrowIndex */]
|
|
7754
|
+
),
|
|
7683
7755
|
// rates
|
|
7684
7756
|
depositRate: formatAaveRawApyToApr(
|
|
7685
7757
|
reserveData?.[3 /* liquidityRate */]?.toString()
|
|
@@ -7850,6 +7922,10 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
|
7850
7922
|
totalDebt,
|
|
7851
7923
|
totalDebtStable
|
|
7852
7924
|
),
|
|
7925
|
+
accumulator: rayAccumulator(
|
|
7926
|
+
reserveData?.[9 /* liquidityIndex */],
|
|
7927
|
+
reserveData?.[10 /* variableBorrowIndex */]
|
|
7928
|
+
),
|
|
7853
7929
|
// rates
|
|
7854
7930
|
depositRate: formatAaveRawApyToApr(
|
|
7855
7931
|
reserveData?.[5 /* liquidityRate */]?.toString()
|
|
@@ -11704,6 +11780,12 @@ function convertMarketsToMorphoResponse(response, chainId, additionalYields = {
|
|
|
11704
11780
|
borrowLiquidityUSD: Number(state.supplyAssetsUsd) - Number(state.borrowAssetsUsd),
|
|
11705
11781
|
totalDebtUSD: Number(state.borrowAssetsUsd),
|
|
11706
11782
|
utilization,
|
|
11783
|
+
accumulator: assetsPerShareAccumulator(
|
|
11784
|
+
state.supplyAssets,
|
|
11785
|
+
state.supplyShares,
|
|
11786
|
+
state.borrowAssets,
|
|
11787
|
+
state.borrowShares
|
|
11788
|
+
),
|
|
11707
11789
|
depositRate: apyToApr2(Number(state.supplyApy)) * 100,
|
|
11708
11790
|
variableBorrowRate: apyToApr2(Number(state.borrowApy)) * 100,
|
|
11709
11791
|
stableBorrowRate: 0,
|
|
@@ -11865,8 +11947,10 @@ query GetMarkets {
|
|
|
11865
11947
|
}
|
|
11866
11948
|
borrowAssets
|
|
11867
11949
|
borrowAssetsUsd
|
|
11950
|
+
borrowShares
|
|
11868
11951
|
supplyAssets
|
|
11869
11952
|
supplyAssetsUsd
|
|
11953
|
+
supplyShares
|
|
11870
11954
|
collateralAssets
|
|
11871
11955
|
collateralAssetsUsd
|
|
11872
11956
|
fee
|
|
@@ -12749,6 +12833,12 @@ function getMorphoMarketDataConverter(lender, chainId, prices, additionalYields
|
|
|
12749
12833
|
totalDebtUSD: totalDebt * loanPrice,
|
|
12750
12834
|
// utilization is a WAD bigint from MathLib; surface as 0..1 number
|
|
12751
12835
|
utilization: Number(utilization) / 1e18,
|
|
12836
|
+
accumulator: assetsPerShareAccumulator(
|
|
12837
|
+
state.totalSupplyAssets,
|
|
12838
|
+
state.totalSupplyShares,
|
|
12839
|
+
state.totalBorrowAssets,
|
|
12840
|
+
state.totalBorrowShares
|
|
12841
|
+
),
|
|
12752
12842
|
depositRate: depositApr,
|
|
12753
12843
|
variableBorrowRate: borrowApr,
|
|
12754
12844
|
stableBorrowRate: 0,
|
|
@@ -15479,7 +15569,7 @@ function decodePausedActions(bitmap) {
|
|
|
15479
15569
|
}
|
|
15480
15570
|
|
|
15481
15571
|
// src/lending/public-data/compound-v2/getters/moonwell.ts
|
|
15482
|
-
function
|
|
15572
|
+
function toBigInt2(value) {
|
|
15483
15573
|
if (typeof value === "bigint") return value;
|
|
15484
15574
|
if (typeof value === "number") return BigInt(value);
|
|
15485
15575
|
if (typeof value === "string") return BigInt(value);
|
|
@@ -15517,8 +15607,8 @@ function field(src, key3, index) {
|
|
|
15517
15607
|
function parseMarketIncentives(input) {
|
|
15518
15608
|
return {
|
|
15519
15609
|
token: toAddress(field(input, "token", 0)),
|
|
15520
|
-
supplyIncentivesPerSec:
|
|
15521
|
-
borrowIncentivesPerSec:
|
|
15610
|
+
supplyIncentivesPerSec: toBigInt2(field(input, "supplyIncentivesPerSec", 1)),
|
|
15611
|
+
borrowIncentivesPerSec: toBigInt2(field(input, "borrowIncentivesPerSec", 2))
|
|
15522
15612
|
};
|
|
15523
15613
|
}
|
|
15524
15614
|
function parseMoonwellMarket(input, token) {
|
|
@@ -15531,15 +15621,15 @@ function parseMoonwellMarket(input, token) {
|
|
|
15531
15621
|
// supplyCap: toBigInt(field(input, 'supplyCap', 3)),
|
|
15532
15622
|
// mintPaused: toBool(field(input, 'mintPaused', 4)),
|
|
15533
15623
|
// isBorrowAllowed: !toBool(field(input, 'borrowPaused', 5)),
|
|
15534
|
-
collateralFactorMantissa:
|
|
15535
|
-
underlyingPrice:
|
|
15536
|
-
totalSupply:
|
|
15537
|
-
totalBorrows:
|
|
15538
|
-
totalReserves:
|
|
15539
|
-
cash:
|
|
15540
|
-
exchangeRateCurrent:
|
|
15541
|
-
borrowIndex:
|
|
15542
|
-
reserveFactor:
|
|
15624
|
+
collateralFactorMantissa: toBigInt2(field(input, "collateralFactor", 6)),
|
|
15625
|
+
underlyingPrice: toBigInt2(field(input, "underlyingPrice", 7)),
|
|
15626
|
+
totalSupply: toBigInt2(field(input, "totalSupply", 8)),
|
|
15627
|
+
totalBorrows: toBigInt2(field(input, "totalBorrows", 9)),
|
|
15628
|
+
totalReserves: toBigInt2(field(input, "totalReserves", 10)),
|
|
15629
|
+
cash: toBigInt2(field(input, "cash", 11)),
|
|
15630
|
+
exchangeRateCurrent: toBigInt2(field(input, "exchangeRate", 12)),
|
|
15631
|
+
borrowIndex: toBigInt2(field(input, "borrowIndex", 13)),
|
|
15632
|
+
reserveFactor: toBigInt2(field(input, "reserveFactor", 14)),
|
|
15543
15633
|
// borrowRate: toBigInt(field(input, 'borrowRate', 15)),
|
|
15544
15634
|
// supplyRate: toBigInt(field(input, 'supplyRate', 16)),
|
|
15545
15635
|
pausedActions: {
|
|
@@ -15549,30 +15639,30 @@ function parseMoonwellMarket(input, token) {
|
|
|
15549
15639
|
incentives: (incentivesRaw ?? []).map(parseMarketIncentives),
|
|
15550
15640
|
depositRate: apyToApr(
|
|
15551
15641
|
calculateRateForCompoundType(
|
|
15552
|
-
|
|
15642
|
+
toBigInt2(field(input, "supplyRate", 15)).toString() ?? "0",
|
|
15553
15643
|
"1",
|
|
15554
15644
|
1 /* SECOND */
|
|
15555
15645
|
) / 100
|
|
15556
15646
|
) * 100,
|
|
15557
15647
|
variableBorrowRate: apyToApr(
|
|
15558
15648
|
calculateRateForCompoundType(
|
|
15559
|
-
|
|
15649
|
+
toBigInt2(field(input, "borrowRate", 15)).toString() ?? "0",
|
|
15560
15650
|
"1",
|
|
15561
15651
|
1 /* SECOND */
|
|
15562
15652
|
) / 100
|
|
15563
15653
|
) * 100,
|
|
15564
15654
|
isBorrowAllowed: true,
|
|
15565
15655
|
borrowCap: Number(
|
|
15566
|
-
formatUnits(
|
|
15656
|
+
formatUnits(toBigInt2(field(input, "borrowCap", 2)), token.decimals ?? 18)
|
|
15567
15657
|
),
|
|
15568
15658
|
supplyCap: Number(
|
|
15569
|
-
formatUnits(
|
|
15659
|
+
formatUnits(toBigInt2(field(input, "supplyCap", 2)), token.decimals ?? 18)
|
|
15570
15660
|
)
|
|
15571
15661
|
};
|
|
15572
15662
|
}
|
|
15573
15663
|
|
|
15574
15664
|
// src/lending/public-data/compound-v2/getters/takara.ts
|
|
15575
|
-
function
|
|
15665
|
+
function toBigInt3(value) {
|
|
15576
15666
|
if (typeof value === "bigint") return value;
|
|
15577
15667
|
if (typeof value === "number") return BigInt(value);
|
|
15578
15668
|
if (typeof value === "string") return BigInt(value);
|
|
@@ -15604,17 +15694,17 @@ function toBool2(value) {
|
|
|
15604
15694
|
}
|
|
15605
15695
|
function parseTakaraMarketsInfo(input) {
|
|
15606
15696
|
return {
|
|
15607
|
-
tvl:
|
|
15608
|
-
ltv:
|
|
15609
|
-
exchangeRateCurrent:
|
|
15610
|
-
reserveFactorMantissa:
|
|
15611
|
-
totalSupply:
|
|
15697
|
+
tvl: toBigInt3(field2(input, "tvl", 0)),
|
|
15698
|
+
ltv: toBigInt3(field2(input, "ltv", 1)),
|
|
15699
|
+
exchangeRateCurrent: toBigInt3(field2(input, "exchangeRateCurrent", 2)),
|
|
15700
|
+
reserveFactorMantissa: toBigInt3(field2(input, "reserveFactorMantissa", 3)),
|
|
15701
|
+
totalSupply: toBigInt3(field2(input, "totalSupply", 4)),
|
|
15612
15702
|
isListed: toBool2(field2(input, "isListed", 5)),
|
|
15613
|
-
totalBorrows:
|
|
15614
|
-
supplyRatePerBlock:
|
|
15615
|
-
borrowRatePerBlock:
|
|
15616
|
-
blocksPerYear:
|
|
15617
|
-
timestampsPerYear:
|
|
15703
|
+
totalBorrows: toBigInt3(field2(input, "totalBorrows", 6)),
|
|
15704
|
+
supplyRatePerBlock: toBigInt3(field2(input, "supplyRatePerBlock", 7)),
|
|
15705
|
+
borrowRatePerBlock: toBigInt3(field2(input, "borrowRatePerBlock", 8)),
|
|
15706
|
+
blocksPerYear: toBigInt3(field2(input, "blocksPerYear", 9)),
|
|
15707
|
+
timestampsPerYear: toBigInt3(field2(input, "timestampsPerYear", 10)),
|
|
15618
15708
|
token: String(field2(input, "token", 11)),
|
|
15619
15709
|
underlying: String(field2(input, "underlying", 12)),
|
|
15620
15710
|
symbol: String(field2(input, "symbol", 13)),
|
|
@@ -15631,7 +15721,7 @@ function getTakaraRates(info) {
|
|
|
15631
15721
|
}
|
|
15632
15722
|
|
|
15633
15723
|
// src/lending/public-data/compound-v2/getters/tectonic.ts
|
|
15634
|
-
function
|
|
15724
|
+
function toBigInt4(value) {
|
|
15635
15725
|
if (typeof value === "bigint") return value;
|
|
15636
15726
|
if (typeof value === "number") return BigInt(value);
|
|
15637
15727
|
if (typeof value === "string") return BigInt(value);
|
|
@@ -15662,29 +15752,29 @@ function parseTectonicMarketData(input) {
|
|
|
15662
15752
|
decimal: Number(field3(input, "decimal", 3)),
|
|
15663
15753
|
ttokenAddress: String(field3(input, "ttokenAddress", 4)),
|
|
15664
15754
|
ttokenDecimal: Number(field3(input, "ttokenDecimal", 5)),
|
|
15665
|
-
borrowCap:
|
|
15666
|
-
supplyCap:
|
|
15667
|
-
availableLiquidity:
|
|
15755
|
+
borrowCap: toBigInt4(field3(input, "borrowCap", 6)),
|
|
15756
|
+
supplyCap: toBigInt4(field3(input, "supplyCap", 7)),
|
|
15757
|
+
availableLiquidity: toBigInt4(field3(input, "availableLiquidity", 8)),
|
|
15668
15758
|
asCollateralEnabled: toBool3(field3(input, "asCollateralEnabled", 9)),
|
|
15669
|
-
reserves:
|
|
15670
|
-
reserveFactor:
|
|
15671
|
-
collateralFactor:
|
|
15672
|
-
liquidationPenalty:
|
|
15673
|
-
price:
|
|
15674
|
-
exchangeRate:
|
|
15675
|
-
tTokenMinted:
|
|
15676
|
-
totalSupply:
|
|
15677
|
-
totalBorrow:
|
|
15678
|
-
borrowRatePerBlock:
|
|
15679
|
-
supplyRatePerBlock:
|
|
15680
|
-
availableBorrow:
|
|
15759
|
+
reserves: toBigInt4(field3(input, "reserves", 10)),
|
|
15760
|
+
reserveFactor: toBigInt4(field3(input, "reserveFactor", 11)),
|
|
15761
|
+
collateralFactor: toBigInt4(field3(input, "collateralFactor", 12)),
|
|
15762
|
+
liquidationPenalty: toBigInt4(field3(input, "liquidationPenalty", 13)),
|
|
15763
|
+
price: toBigInt4(field3(input, "price", 14)),
|
|
15764
|
+
exchangeRate: toBigInt4(field3(input, "exchangeRate", 15)),
|
|
15765
|
+
tTokenMinted: toBigInt4(field3(input, "tTokenMinted", 16)),
|
|
15766
|
+
totalSupply: toBigInt4(field3(input, "totalSupply", 17)),
|
|
15767
|
+
totalBorrow: toBigInt4(field3(input, "totalBorrow", 18)),
|
|
15768
|
+
borrowRatePerBlock: toBigInt4(field3(input, "borrowRatePerBlock", 19)),
|
|
15769
|
+
supplyRatePerBlock: toBigInt4(field3(input, "supplyRatePerBlock", 20)),
|
|
15770
|
+
availableBorrow: toBigInt4(field3(input, "availableBorrow", 21)),
|
|
15681
15771
|
isBoosted: toBool3(field3(input, "isBoosted", 22)),
|
|
15682
|
-
baseRatePerBlock:
|
|
15683
|
-
multiplierPerBlock:
|
|
15684
|
-
jumpMultiplierPerBlock:
|
|
15772
|
+
baseRatePerBlock: toBigInt4(field3(input, "baseRatePerBlock", 23)),
|
|
15773
|
+
multiplierPerBlock: toBigInt4(field3(input, "multiplierPerBlock", 24)),
|
|
15774
|
+
jumpMultiplierPerBlock: toBigInt4(
|
|
15685
15775
|
field3(input, "jumpMultiplierPerBlock", 25)
|
|
15686
15776
|
),
|
|
15687
|
-
kink:
|
|
15777
|
+
kink: toBigInt4(field3(input, "kink", 26))
|
|
15688
15778
|
};
|
|
15689
15779
|
}
|
|
15690
15780
|
function getTectonicRates(info, chainId, unitSeconds) {
|
|
@@ -15707,7 +15797,7 @@ function getTectonicRates(info, chainId, unitSeconds) {
|
|
|
15707
15797
|
}
|
|
15708
15798
|
|
|
15709
15799
|
// src/lending/public-data/compound-v2/getters/kinetic.ts
|
|
15710
|
-
function
|
|
15800
|
+
function toBigInt5(value) {
|
|
15711
15801
|
if (typeof value === "bigint") return value;
|
|
15712
15802
|
if (typeof value === "number") return BigInt(value);
|
|
15713
15803
|
if (typeof value === "string") return BigInt(value);
|
|
@@ -15733,23 +15823,23 @@ function field4(src, key3, index) {
|
|
|
15733
15823
|
function parseKineticMarketMetadata(input) {
|
|
15734
15824
|
return {
|
|
15735
15825
|
market: String(field4(input, "market", 0)),
|
|
15736
|
-
supplyRate:
|
|
15737
|
-
borrowRate:
|
|
15738
|
-
price:
|
|
15739
|
-
exchangeRate:
|
|
15740
|
-
reserveFactor:
|
|
15741
|
-
borrowCap:
|
|
15742
|
-
totalSupply:
|
|
15743
|
-
totalUnderlyingSupply:
|
|
15744
|
-
totalBorrows:
|
|
15745
|
-
collateralFactor:
|
|
15826
|
+
supplyRate: toBigInt5(field4(input, "supplyRate", 1)),
|
|
15827
|
+
borrowRate: toBigInt5(field4(input, "borrowRate", 2)),
|
|
15828
|
+
price: toBigInt5(field4(input, "price", 3)),
|
|
15829
|
+
exchangeRate: toBigInt5(field4(input, "exchangeRate", 4)),
|
|
15830
|
+
reserveFactor: toBigInt5(field4(input, "reserveFactor", 5)),
|
|
15831
|
+
borrowCap: toBigInt5(field4(input, "borrowCap", 6)),
|
|
15832
|
+
totalSupply: toBigInt5(field4(input, "totalSupply", 7)),
|
|
15833
|
+
totalUnderlyingSupply: toBigInt5(field4(input, "totalUnderlyingSupply", 8)),
|
|
15834
|
+
totalBorrows: toBigInt5(field4(input, "totalBorrows", 9)),
|
|
15835
|
+
collateralFactor: toBigInt5(field4(input, "collateralFactor", 10)),
|
|
15746
15836
|
underlyingToken: String(field4(input, "underlyingToken", 11)),
|
|
15747
15837
|
underlyingTokenDecimals: Number(
|
|
15748
15838
|
field4(input, "underlyingTokenDecimals", 12)
|
|
15749
15839
|
),
|
|
15750
15840
|
cTokenDecimals: Number(field4(input, "cTokenDecimals", 13)),
|
|
15751
|
-
totalReserves:
|
|
15752
|
-
cash:
|
|
15841
|
+
totalReserves: toBigInt5(field4(input, "totalReserves", 16)),
|
|
15842
|
+
cash: toBigInt5(field4(input, "cash", 17)),
|
|
15753
15843
|
mintPaused: toBool4(field4(input, "mintPaused", 18)),
|
|
15754
15844
|
borrowPaused: toBool4(field4(input, "borrowPaused", 19))
|
|
15755
15845
|
};
|
|
@@ -15857,6 +15947,7 @@ function convertSingleEntry(opts) {
|
|
|
15857
15947
|
poolId,
|
|
15858
15948
|
asset,
|
|
15859
15949
|
// interest rates (use lender passed-in, not hardcoded)
|
|
15950
|
+
accumulator: exchangeRateAccumulator(exchangeRateRaw),
|
|
15860
15951
|
depositRate: currentEntry.depositRate,
|
|
15861
15952
|
variableBorrowRate: currentEntry.variableBorrowRate,
|
|
15862
15953
|
stableBorrowRate: 0,
|
|
@@ -15975,6 +16066,7 @@ function convertSumerEntry(opts) {
|
|
|
15975
16066
|
name: lenderShortName(lender) + " " + (asset?.symbol ?? ""),
|
|
15976
16067
|
poolId,
|
|
15977
16068
|
asset,
|
|
16069
|
+
accumulator: exchangeRateAccumulator(exchangeRateRaw),
|
|
15978
16070
|
depositRate: currentEntry.depositRate,
|
|
15979
16071
|
variableBorrowRate: currentEntry.variableBorrowRate,
|
|
15980
16072
|
stableBorrowRate: 0,
|
|
@@ -16042,6 +16134,7 @@ function convertTakaraEntry(opts) {
|
|
|
16042
16134
|
name: lenderShortName(lender) + " " + (asset?.symbol ?? ""),
|
|
16043
16135
|
poolId,
|
|
16044
16136
|
asset,
|
|
16137
|
+
accumulator: exchangeRateAccumulator(info.exchangeRateCurrent),
|
|
16045
16138
|
depositRate: rates.depositRate,
|
|
16046
16139
|
variableBorrowRate: rates.variableBorrowRate,
|
|
16047
16140
|
stableBorrowRate: 0,
|
|
@@ -16119,6 +16212,7 @@ function convertTectonicEntry(opts) {
|
|
|
16119
16212
|
name: lenderShortName(lender) + " " + (asset?.symbol ?? ""),
|
|
16120
16213
|
poolId,
|
|
16121
16214
|
asset,
|
|
16215
|
+
accumulator: exchangeRateAccumulator(info.exchangeRate),
|
|
16122
16216
|
depositRate: rates.depositRate,
|
|
16123
16217
|
variableBorrowRate: rates.variableBorrowRate,
|
|
16124
16218
|
stableBorrowRate: 0,
|
|
@@ -16166,7 +16260,7 @@ function convertTectonicEntry(opts) {
|
|
|
16166
16260
|
}
|
|
16167
16261
|
|
|
16168
16262
|
// src/lending/public-data/compound-v2/getters/benqi.ts
|
|
16169
|
-
function
|
|
16263
|
+
function toBigInt6(value) {
|
|
16170
16264
|
if (typeof value === "bigint") return value;
|
|
16171
16265
|
if (typeof value === "number") return BigInt(value);
|
|
16172
16266
|
if (typeof value === "string") return BigInt(value);
|
|
@@ -16200,22 +16294,22 @@ function parseToken(raw) {
|
|
|
16200
16294
|
function parseBenqiMarketMetadata(input) {
|
|
16201
16295
|
return {
|
|
16202
16296
|
market: String(field5(input, "market", 0)),
|
|
16203
|
-
supplyRate:
|
|
16204
|
-
borrowRate:
|
|
16205
|
-
price:
|
|
16206
|
-
exchangeRate:
|
|
16207
|
-
reserveFactor:
|
|
16208
|
-
borrowCap:
|
|
16297
|
+
supplyRate: toBigInt6(field5(input, "supplyRate", 1)),
|
|
16298
|
+
borrowRate: toBigInt6(field5(input, "borrowRate", 2)),
|
|
16299
|
+
price: toBigInt6(field5(input, "price", 3)),
|
|
16300
|
+
exchangeRate: toBigInt6(field5(input, "exchangeRate", 4)),
|
|
16301
|
+
reserveFactor: toBigInt6(field5(input, "reserveFactor", 5)),
|
|
16302
|
+
borrowCap: toBigInt6(field5(input, "borrowCap", 6)),
|
|
16209
16303
|
supplyCap: 0n,
|
|
16210
16304
|
// regular BENQI has no supply cap
|
|
16211
|
-
totalSupply:
|
|
16212
|
-
totalUnderlyingSupply:
|
|
16213
|
-
totalBorrows:
|
|
16214
|
-
collateralFactor:
|
|
16305
|
+
totalSupply: toBigInt6(field5(input, "totalSupply", 7)),
|
|
16306
|
+
totalUnderlyingSupply: toBigInt6(field5(input, "totalUnderlyingSupply", 8)),
|
|
16307
|
+
totalBorrows: toBigInt6(field5(input, "totalBorrows", 9)),
|
|
16308
|
+
collateralFactor: toBigInt6(field5(input, "collateralFactor", 10)),
|
|
16215
16309
|
underlying: parseToken(field5(input, "underlying", 11)),
|
|
16216
16310
|
qiTokenDecimals: Number(field5(input, "qiTokenDecimals", 12)),
|
|
16217
|
-
totalReserves:
|
|
16218
|
-
cash:
|
|
16311
|
+
totalReserves: toBigInt6(field5(input, "totalReserves", 17)),
|
|
16312
|
+
cash: toBigInt6(field5(input, "cash", 18)),
|
|
16219
16313
|
mintPaused: toBool5(field5(input, "mintPaused", 19)),
|
|
16220
16314
|
borrowPaused: toBool5(field5(input, "borrowPaused", 20))
|
|
16221
16315
|
};
|
|
@@ -16223,21 +16317,21 @@ function parseBenqiMarketMetadata(input) {
|
|
|
16223
16317
|
function parseBenqiEcoMarketMetadata(input) {
|
|
16224
16318
|
return {
|
|
16225
16319
|
market: String(field5(input, "market", 0)),
|
|
16226
|
-
supplyRate:
|
|
16227
|
-
borrowRate:
|
|
16228
|
-
price:
|
|
16229
|
-
exchangeRate:
|
|
16230
|
-
reserveFactor:
|
|
16231
|
-
borrowCap:
|
|
16232
|
-
supplyCap:
|
|
16233
|
-
totalSupply:
|
|
16234
|
-
totalUnderlyingSupply:
|
|
16235
|
-
totalBorrows:
|
|
16236
|
-
collateralFactor:
|
|
16320
|
+
supplyRate: toBigInt6(field5(input, "supplyRate", 1)),
|
|
16321
|
+
borrowRate: toBigInt6(field5(input, "borrowRate", 2)),
|
|
16322
|
+
price: toBigInt6(field5(input, "price", 3)),
|
|
16323
|
+
exchangeRate: toBigInt6(field5(input, "exchangeRate", 4)),
|
|
16324
|
+
reserveFactor: toBigInt6(field5(input, "reserveFactor", 5)),
|
|
16325
|
+
borrowCap: toBigInt6(field5(input, "borrowCap", 6)),
|
|
16326
|
+
supplyCap: toBigInt6(field5(input, "supplyCap", 7)),
|
|
16327
|
+
totalSupply: toBigInt6(field5(input, "totalSupply", 8)),
|
|
16328
|
+
totalUnderlyingSupply: toBigInt6(field5(input, "totalUnderlyingSupply", 9)),
|
|
16329
|
+
totalBorrows: toBigInt6(field5(input, "totalBorrows", 10)),
|
|
16330
|
+
collateralFactor: toBigInt6(field5(input, "collateralFactor", 11)),
|
|
16237
16331
|
underlying: parseToken(field5(input, "underlying", 12)),
|
|
16238
16332
|
qiTokenDecimals: Number(field5(input, "qiTokenDecimals", 13)),
|
|
16239
|
-
totalReserves:
|
|
16240
|
-
cash:
|
|
16333
|
+
totalReserves: toBigInt6(field5(input, "totalReserves", 14)),
|
|
16334
|
+
cash: toBigInt6(field5(input, "cash", 15)),
|
|
16241
16335
|
mintPaused: toBool5(field5(input, "mintPaused", 16)),
|
|
16242
16336
|
borrowPaused: toBool5(field5(input, "borrowPaused", 17))
|
|
16243
16337
|
};
|
|
@@ -16287,6 +16381,7 @@ function convertBenqiEntry(opts) {
|
|
|
16287
16381
|
name: lenderShortName(lender) + " " + (asset?.symbol ?? ""),
|
|
16288
16382
|
poolId,
|
|
16289
16383
|
asset,
|
|
16384
|
+
accumulator: exchangeRateAccumulator(parsed.exchangeRate),
|
|
16290
16385
|
depositRate: rates.depositRate,
|
|
16291
16386
|
variableBorrowRate: rates.variableBorrowRate,
|
|
16292
16387
|
stableBorrowRate: 0,
|
|
@@ -16359,6 +16454,7 @@ function convertKineticEntry(opts) {
|
|
|
16359
16454
|
name: lenderShortName(lender) + " " + (asset?.symbol ?? ""),
|
|
16360
16455
|
poolId,
|
|
16361
16456
|
asset,
|
|
16457
|
+
accumulator: exchangeRateAccumulator(parsed.exchangeRate),
|
|
16362
16458
|
depositRate: rates.depositRate,
|
|
16363
16459
|
variableBorrowRate: rates.variableBorrowRate,
|
|
16364
16460
|
stableBorrowRate: 0,
|
|
@@ -16678,13 +16774,13 @@ var REPAIR_BACKOFF_JITTER_MS = 60;
|
|
|
16678
16774
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
16679
16775
|
var backoffForRound = (round) => REPAIR_BACKOFF_BASE_MS * 2 ** round + Math.random() * REPAIR_BACKOFF_JITTER_MS;
|
|
16680
16776
|
var endpointUrl = (client, rpcId) => client?.transport?.url ?? `rpc#${rpcId}`;
|
|
16681
|
-
var resolveEndpoint = (chainId,
|
|
16777
|
+
var resolveEndpoint = (chainId, getEvmClient20, startRpcId, tried, maxProbe = 12, timeoutMs) => {
|
|
16682
16778
|
let fallback = null;
|
|
16683
16779
|
for (let probe = 0; probe < maxProbe; probe++) {
|
|
16684
16780
|
const rpcId = startRpcId + probe;
|
|
16685
16781
|
let client;
|
|
16686
16782
|
try {
|
|
16687
|
-
client =
|
|
16783
|
+
client = getEvmClient20(chainId, rpcId, { timeoutMs });
|
|
16688
16784
|
} catch {
|
|
16689
16785
|
break;
|
|
16690
16786
|
}
|
|
@@ -16713,7 +16809,7 @@ var recordPermanentFailures = (slots, offset, collector) => {
|
|
|
16713
16809
|
if (slots[i].permanent) collector.add(offset + i);
|
|
16714
16810
|
}
|
|
16715
16811
|
};
|
|
16716
|
-
var repairFailedSlots = async (chainId, contracts, slots,
|
|
16812
|
+
var repairFailedSlots = async (chainId, contracts, slots, getEvmClient20, nextRpcId, batchSize, logs, rounds = MULTICALL_REPAIR_ROUNDS, options) => {
|
|
16717
16813
|
let searchFrom = nextRpcId;
|
|
16718
16814
|
for (let round = 0; round < rounds; round++) {
|
|
16719
16815
|
const failedIdx = [];
|
|
@@ -16723,7 +16819,7 @@ var repairFailedSlots = async (chainId, contracts, slots, getEvmClient19, nextRp
|
|
|
16723
16819
|
if (failedIdx.length === 0) return slots;
|
|
16724
16820
|
const endpoint = resolveEndpoint(
|
|
16725
16821
|
chainId,
|
|
16726
|
-
|
|
16822
|
+
getEvmClient20,
|
|
16727
16823
|
searchFrom,
|
|
16728
16824
|
options?.tried
|
|
16729
16825
|
);
|
|
@@ -16775,7 +16871,7 @@ var repairFailedSlots = async (chainId, contracts, slots, getEvmClient19, nextRp
|
|
|
16775
16871
|
}
|
|
16776
16872
|
return slots;
|
|
16777
16873
|
};
|
|
16778
|
-
var multicallShardedAbiArray = async (chainId, abi, calls,
|
|
16874
|
+
var multicallShardedAbiArray = async (chainId, abi, calls, getEvmClient20, poolSize, retries = maxRetries, allowFailure = true, batchSize = MULTICALL_DEFAULT_BATCH_SIZE, logs = false, retryFailed = false, permanentFailures, options) => {
|
|
16779
16875
|
const abiIsArray = isArray(abi[0]);
|
|
16780
16876
|
const contracts = calls.map(({ address, name, params }, i) => ({
|
|
16781
16877
|
abi: abiIsArray ? abi?.[i] : abi,
|
|
@@ -16849,7 +16945,7 @@ var multicallShardedAbiArray = async (chainId, abi, calls, getEvmClient19, poolS
|
|
|
16849
16945
|
const attemptHedged = async (items, startRpcId, tried) => {
|
|
16850
16946
|
const primary = resolveEndpoint(
|
|
16851
16947
|
chainId,
|
|
16852
|
-
|
|
16948
|
+
getEvmClient20,
|
|
16853
16949
|
startRpcId,
|
|
16854
16950
|
tried,
|
|
16855
16951
|
12,
|
|
@@ -16873,7 +16969,7 @@ var multicallShardedAbiArray = async (chainId, abi, calls, getEvmClient19, poolS
|
|
|
16873
16969
|
clearTimeout(timer);
|
|
16874
16970
|
const alt = resolveEndpoint(
|
|
16875
16971
|
chainId,
|
|
16876
|
-
|
|
16972
|
+
getEvmClient20,
|
|
16877
16973
|
primary.rpcId + 1,
|
|
16878
16974
|
tried,
|
|
16879
16975
|
12,
|
|
@@ -16925,7 +17021,7 @@ var multicallShardedAbiArray = async (chainId, abi, calls, getEvmClient19, poolS
|
|
|
16925
17021
|
chainId,
|
|
16926
17022
|
batch.items,
|
|
16927
17023
|
slots,
|
|
16928
|
-
|
|
17024
|
+
getEvmClient20,
|
|
16929
17025
|
won.rpcId + 1,
|
|
16930
17026
|
requestBytes,
|
|
16931
17027
|
logs,
|
|
@@ -16947,7 +17043,7 @@ var multicallShardedAbiArray = async (chainId, abi, calls, getEvmClient19, poolS
|
|
|
16947
17043
|
const tried = /* @__PURE__ */ new Set();
|
|
16948
17044
|
const start = resolveEndpoint(
|
|
16949
17045
|
chainId,
|
|
16950
|
-
|
|
17046
|
+
getEvmClient20,
|
|
16951
17047
|
workerId,
|
|
16952
17048
|
void 0,
|
|
16953
17049
|
12,
|
|
@@ -18497,6 +18593,7 @@ function buildTokenEntry(info, config, collateralActive, borrowVaults, opts) {
|
|
|
18497
18593
|
averageStableBorrowRate: 0,
|
|
18498
18594
|
liquidityIndex: "0",
|
|
18499
18595
|
variableBorrowIndex: "0",
|
|
18596
|
+
accumulator: assetsPerShareAccumulator(info.totalAssets, info.totalShares),
|
|
18500
18597
|
lastUpdateTimestamp: Number(info.timestamp),
|
|
18501
18598
|
config,
|
|
18502
18599
|
collateralActive,
|
|
@@ -18653,6 +18750,7 @@ var getEulerV2ReservesDataConverter = (lender, chainId, prices, additionalYields
|
|
|
18653
18750
|
totalDebtStableUSD: entry.totalDebtStableUSD,
|
|
18654
18751
|
totalDebtUSD,
|
|
18655
18752
|
totalLiquidityUSD,
|
|
18753
|
+
accumulator: entry.accumulator,
|
|
18656
18754
|
// rates (normalizer yields APY as decimal, convert to APR percentage)
|
|
18657
18755
|
depositRate: apyToApr(entry.depositRate) * 100,
|
|
18658
18756
|
variableBorrowRate: apyToApr(entry.variableBorrowRate) * 100,
|
|
@@ -19502,7 +19600,7 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19502
19600
|
{ self: market.silo0, other: market.silo1 },
|
|
19503
19601
|
{ self: market.silo1, other: market.silo0 }
|
|
19504
19602
|
];
|
|
19505
|
-
const
|
|
19603
|
+
const toBigInt18 = (v) => {
|
|
19506
19604
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
19507
19605
|
if (typeof v === "bigint") return v;
|
|
19508
19606
|
try {
|
|
@@ -19514,8 +19612,8 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19514
19612
|
for (let s = 0; s < 2; s++) {
|
|
19515
19613
|
const { self, other } = sides[s];
|
|
19516
19614
|
const slot = s * SILO_V2_CALLS_PER_SIDE;
|
|
19517
|
-
const totalAssetsRaw =
|
|
19518
|
-
const debtAssetsRaw =
|
|
19615
|
+
const totalAssetsRaw = toBigInt18(data[slot]);
|
|
19616
|
+
const debtAssetsRaw = toBigInt18(data[slot + 1]);
|
|
19519
19617
|
const irmConfigRaw = data[slot + 2];
|
|
19520
19618
|
const decimals = self.decimals;
|
|
19521
19619
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -19670,7 +19768,7 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19670
19768
|
{ self: market.silo0, other: market.silo1 },
|
|
19671
19769
|
{ self: market.silo1, other: market.silo0 }
|
|
19672
19770
|
];
|
|
19673
|
-
const
|
|
19771
|
+
const toBigInt18 = (v) => {
|
|
19674
19772
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
19675
19773
|
if (typeof v === "bigint") return v;
|
|
19676
19774
|
try {
|
|
@@ -19682,8 +19780,8 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19682
19780
|
for (let s = 0; s < 2; s++) {
|
|
19683
19781
|
const { self, other } = sides[s];
|
|
19684
19782
|
const slot = s * SILO_V3_CALLS_PER_SIDE;
|
|
19685
|
-
const totalAssetsRaw =
|
|
19686
|
-
const debtAssetsRaw =
|
|
19783
|
+
const totalAssetsRaw = toBigInt18(data[slot]);
|
|
19784
|
+
const debtAssetsRaw = toBigInt18(data[slot + 1]);
|
|
19687
19785
|
const irmConfigRaw = data[slot + 2];
|
|
19688
19786
|
const decimals = self.decimals;
|
|
19689
19787
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -19814,7 +19912,7 @@ var ZERO_ADDRESS4 = "0x0000000000000000000000000000000000000000";
|
|
|
19814
19912
|
var cache = {};
|
|
19815
19913
|
var inflight = /* @__PURE__ */ new Map();
|
|
19816
19914
|
var isRealDex = (d) => !!d && String(d.id ?? "0") !== "0" && String(d.address ?? ZERO_ADDRESS4).toLowerCase() !== ZERO_ADDRESS4;
|
|
19817
|
-
var
|
|
19915
|
+
var toBigInt7 = (v) => {
|
|
19818
19916
|
try {
|
|
19819
19917
|
return BigInt(v ?? 0);
|
|
19820
19918
|
} catch {
|
|
@@ -19823,8 +19921,8 @@ var toBigInt6 = (v) => {
|
|
|
19823
19921
|
};
|
|
19824
19922
|
var parseSide = (d, sideToken) => {
|
|
19825
19923
|
if (!isRealDex(d)) return void 0;
|
|
19826
|
-
const token0PerShare =
|
|
19827
|
-
const token1PerShare =
|
|
19924
|
+
const token0PerShare = toBigInt7(d.token0PerShare);
|
|
19925
|
+
const token1PerShare = toBigInt7(d.token1PerShare);
|
|
19828
19926
|
if (token0PerShare === 0n && token1PerShare === 0n) return void 0;
|
|
19829
19927
|
const d0 = Number(sideToken?.token0?.decimals);
|
|
19830
19928
|
const d1 = Number(sideToken?.token1?.decimals);
|
|
@@ -21061,8 +21159,12 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
|
|
|
21061
21159
|
multicallRetry({
|
|
21062
21160
|
chain: chainId,
|
|
21063
21161
|
calls: calls.map((call) => call.call),
|
|
21064
|
-
abi: calls.map((call) => call.abi)
|
|
21065
|
-
|
|
21162
|
+
abi: calls.map((call) => call.abi)
|
|
21163
|
+
// No per-chain byte override any more. Ethereum used to pass 500 bytes
|
|
21164
|
+
// to keep one huge `aggregate3` from timing out — a workaround for the
|
|
21165
|
+
// 1024-byte default fan-out that `@1delta/providers` replaced with
|
|
21166
|
+
// count-based chunking (250 calls, two in flight). A 500-byte chunk is
|
|
21167
|
+
// now 4–14 calls issued nearly serially, i.e. slower than the default.
|
|
21066
21168
|
}),
|
|
21067
21169
|
tokenList(),
|
|
21068
21170
|
// Fluid SMART vaults (T2/T3/T4) need the DEX trading yield, which is
|
|
@@ -34345,8 +34447,8 @@ var getSiloV2UserDataConverter = (lender, chainId, account, meta, params) => {
|
|
|
34345
34447
|
const slice2 = data.slice(base, base + SILO_V2_USER_CALLS_PER_PAIR);
|
|
34346
34448
|
if (slice2.some((v) => isFailedCall(v))) continue;
|
|
34347
34449
|
states.set(i, {
|
|
34348
|
-
side0: slice2.slice(0, 5).map(
|
|
34349
|
-
side1: slice2.slice(5, 10).map(
|
|
34450
|
+
side0: slice2.slice(0, 5).map(toBigInt8),
|
|
34451
|
+
side1: slice2.slice(5, 10).map(toBigInt8)
|
|
34350
34452
|
});
|
|
34351
34453
|
}
|
|
34352
34454
|
}
|
|
@@ -34469,7 +34571,7 @@ function convertSiloPair(chainId, lender, account, market, state, metaMap) {
|
|
|
34469
34571
|
}
|
|
34470
34572
|
}
|
|
34471
34573
|
}
|
|
34472
|
-
function
|
|
34574
|
+
function toBigInt8(v) {
|
|
34473
34575
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
34474
34576
|
if (typeof v === "bigint") return v;
|
|
34475
34577
|
try {
|
|
@@ -34483,7 +34585,7 @@ function toBigInt7(v) {
|
|
|
34483
34585
|
var getSiloV3UserDataConverter = (lender, chainId, account, meta, params) => getSiloV2UserDataConverter(lender, chainId, account, meta, params);
|
|
34484
34586
|
var FLUID_EEE_LOWER2 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
34485
34587
|
var normalizeUnderlying2 = (addr4) => addr4 === FLUID_EEE_LOWER2 ? zeroAddress : addr4;
|
|
34486
|
-
function
|
|
34588
|
+
function toBigInt9(v) {
|
|
34487
34589
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
34488
34590
|
if (typeof v === "bigint") return v;
|
|
34489
34591
|
try {
|
|
@@ -34578,8 +34680,8 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34578
34680
|
const histData = {};
|
|
34579
34681
|
for (const { pos } of nfts) {
|
|
34580
34682
|
const nftId = pos.nftId.toString();
|
|
34581
|
-
const supplyRaw =
|
|
34582
|
-
const borrowRaw =
|
|
34683
|
+
const supplyRaw = toBigInt9(pos.supply);
|
|
34684
|
+
const borrowRaw = toBigInt9(pos.borrow) + toBigInt9(pos.dustBorrow);
|
|
34583
34685
|
if (supplyRaw === 0n && borrowRaw === 0n) continue;
|
|
34584
34686
|
modes[nftId] = 0;
|
|
34585
34687
|
const posData = {};
|
|
@@ -34659,7 +34761,7 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34659
34761
|
FLUID_USER_CALL_COUNT
|
|
34660
34762
|
];
|
|
34661
34763
|
};
|
|
34662
|
-
function
|
|
34764
|
+
function toBigInt10(v) {
|
|
34663
34765
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
34664
34766
|
if (typeof v === "bigint") return v;
|
|
34665
34767
|
try {
|
|
@@ -34743,7 +34845,7 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
34743
34845
|
for (const ca of accounts) {
|
|
34744
34846
|
const caAddress = (ca.creditAccount ?? ca.addr ?? "").toString().toLowerCase();
|
|
34745
34847
|
if (!caAddress) continue;
|
|
34746
|
-
const debtRaw =
|
|
34848
|
+
const debtRaw = toBigInt10(ca.debt);
|
|
34747
34849
|
const tokens = Array.isArray(ca.tokens) ? ca.tokens : Array.isArray(ca.balances) ? ca.balances : [];
|
|
34748
34850
|
modes[caAddress] = 0;
|
|
34749
34851
|
const posData = {};
|
|
@@ -34752,9 +34854,9 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
34752
34854
|
const rawToken = (bal?.token ?? "").toString().toLowerCase();
|
|
34753
34855
|
if (!rawToken) continue;
|
|
34754
34856
|
const token = rawToken;
|
|
34755
|
-
const balRaw =
|
|
34857
|
+
const balRaw = toBigInt10(bal.balance);
|
|
34756
34858
|
if (balRaw === 0n) continue;
|
|
34757
|
-
const quotaRaw =
|
|
34859
|
+
const quotaRaw = toBigInt10(bal.quota);
|
|
34758
34860
|
const isQuoted = quotaRaw > 0n || !!bal?.isQuoted;
|
|
34759
34861
|
const colMarketUid = createMarketUid(chainId, lenderKey, token);
|
|
34760
34862
|
ensureMetaStub(metaMap, colMarketUid, token);
|
|
@@ -34929,7 +35031,7 @@ function normalizeUnderlying3(token) {
|
|
|
34929
35031
|
const lower4 = token.toLowerCase();
|
|
34930
35032
|
return Object.values(WETH_BY_CHAIN).includes(lower4) ? zeroAddress : lower4;
|
|
34931
35033
|
}
|
|
34932
|
-
function
|
|
35034
|
+
function toBigInt11(v) {
|
|
34933
35035
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
34934
35036
|
if (typeof v === "bigint") return v;
|
|
34935
35037
|
try {
|
|
@@ -34939,22 +35041,22 @@ function toBigInt10(v) {
|
|
|
34939
35041
|
}
|
|
34940
35042
|
}
|
|
34941
35043
|
function readDebtUnits(positionResult) {
|
|
34942
|
-
if (Array.isArray(positionResult)) return
|
|
35044
|
+
if (Array.isArray(positionResult)) return toBigInt11(positionResult[4]);
|
|
34943
35045
|
if (positionResult && typeof positionResult === "object")
|
|
34944
|
-
return
|
|
35046
|
+
return toBigInt11(positionResult.debt);
|
|
34945
35047
|
return 0n;
|
|
34946
35048
|
}
|
|
34947
35049
|
function readUpdatedLender(updateResult) {
|
|
34948
35050
|
if (Array.isArray(updateResult)) {
|
|
34949
35051
|
return {
|
|
34950
|
-
credit:
|
|
34951
|
-
pendingFee:
|
|
35052
|
+
credit: toBigInt11(updateResult[0]),
|
|
35053
|
+
pendingFee: toBigInt11(updateResult[1])
|
|
34952
35054
|
};
|
|
34953
35055
|
}
|
|
34954
35056
|
if (updateResult && typeof updateResult === "object") {
|
|
34955
35057
|
return {
|
|
34956
|
-
credit:
|
|
34957
|
-
pendingFee:
|
|
35058
|
+
credit: toBigInt11(updateResult.newCredit),
|
|
35059
|
+
pendingFee: toBigInt11(updateResult.newPendingFee)
|
|
34958
35060
|
};
|
|
34959
35061
|
}
|
|
34960
35062
|
return { credit: 0n, pendingFee: 0n };
|
|
@@ -35025,7 +35127,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
35025
35127
|
pendingFee: pendingFeeStr
|
|
35026
35128
|
};
|
|
35027
35129
|
market.collateralParams.forEach((c, i) => {
|
|
35028
|
-
const collAmt =
|
|
35130
|
+
const collAmt = toBigInt11(collateralResults[i]);
|
|
35029
35131
|
if (collAmt === 0n) return;
|
|
35030
35132
|
anyBalance = true;
|
|
35031
35133
|
const collAddr = c.token.toLowerCase();
|
|
@@ -35078,7 +35180,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
35078
35180
|
];
|
|
35079
35181
|
};
|
|
35080
35182
|
var WAD12 = 1000000000000000000n;
|
|
35081
|
-
function
|
|
35183
|
+
function toBigInt12(v) {
|
|
35082
35184
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
35083
35185
|
if (typeof v === "bigint") return v;
|
|
35084
35186
|
try {
|
|
@@ -35119,11 +35221,11 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
35119
35221
|
const loanDisplayPrice = loanMeta ? getDisplayPrice(loanMeta) : 0;
|
|
35120
35222
|
const loanOraclePrice = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
35121
35223
|
const loanPriceHist = loanMeta?.price?.priceUsd24h ?? loanDisplayPrice;
|
|
35122
|
-
const debtUnits =
|
|
35224
|
+
const debtUnits = toBigInt12(obligationResult);
|
|
35123
35225
|
const debtStr = parseRawAmount(debtUnits.toString(), market.loanDecimals);
|
|
35124
35226
|
const debtNum = Number(debtStr);
|
|
35125
|
-
const repoBalance =
|
|
35126
|
-
const redemptionValue =
|
|
35227
|
+
const repoBalance = toBigInt12(balanceResult);
|
|
35228
|
+
const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD12;
|
|
35127
35229
|
const lentUnits = repoBalance * redemptionValue / WAD12;
|
|
35128
35230
|
const depositsStr = parseRawAmount(lentUnits.toString(), market.loanDecimals);
|
|
35129
35231
|
const depositsNum = Number(depositsStr);
|
|
@@ -35147,7 +35249,7 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
35147
35249
|
claimableRewards: 0
|
|
35148
35250
|
};
|
|
35149
35251
|
market.collateralParams.forEach((c, i) => {
|
|
35150
|
-
const collAmt =
|
|
35252
|
+
const collAmt = toBigInt12(collateralResults[i]);
|
|
35151
35253
|
if (collAmt === 0n) return;
|
|
35152
35254
|
anyBalance = true;
|
|
35153
35255
|
const collAddr = c.token.toLowerCase();
|
|
@@ -37259,7 +37361,7 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
37259
37361
|
];
|
|
37260
37362
|
};
|
|
37261
37363
|
var nowSec8 = () => Math.floor(Date.now() / 1e3);
|
|
37262
|
-
function
|
|
37364
|
+
function toBigInt13(v) {
|
|
37263
37365
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
37264
37366
|
if (typeof v === "bigint") return v;
|
|
37265
37367
|
try {
|
|
@@ -37276,18 +37378,18 @@ function field11(res, name, index) {
|
|
|
37276
37378
|
return void 0;
|
|
37277
37379
|
}
|
|
37278
37380
|
function parsePosition(res) {
|
|
37279
|
-
const ftBalance =
|
|
37280
|
-
const xtBalance =
|
|
37381
|
+
const ftBalance = toBigInt13(field11(res, "ftBalance", 2));
|
|
37382
|
+
const xtBalance = toBigInt13(field11(res, "xtBalance", 3));
|
|
37281
37383
|
const rawGts = field11(res, "gtInfo", 4);
|
|
37282
37384
|
const gts = [];
|
|
37283
37385
|
if (Array.isArray(rawGts)) {
|
|
37284
37386
|
for (const g of rawGts) {
|
|
37285
|
-
const loanId =
|
|
37387
|
+
const loanId = toBigInt13(field11(g, "loanId", 0));
|
|
37286
37388
|
if (loanId === 0n) continue;
|
|
37287
37389
|
gts.push({
|
|
37288
37390
|
loanId: loanId.toString(),
|
|
37289
|
-
collateralAmt:
|
|
37290
|
-
debtAmt:
|
|
37391
|
+
collateralAmt: toBigInt13(field11(g, "collateralAmt", 1)),
|
|
37392
|
+
debtAmt: toBigInt13(field11(g, "debtAmt", 2))
|
|
37291
37393
|
});
|
|
37292
37394
|
}
|
|
37293
37395
|
}
|
|
@@ -42377,7 +42479,7 @@ function unflattenLenderData(pools) {
|
|
|
42377
42479
|
}
|
|
42378
42480
|
return result;
|
|
42379
42481
|
}
|
|
42380
|
-
var getLenderUserDataResult = async (chainId, queriesRaw,
|
|
42482
|
+
var getLenderUserDataResult = async (chainId, queriesRaw, getEvmClient20, allowFailure = true, batchSize = MULTICALL_DEFAULT_BATCH_SIZE, retries = 3, logs = false, concurrency = 1, permanentFailures, onEndpointFailure) => {
|
|
42381
42483
|
const queries = organizeUserQueries(queriesRaw);
|
|
42382
42484
|
const builtCalls = await Promise.all(
|
|
42383
42485
|
queries.map(async (query3) => {
|
|
@@ -42387,7 +42489,7 @@ var getLenderUserDataResult = async (chainId, queriesRaw, getEvmClient19, allowF
|
|
|
42387
42489
|
query3.lender,
|
|
42388
42490
|
query3.account,
|
|
42389
42491
|
query3.params,
|
|
42390
|
-
|
|
42492
|
+
getEvmClient20
|
|
42391
42493
|
);
|
|
42392
42494
|
return callData.map((call) => ({ call, abi: call.abi ?? abi }));
|
|
42393
42495
|
})
|
|
@@ -42397,7 +42499,7 @@ var getLenderUserDataResult = async (chainId, queriesRaw, getEvmClient19, allowF
|
|
|
42397
42499
|
chainId,
|
|
42398
42500
|
calls.map((call) => call.abi),
|
|
42399
42501
|
calls.map((call) => call.call),
|
|
42400
|
-
|
|
42502
|
+
getEvmClient20,
|
|
42401
42503
|
concurrency,
|
|
42402
42504
|
retries,
|
|
42403
42505
|
allowFailure,
|
|
@@ -44843,8 +44945,6 @@ var stKaiaFetcher = {
|
|
|
44843
44945
|
}
|
|
44844
44946
|
}
|
|
44845
44947
|
};
|
|
44846
|
-
|
|
44847
|
-
// src/yields/intrinsic/fetchers/lista.ts
|
|
44848
44948
|
var HISTORY_URL = "https://api.lista.org/api/datachart/history";
|
|
44849
44949
|
var SLISBNB = "Lista Staked BNB::slisBNB";
|
|
44850
44950
|
var DAY_SECONDS2 = 86400;
|
|
@@ -44875,6 +44975,68 @@ var slisBnbFetcher = {
|
|
|
44875
44975
|
}
|
|
44876
44976
|
}
|
|
44877
44977
|
};
|
|
44978
|
+
var LISASTER_OVERVIEW_URL = "https://api.lista.org/api/lisaster/overview";
|
|
44979
|
+
var LISASTER_KEY = "Lista Staked Aster::lisAster";
|
|
44980
|
+
var LISASTER_SMARTLP_KEY = "lisAster & ASTER-SmartLP::lisAster & ASTER-SmartLP";
|
|
44981
|
+
var LISASTER_SMARTLP_DEX = "0x510d69b25a2177eddce9becdb0a66a511c944840";
|
|
44982
|
+
var STABLESWAP_BALANCES_ABI = [
|
|
44983
|
+
{
|
|
44984
|
+
type: "function",
|
|
44985
|
+
name: "balances",
|
|
44986
|
+
stateMutability: "view",
|
|
44987
|
+
inputs: [{ name: "i", type: "uint256" }],
|
|
44988
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
44989
|
+
}
|
|
44990
|
+
];
|
|
44991
|
+
var lisAsterFetcher = {
|
|
44992
|
+
label: "LISASTER",
|
|
44993
|
+
fetch: async () => {
|
|
44994
|
+
const controller = new AbortController();
|
|
44995
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
44996
|
+
let apr;
|
|
44997
|
+
try {
|
|
44998
|
+
const res = await fetch(LISASTER_OVERVIEW_URL, {
|
|
44999
|
+
method: "GET",
|
|
45000
|
+
headers: { Accept: "application/json" },
|
|
45001
|
+
signal: controller.signal
|
|
45002
|
+
}).then((r) => r.json());
|
|
45003
|
+
const apyFraction = Number(res.data?.lisasterApy);
|
|
45004
|
+
if (!Number.isFinite(apyFraction) || apyFraction <= 0) {
|
|
45005
|
+
throw new Error(
|
|
45006
|
+
`lisAster: overview carried no usable lisasterApy (${String(res.data?.lisasterApy)})`
|
|
45007
|
+
);
|
|
45008
|
+
}
|
|
45009
|
+
apr = apyToAprPercent(apyFraction * 100);
|
|
45010
|
+
} finally {
|
|
45011
|
+
clearTimeout(timer);
|
|
45012
|
+
}
|
|
45013
|
+
const out = { [LISASTER_KEY]: apr };
|
|
45014
|
+
try {
|
|
45015
|
+
const client = getEvmClient(Chain.BNB_SMART_CHAIN_MAINNET);
|
|
45016
|
+
const [aster, lisAster] = await Promise.all([
|
|
45017
|
+
client.readContract({
|
|
45018
|
+
address: LISASTER_SMARTLP_DEX,
|
|
45019
|
+
abi: STABLESWAP_BALANCES_ABI,
|
|
45020
|
+
functionName: "balances",
|
|
45021
|
+
args: [0n]
|
|
45022
|
+
}),
|
|
45023
|
+
client.readContract({
|
|
45024
|
+
address: LISASTER_SMARTLP_DEX,
|
|
45025
|
+
abi: STABLESWAP_BALANCES_ABI,
|
|
45026
|
+
functionName: "balances",
|
|
45027
|
+
args: [1n]
|
|
45028
|
+
})
|
|
45029
|
+
]);
|
|
45030
|
+
const total = aster + lisAster;
|
|
45031
|
+
if (total > 0n) {
|
|
45032
|
+
const weight = Number(lisAster) / Number(total);
|
|
45033
|
+
out[LISASTER_SMARTLP_KEY] = apr * weight;
|
|
45034
|
+
}
|
|
45035
|
+
} catch {
|
|
45036
|
+
}
|
|
45037
|
+
return out;
|
|
45038
|
+
}
|
|
45039
|
+
};
|
|
44878
45040
|
var CHAIN_ID3 = "80094";
|
|
44879
45041
|
var IBERA = "0x9b6761bf2397bb5a6624a856cc84a3a14dcd3fe5";
|
|
44880
45042
|
var ONE_E182 = 10n ** 18n;
|
|
@@ -50074,7 +50236,7 @@ var BFBTC = [
|
|
|
50074
50236
|
exitNote: "The only exit is to Bitcoin (flat 0.00002 bfBTC) \u2014 the EVM route is switched off by a 100 % fee"
|
|
50075
50237
|
}
|
|
50076
50238
|
];
|
|
50077
|
-
var bfbtcDescription = (row) => `bfBTC accrues against BTC through a daily settled exchange ratio
|
|
50239
|
+
var bfbtcDescription = (row) => `bfBTC accrues against BTC through a daily settled exchange ratio. The yield is not staking: it is delta-neutral derivatives trading (perpetual funding and basis) run by third-party quant teams on assets in Ceffu custody, so the backing is off-chain with no on-chain solvency invariant. ` + (row.depositToken ? `Deposits take ${row.depositToken}. ` : `No on-chain deposit here \u2014 BTC is sent on the Bitcoin network. `) + `Exits need approval from a 2-of-3 BitFi Safe, above which a single EOA can replace the Safe, upgrade the contract and blacklist. ${row.exitNote}.`;
|
|
50078
50240
|
var BITFI_ENTRIES = {
|
|
50079
50241
|
...Object.fromEntries(
|
|
50080
50242
|
BFBTC.map((row) => [
|
|
@@ -53525,10 +53687,11 @@ var LENDING_ONLY_FETCHERS = [
|
|
|
53525
53687
|
ethZeroFetcher,
|
|
53526
53688
|
jitoSolFetcher,
|
|
53527
53689
|
thbillFetcher,
|
|
53528
|
-
// sthusdFetcher / scrvusdFetcher are NOT here
|
|
53529
|
-
// their savings rows, so they reach
|
|
53530
|
-
// `collectVaultFetchers` (the disjointness rule
|
|
53531
|
-
// stays — thBILL is a lending collateral with no
|
|
53690
|
+
// sthusdFetcher / scrvusdFetcher are NOT here (and deliberately not
|
|
53691
|
+
// imported): both are vault-wired by their savings rows, so they reach
|
|
53692
|
+
// the global map through `collectVaultFetchers` (the disjointness rule
|
|
53693
|
+
// above). thbillFetcher stays — thBILL is a lending collateral with no
|
|
53694
|
+
// vault row of its own.
|
|
53532
53695
|
ssuperusdFetcher,
|
|
53533
53696
|
hlpFetcher,
|
|
53534
53697
|
hwhlpFetcher,
|
|
@@ -53549,6 +53712,10 @@ var LENDING_ONLY_FETCHERS = [
|
|
|
53549
53712
|
// by reference, so removing it here changes nothing at runtime.
|
|
53550
53713
|
nestFetcher,
|
|
53551
53714
|
accountableFetcher,
|
|
53715
|
+
// slisBnbFetcher is NOT here (LST-wired); lisAster has no vault row — it
|
|
53716
|
+
// is a lock receipt with no rate and no exit — so its reward stream is
|
|
53717
|
+
// lending-only, surfaced for the Moolah lisAster/ASTER collateral join.
|
|
53718
|
+
lisAsterFetcher,
|
|
53552
53719
|
upshiftFetcher,
|
|
53553
53720
|
// Every endorsed Yearn V3 vault on every Yearn chain (Katana included —
|
|
53554
53721
|
// it superseded the Katana-only fetcher, which double-counted).
|
|
@@ -62529,7 +62696,7 @@ var Multicall3BalanceAbi = [
|
|
|
62529
62696
|
outputs: [{ type: "uint256" }]
|
|
62530
62697
|
}
|
|
62531
62698
|
];
|
|
62532
|
-
var
|
|
62699
|
+
var toBigInt14 = (v) => {
|
|
62533
62700
|
if (v === void 0 || v === null) return void 0;
|
|
62534
62701
|
if (typeof v === "bigint") return v;
|
|
62535
62702
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -62553,12 +62720,12 @@ var readerBeetsStS = (entry) => ({
|
|
|
62553
62720
|
],
|
|
62554
62721
|
abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
|
|
62555
62722
|
parse: ([supply, rate, pool]) => {
|
|
62556
|
-
const totalSupply =
|
|
62557
|
-
const exchangeRate =
|
|
62723
|
+
const totalSupply = toBigInt14(supply);
|
|
62724
|
+
const exchangeRate = toBigInt14(rate);
|
|
62558
62725
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62559
62726
|
return void 0;
|
|
62560
62727
|
}
|
|
62561
|
-
const liquidity =
|
|
62728
|
+
const liquidity = toBigInt14(pool);
|
|
62562
62729
|
return {
|
|
62563
62730
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
62564
62731
|
totalSupply,
|
|
@@ -62599,12 +62766,12 @@ var readerBenqiSavax = (entry) => ({
|
|
|
62599
62766
|
],
|
|
62600
62767
|
abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
|
|
62601
62768
|
parse: ([supply, rate, totalPooled]) => {
|
|
62602
|
-
const totalSupply =
|
|
62603
|
-
const exchangeRate =
|
|
62769
|
+
const totalSupply = toBigInt14(supply);
|
|
62770
|
+
const exchangeRate = toBigInt14(rate);
|
|
62604
62771
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62605
62772
|
return void 0;
|
|
62606
62773
|
}
|
|
62607
|
-
const totalAssets =
|
|
62774
|
+
const totalAssets = toBigInt14(totalPooled) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
62608
62775
|
return {
|
|
62609
62776
|
totalAssets,
|
|
62610
62777
|
totalSupply,
|
|
@@ -62618,7 +62785,7 @@ var readerBgtWrapper1to1 = (entry) => ({
|
|
|
62618
62785
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62619
62786
|
abis: [TotalSupplyAbi],
|
|
62620
62787
|
parse: ([supply]) => {
|
|
62621
|
-
const totalSupply =
|
|
62788
|
+
const totalSupply = toBigInt14(supply);
|
|
62622
62789
|
if (totalSupply === void 0) return void 0;
|
|
62623
62790
|
return {
|
|
62624
62791
|
totalAssets: totalSupply,
|
|
@@ -62647,8 +62814,8 @@ var readerDineroBeraEth = (entry) => ({
|
|
|
62647
62814
|
],
|
|
62648
62815
|
abis: [TotalSupplyAbi, DineroBeraEthAbi],
|
|
62649
62816
|
parse: ([supply, rate]) => {
|
|
62650
|
-
const totalSupply =
|
|
62651
|
-
const exchangeRate =
|
|
62817
|
+
const totalSupply = toBigInt14(supply);
|
|
62818
|
+
const exchangeRate = toBigInt14(rate);
|
|
62652
62819
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62653
62820
|
return void 0;
|
|
62654
62821
|
}
|
|
@@ -62669,9 +62836,9 @@ var readerErc4626 = (entry) => ({
|
|
|
62669
62836
|
],
|
|
62670
62837
|
abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
|
|
62671
62838
|
parse: ([assets, supply, rate]) => {
|
|
62672
|
-
const totalAssets =
|
|
62673
|
-
const totalSupply =
|
|
62674
|
-
const exchangeRate =
|
|
62839
|
+
const totalAssets = toBigInt14(assets);
|
|
62840
|
+
const totalSupply = toBigInt14(supply);
|
|
62841
|
+
const exchangeRate = toBigInt14(rate);
|
|
62675
62842
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62676
62843
|
return void 0;
|
|
62677
62844
|
}
|
|
@@ -62686,9 +62853,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
|
|
|
62686
62853
|
],
|
|
62687
62854
|
abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
|
|
62688
62855
|
parse: ([assets, supply, rate]) => {
|
|
62689
|
-
const totalAssets =
|
|
62690
|
-
const totalSupply =
|
|
62691
|
-
const exchangeRate =
|
|
62856
|
+
const totalAssets = toBigInt14(assets);
|
|
62857
|
+
const totalSupply = toBigInt14(supply);
|
|
62858
|
+
const exchangeRate = toBigInt14(rate);
|
|
62692
62859
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62693
62860
|
return void 0;
|
|
62694
62861
|
}
|
|
@@ -62748,15 +62915,15 @@ var readerEtherFiWeEth = (entry) => {
|
|
|
62748
62915
|
calls,
|
|
62749
62916
|
abis,
|
|
62750
62917
|
parse: (slice2) => {
|
|
62751
|
-
const totalSupply =
|
|
62752
|
-
const exchangeRate =
|
|
62918
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
62919
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
62753
62920
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62754
62921
|
return void 0;
|
|
62755
62922
|
}
|
|
62756
62923
|
let liquidity;
|
|
62757
62924
|
if (lp) {
|
|
62758
|
-
const lpBalance =
|
|
62759
|
-
const locked =
|
|
62925
|
+
const lpBalance = toBigInt14(slice2[2]);
|
|
62926
|
+
const locked = toBigInt14(slice2[3]);
|
|
62760
62927
|
if (lpBalance !== void 0 && locked !== void 0) {
|
|
62761
62928
|
liquidity = lpBalance > locked ? lpBalance - locked : 0n;
|
|
62762
62929
|
}
|
|
@@ -62790,7 +62957,7 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62790
62957
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62791
62958
|
abis: [TotalSupplyAbi],
|
|
62792
62959
|
parse: ([supply]) => {
|
|
62793
|
-
const totalSupply =
|
|
62960
|
+
const totalSupply = toBigInt14(supply);
|
|
62794
62961
|
if (totalSupply === void 0) return void 0;
|
|
62795
62962
|
return {
|
|
62796
62963
|
totalAssets: totalSupply,
|
|
@@ -62807,8 +62974,8 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62807
62974
|
],
|
|
62808
62975
|
abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
|
|
62809
62976
|
parse: ([supply, rate]) => {
|
|
62810
|
-
const totalSupply =
|
|
62811
|
-
const exchangeRate =
|
|
62977
|
+
const totalSupply = toBigInt14(supply);
|
|
62978
|
+
const exchangeRate = toBigInt14(rate);
|
|
62812
62979
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62813
62980
|
return void 0;
|
|
62814
62981
|
}
|
|
@@ -62840,7 +63007,7 @@ var readerKelpRsEth = (entry) => {
|
|
|
62840
63007
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62841
63008
|
abis: [TotalSupplyAbi],
|
|
62842
63009
|
parse: ([supply]) => {
|
|
62843
|
-
const totalSupply =
|
|
63010
|
+
const totalSupply = toBigInt14(supply);
|
|
62844
63011
|
if (totalSupply === void 0) return void 0;
|
|
62845
63012
|
return {
|
|
62846
63013
|
totalAssets: totalSupply,
|
|
@@ -62857,8 +63024,8 @@ var readerKelpRsEth = (entry) => {
|
|
|
62857
63024
|
],
|
|
62858
63025
|
abis: [TotalSupplyAbi, KelpLrtOracleAbi],
|
|
62859
63026
|
parse: ([supply, rate]) => {
|
|
62860
|
-
const totalSupply =
|
|
62861
|
-
const exchangeRate =
|
|
63027
|
+
const totalSupply = toBigInt14(supply);
|
|
63028
|
+
const exchangeRate = toBigInt14(rate);
|
|
62862
63029
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62863
63030
|
return void 0;
|
|
62864
63031
|
}
|
|
@@ -62890,7 +63057,7 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62890
63057
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62891
63058
|
abis: [TotalSupplyAbi],
|
|
62892
63059
|
parse: ([supply]) => {
|
|
62893
|
-
const totalSupply =
|
|
63060
|
+
const totalSupply = toBigInt14(supply);
|
|
62894
63061
|
if (totalSupply === void 0) return void 0;
|
|
62895
63062
|
return {
|
|
62896
63063
|
totalAssets: totalSupply,
|
|
@@ -62907,8 +63074,8 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62907
63074
|
],
|
|
62908
63075
|
abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
|
|
62909
63076
|
parse: ([supply, rate]) => {
|
|
62910
|
-
const totalSupply =
|
|
62911
|
-
const exchangeRate =
|
|
63077
|
+
const totalSupply = toBigInt14(supply);
|
|
63078
|
+
const exchangeRate = toBigInt14(rate);
|
|
62912
63079
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62913
63080
|
return void 0;
|
|
62914
63081
|
}
|
|
@@ -62948,12 +63115,12 @@ var readerLairStKaia = (entry) => ({
|
|
|
62948
63115
|
],
|
|
62949
63116
|
abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
|
|
62950
63117
|
parse: ([supply, rate, totalStaking]) => {
|
|
62951
|
-
const totalSupply =
|
|
62952
|
-
const exchangeRate =
|
|
63118
|
+
const totalSupply = toBigInt14(supply);
|
|
63119
|
+
const exchangeRate = toBigInt14(rate);
|
|
62953
63120
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62954
63121
|
return void 0;
|
|
62955
63122
|
}
|
|
62956
|
-
const totalAssets =
|
|
63123
|
+
const totalAssets = toBigInt14(totalStaking) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
62957
63124
|
return {
|
|
62958
63125
|
totalAssets,
|
|
62959
63126
|
totalSupply,
|
|
@@ -62981,8 +63148,8 @@ var readerLidoWstEth = (entry) => ({
|
|
|
62981
63148
|
],
|
|
62982
63149
|
abis: [TotalSupplyAbi, LidoWstEthAbi],
|
|
62983
63150
|
parse: ([supply, rate]) => {
|
|
62984
|
-
const totalSupply =
|
|
62985
|
-
const exchangeRate =
|
|
63151
|
+
const totalSupply = toBigInt14(supply);
|
|
63152
|
+
const exchangeRate = toBigInt14(rate);
|
|
62986
63153
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62987
63154
|
return void 0;
|
|
62988
63155
|
}
|
|
@@ -63020,7 +63187,7 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63020
63187
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63021
63188
|
abis: [TotalSupplyAbi],
|
|
63022
63189
|
parse: ([supply]) => {
|
|
63023
|
-
const totalSupply =
|
|
63190
|
+
const totalSupply = toBigInt14(supply);
|
|
63024
63191
|
if (totalSupply === void 0) return void 0;
|
|
63025
63192
|
return {
|
|
63026
63193
|
totalAssets: totalSupply,
|
|
@@ -63038,12 +63205,12 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63038
63205
|
],
|
|
63039
63206
|
abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
|
|
63040
63207
|
parse: ([supply, rate, pooled]) => {
|
|
63041
|
-
const totalSupply =
|
|
63042
|
-
const exchangeRate =
|
|
63208
|
+
const totalSupply = toBigInt14(supply);
|
|
63209
|
+
const exchangeRate = toBigInt14(rate);
|
|
63043
63210
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63044
63211
|
return void 0;
|
|
63045
63212
|
}
|
|
63046
|
-
const pooledBnb =
|
|
63213
|
+
const pooledBnb = toBigInt14(pooled);
|
|
63047
63214
|
const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E1812;
|
|
63048
63215
|
return { totalAssets, totalSupply, exchangeRate };
|
|
63049
63216
|
}
|
|
@@ -63069,7 +63236,7 @@ var readerMantleMEth = (entry) => {
|
|
|
63069
63236
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63070
63237
|
abis: [TotalSupplyAbi],
|
|
63071
63238
|
parse: ([supply]) => {
|
|
63072
|
-
const totalSupply =
|
|
63239
|
+
const totalSupply = toBigInt14(supply);
|
|
63073
63240
|
if (totalSupply === void 0) return void 0;
|
|
63074
63241
|
return {
|
|
63075
63242
|
totalAssets: totalSupply,
|
|
@@ -63086,8 +63253,8 @@ var readerMantleMEth = (entry) => {
|
|
|
63086
63253
|
],
|
|
63087
63254
|
abis: [TotalSupplyAbi, MantleStakingAbi],
|
|
63088
63255
|
parse: ([supply, rate]) => {
|
|
63089
|
-
const totalSupply =
|
|
63090
|
-
const exchangeRate =
|
|
63256
|
+
const totalSupply = toBigInt14(supply);
|
|
63257
|
+
const exchangeRate = toBigInt14(rate);
|
|
63091
63258
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63092
63259
|
return void 0;
|
|
63093
63260
|
}
|
|
@@ -63108,7 +63275,7 @@ var readerOffChain = (entry) => {
|
|
|
63108
63275
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63109
63276
|
abis: [TotalSupplyAbi],
|
|
63110
63277
|
parse: ([supply]) => {
|
|
63111
|
-
const totalSupply =
|
|
63278
|
+
const totalSupply = toBigInt14(supply);
|
|
63112
63279
|
if (totalSupply === void 0) return void 0;
|
|
63113
63280
|
return {
|
|
63114
63281
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63142,7 +63309,7 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63142
63309
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63143
63310
|
abis: [TotalSupplyAbi],
|
|
63144
63311
|
parse: ([supply]) => {
|
|
63145
|
-
const totalSupply =
|
|
63312
|
+
const totalSupply = toBigInt14(supply);
|
|
63146
63313
|
if (totalSupply === void 0) return void 0;
|
|
63147
63314
|
return {
|
|
63148
63315
|
totalAssets: totalSupply,
|
|
@@ -63159,9 +63326,9 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63159
63326
|
],
|
|
63160
63327
|
abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
|
|
63161
63328
|
parse: ([supply, tvls]) => {
|
|
63162
|
-
const totalSupply =
|
|
63329
|
+
const totalSupply = toBigInt14(supply);
|
|
63163
63330
|
if (totalSupply === void 0 || totalSupply === 0n) return void 0;
|
|
63164
|
-
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ?
|
|
63331
|
+
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt14(tvls[2]) : void 0;
|
|
63165
63332
|
if (totalTvl === void 0) return void 0;
|
|
63166
63333
|
return {
|
|
63167
63334
|
totalAssets: totalTvl,
|
|
@@ -63215,12 +63382,12 @@ var readerRocketReth = (entry) => {
|
|
|
63215
63382
|
calls,
|
|
63216
63383
|
abis,
|
|
63217
63384
|
parse: (slice2) => {
|
|
63218
|
-
const totalSupply =
|
|
63219
|
-
const exchangeRate =
|
|
63385
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
63386
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
63220
63387
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63221
63388
|
return void 0;
|
|
63222
63389
|
}
|
|
63223
|
-
const liquidity = depositPool ?
|
|
63390
|
+
const liquidity = depositPool ? toBigInt14(slice2[2]) : void 0;
|
|
63224
63391
|
return {
|
|
63225
63392
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
63226
63393
|
totalSupply,
|
|
@@ -63259,7 +63426,7 @@ var readerStaderEthx = (entry) => {
|
|
|
63259
63426
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63260
63427
|
abis: [TotalSupplyAbi],
|
|
63261
63428
|
parse: ([supply]) => {
|
|
63262
|
-
const totalSupply =
|
|
63429
|
+
const totalSupply = toBigInt14(supply);
|
|
63263
63430
|
if (totalSupply === void 0) return void 0;
|
|
63264
63431
|
return {
|
|
63265
63432
|
totalAssets: totalSupply,
|
|
@@ -63276,8 +63443,8 @@ var readerStaderEthx = (entry) => {
|
|
|
63276
63443
|
],
|
|
63277
63444
|
abis: [TotalSupplyAbi, StaderEthxAbi],
|
|
63278
63445
|
parse: ([supply, rate]) => {
|
|
63279
|
-
const totalSupply =
|
|
63280
|
-
const exchangeRate =
|
|
63446
|
+
const totalSupply = toBigInt14(supply);
|
|
63447
|
+
const exchangeRate = toBigInt14(rate);
|
|
63281
63448
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63282
63449
|
return void 0;
|
|
63283
63450
|
}
|
|
@@ -63305,10 +63472,10 @@ var readerStaderMaticX = (entry) => {
|
|
|
63305
63472
|
],
|
|
63306
63473
|
abis: [TotalSupplyAbi, StaderMaticXAbi],
|
|
63307
63474
|
parse: ([supply, tup]) => {
|
|
63308
|
-
const totalSupply =
|
|
63475
|
+
const totalSupply = toBigInt14(supply);
|
|
63309
63476
|
if (!Array.isArray(tup) || tup.length < 3) return void 0;
|
|
63310
|
-
const amountInMatic =
|
|
63311
|
-
const totalPooledMatic =
|
|
63477
|
+
const amountInMatic = toBigInt14(tup[0]);
|
|
63478
|
+
const totalPooledMatic = toBigInt14(tup[2]);
|
|
63312
63479
|
if (totalSupply === void 0 || amountInMatic === void 0) {
|
|
63313
63480
|
return void 0;
|
|
63314
63481
|
}
|
|
@@ -63341,7 +63508,7 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63341
63508
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63342
63509
|
abis: [TotalSupplyAbi],
|
|
63343
63510
|
parse: ([supply]) => {
|
|
63344
|
-
const totalSupply =
|
|
63511
|
+
const totalSupply = toBigInt14(supply);
|
|
63345
63512
|
if (totalSupply === void 0) return void 0;
|
|
63346
63513
|
return {
|
|
63347
63514
|
totalAssets: totalSupply,
|
|
@@ -63358,8 +63525,8 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63358
63525
|
],
|
|
63359
63526
|
abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
|
|
63360
63527
|
parse: ([supply, rate]) => {
|
|
63361
|
-
const totalSupply =
|
|
63362
|
-
const exchangeRate =
|
|
63528
|
+
const totalSupply = toBigInt14(supply);
|
|
63529
|
+
const exchangeRate = toBigInt14(rate);
|
|
63363
63530
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63364
63531
|
return void 0;
|
|
63365
63532
|
}
|
|
@@ -63391,7 +63558,7 @@ var readerStCelo = (entry) => {
|
|
|
63391
63558
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63392
63559
|
abis: [TotalSupplyAbi],
|
|
63393
63560
|
parse: ([supply]) => {
|
|
63394
|
-
const totalSupply =
|
|
63561
|
+
const totalSupply = toBigInt14(supply);
|
|
63395
63562
|
if (totalSupply === void 0) return void 0;
|
|
63396
63563
|
return {
|
|
63397
63564
|
totalAssets: totalSupply,
|
|
@@ -63408,8 +63575,8 @@ var readerStCelo = (entry) => {
|
|
|
63408
63575
|
],
|
|
63409
63576
|
abis: [TotalSupplyAbi, StCeloManagerAbi],
|
|
63410
63577
|
parse: ([supply, rate]) => {
|
|
63411
|
-
const totalSupply =
|
|
63412
|
-
const exchangeRate =
|
|
63578
|
+
const totalSupply = toBigInt14(supply);
|
|
63579
|
+
const exchangeRate = toBigInt14(rate);
|
|
63413
63580
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63414
63581
|
return void 0;
|
|
63415
63582
|
}
|
|
@@ -63441,8 +63608,8 @@ var readerSwellGetRate = (entry) => ({
|
|
|
63441
63608
|
],
|
|
63442
63609
|
abis: [TotalSupplyAbi, SwellGetRateAbi],
|
|
63443
63610
|
parse: ([supply, rate]) => {
|
|
63444
|
-
const totalSupply =
|
|
63445
|
-
const exchangeRate =
|
|
63611
|
+
const totalSupply = toBigInt14(supply);
|
|
63612
|
+
const exchangeRate = toBigInt14(rate);
|
|
63446
63613
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63447
63614
|
return void 0;
|
|
63448
63615
|
}
|
|
@@ -63473,7 +63640,7 @@ var readerValantisWstHype = (entry) => {
|
|
|
63473
63640
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63474
63641
|
abis: [TotalSupplyAbi],
|
|
63475
63642
|
parse: ([supply]) => {
|
|
63476
|
-
const totalSupply =
|
|
63643
|
+
const totalSupply = toBigInt14(supply);
|
|
63477
63644
|
if (totalSupply === void 0) return void 0;
|
|
63478
63645
|
return {
|
|
63479
63646
|
totalAssets: totalSupply,
|
|
@@ -63490,8 +63657,8 @@ var readerValantisWstHype = (entry) => {
|
|
|
63490
63657
|
],
|
|
63491
63658
|
abis: [TotalSupplyAbi, ValantisStHypeAbi],
|
|
63492
63659
|
parse: ([supply, rate]) => {
|
|
63493
|
-
const totalSupply =
|
|
63494
|
-
const exchangeRate =
|
|
63660
|
+
const totalSupply = toBigInt14(supply);
|
|
63661
|
+
const exchangeRate = toBigInt14(rate);
|
|
63495
63662
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63496
63663
|
return void 0;
|
|
63497
63664
|
}
|
|
@@ -63525,7 +63692,7 @@ var readerVedaAccountant = (entry) => {
|
|
|
63525
63692
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63526
63693
|
abis: [TotalSupplyAbi],
|
|
63527
63694
|
parse: ([supply]) => {
|
|
63528
|
-
const totalSupply =
|
|
63695
|
+
const totalSupply = toBigInt14(supply);
|
|
63529
63696
|
if (totalSupply === void 0) return void 0;
|
|
63530
63697
|
return {
|
|
63531
63698
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63543,8 +63710,8 @@ var readerVedaAccountant = (entry) => {
|
|
|
63543
63710
|
],
|
|
63544
63711
|
abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
|
|
63545
63712
|
parse: ([supply, rate]) => {
|
|
63546
|
-
const totalSupply =
|
|
63547
|
-
const rawRate =
|
|
63713
|
+
const totalSupply = toBigInt14(supply);
|
|
63714
|
+
const rawRate = toBigInt14(rate);
|
|
63548
63715
|
if (totalSupply === void 0 || rawRate === void 0) return void 0;
|
|
63549
63716
|
const exchangeRate = rawRate * scale3;
|
|
63550
63717
|
return {
|
|
@@ -63579,8 +63746,8 @@ var readerAnkrRatio = (entry) => ({
|
|
|
63579
63746
|
],
|
|
63580
63747
|
abis: [TotalSupplyAbi, AnkrRatioAbi],
|
|
63581
63748
|
parse: ([supply, ratio]) => {
|
|
63582
|
-
const totalSupply =
|
|
63583
|
-
const r =
|
|
63749
|
+
const totalSupply = toBigInt14(supply);
|
|
63750
|
+
const r = toBigInt14(ratio);
|
|
63584
63751
|
if (totalSupply === void 0 || r === void 0 || r === 0n) {
|
|
63585
63752
|
return void 0;
|
|
63586
63753
|
}
|
|
@@ -63611,8 +63778,8 @@ var readerBinanceWbeth = (entry) => ({
|
|
|
63611
63778
|
],
|
|
63612
63779
|
abis: [TotalSupplyAbi, WbethExchangeRateAbi],
|
|
63613
63780
|
parse: ([supply, rate]) => {
|
|
63614
|
-
const totalSupply =
|
|
63615
|
-
const exchangeRate =
|
|
63781
|
+
const totalSupply = toBigInt14(supply);
|
|
63782
|
+
const exchangeRate = toBigInt14(rate);
|
|
63616
63783
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63617
63784
|
return void 0;
|
|
63618
63785
|
}
|
|
@@ -63655,8 +63822,8 @@ var readerCoreEarnRate = (entry) => {
|
|
|
63655
63822
|
],
|
|
63656
63823
|
abis: [CoreEarnRateAbi, TotalSupplyAbi],
|
|
63657
63824
|
parse: ([rate, supply]) => {
|
|
63658
|
-
const r =
|
|
63659
|
-
const totalSupply =
|
|
63825
|
+
const r = toBigInt14(rate);
|
|
63826
|
+
const totalSupply = toBigInt14(supply);
|
|
63660
63827
|
if (r === void 0 || r === 0n || totalSupply === void 0) {
|
|
63661
63828
|
return void 0;
|
|
63662
63829
|
}
|
|
@@ -63677,8 +63844,8 @@ var readerCoreStakedRatio = (entry) => {
|
|
|
63677
63844
|
],
|
|
63678
63845
|
abis: [CoreTotalStakedAbi, TotalSupplyAbi],
|
|
63679
63846
|
parse: ([staked, supply]) => {
|
|
63680
|
-
const totalStaked =
|
|
63681
|
-
const totalSupply =
|
|
63847
|
+
const totalStaked = toBigInt14(staked);
|
|
63848
|
+
const totalSupply = toBigInt14(supply);
|
|
63682
63849
|
if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
|
|
63683
63850
|
return void 0;
|
|
63684
63851
|
}
|
|
@@ -63717,8 +63884,8 @@ var readerKintsuSMon = (entry) => ({
|
|
|
63717
63884
|
],
|
|
63718
63885
|
abis: [KintsuSMonAbi, KintsuSMonAbi],
|
|
63719
63886
|
parse: ([pooled, shares]) => {
|
|
63720
|
-
const totalAssets =
|
|
63721
|
-
const totalSupply =
|
|
63887
|
+
const totalAssets = toBigInt14(pooled);
|
|
63888
|
+
const totalSupply = toBigInt14(shares);
|
|
63722
63889
|
if (totalAssets === void 0 || totalSupply === void 0) return void 0;
|
|
63723
63890
|
const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E1812 / totalSupply : ONE_E1812;
|
|
63724
63891
|
return { totalAssets, totalSupply, exchangeRate };
|
|
@@ -63826,18 +63993,18 @@ var readerTreehouseTAsset = (entry) => {
|
|
|
63826
63993
|
queueFee,
|
|
63827
63994
|
queueMin
|
|
63828
63995
|
] = slice2;
|
|
63829
|
-
const totalAssets =
|
|
63830
|
-
const totalSupply =
|
|
63831
|
-
const exchangeRate =
|
|
63996
|
+
const totalAssets = toBigInt14(assets);
|
|
63997
|
+
const totalSupply = toBigInt14(supply);
|
|
63998
|
+
const exchangeRate = toBigInt14(rate);
|
|
63832
63999
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
63833
64000
|
return void 0;
|
|
63834
64001
|
}
|
|
63835
|
-
const liquidity =
|
|
63836
|
-
const wait =
|
|
63837
|
-
const instantFeeBps = asBps(
|
|
63838
|
-
const queuedFeeBps = asBps(
|
|
63839
|
-
const instantMin =
|
|
63840
|
-
const queuedMin =
|
|
64002
|
+
const liquidity = toBigInt14(redeemable) ?? 0n;
|
|
64003
|
+
const wait = toBigInt14(waiting);
|
|
64004
|
+
const instantFeeBps = asBps(toBigInt14(fastFee));
|
|
64005
|
+
const queuedFeeBps = asBps(toBigInt14(queueFee));
|
|
64006
|
+
const instantMin = toBigInt14(fastMin);
|
|
64007
|
+
const queuedMin = toBigInt14(queueMin);
|
|
63841
64008
|
const instant = {
|
|
63842
64009
|
id: "instant",
|
|
63843
64010
|
kind: "instant",
|
|
@@ -64523,7 +64690,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
64523
64690
|
const validatorsByAddress = new Map(validatorEntries);
|
|
64524
64691
|
const idleByAddress = /* @__PURE__ */ new Map();
|
|
64525
64692
|
idleEntries.forEach((e, i) => {
|
|
64526
|
-
const bal =
|
|
64693
|
+
const bal = toBigInt14(idleResults[i]);
|
|
64527
64694
|
if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
|
|
64528
64695
|
});
|
|
64529
64696
|
const rawResults = new Array(allCalls.length);
|
|
@@ -64681,7 +64848,7 @@ var BeetsStSWithdrawalAbi = [
|
|
|
64681
64848
|
];
|
|
64682
64849
|
|
|
64683
64850
|
// src/vaults/lst/withdrawals/readers/shared.ts
|
|
64684
|
-
var
|
|
64851
|
+
var toBigInt15 = (v) => {
|
|
64685
64852
|
if (v === void 0 || v === null) return void 0;
|
|
64686
64853
|
if (typeof v === "bigint") return v;
|
|
64687
64854
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -64696,7 +64863,7 @@ var toBigInt14 = (v) => {
|
|
|
64696
64863
|
return void 0;
|
|
64697
64864
|
};
|
|
64698
64865
|
var toNumber = (v) => {
|
|
64699
|
-
const b =
|
|
64866
|
+
const b = toBigInt15(v);
|
|
64700
64867
|
if (b === void 0) return void 0;
|
|
64701
64868
|
if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
|
|
64702
64869
|
return Number(b);
|
|
@@ -64733,7 +64900,7 @@ var readerBeets = {
|
|
|
64733
64900
|
const out = [];
|
|
64734
64901
|
for (let i = 0; i < reqs.length; i++) {
|
|
64735
64902
|
const r = reqs[i];
|
|
64736
|
-
const amount4 =
|
|
64903
|
+
const amount4 = toBigInt15(r.assetAmount);
|
|
64737
64904
|
const ts = toNumber(r.requestTimestamp);
|
|
64738
64905
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
64739
64906
|
if (amount4 === void 0 || ts === void 0) continue;
|
|
@@ -64825,13 +64992,13 @@ var readerBeHype = {
|
|
|
64825
64992
|
const q = stage2[i * 2];
|
|
64826
64993
|
const canClaim = Boolean(stage2[i * 2 + 1]);
|
|
64827
64994
|
if (!q) continue;
|
|
64828
|
-
const hypeAmount = Array.isArray(q) ?
|
|
64995
|
+
const hypeAmount = Array.isArray(q) ? toBigInt15(q[2]) : toBigInt15(q.hypeAmount);
|
|
64829
64996
|
if (hypeAmount === void 0) continue;
|
|
64830
64997
|
out.push({
|
|
64831
64998
|
lst: entry.lst,
|
|
64832
64999
|
brand: entry.brand,
|
|
64833
65000
|
symbol: entry.symbol,
|
|
64834
|
-
requestId: String(
|
|
65001
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
64835
65002
|
amountUnderlying: hypeAmount.toString(),
|
|
64836
65003
|
status: canClaim ? "claimable" : "pending"
|
|
64837
65004
|
});
|
|
@@ -64934,7 +65101,7 @@ var readerBenqi = {
|
|
|
64934
65101
|
for (let i = 0; i < reqs.length; i++) {
|
|
64935
65102
|
const r = reqs[i];
|
|
64936
65103
|
const startedAt = toNumber(r.startedAt);
|
|
64937
|
-
const shareAmount =
|
|
65104
|
+
const shareAmount = toBigInt15(r.shareAmount);
|
|
64938
65105
|
if (startedAt === void 0 || shareAmount === void 0) continue;
|
|
64939
65106
|
const readyAt = startedAt + cooldown;
|
|
64940
65107
|
const expiresAt = readyAt + claimWindow;
|
|
@@ -65023,8 +65190,8 @@ var readerBinanceWbeth2 = {
|
|
|
65023
65190
|
for (let i = 0; i < reqs.length; i++) {
|
|
65024
65191
|
const r = reqs[i];
|
|
65025
65192
|
const triggerTime = toNumber(r.triggerTime);
|
|
65026
|
-
const ethAmount =
|
|
65027
|
-
const wbethAmount =
|
|
65193
|
+
const ethAmount = toBigInt15(r.ethAmount);
|
|
65194
|
+
const wbethAmount = toBigInt15(r.wbethAmount);
|
|
65028
65195
|
if (triggerTime === void 0 || ethAmount === void 0) continue;
|
|
65029
65196
|
const readyAt = triggerTime + lockTime;
|
|
65030
65197
|
const claimed = (toNumber(r.claimTime) ?? 0) > 0;
|
|
@@ -65087,8 +65254,8 @@ var readerBeraPaw = {
|
|
|
65087
65254
|
}
|
|
65088
65255
|
const pos = res[0];
|
|
65089
65256
|
if (!pos) return [];
|
|
65090
|
-
const queued = Array.isArray(pos) ?
|
|
65091
|
-
const available = Array.isArray(pos) ?
|
|
65257
|
+
const queued = Array.isArray(pos) ? toBigInt15(pos[0]) : toBigInt15(pos.queued);
|
|
65258
|
+
const available = Array.isArray(pos) ? toBigInt15(pos[1]) : toBigInt15(pos.available);
|
|
65092
65259
|
const out = [];
|
|
65093
65260
|
if (available !== void 0 && available > 0n) {
|
|
65094
65261
|
out.push({
|
|
@@ -65170,7 +65337,7 @@ var readerIbera = {
|
|
|
65170
65337
|
return [];
|
|
65171
65338
|
}
|
|
65172
65339
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65173
|
-
const frontier =
|
|
65340
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65174
65341
|
if (length === 0) return [];
|
|
65175
65342
|
const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
|
|
65176
65343
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65194,7 +65361,7 @@ var readerIbera = {
|
|
|
65194
65361
|
const r = stage2[k];
|
|
65195
65362
|
if (!r) continue;
|
|
65196
65363
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
65197
|
-
const amount4 = Array.isArray(r) ?
|
|
65364
|
+
const amount4 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
|
|
65198
65365
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount4 === void 0 || amount4 === 0n) {
|
|
65199
65366
|
continue;
|
|
65200
65367
|
}
|
|
@@ -65267,7 +65434,7 @@ var readerPrimeStaking = {
|
|
|
65267
65434
|
return [];
|
|
65268
65435
|
}
|
|
65269
65436
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65270
|
-
const frontier =
|
|
65437
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65271
65438
|
if (length === 0) return [];
|
|
65272
65439
|
const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
|
|
65273
65440
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65291,7 +65458,7 @@ var readerPrimeStaking = {
|
|
|
65291
65458
|
const r = stage2[k];
|
|
65292
65459
|
if (!r) continue;
|
|
65293
65460
|
const receiver = Array.isArray(r) ? r[1] : r.receiver;
|
|
65294
|
-
const assets = Array.isArray(r) ?
|
|
65461
|
+
const assets = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.assets);
|
|
65295
65462
|
const processed = Array.isArray(r) ? r[4] : r.processed;
|
|
65296
65463
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
|
|
65297
65464
|
continue;
|
|
@@ -65362,8 +65529,8 @@ var readerErc7540 = {
|
|
|
65362
65529
|
],
|
|
65363
65530
|
abi: [Erc7540Abi, Erc7540Abi]
|
|
65364
65531
|
});
|
|
65365
|
-
const pending =
|
|
65366
|
-
const claimable =
|
|
65532
|
+
const pending = toBigInt15(stage1[0]) ?? 0n;
|
|
65533
|
+
const claimable = toBigInt15(stage1[1]) ?? 0n;
|
|
65367
65534
|
const out = [];
|
|
65368
65535
|
if (claimable > 0n) {
|
|
65369
65536
|
const stage2 = await multicallRetry({
|
|
@@ -65377,7 +65544,7 @@ var readerErc7540 = {
|
|
|
65377
65544
|
],
|
|
65378
65545
|
abi: [Erc7540Abi]
|
|
65379
65546
|
});
|
|
65380
|
-
const amount4 =
|
|
65547
|
+
const amount4 = toBigInt15(stage2[0]) ?? claimable;
|
|
65381
65548
|
out.push({
|
|
65382
65549
|
lst: entry.lst,
|
|
65383
65550
|
brand: entry.brand,
|
|
@@ -65434,11 +65601,11 @@ var readerEthenaCooldown = {
|
|
|
65434
65601
|
let cooldownEnd;
|
|
65435
65602
|
let amount4;
|
|
65436
65603
|
if (Array.isArray(cell)) {
|
|
65437
|
-
cooldownEnd =
|
|
65438
|
-
amount4 =
|
|
65604
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65605
|
+
amount4 = toBigInt15(cell[1]);
|
|
65439
65606
|
} else if (cell && typeof cell === "object") {
|
|
65440
|
-
cooldownEnd =
|
|
65441
|
-
amount4 =
|
|
65607
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65608
|
+
amount4 = toBigInt15(cell.underlyingAmount);
|
|
65442
65609
|
}
|
|
65443
65610
|
if (!amount4 || amount4 === 0n) return [];
|
|
65444
65611
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65494,13 +65661,13 @@ var readerSusd3Cooldown = {
|
|
|
65494
65661
|
let windowEnd;
|
|
65495
65662
|
let shares;
|
|
65496
65663
|
if (Array.isArray(cell)) {
|
|
65497
|
-
cooldownEnd =
|
|
65498
|
-
windowEnd =
|
|
65499
|
-
shares =
|
|
65664
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65665
|
+
windowEnd = toBigInt15(cell[1]);
|
|
65666
|
+
shares = toBigInt15(cell[2]);
|
|
65500
65667
|
} else if (cell && typeof cell === "object") {
|
|
65501
|
-
cooldownEnd =
|
|
65502
|
-
windowEnd =
|
|
65503
|
-
shares =
|
|
65668
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65669
|
+
windowEnd = toBigInt15(cell.windowEnd);
|
|
65670
|
+
shares = toBigInt15(cell.shares);
|
|
65504
65671
|
}
|
|
65505
65672
|
if (!shares || shares === 0n) return [];
|
|
65506
65673
|
let amount4 = shares;
|
|
@@ -65512,7 +65679,7 @@ var readerSusd3Cooldown = {
|
|
|
65512
65679
|
],
|
|
65513
65680
|
abi: [Susd3CooldownStatusAbi]
|
|
65514
65681
|
});
|
|
65515
|
-
amount4 =
|
|
65682
|
+
amount4 = toBigInt15(stage2[0]) ?? shares;
|
|
65516
65683
|
} catch {
|
|
65517
65684
|
}
|
|
65518
65685
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65586,12 +65753,12 @@ var readerStrataCooldown = {
|
|
|
65586
65753
|
let claimable;
|
|
65587
65754
|
let nextUnlockAt;
|
|
65588
65755
|
if (Array.isArray(cell)) {
|
|
65589
|
-
pending =
|
|
65590
|
-
claimable =
|
|
65756
|
+
pending = toBigInt15(cell[0]);
|
|
65757
|
+
claimable = toBigInt15(cell[1]);
|
|
65591
65758
|
nextUnlockAt = toNumber(cell[2]);
|
|
65592
65759
|
} else if (cell && typeof cell === "object") {
|
|
65593
|
-
pending =
|
|
65594
|
-
claimable =
|
|
65760
|
+
pending = toBigInt15(cell.pending);
|
|
65761
|
+
claimable = toBigInt15(cell.claimable);
|
|
65595
65762
|
nextUnlockAt = toNumber(cell.nextUnlockAt);
|
|
65596
65763
|
}
|
|
65597
65764
|
const escrow = { withdrawQueue: contracts[i], claimToken: escrowToken };
|
|
@@ -65699,7 +65866,7 @@ var readerEtherFi = {
|
|
|
65699
65866
|
calls: enumCalls,
|
|
65700
65867
|
abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
|
|
65701
65868
|
});
|
|
65702
|
-
const ids = stage2.map(
|
|
65869
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
65703
65870
|
if (ids.length === 0) return [];
|
|
65704
65871
|
const detailCalls = ids.flatMap((id) => [
|
|
65705
65872
|
{ address: entry.withdrawalContract, name: "getRequest", params: [id] },
|
|
@@ -65719,7 +65886,7 @@ var readerEtherFi = {
|
|
|
65719
65886
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
65720
65887
|
if (!req) continue;
|
|
65721
65888
|
if (!isValid) continue;
|
|
65722
|
-
const amount4 =
|
|
65889
|
+
const amount4 = toBigInt15(req.amountOfEEth);
|
|
65723
65890
|
if (amount4 === void 0) continue;
|
|
65724
65891
|
out.push({
|
|
65725
65892
|
lst: entry.lst,
|
|
@@ -65814,7 +65981,7 @@ var readerKelp = {
|
|
|
65814
65981
|
}
|
|
65815
65982
|
],
|
|
65816
65983
|
abi: [KelpWithdrawalManagerAbi]
|
|
65817
|
-
}).then((res) =>
|
|
65984
|
+
}).then((res) => toBigInt15(res[0]) ?? 0n)
|
|
65818
65985
|
]);
|
|
65819
65986
|
lengths = storageReads;
|
|
65820
65987
|
currentBlock = block;
|
|
@@ -65846,9 +66013,9 @@ var readerKelp = {
|
|
|
65846
66013
|
for (let i = 0; i < detailCalls.length; i++) {
|
|
65847
66014
|
const r = stage2[i];
|
|
65848
66015
|
if (!r) continue;
|
|
65849
|
-
const expected = Array.isArray(r) ?
|
|
65850
|
-
const startBlock = Array.isArray(r) ?
|
|
65851
|
-
const nonce = Array.isArray(r) ?
|
|
66016
|
+
const expected = Array.isArray(r) ? toBigInt15(r[1]) : toBigInt15(r.expectedAssetAmount);
|
|
66017
|
+
const startBlock = Array.isArray(r) ? toBigInt15(r[2]) : toBigInt15(r.withdrawalStartBlock);
|
|
66018
|
+
const nonce = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.userNonce);
|
|
65852
66019
|
if (expected === void 0 || startBlock === void 0) continue;
|
|
65853
66020
|
const claimable = currentBlock >= startBlock + delayBlocks;
|
|
65854
66021
|
out.push({
|
|
@@ -65925,7 +66092,7 @@ var readerLido = {
|
|
|
65925
66092
|
abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
|
|
65926
66093
|
});
|
|
65927
66094
|
const ids = stage1[0];
|
|
65928
|
-
const frontier =
|
|
66095
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65929
66096
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
65930
66097
|
const stage2 = await multicallRetry({
|
|
65931
66098
|
chain: chainId,
|
|
@@ -65942,10 +66109,10 @@ var readerLido = {
|
|
|
65942
66109
|
if (!Array.isArray(statuses)) return [];
|
|
65943
66110
|
const out = [];
|
|
65944
66111
|
for (let i = 0; i < ids.length; i++) {
|
|
65945
|
-
const id =
|
|
66112
|
+
const id = toBigInt15(ids[i]);
|
|
65946
66113
|
const s = statuses[i];
|
|
65947
66114
|
if (id === void 0 || !s) continue;
|
|
65948
|
-
const amountOfStETH =
|
|
66115
|
+
const amountOfStETH = toBigInt15(s.amountOfStETH);
|
|
65949
66116
|
const isFinalized = Boolean(s.isFinalized);
|
|
65950
66117
|
const isClaimed = Boolean(s.isClaimed);
|
|
65951
66118
|
if (amountOfStETH === void 0) continue;
|
|
@@ -66054,11 +66221,11 @@ var readerLista = {
|
|
|
66054
66221
|
const status = stage2[i];
|
|
66055
66222
|
if (!status) continue;
|
|
66056
66223
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
66057
|
-
const bnbAmount = Array.isArray(status) ?
|
|
66058
|
-
const snbnbAmount = Array.isArray(req) ?
|
|
66224
|
+
const bnbAmount = Array.isArray(status) ? toBigInt15(status[1]) : toBigInt15(status._amount);
|
|
66225
|
+
const snbnbAmount = Array.isArray(req) ? toBigInt15(req[1]) : toBigInt15(req?.amountInSnBnb);
|
|
66059
66226
|
const amount4 = bnbAmount ?? snbnbAmount;
|
|
66060
66227
|
if (amount4 === void 0) continue;
|
|
66061
|
-
const uuid = Array.isArray(req) ?
|
|
66228
|
+
const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
|
|
66062
66229
|
out.push({
|
|
66063
66230
|
lst: entry.lst,
|
|
66064
66231
|
brand: entry.brand,
|
|
@@ -66143,7 +66310,7 @@ var readerRenzo = {
|
|
|
66143
66310
|
for (let i = 0; i < count; i++) {
|
|
66144
66311
|
const tup = stage2[i];
|
|
66145
66312
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66146
|
-
const amountToRedeem =
|
|
66313
|
+
const amountToRedeem = toBigInt15(tup[2]);
|
|
66147
66314
|
const createdAt = toNumber(tup[4]);
|
|
66148
66315
|
if (amountToRedeem === void 0 || createdAt === void 0) continue;
|
|
66149
66316
|
const readyAt = createdAt + cooldown;
|
|
@@ -66216,9 +66383,9 @@ var readerStaderEthx2 = {
|
|
|
66216
66383
|
]
|
|
66217
66384
|
});
|
|
66218
66385
|
const ids = stage1[0];
|
|
66219
|
-
const frontier =
|
|
66386
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
66220
66387
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
66221
|
-
const idBigInts = ids.map(
|
|
66388
|
+
const idBigInts = ids.map(toBigInt15).filter((v) => v !== void 0);
|
|
66222
66389
|
const detailCalls = idBigInts.map((id) => ({
|
|
66223
66390
|
address: entry.withdrawalContract,
|
|
66224
66391
|
name: "userWithdrawRequests",
|
|
@@ -66234,8 +66401,8 @@ var readerStaderEthx2 = {
|
|
|
66234
66401
|
const id = idBigInts[i];
|
|
66235
66402
|
const tup = stage2[i];
|
|
66236
66403
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66237
|
-
const ethExpected =
|
|
66238
|
-
const ethFinalized =
|
|
66404
|
+
const ethExpected = toBigInt15(tup[2]) ?? 0n;
|
|
66405
|
+
const ethFinalized = toBigInt15(tup[3]) ?? 0n;
|
|
66239
66406
|
const isFinalized = id < frontier && ethFinalized > 0n;
|
|
66240
66407
|
const queuePosition = isFinalized ? 0 : Number(id - frontier);
|
|
66241
66408
|
out.push({
|
|
@@ -66314,13 +66481,13 @@ var readerStaderMaticX2 = {
|
|
|
66314
66481
|
});
|
|
66315
66482
|
const arr = stage1[0];
|
|
66316
66483
|
if (!Array.isArray(arr)) return [];
|
|
66317
|
-
const currentEpoch = stakeManager ?
|
|
66318
|
-
const delay = stakeManager ?
|
|
66484
|
+
const currentEpoch = stakeManager ? toBigInt15(stage1[1]) ?? 0n : 0n;
|
|
66485
|
+
const delay = stakeManager ? toBigInt15(stage1[2]) ?? 0n : 0n;
|
|
66319
66486
|
const out = [];
|
|
66320
66487
|
for (let i = 0; i < arr.length; i++) {
|
|
66321
66488
|
const r = arr[i];
|
|
66322
|
-
const amount4 =
|
|
66323
|
-
const requestEpoch =
|
|
66489
|
+
const amount4 = toBigInt15(r.amount) ?? 0n;
|
|
66490
|
+
const requestEpoch = toBigInt15(r.requestEpoch);
|
|
66324
66491
|
if (requestEpoch === void 0) continue;
|
|
66325
66492
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
66326
66493
|
out.push({
|
|
@@ -66405,9 +66572,9 @@ var readerMantle = {
|
|
|
66405
66572
|
if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
|
|
66406
66573
|
continue;
|
|
66407
66574
|
}
|
|
66408
|
-
const ethRequested = Array.isArray(detail) ?
|
|
66575
|
+
const ethRequested = Array.isArray(detail) ? toBigInt15(detail[3]) : toBigInt15(detail.ethRequested);
|
|
66409
66576
|
const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
|
|
66410
|
-
const claimable = Array.isArray(info) ?
|
|
66577
|
+
const claimable = Array.isArray(info) ? toBigInt15(info[1]) : toBigInt15(info.claimableAmount);
|
|
66411
66578
|
if (ethRequested === void 0) continue;
|
|
66412
66579
|
out.push({
|
|
66413
66580
|
lst: entry.lst,
|
|
@@ -66486,8 +66653,8 @@ var readerPuffer = {
|
|
|
66486
66653
|
calls,
|
|
66487
66654
|
abi: calls.map(() => PufferWithdrawalManagerAbi)
|
|
66488
66655
|
});
|
|
66489
|
-
const finalizedBatch =
|
|
66490
|
-
const batchSize =
|
|
66656
|
+
const finalizedBatch = toBigInt15(results[detailCalls.length]) ?? 0n;
|
|
66657
|
+
const batchSize = toBigInt15(results[detailCalls.length + 1]) ?? 0n;
|
|
66491
66658
|
const out = [];
|
|
66492
66659
|
const lcUser = user.toLowerCase();
|
|
66493
66660
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -66497,7 +66664,7 @@ var readerPuffer = {
|
|
|
66497
66664
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
66498
66665
|
continue;
|
|
66499
66666
|
}
|
|
66500
|
-
const pufETHAmount = Array.isArray(d) ?
|
|
66667
|
+
const pufETHAmount = Array.isArray(d) ? toBigInt15(d[0]) : toBigInt15(d.pufETHAmount);
|
|
66501
66668
|
if (pufETHAmount === void 0) continue;
|
|
66502
66669
|
const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
|
|
66503
66670
|
const claimable = batchIdx <= finalizedBatch;
|
|
@@ -66595,7 +66762,7 @@ var readerKinetiq = {
|
|
|
66595
66762
|
for (let i = 0; i < count; i++) {
|
|
66596
66763
|
const r = stage2[i];
|
|
66597
66764
|
if (!r) continue;
|
|
66598
|
-
const hypeAmount = Array.isArray(r) ?
|
|
66765
|
+
const hypeAmount = Array.isArray(r) ? toBigInt15(r[0]) : toBigInt15(r.hypeAmount);
|
|
66599
66766
|
const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
|
|
66600
66767
|
if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
|
|
66601
66768
|
continue;
|
|
@@ -66723,7 +66890,7 @@ var readerStakeWise = {
|
|
|
66723
66890
|
const claimedByIdx = /* @__PURE__ */ new Map();
|
|
66724
66891
|
for (let i = 0; i < onChainChecks.length; i++) {
|
|
66725
66892
|
const cell = checkResults[i];
|
|
66726
|
-
const claimed = Array.isArray(cell) ?
|
|
66893
|
+
const claimed = Array.isArray(cell) ? toBigInt15(cell[2]) : toBigInt15(cell?.claimedAssets);
|
|
66727
66894
|
if (claimed !== void 0 && claimed > 0n) {
|
|
66728
66895
|
claimedByIdx.set(onChainChecks[i].idx, claimed);
|
|
66729
66896
|
}
|
|
@@ -66731,7 +66898,7 @@ var readerStakeWise = {
|
|
|
66731
66898
|
const out = [];
|
|
66732
66899
|
for (let i = 0; i < requests.length; i++) {
|
|
66733
66900
|
const r = requests[i];
|
|
66734
|
-
const amount4 =
|
|
66901
|
+
const amount4 = toBigInt15(r.totalAssets) ?? 0n;
|
|
66735
66902
|
const onChainClaimed = claimedByIdx.get(i);
|
|
66736
66903
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
66737
66904
|
out.push({
|
|
@@ -66788,7 +66955,7 @@ var readerStCelo2 = {
|
|
|
66788
66955
|
const timestamps = cell[1] ?? [];
|
|
66789
66956
|
const out = [];
|
|
66790
66957
|
for (let i = 0; i < values.length; i++) {
|
|
66791
|
-
const amount4 =
|
|
66958
|
+
const amount4 = toBigInt15(values[i]);
|
|
66792
66959
|
const readyAt = toNumber(timestamps[i]);
|
|
66793
66960
|
if (amount4 === void 0 || readyAt === void 0) continue;
|
|
66794
66961
|
out.push({
|
|
@@ -66868,7 +67035,7 @@ var readerSwell = {
|
|
|
66868
67035
|
abi: [SwellRswExitAbi, SwellRswExitAbi]
|
|
66869
67036
|
});
|
|
66870
67037
|
const count = toNumber(stage1[0]) ?? 0;
|
|
66871
|
-
const lastProcessed =
|
|
67038
|
+
const lastProcessed = toBigInt15(stage1[1]) ?? 0n;
|
|
66872
67039
|
if (count === 0) return [];
|
|
66873
67040
|
const enumCalls = Array.from({ length: count }, (_3, i) => ({
|
|
66874
67041
|
address: entry.withdrawalContract,
|
|
@@ -66880,7 +67047,7 @@ var readerSwell = {
|
|
|
66880
67047
|
calls: enumCalls,
|
|
66881
67048
|
abi: enumCalls.map(() => SwellRswExitAbi)
|
|
66882
67049
|
});
|
|
66883
|
-
const ids = stage2.map(
|
|
67050
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
66884
67051
|
if (ids.length === 0) return [];
|
|
66885
67052
|
const detailCalls = ids.map((id) => ({
|
|
66886
67053
|
address: entry.withdrawalContract,
|
|
@@ -66897,7 +67064,7 @@ var readerSwell = {
|
|
|
66897
67064
|
const id = ids[i];
|
|
66898
67065
|
const r = stage3[i];
|
|
66899
67066
|
if (!r) continue;
|
|
66900
|
-
const amount4 =
|
|
67067
|
+
const amount4 = toBigInt15(r.amount);
|
|
66901
67068
|
if (amount4 === void 0) continue;
|
|
66902
67069
|
const claimable = id <= lastProcessed;
|
|
66903
67070
|
out.push({
|
|
@@ -66971,14 +67138,14 @@ var readerValantis = {
|
|
|
66971
67138
|
for (let i = 0; i < burns.length; i++) {
|
|
66972
67139
|
const b = burns[i];
|
|
66973
67140
|
if (!b) continue;
|
|
66974
|
-
const amount4 = Array.isArray(b) ?
|
|
67141
|
+
const amount4 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
|
|
66975
67142
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
66976
67143
|
if (amount4 === void 0 || completed) continue;
|
|
66977
67144
|
out.push({
|
|
66978
67145
|
lst: entry.lst,
|
|
66979
67146
|
brand: entry.brand,
|
|
66980
67147
|
symbol: entry.symbol,
|
|
66981
|
-
requestId: String(
|
|
67148
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
66982
67149
|
amountUnderlying: amount4.toString(),
|
|
66983
67150
|
status: redeemable[i] ? "claimable" : "pending"
|
|
66984
67151
|
});
|
|
@@ -67045,8 +67212,8 @@ var readerTreehouseRedemption = {
|
|
|
67045
67212
|
for (let i = 0; i < reqs.length; i++) {
|
|
67046
67213
|
const r = reqs[i];
|
|
67047
67214
|
const startTime = toNumber(r.startTime);
|
|
67048
|
-
const assets =
|
|
67049
|
-
const shares =
|
|
67215
|
+
const assets = toBigInt15(r.assets);
|
|
67216
|
+
const shares = toBigInt15(r.shares);
|
|
67050
67217
|
if (startTime === void 0 || assets === void 0) continue;
|
|
67051
67218
|
const readyAt = startTime + waitingPeriod;
|
|
67052
67219
|
out.push({
|
|
@@ -67129,7 +67296,7 @@ var readerTruFin = {
|
|
|
67129
67296
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
67130
67297
|
continue;
|
|
67131
67298
|
}
|
|
67132
|
-
const amount4 = Array.isArray(w) ?
|
|
67299
|
+
const amount4 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
|
|
67133
67300
|
if (amount4 === void 0 || amount4 === 0n) continue;
|
|
67134
67301
|
out.push({
|
|
67135
67302
|
lst: entry.lst,
|
|
@@ -67225,7 +67392,7 @@ var readerYieldNest = {
|
|
|
67225
67392
|
calls: enumCalls,
|
|
67226
67393
|
abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
|
|
67227
67394
|
});
|
|
67228
|
-
const ids = stage2.map(
|
|
67395
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
67229
67396
|
if (ids.length === 0) return [];
|
|
67230
67397
|
const detailCalls = ids.map((id) => ({
|
|
67231
67398
|
address: entry.withdrawalContract,
|
|
@@ -67244,7 +67411,7 @@ var readerYieldNest = {
|
|
|
67244
67411
|
const id = ids[i];
|
|
67245
67412
|
const r = stage3[i];
|
|
67246
67413
|
if (!r) continue;
|
|
67247
|
-
const amount4 =
|
|
67414
|
+
const amount4 = toBigInt15(r.amount);
|
|
67248
67415
|
const created = toNumber(r.creationTimestamp);
|
|
67249
67416
|
const processed = Boolean(r.processed);
|
|
67250
67417
|
if (amount4 === void 0 || created === void 0) continue;
|
|
@@ -68194,7 +68361,7 @@ var NavOracleReadAbi = [
|
|
|
68194
68361
|
|
|
68195
68362
|
// src/vaults/savings/readers/shared.ts
|
|
68196
68363
|
var ONE_E1814 = 10n ** 18n;
|
|
68197
|
-
var
|
|
68364
|
+
var toBigInt16 = (v) => {
|
|
68198
68365
|
if (v === void 0 || v === null) return void 0;
|
|
68199
68366
|
if (typeof v === "bigint") return v;
|
|
68200
68367
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -68225,9 +68392,9 @@ var readerErc46262 = (entry) => {
|
|
|
68225
68392
|
],
|
|
68226
68393
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
68227
68394
|
parse: ([assets, supply, rate]) => {
|
|
68228
|
-
const totalAssets =
|
|
68229
|
-
const totalSupply =
|
|
68230
|
-
const convertToAssetsRaw =
|
|
68395
|
+
const totalAssets = toBigInt16(assets);
|
|
68396
|
+
const totalSupply = toBigInt16(supply);
|
|
68397
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68231
68398
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68232
68399
|
return void 0;
|
|
68233
68400
|
}
|
|
@@ -68255,13 +68422,13 @@ var readerErc4626Cooldown = (entry) => {
|
|
|
68255
68422
|
],
|
|
68256
68423
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, cooldownAbi],
|
|
68257
68424
|
parse: ([assets, supply, rate, cooldown]) => {
|
|
68258
|
-
const totalAssets =
|
|
68259
|
-
const totalSupply =
|
|
68260
|
-
const convertToAssetsRaw =
|
|
68425
|
+
const totalAssets = toBigInt16(assets);
|
|
68426
|
+
const totalSupply = toBigInt16(supply);
|
|
68427
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68261
68428
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68262
68429
|
return void 0;
|
|
68263
68430
|
}
|
|
68264
|
-
const cooldownSecs =
|
|
68431
|
+
const cooldownSecs = toBigInt16(cooldown);
|
|
68265
68432
|
return {
|
|
68266
68433
|
totalAssets,
|
|
68267
68434
|
totalSupply,
|
|
@@ -68940,13 +69107,13 @@ var readerErc4626Idle = (entry) => {
|
|
|
68940
69107
|
],
|
|
68941
69108
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, BalanceOfAbi],
|
|
68942
69109
|
parse: ([assets, supply, rate, inventoryBalance]) => {
|
|
68943
|
-
const totalAssets =
|
|
68944
|
-
const totalSupply =
|
|
68945
|
-
const convertToAssetsRaw =
|
|
69110
|
+
const totalAssets = toBigInt16(assets);
|
|
69111
|
+
const totalSupply = toBigInt16(supply);
|
|
69112
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68946
69113
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68947
69114
|
return void 0;
|
|
68948
69115
|
}
|
|
68949
|
-
const capacity =
|
|
69116
|
+
const capacity = toBigInt16(inventoryBalance);
|
|
68950
69117
|
return {
|
|
68951
69118
|
totalAssets,
|
|
68952
69119
|
totalSupply,
|
|
@@ -68989,13 +69156,13 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
68989
69156
|
AvailableWithdrawLimitAbi
|
|
68990
69157
|
],
|
|
68991
69158
|
parse: ([assets, supply, rate, withdrawLimit]) => {
|
|
68992
|
-
const totalAssets =
|
|
68993
|
-
const totalSupply =
|
|
68994
|
-
const convertToAssetsRaw =
|
|
69159
|
+
const totalAssets = toBigInt16(assets);
|
|
69160
|
+
const totalSupply = toBigInt16(supply);
|
|
69161
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68995
69162
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68996
69163
|
return void 0;
|
|
68997
69164
|
}
|
|
68998
|
-
const capacity =
|
|
69165
|
+
const capacity = toBigInt16(withdrawLimit);
|
|
68999
69166
|
return {
|
|
69000
69167
|
totalAssets,
|
|
69001
69168
|
totalSupply,
|
|
@@ -69013,6 +69180,7 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
69013
69180
|
// src/vaults/savings/readers/bitfiBfbtc.ts
|
|
69014
69181
|
var BITFI_RATIO_SCALE = 10n ** 8n;
|
|
69015
69182
|
var CLOSED_DEPOSIT_MIN = 10n ** 20n;
|
|
69183
|
+
var CLOSED_FLAT_FEE = 10n ** 8n;
|
|
69016
69184
|
var readerBitfiBfbtc = (entry) => {
|
|
69017
69185
|
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
69018
69186
|
const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
|
|
@@ -69034,18 +69202,25 @@ var readerBitfiBfbtc = (entry) => {
|
|
|
69034
69202
|
BfbtcReadAbi
|
|
69035
69203
|
],
|
|
69036
69204
|
parse: ([supply, ratio, evmFee, nativeFee, minDeposit, paused]) => {
|
|
69037
|
-
const totalSupply =
|
|
69038
|
-
const currentRatio =
|
|
69205
|
+
const totalSupply = toBigInt16(supply);
|
|
69206
|
+
const currentRatio = toBigInt16(ratio);
|
|
69039
69207
|
if (totalSupply === void 0) return void 0;
|
|
69040
69208
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69041
69209
|
const exchangeRate = ONE_E1814 * BITFI_RATIO_SCALE / currentRatio;
|
|
69042
69210
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69043
|
-
const
|
|
69044
|
-
|
|
69045
|
-
|
|
69046
|
-
|
|
69047
|
-
|
|
69048
|
-
|
|
69211
|
+
const feeOf = (cell) => {
|
|
69212
|
+
if (!Array.isArray(cell)) return void 0;
|
|
69213
|
+
const pct3 = toBigInt16(cell[0]);
|
|
69214
|
+
const fixed = toBigInt16(cell[1]);
|
|
69215
|
+
return pct3 === void 0 || fixed === void 0 ? void 0 : { pct: pct3, fixed };
|
|
69216
|
+
};
|
|
69217
|
+
const evm = feeOf(evmFee);
|
|
69218
|
+
const native = feeOf(nativeFee);
|
|
69219
|
+
const routeOpen = (f) => f === void 0 || f.pct < BITFI_FEE_PRECISION && f.fixed < CLOSED_FLAT_FEE;
|
|
69220
|
+
const evmExitEnabled = routeOpen(evm);
|
|
69221
|
+
const nativeExitEnabled = routeOpen(native);
|
|
69222
|
+
const evmPct = evm?.pct;
|
|
69223
|
+
const minDep = toBigInt16(minDeposit);
|
|
69049
69224
|
const depositsClosed = minDep !== void 0 && minDep >= CLOSED_DEPOSIT_MIN;
|
|
69050
69225
|
const isPaused = paused === true;
|
|
69051
69226
|
return {
|
|
@@ -69094,16 +69269,16 @@ var readerBitfiVault = (entry) => {
|
|
|
69094
69269
|
BfusdVaultReadAbi
|
|
69095
69270
|
],
|
|
69096
69271
|
parse: ([assets, supply, ratio, depositRatio, cap, paused]) => {
|
|
69097
|
-
const totalAssets =
|
|
69098
|
-
const totalSupply =
|
|
69099
|
-
const currentRatio =
|
|
69272
|
+
const totalAssets = toBigInt16(assets);
|
|
69273
|
+
const totalSupply = toBigInt16(supply);
|
|
69274
|
+
const currentRatio = toBigInt16(ratio);
|
|
69100
69275
|
if (totalAssets === void 0 || totalSupply === void 0)
|
|
69101
69276
|
return void 0;
|
|
69102
69277
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69103
69278
|
const exchangeRate = currentRatio * ONE_E1814 / BITFI_RATIO_SCALE;
|
|
69104
|
-
const depRatio =
|
|
69279
|
+
const depRatio = toBigInt16(depositRatio);
|
|
69105
69280
|
const fundamentalExchangeRate = depRatio !== void 0 && depRatio > 0n ? depRatio * ONE_E1814 / BITFI_RATIO_SCALE : void 0;
|
|
69106
|
-
const supplyCap =
|
|
69281
|
+
const supplyCap = toBigInt16(cap);
|
|
69107
69282
|
const isPaused = paused === true;
|
|
69108
69283
|
let depositCapacity;
|
|
69109
69284
|
if (isPaused) {
|
|
@@ -69157,13 +69332,13 @@ var readerBitwayVault = (entry) => {
|
|
|
69157
69332
|
BitwayVaultReadAbi
|
|
69158
69333
|
],
|
|
69159
69334
|
parse: ([supply, rate, buffer, waitingTime]) => {
|
|
69160
|
-
const totalSupply =
|
|
69161
|
-
const exchangeRate =
|
|
69335
|
+
const totalSupply = toBigInt16(supply);
|
|
69336
|
+
const exchangeRate = toBigInt16(rate);
|
|
69162
69337
|
if (totalSupply === void 0 || exchangeRate === void 0 || exchangeRate === 0n) {
|
|
69163
69338
|
return void 0;
|
|
69164
69339
|
}
|
|
69165
|
-
const capacity =
|
|
69166
|
-
const wait =
|
|
69340
|
+
const capacity = toBigInt16(buffer);
|
|
69341
|
+
const wait = toBigInt16(waitingTime);
|
|
69167
69342
|
return {
|
|
69168
69343
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69169
69344
|
// (Every live leg is 18/18-dec — BSC stables are 18-dec — but the
|
|
@@ -69193,9 +69368,9 @@ var readerFrankencoinSavings = (entry) => ({
|
|
|
69193
69368
|
],
|
|
69194
69369
|
abis: [BalanceOfAbi, FrankencoinSavingsReadAbi],
|
|
69195
69370
|
parse: ([balance, ratePPM]) => {
|
|
69196
|
-
const deposits =
|
|
69371
|
+
const deposits = toBigInt16(balance);
|
|
69197
69372
|
if (deposits === void 0) return void 0;
|
|
69198
|
-
if (
|
|
69373
|
+
if (toBigInt16(ratePPM) === void 0) return void 0;
|
|
69199
69374
|
return {
|
|
69200
69375
|
totalAssets: deposits,
|
|
69201
69376
|
// No shares exist; the "supply" IS the deposited principal, and
|
|
@@ -69239,15 +69414,15 @@ var readerHyperbeatVault = (entry) => {
|
|
|
69239
69414
|
HyperbeatQueueReadAbi
|
|
69240
69415
|
],
|
|
69241
69416
|
parse: ([supply, rate, rateDecimals, inventory, fee, instantPaused]) => {
|
|
69242
|
-
const totalSupply =
|
|
69243
|
-
const rawRate =
|
|
69244
|
-
const rateDec =
|
|
69417
|
+
const totalSupply = toBigInt16(supply);
|
|
69418
|
+
const rawRate = toBigInt16(rate);
|
|
69419
|
+
const rateDec = toBigInt16(rateDecimals);
|
|
69245
69420
|
if (totalSupply === void 0 || rawRate === void 0 || rateDec === void 0 || rawRate === 0n) {
|
|
69246
69421
|
return void 0;
|
|
69247
69422
|
}
|
|
69248
69423
|
const exchangeRate = rateDec <= 18n ? rawRate * 10n ** (18n - rateDec) : rawRate / 10n ** (rateDec - 18n);
|
|
69249
|
-
const capacity =
|
|
69250
|
-
const feeRaw =
|
|
69424
|
+
const capacity = toBigInt16(inventory);
|
|
69425
|
+
const feeRaw = toBigInt16(fee);
|
|
69251
69426
|
return {
|
|
69252
69427
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69253
69428
|
totalAssets: totalSupply * exchangeRate * underlyingUnit / (shareUnit * ONE_E1814),
|
|
@@ -69282,10 +69457,10 @@ var readerNavOracle = (entry) => {
|
|
|
69282
69457
|
],
|
|
69283
69458
|
abis: [TotalSupplyAbi2, NavOracleReadAbi],
|
|
69284
69459
|
parse: ([supply, round]) => {
|
|
69285
|
-
const totalSupply =
|
|
69460
|
+
const totalSupply = toBigInt16(supply);
|
|
69286
69461
|
if (totalSupply === void 0) return void 0;
|
|
69287
69462
|
const raw = Array.isArray(round) ? round[1] : round?.answer;
|
|
69288
|
-
const answer =
|
|
69463
|
+
const answer = toBigInt16(raw);
|
|
69289
69464
|
if (answer === void 0 || answer <= 0n) return void 0;
|
|
69290
69465
|
const exchangeRate = answer * ONE_E1814 / oracleScale;
|
|
69291
69466
|
return {
|
|
@@ -69328,14 +69503,14 @@ var readerNativeWnlp = (entry) => {
|
|
|
69328
69503
|
NativeWithdrawQueueReadAbi
|
|
69329
69504
|
],
|
|
69330
69505
|
parse: ([supply, rate, feeBips, instantEnabled, inventory, window]) => {
|
|
69331
|
-
const totalSupply =
|
|
69332
|
-
const exchangeRate =
|
|
69506
|
+
const totalSupply = toBigInt16(supply);
|
|
69507
|
+
const exchangeRate = toBigInt16(rate);
|
|
69333
69508
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
69334
69509
|
return void 0;
|
|
69335
69510
|
}
|
|
69336
|
-
const capacity =
|
|
69337
|
-
const windowSeconds =
|
|
69338
|
-
const bips =
|
|
69511
|
+
const capacity = toBigInt16(inventory);
|
|
69512
|
+
const windowSeconds = toBigInt16(window);
|
|
69513
|
+
const bips = toBigInt16(feeBips);
|
|
69339
69514
|
return {
|
|
69340
69515
|
totalAssets: totalSupply * exchangeRate / ONE_E1814,
|
|
69341
69516
|
totalSupply,
|
|
@@ -69380,15 +69555,15 @@ var readerSaturnVault = (entry) => {
|
|
|
69380
69555
|
SaturnMinWithdrawalAbi
|
|
69381
69556
|
],
|
|
69382
69557
|
parse: ([assets, supply, rate, previewShares, feeBps, minWithdrawal]) => {
|
|
69383
|
-
const totalAssets =
|
|
69384
|
-
const totalSupply =
|
|
69385
|
-
const convertToAssetsRaw =
|
|
69558
|
+
const totalAssets = toBigInt16(assets);
|
|
69559
|
+
const totalSupply = toBigInt16(supply);
|
|
69560
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69386
69561
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69387
69562
|
return void 0;
|
|
69388
69563
|
}
|
|
69389
|
-
const entryShares =
|
|
69390
|
-
const depositFeeBps =
|
|
69391
|
-
const exitMinAmount =
|
|
69564
|
+
const entryShares = toBigInt16(previewShares);
|
|
69565
|
+
const depositFeeBps = toBigInt16(feeBps);
|
|
69566
|
+
const exitMinAmount = toBigInt16(minWithdrawal);
|
|
69392
69567
|
return {
|
|
69393
69568
|
totalAssets,
|
|
69394
69569
|
totalSupply,
|
|
@@ -69473,17 +69648,17 @@ var readerVenusHub = (entry) => {
|
|
|
69473
69648
|
calls,
|
|
69474
69649
|
abis,
|
|
69475
69650
|
parse: (slice2) => {
|
|
69476
|
-
const totalAssets =
|
|
69477
|
-
const totalSupply =
|
|
69478
|
-
const convertToAssetsRaw =
|
|
69651
|
+
const totalAssets = toBigInt16(slice2[0]);
|
|
69652
|
+
const totalSupply = toBigInt16(slice2[1]);
|
|
69653
|
+
const convertToAssetsRaw = toBigInt16(slice2[2]);
|
|
69479
69654
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69480
69655
|
return void 0;
|
|
69481
69656
|
}
|
|
69482
69657
|
const paused = slice2[4] === true;
|
|
69483
|
-
const maxWithdrawalSize =
|
|
69484
|
-
const redeemFeeBps =
|
|
69485
|
-
const idle =
|
|
69486
|
-
const depositCapacity =
|
|
69658
|
+
const maxWithdrawalSize = toBigInt16(slice2[5]);
|
|
69659
|
+
const redeemFeeBps = toBigInt16(slice2[6]);
|
|
69660
|
+
const idle = toBigInt16(slice2[7]);
|
|
69661
|
+
const depositCapacity = toBigInt16(slice2[3]);
|
|
69487
69662
|
let groupLiquid = 0n;
|
|
69488
69663
|
let weightedBps = 0n;
|
|
69489
69664
|
let rateWeight = 0n;
|
|
@@ -69491,9 +69666,9 @@ var readerVenusHub = (entry) => {
|
|
|
69491
69666
|
let groupsOk = groups.length > 0;
|
|
69492
69667
|
for (let i = 0; i < groups.length; i++) {
|
|
69493
69668
|
const base = 8 + i * 3;
|
|
69494
|
-
const liquid =
|
|
69495
|
-
const assets =
|
|
69496
|
-
const apyBps =
|
|
69669
|
+
const liquid = toBigInt16(slice2[base]);
|
|
69670
|
+
const assets = toBigInt16(slice2[base + 1]);
|
|
69671
|
+
const apyBps = toBigInt16(slice2[base + 2]);
|
|
69497
69672
|
if (liquid === void 0 || assets === void 0 || apyBps === void 0) {
|
|
69498
69673
|
groupsOk = false;
|
|
69499
69674
|
continue;
|
|
@@ -69536,12 +69711,12 @@ var readerVenusHub = (entry) => {
|
|
|
69536
69711
|
};
|
|
69537
69712
|
};
|
|
69538
69713
|
var parseStrandedRewards = (slice2, base, coreGroupAssets, hubTotalAssets) => {
|
|
69539
|
-
const blocksPerYear =
|
|
69540
|
-
const supplySpeed =
|
|
69541
|
-
const rewardPrice =
|
|
69542
|
-
const underlyingPrice =
|
|
69543
|
-
const vTokenSupply =
|
|
69544
|
-
const exchangeRateStored =
|
|
69714
|
+
const blocksPerYear = toBigInt16(slice2[base]);
|
|
69715
|
+
const supplySpeed = toBigInt16(slice2[base + 1]);
|
|
69716
|
+
const rewardPrice = toBigInt16(slice2[base + 2]);
|
|
69717
|
+
const underlyingPrice = toBigInt16(slice2[base + 3]);
|
|
69718
|
+
const vTokenSupply = toBigInt16(slice2[base + 4]);
|
|
69719
|
+
const exchangeRateStored = toBigInt16(slice2[base + 5]);
|
|
69545
69720
|
if (blocksPerYear === void 0 || supplySpeed === void 0 || rewardPrice === void 0 || underlyingPrice === void 0 || vTokenSupply === void 0 || exchangeRateStored === void 0) {
|
|
69546
69721
|
return void 0;
|
|
69547
69722
|
}
|
|
@@ -69567,9 +69742,9 @@ var readerVesperPool = (entry) => {
|
|
|
69567
69742
|
],
|
|
69568
69743
|
abis: [VesperPoolReadAbi, VesperPoolReadAbi, VesperPoolReadAbi],
|
|
69569
69744
|
parse: ([value, supply, pps]) => {
|
|
69570
|
-
const totalAssets =
|
|
69571
|
-
const totalSupply =
|
|
69572
|
-
const pricePerShare =
|
|
69745
|
+
const totalAssets = toBigInt16(value);
|
|
69746
|
+
const totalSupply = toBigInt16(supply);
|
|
69747
|
+
const pricePerShare = toBigInt16(pps);
|
|
69573
69748
|
if (totalAssets === void 0 || totalSupply === void 0) {
|
|
69574
69749
|
return void 0;
|
|
69575
69750
|
}
|
|
@@ -69597,15 +69772,15 @@ var readerWrenNav = (entry) => {
|
|
|
69597
69772
|
],
|
|
69598
69773
|
abis: [TotalSupplyAbi2, WrenNavReadAbi, WrenNavReadAbi, WrenNavReadAbi],
|
|
69599
69774
|
parse: ([supply, burn, nav, burnable]) => {
|
|
69600
|
-
const totalSupply =
|
|
69601
|
-
const navPrice =
|
|
69775
|
+
const totalSupply = toBigInt16(supply);
|
|
69776
|
+
const navPrice = toBigInt16(nav);
|
|
69602
69777
|
if (totalSupply === void 0) return void 0;
|
|
69603
69778
|
if (navPrice === void 0 || navPrice <= 0n) return void 0;
|
|
69604
|
-
const burncost =
|
|
69779
|
+
const burncost = toBigInt16(burn);
|
|
69605
69780
|
const hasBurncost = burncost !== void 0 && burncost > 0n;
|
|
69606
69781
|
const exchangeRate = hasBurncost ? burncost : navPrice;
|
|
69607
69782
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69608
|
-
const burnFlag =
|
|
69783
|
+
const burnFlag = toBigInt16(burnable);
|
|
69609
69784
|
const instantRedeemEnabled = burnFlag === void 0 ? true : burnFlag > 0n;
|
|
69610
69785
|
return {
|
|
69611
69786
|
totalAssets,
|
|
@@ -69639,17 +69814,17 @@ var readerYieldBasisLt = (entry) => {
|
|
|
69639
69814
|
YieldBasisAmmReadAbi
|
|
69640
69815
|
],
|
|
69641
69816
|
parse: ([supply, pps, redeemPerShare, maxDebt, valueOracle]) => {
|
|
69642
|
-
const totalSupply =
|
|
69643
|
-
const fundamental =
|
|
69644
|
-
const redeemRaw =
|
|
69817
|
+
const totalSupply = toBigInt16(supply);
|
|
69818
|
+
const fundamental = toBigInt16(pps);
|
|
69819
|
+
const redeemRaw = toBigInt16(redeemPerShare);
|
|
69645
69820
|
if (totalSupply === void 0 || fundamental === void 0 || redeemRaw === void 0) {
|
|
69646
69821
|
return void 0;
|
|
69647
69822
|
}
|
|
69648
69823
|
if (totalSupply === 0n || redeemRaw === 0n) return void 0;
|
|
69649
69824
|
const totalAssets = totalSupply * redeemRaw / ONE_SHARE;
|
|
69650
69825
|
const exchangeRate = redeemRaw * ONE_E1814 / underlyingUnit;
|
|
69651
|
-
const equity = Array.isArray(valueOracle) ?
|
|
69652
|
-
const cap =
|
|
69826
|
+
const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
|
|
69827
|
+
const cap = toBigInt16(maxDebt);
|
|
69653
69828
|
let depositCapacity;
|
|
69654
69829
|
if (cap !== void 0 && equity !== void 0 && equity > 0n) {
|
|
69655
69830
|
const headroom = cap / 2n - equity;
|
|
@@ -69718,6 +69893,36 @@ var resolveSelfOnly = (chainId, vault) => {
|
|
|
69718
69893
|
var withSelfOnly = (routes2, selfOnly) => selfOnly === void 0 ? routes2 : routes2.map(
|
|
69719
69894
|
(r) => r.kind === "market" || r.selfOnly !== void 0 ? r : { ...r, selfOnly }
|
|
69720
69895
|
);
|
|
69896
|
+
var bitfiExitRoutes = (exit, waitSeconds) => {
|
|
69897
|
+
if (!exit) return void 0;
|
|
69898
|
+
const routes2 = [];
|
|
69899
|
+
if (exit.evmExitEnabled) {
|
|
69900
|
+
routes2.push({
|
|
69901
|
+
id: "queued",
|
|
69902
|
+
kind: "queued",
|
|
69903
|
+
label: "Queued (multisig-approved)",
|
|
69904
|
+
settlement: "async",
|
|
69905
|
+
// The proportional fee is 0 on every open leg; the flat per-request fee
|
|
69906
|
+
// (0.000006–0.00009 bfBTC by chain) is stated on the row.
|
|
69907
|
+
feeBps: 0,
|
|
69908
|
+
waitSeconds,
|
|
69909
|
+
description: "Burns the bfBTC and books a request that BitFi's Safe must approve before it can be claimed; no on-chain deadline."
|
|
69910
|
+
});
|
|
69911
|
+
}
|
|
69912
|
+
if (exit.nativeExitEnabled) {
|
|
69913
|
+
routes2.push({
|
|
69914
|
+
id: "queued-bitcoin",
|
|
69915
|
+
kind: "queued",
|
|
69916
|
+
label: "Bitcoin network",
|
|
69917
|
+
settlement: "async",
|
|
69918
|
+
feeBps: 0,
|
|
69919
|
+
waitSeconds,
|
|
69920
|
+
selfOnly: true,
|
|
69921
|
+
description: "Pays BTC on the Bitcoin network to an address you supply, settled by BitFi off-chain \u2014 there is no on-chain claim and no way to correct a wrong address."
|
|
69922
|
+
});
|
|
69923
|
+
}
|
|
69924
|
+
return routes2;
|
|
69925
|
+
};
|
|
69721
69926
|
var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList = {}) => {
|
|
69722
69927
|
const entries = getSavingsRegistry(chainId);
|
|
69723
69928
|
if (entries.length === 0) return {};
|
|
@@ -69853,7 +70058,10 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
69853
70058
|
// fee is left ABSENT rather than 0 because "not published" and "free"
|
|
69854
70059
|
// are different claims and only some protocols make the second.
|
|
69855
70060
|
exitRoutes: withSelfOnly(
|
|
69856
|
-
|
|
70061
|
+
bitfiExitRoutes(
|
|
70062
|
+
state.bitfiExit,
|
|
70063
|
+
state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds
|
|
70064
|
+
) ?? deriveExitRoutes({
|
|
69857
70065
|
withdrawalMode: entry.withdrawalMode,
|
|
69858
70066
|
withdrawFeeBps: state.withdrawFeeBps,
|
|
69859
70067
|
withdrawalCooldownSeconds: state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds,
|
|
@@ -70234,7 +70442,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
|
|
|
70234
70442
|
|
|
70235
70443
|
// src/vaults/aave-earn/fetchPublic.ts
|
|
70236
70444
|
var BRAND2 = "Aave";
|
|
70237
|
-
var
|
|
70445
|
+
var toBigInt17 = (v) => {
|
|
70238
70446
|
if (v === void 0 || v === null) return void 0;
|
|
70239
70447
|
if (typeof v === "bigint") return v;
|
|
70240
70448
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -70294,15 +70502,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
70294
70502
|
const token = v.usedReserve.underlyingToken;
|
|
70295
70503
|
const underlyingLc = token.address.toLowerCase();
|
|
70296
70504
|
const assetDecimals = token.decimals;
|
|
70297
|
-
const shareDecOnChain =
|
|
70505
|
+
const shareDecOnChain = toBigInt17(slice2[1]);
|
|
70298
70506
|
const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
|
|
70299
|
-
const totalSupply =
|
|
70507
|
+
const totalSupply = toBigInt17(slice2[2]);
|
|
70300
70508
|
if (totalSupply === void 0) continue;
|
|
70301
70509
|
const shareUnit = 10n ** BigInt(decimals);
|
|
70302
70510
|
const underlyingUnit = 10n ** BigInt(assetDecimals);
|
|
70303
|
-
const convertToAssets =
|
|
70511
|
+
const convertToAssets = toBigInt17(slice2[3]) ?? 0n;
|
|
70304
70512
|
const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
|
|
70305
|
-
const totalAssets =
|
|
70513
|
+
const totalAssets = toBigInt17(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
|
|
70306
70514
|
const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
|
|
70307
70515
|
const asset = tokenList[underlyingLc];
|
|
70308
70516
|
const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num7(v.balance.usdPerToken) : void 0);
|
|
@@ -76018,7 +76226,12 @@ function resolveAvailability(meta, maturity) {
|
|
|
76018
76226
|
// door open outward, and a matured bond is precisely the case where the
|
|
76019
76227
|
// holder still needs out. An explicit pause is the one thing that shuts
|
|
76020
76228
|
// both.
|
|
76021
|
-
|
|
76229
|
+
// ...and so is an EMPTY route list. `exitRoutes` is derived for every row
|
|
76230
|
+
// and the invariant is "at least one route", so `[]` is never a default —
|
|
76231
|
+
// it is a reader saying every leg is shut (BitFi publishes its two queues
|
|
76232
|
+
// from live fee flags, and a chain can have both switched off). Absent is
|
|
76233
|
+
// the ordinary case and says nothing.
|
|
76234
|
+
canWithdraw: meta.paused !== true && !(Array.isArray(meta.exitRoutes) && meta.exitRoutes.length === 0),
|
|
76022
76235
|
gating,
|
|
76023
76236
|
reason
|
|
76024
76237
|
};
|