@1delta/margin-fetcher 5.0.77 → 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 +528 -379
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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,
|
|
@@ -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
|
}
|
|
@@ -50134,7 +50236,7 @@ var BFBTC = [
|
|
|
50134
50236
|
exitNote: "The only exit is to Bitcoin (flat 0.00002 bfBTC) \u2014 the EVM route is switched off by a 100 % fee"
|
|
50135
50237
|
}
|
|
50136
50238
|
];
|
|
50137
|
-
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}.`;
|
|
50138
50240
|
var BITFI_ENTRIES = {
|
|
50139
50241
|
...Object.fromEntries(
|
|
50140
50242
|
BFBTC.map((row) => [
|
|
@@ -53585,10 +53687,11 @@ var LENDING_ONLY_FETCHERS = [
|
|
|
53585
53687
|
ethZeroFetcher,
|
|
53586
53688
|
jitoSolFetcher,
|
|
53587
53689
|
thbillFetcher,
|
|
53588
|
-
// sthusdFetcher / scrvusdFetcher are NOT here
|
|
53589
|
-
// their savings rows, so they reach
|
|
53590
|
-
// `collectVaultFetchers` (the disjointness rule
|
|
53591
|
-
// 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.
|
|
53592
53695
|
ssuperusdFetcher,
|
|
53593
53696
|
hlpFetcher,
|
|
53594
53697
|
hwhlpFetcher,
|
|
@@ -62593,7 +62696,7 @@ var Multicall3BalanceAbi = [
|
|
|
62593
62696
|
outputs: [{ type: "uint256" }]
|
|
62594
62697
|
}
|
|
62595
62698
|
];
|
|
62596
|
-
var
|
|
62699
|
+
var toBigInt14 = (v) => {
|
|
62597
62700
|
if (v === void 0 || v === null) return void 0;
|
|
62598
62701
|
if (typeof v === "bigint") return v;
|
|
62599
62702
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -62617,12 +62720,12 @@ var readerBeetsStS = (entry) => ({
|
|
|
62617
62720
|
],
|
|
62618
62721
|
abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
|
|
62619
62722
|
parse: ([supply, rate, pool]) => {
|
|
62620
|
-
const totalSupply =
|
|
62621
|
-
const exchangeRate =
|
|
62723
|
+
const totalSupply = toBigInt14(supply);
|
|
62724
|
+
const exchangeRate = toBigInt14(rate);
|
|
62622
62725
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62623
62726
|
return void 0;
|
|
62624
62727
|
}
|
|
62625
|
-
const liquidity =
|
|
62728
|
+
const liquidity = toBigInt14(pool);
|
|
62626
62729
|
return {
|
|
62627
62730
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
62628
62731
|
totalSupply,
|
|
@@ -62663,12 +62766,12 @@ var readerBenqiSavax = (entry) => ({
|
|
|
62663
62766
|
],
|
|
62664
62767
|
abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
|
|
62665
62768
|
parse: ([supply, rate, totalPooled]) => {
|
|
62666
|
-
const totalSupply =
|
|
62667
|
-
const exchangeRate =
|
|
62769
|
+
const totalSupply = toBigInt14(supply);
|
|
62770
|
+
const exchangeRate = toBigInt14(rate);
|
|
62668
62771
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62669
62772
|
return void 0;
|
|
62670
62773
|
}
|
|
62671
|
-
const totalAssets =
|
|
62774
|
+
const totalAssets = toBigInt14(totalPooled) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
62672
62775
|
return {
|
|
62673
62776
|
totalAssets,
|
|
62674
62777
|
totalSupply,
|
|
@@ -62682,7 +62785,7 @@ var readerBgtWrapper1to1 = (entry) => ({
|
|
|
62682
62785
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62683
62786
|
abis: [TotalSupplyAbi],
|
|
62684
62787
|
parse: ([supply]) => {
|
|
62685
|
-
const totalSupply =
|
|
62788
|
+
const totalSupply = toBigInt14(supply);
|
|
62686
62789
|
if (totalSupply === void 0) return void 0;
|
|
62687
62790
|
return {
|
|
62688
62791
|
totalAssets: totalSupply,
|
|
@@ -62711,8 +62814,8 @@ var readerDineroBeraEth = (entry) => ({
|
|
|
62711
62814
|
],
|
|
62712
62815
|
abis: [TotalSupplyAbi, DineroBeraEthAbi],
|
|
62713
62816
|
parse: ([supply, rate]) => {
|
|
62714
|
-
const totalSupply =
|
|
62715
|
-
const exchangeRate =
|
|
62817
|
+
const totalSupply = toBigInt14(supply);
|
|
62818
|
+
const exchangeRate = toBigInt14(rate);
|
|
62716
62819
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62717
62820
|
return void 0;
|
|
62718
62821
|
}
|
|
@@ -62733,9 +62836,9 @@ var readerErc4626 = (entry) => ({
|
|
|
62733
62836
|
],
|
|
62734
62837
|
abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
|
|
62735
62838
|
parse: ([assets, supply, rate]) => {
|
|
62736
|
-
const totalAssets =
|
|
62737
|
-
const totalSupply =
|
|
62738
|
-
const exchangeRate =
|
|
62839
|
+
const totalAssets = toBigInt14(assets);
|
|
62840
|
+
const totalSupply = toBigInt14(supply);
|
|
62841
|
+
const exchangeRate = toBigInt14(rate);
|
|
62739
62842
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62740
62843
|
return void 0;
|
|
62741
62844
|
}
|
|
@@ -62750,9 +62853,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
|
|
|
62750
62853
|
],
|
|
62751
62854
|
abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
|
|
62752
62855
|
parse: ([assets, supply, rate]) => {
|
|
62753
|
-
const totalAssets =
|
|
62754
|
-
const totalSupply =
|
|
62755
|
-
const exchangeRate =
|
|
62856
|
+
const totalAssets = toBigInt14(assets);
|
|
62857
|
+
const totalSupply = toBigInt14(supply);
|
|
62858
|
+
const exchangeRate = toBigInt14(rate);
|
|
62756
62859
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62757
62860
|
return void 0;
|
|
62758
62861
|
}
|
|
@@ -62812,15 +62915,15 @@ var readerEtherFiWeEth = (entry) => {
|
|
|
62812
62915
|
calls,
|
|
62813
62916
|
abis,
|
|
62814
62917
|
parse: (slice2) => {
|
|
62815
|
-
const totalSupply =
|
|
62816
|
-
const exchangeRate =
|
|
62918
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
62919
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
62817
62920
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62818
62921
|
return void 0;
|
|
62819
62922
|
}
|
|
62820
62923
|
let liquidity;
|
|
62821
62924
|
if (lp) {
|
|
62822
|
-
const lpBalance =
|
|
62823
|
-
const locked =
|
|
62925
|
+
const lpBalance = toBigInt14(slice2[2]);
|
|
62926
|
+
const locked = toBigInt14(slice2[3]);
|
|
62824
62927
|
if (lpBalance !== void 0 && locked !== void 0) {
|
|
62825
62928
|
liquidity = lpBalance > locked ? lpBalance - locked : 0n;
|
|
62826
62929
|
}
|
|
@@ -62854,7 +62957,7 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62854
62957
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62855
62958
|
abis: [TotalSupplyAbi],
|
|
62856
62959
|
parse: ([supply]) => {
|
|
62857
|
-
const totalSupply =
|
|
62960
|
+
const totalSupply = toBigInt14(supply);
|
|
62858
62961
|
if (totalSupply === void 0) return void 0;
|
|
62859
62962
|
return {
|
|
62860
62963
|
totalAssets: totalSupply,
|
|
@@ -62871,8 +62974,8 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62871
62974
|
],
|
|
62872
62975
|
abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
|
|
62873
62976
|
parse: ([supply, rate]) => {
|
|
62874
|
-
const totalSupply =
|
|
62875
|
-
const exchangeRate =
|
|
62977
|
+
const totalSupply = toBigInt14(supply);
|
|
62978
|
+
const exchangeRate = toBigInt14(rate);
|
|
62876
62979
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62877
62980
|
return void 0;
|
|
62878
62981
|
}
|
|
@@ -62904,7 +63007,7 @@ var readerKelpRsEth = (entry) => {
|
|
|
62904
63007
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62905
63008
|
abis: [TotalSupplyAbi],
|
|
62906
63009
|
parse: ([supply]) => {
|
|
62907
|
-
const totalSupply =
|
|
63010
|
+
const totalSupply = toBigInt14(supply);
|
|
62908
63011
|
if (totalSupply === void 0) return void 0;
|
|
62909
63012
|
return {
|
|
62910
63013
|
totalAssets: totalSupply,
|
|
@@ -62921,8 +63024,8 @@ var readerKelpRsEth = (entry) => {
|
|
|
62921
63024
|
],
|
|
62922
63025
|
abis: [TotalSupplyAbi, KelpLrtOracleAbi],
|
|
62923
63026
|
parse: ([supply, rate]) => {
|
|
62924
|
-
const totalSupply =
|
|
62925
|
-
const exchangeRate =
|
|
63027
|
+
const totalSupply = toBigInt14(supply);
|
|
63028
|
+
const exchangeRate = toBigInt14(rate);
|
|
62926
63029
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62927
63030
|
return void 0;
|
|
62928
63031
|
}
|
|
@@ -62954,7 +63057,7 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62954
63057
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62955
63058
|
abis: [TotalSupplyAbi],
|
|
62956
63059
|
parse: ([supply]) => {
|
|
62957
|
-
const totalSupply =
|
|
63060
|
+
const totalSupply = toBigInt14(supply);
|
|
62958
63061
|
if (totalSupply === void 0) return void 0;
|
|
62959
63062
|
return {
|
|
62960
63063
|
totalAssets: totalSupply,
|
|
@@ -62971,8 +63074,8 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62971
63074
|
],
|
|
62972
63075
|
abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
|
|
62973
63076
|
parse: ([supply, rate]) => {
|
|
62974
|
-
const totalSupply =
|
|
62975
|
-
const exchangeRate =
|
|
63077
|
+
const totalSupply = toBigInt14(supply);
|
|
63078
|
+
const exchangeRate = toBigInt14(rate);
|
|
62976
63079
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62977
63080
|
return void 0;
|
|
62978
63081
|
}
|
|
@@ -63012,12 +63115,12 @@ var readerLairStKaia = (entry) => ({
|
|
|
63012
63115
|
],
|
|
63013
63116
|
abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
|
|
63014
63117
|
parse: ([supply, rate, totalStaking]) => {
|
|
63015
|
-
const totalSupply =
|
|
63016
|
-
const exchangeRate =
|
|
63118
|
+
const totalSupply = toBigInt14(supply);
|
|
63119
|
+
const exchangeRate = toBigInt14(rate);
|
|
63017
63120
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63018
63121
|
return void 0;
|
|
63019
63122
|
}
|
|
63020
|
-
const totalAssets =
|
|
63123
|
+
const totalAssets = toBigInt14(totalStaking) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
63021
63124
|
return {
|
|
63022
63125
|
totalAssets,
|
|
63023
63126
|
totalSupply,
|
|
@@ -63045,8 +63148,8 @@ var readerLidoWstEth = (entry) => ({
|
|
|
63045
63148
|
],
|
|
63046
63149
|
abis: [TotalSupplyAbi, LidoWstEthAbi],
|
|
63047
63150
|
parse: ([supply, rate]) => {
|
|
63048
|
-
const totalSupply =
|
|
63049
|
-
const exchangeRate =
|
|
63151
|
+
const totalSupply = toBigInt14(supply);
|
|
63152
|
+
const exchangeRate = toBigInt14(rate);
|
|
63050
63153
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63051
63154
|
return void 0;
|
|
63052
63155
|
}
|
|
@@ -63084,7 +63187,7 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63084
63187
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63085
63188
|
abis: [TotalSupplyAbi],
|
|
63086
63189
|
parse: ([supply]) => {
|
|
63087
|
-
const totalSupply =
|
|
63190
|
+
const totalSupply = toBigInt14(supply);
|
|
63088
63191
|
if (totalSupply === void 0) return void 0;
|
|
63089
63192
|
return {
|
|
63090
63193
|
totalAssets: totalSupply,
|
|
@@ -63102,12 +63205,12 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63102
63205
|
],
|
|
63103
63206
|
abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
|
|
63104
63207
|
parse: ([supply, rate, pooled]) => {
|
|
63105
|
-
const totalSupply =
|
|
63106
|
-
const exchangeRate =
|
|
63208
|
+
const totalSupply = toBigInt14(supply);
|
|
63209
|
+
const exchangeRate = toBigInt14(rate);
|
|
63107
63210
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63108
63211
|
return void 0;
|
|
63109
63212
|
}
|
|
63110
|
-
const pooledBnb =
|
|
63213
|
+
const pooledBnb = toBigInt14(pooled);
|
|
63111
63214
|
const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E1812;
|
|
63112
63215
|
return { totalAssets, totalSupply, exchangeRate };
|
|
63113
63216
|
}
|
|
@@ -63133,7 +63236,7 @@ var readerMantleMEth = (entry) => {
|
|
|
63133
63236
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63134
63237
|
abis: [TotalSupplyAbi],
|
|
63135
63238
|
parse: ([supply]) => {
|
|
63136
|
-
const totalSupply =
|
|
63239
|
+
const totalSupply = toBigInt14(supply);
|
|
63137
63240
|
if (totalSupply === void 0) return void 0;
|
|
63138
63241
|
return {
|
|
63139
63242
|
totalAssets: totalSupply,
|
|
@@ -63150,8 +63253,8 @@ var readerMantleMEth = (entry) => {
|
|
|
63150
63253
|
],
|
|
63151
63254
|
abis: [TotalSupplyAbi, MantleStakingAbi],
|
|
63152
63255
|
parse: ([supply, rate]) => {
|
|
63153
|
-
const totalSupply =
|
|
63154
|
-
const exchangeRate =
|
|
63256
|
+
const totalSupply = toBigInt14(supply);
|
|
63257
|
+
const exchangeRate = toBigInt14(rate);
|
|
63155
63258
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63156
63259
|
return void 0;
|
|
63157
63260
|
}
|
|
@@ -63172,7 +63275,7 @@ var readerOffChain = (entry) => {
|
|
|
63172
63275
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63173
63276
|
abis: [TotalSupplyAbi],
|
|
63174
63277
|
parse: ([supply]) => {
|
|
63175
|
-
const totalSupply =
|
|
63278
|
+
const totalSupply = toBigInt14(supply);
|
|
63176
63279
|
if (totalSupply === void 0) return void 0;
|
|
63177
63280
|
return {
|
|
63178
63281
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63206,7 +63309,7 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63206
63309
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63207
63310
|
abis: [TotalSupplyAbi],
|
|
63208
63311
|
parse: ([supply]) => {
|
|
63209
|
-
const totalSupply =
|
|
63312
|
+
const totalSupply = toBigInt14(supply);
|
|
63210
63313
|
if (totalSupply === void 0) return void 0;
|
|
63211
63314
|
return {
|
|
63212
63315
|
totalAssets: totalSupply,
|
|
@@ -63223,9 +63326,9 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63223
63326
|
],
|
|
63224
63327
|
abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
|
|
63225
63328
|
parse: ([supply, tvls]) => {
|
|
63226
|
-
const totalSupply =
|
|
63329
|
+
const totalSupply = toBigInt14(supply);
|
|
63227
63330
|
if (totalSupply === void 0 || totalSupply === 0n) return void 0;
|
|
63228
|
-
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ?
|
|
63331
|
+
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt14(tvls[2]) : void 0;
|
|
63229
63332
|
if (totalTvl === void 0) return void 0;
|
|
63230
63333
|
return {
|
|
63231
63334
|
totalAssets: totalTvl,
|
|
@@ -63279,12 +63382,12 @@ var readerRocketReth = (entry) => {
|
|
|
63279
63382
|
calls,
|
|
63280
63383
|
abis,
|
|
63281
63384
|
parse: (slice2) => {
|
|
63282
|
-
const totalSupply =
|
|
63283
|
-
const exchangeRate =
|
|
63385
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
63386
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
63284
63387
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63285
63388
|
return void 0;
|
|
63286
63389
|
}
|
|
63287
|
-
const liquidity = depositPool ?
|
|
63390
|
+
const liquidity = depositPool ? toBigInt14(slice2[2]) : void 0;
|
|
63288
63391
|
return {
|
|
63289
63392
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
63290
63393
|
totalSupply,
|
|
@@ -63323,7 +63426,7 @@ var readerStaderEthx = (entry) => {
|
|
|
63323
63426
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63324
63427
|
abis: [TotalSupplyAbi],
|
|
63325
63428
|
parse: ([supply]) => {
|
|
63326
|
-
const totalSupply =
|
|
63429
|
+
const totalSupply = toBigInt14(supply);
|
|
63327
63430
|
if (totalSupply === void 0) return void 0;
|
|
63328
63431
|
return {
|
|
63329
63432
|
totalAssets: totalSupply,
|
|
@@ -63340,8 +63443,8 @@ var readerStaderEthx = (entry) => {
|
|
|
63340
63443
|
],
|
|
63341
63444
|
abis: [TotalSupplyAbi, StaderEthxAbi],
|
|
63342
63445
|
parse: ([supply, rate]) => {
|
|
63343
|
-
const totalSupply =
|
|
63344
|
-
const exchangeRate =
|
|
63446
|
+
const totalSupply = toBigInt14(supply);
|
|
63447
|
+
const exchangeRate = toBigInt14(rate);
|
|
63345
63448
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63346
63449
|
return void 0;
|
|
63347
63450
|
}
|
|
@@ -63369,10 +63472,10 @@ var readerStaderMaticX = (entry) => {
|
|
|
63369
63472
|
],
|
|
63370
63473
|
abis: [TotalSupplyAbi, StaderMaticXAbi],
|
|
63371
63474
|
parse: ([supply, tup]) => {
|
|
63372
|
-
const totalSupply =
|
|
63475
|
+
const totalSupply = toBigInt14(supply);
|
|
63373
63476
|
if (!Array.isArray(tup) || tup.length < 3) return void 0;
|
|
63374
|
-
const amountInMatic =
|
|
63375
|
-
const totalPooledMatic =
|
|
63477
|
+
const amountInMatic = toBigInt14(tup[0]);
|
|
63478
|
+
const totalPooledMatic = toBigInt14(tup[2]);
|
|
63376
63479
|
if (totalSupply === void 0 || amountInMatic === void 0) {
|
|
63377
63480
|
return void 0;
|
|
63378
63481
|
}
|
|
@@ -63405,7 +63508,7 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63405
63508
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63406
63509
|
abis: [TotalSupplyAbi],
|
|
63407
63510
|
parse: ([supply]) => {
|
|
63408
|
-
const totalSupply =
|
|
63511
|
+
const totalSupply = toBigInt14(supply);
|
|
63409
63512
|
if (totalSupply === void 0) return void 0;
|
|
63410
63513
|
return {
|
|
63411
63514
|
totalAssets: totalSupply,
|
|
@@ -63422,8 +63525,8 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63422
63525
|
],
|
|
63423
63526
|
abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
|
|
63424
63527
|
parse: ([supply, rate]) => {
|
|
63425
|
-
const totalSupply =
|
|
63426
|
-
const exchangeRate =
|
|
63528
|
+
const totalSupply = toBigInt14(supply);
|
|
63529
|
+
const exchangeRate = toBigInt14(rate);
|
|
63427
63530
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63428
63531
|
return void 0;
|
|
63429
63532
|
}
|
|
@@ -63455,7 +63558,7 @@ var readerStCelo = (entry) => {
|
|
|
63455
63558
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63456
63559
|
abis: [TotalSupplyAbi],
|
|
63457
63560
|
parse: ([supply]) => {
|
|
63458
|
-
const totalSupply =
|
|
63561
|
+
const totalSupply = toBigInt14(supply);
|
|
63459
63562
|
if (totalSupply === void 0) return void 0;
|
|
63460
63563
|
return {
|
|
63461
63564
|
totalAssets: totalSupply,
|
|
@@ -63472,8 +63575,8 @@ var readerStCelo = (entry) => {
|
|
|
63472
63575
|
],
|
|
63473
63576
|
abis: [TotalSupplyAbi, StCeloManagerAbi],
|
|
63474
63577
|
parse: ([supply, rate]) => {
|
|
63475
|
-
const totalSupply =
|
|
63476
|
-
const exchangeRate =
|
|
63578
|
+
const totalSupply = toBigInt14(supply);
|
|
63579
|
+
const exchangeRate = toBigInt14(rate);
|
|
63477
63580
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63478
63581
|
return void 0;
|
|
63479
63582
|
}
|
|
@@ -63505,8 +63608,8 @@ var readerSwellGetRate = (entry) => ({
|
|
|
63505
63608
|
],
|
|
63506
63609
|
abis: [TotalSupplyAbi, SwellGetRateAbi],
|
|
63507
63610
|
parse: ([supply, rate]) => {
|
|
63508
|
-
const totalSupply =
|
|
63509
|
-
const exchangeRate =
|
|
63611
|
+
const totalSupply = toBigInt14(supply);
|
|
63612
|
+
const exchangeRate = toBigInt14(rate);
|
|
63510
63613
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63511
63614
|
return void 0;
|
|
63512
63615
|
}
|
|
@@ -63537,7 +63640,7 @@ var readerValantisWstHype = (entry) => {
|
|
|
63537
63640
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63538
63641
|
abis: [TotalSupplyAbi],
|
|
63539
63642
|
parse: ([supply]) => {
|
|
63540
|
-
const totalSupply =
|
|
63643
|
+
const totalSupply = toBigInt14(supply);
|
|
63541
63644
|
if (totalSupply === void 0) return void 0;
|
|
63542
63645
|
return {
|
|
63543
63646
|
totalAssets: totalSupply,
|
|
@@ -63554,8 +63657,8 @@ var readerValantisWstHype = (entry) => {
|
|
|
63554
63657
|
],
|
|
63555
63658
|
abis: [TotalSupplyAbi, ValantisStHypeAbi],
|
|
63556
63659
|
parse: ([supply, rate]) => {
|
|
63557
|
-
const totalSupply =
|
|
63558
|
-
const exchangeRate =
|
|
63660
|
+
const totalSupply = toBigInt14(supply);
|
|
63661
|
+
const exchangeRate = toBigInt14(rate);
|
|
63559
63662
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63560
63663
|
return void 0;
|
|
63561
63664
|
}
|
|
@@ -63589,7 +63692,7 @@ var readerVedaAccountant = (entry) => {
|
|
|
63589
63692
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63590
63693
|
abis: [TotalSupplyAbi],
|
|
63591
63694
|
parse: ([supply]) => {
|
|
63592
|
-
const totalSupply =
|
|
63695
|
+
const totalSupply = toBigInt14(supply);
|
|
63593
63696
|
if (totalSupply === void 0) return void 0;
|
|
63594
63697
|
return {
|
|
63595
63698
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63607,8 +63710,8 @@ var readerVedaAccountant = (entry) => {
|
|
|
63607
63710
|
],
|
|
63608
63711
|
abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
|
|
63609
63712
|
parse: ([supply, rate]) => {
|
|
63610
|
-
const totalSupply =
|
|
63611
|
-
const rawRate =
|
|
63713
|
+
const totalSupply = toBigInt14(supply);
|
|
63714
|
+
const rawRate = toBigInt14(rate);
|
|
63612
63715
|
if (totalSupply === void 0 || rawRate === void 0) return void 0;
|
|
63613
63716
|
const exchangeRate = rawRate * scale3;
|
|
63614
63717
|
return {
|
|
@@ -63643,8 +63746,8 @@ var readerAnkrRatio = (entry) => ({
|
|
|
63643
63746
|
],
|
|
63644
63747
|
abis: [TotalSupplyAbi, AnkrRatioAbi],
|
|
63645
63748
|
parse: ([supply, ratio]) => {
|
|
63646
|
-
const totalSupply =
|
|
63647
|
-
const r =
|
|
63749
|
+
const totalSupply = toBigInt14(supply);
|
|
63750
|
+
const r = toBigInt14(ratio);
|
|
63648
63751
|
if (totalSupply === void 0 || r === void 0 || r === 0n) {
|
|
63649
63752
|
return void 0;
|
|
63650
63753
|
}
|
|
@@ -63675,8 +63778,8 @@ var readerBinanceWbeth = (entry) => ({
|
|
|
63675
63778
|
],
|
|
63676
63779
|
abis: [TotalSupplyAbi, WbethExchangeRateAbi],
|
|
63677
63780
|
parse: ([supply, rate]) => {
|
|
63678
|
-
const totalSupply =
|
|
63679
|
-
const exchangeRate =
|
|
63781
|
+
const totalSupply = toBigInt14(supply);
|
|
63782
|
+
const exchangeRate = toBigInt14(rate);
|
|
63680
63783
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63681
63784
|
return void 0;
|
|
63682
63785
|
}
|
|
@@ -63719,8 +63822,8 @@ var readerCoreEarnRate = (entry) => {
|
|
|
63719
63822
|
],
|
|
63720
63823
|
abis: [CoreEarnRateAbi, TotalSupplyAbi],
|
|
63721
63824
|
parse: ([rate, supply]) => {
|
|
63722
|
-
const r =
|
|
63723
|
-
const totalSupply =
|
|
63825
|
+
const r = toBigInt14(rate);
|
|
63826
|
+
const totalSupply = toBigInt14(supply);
|
|
63724
63827
|
if (r === void 0 || r === 0n || totalSupply === void 0) {
|
|
63725
63828
|
return void 0;
|
|
63726
63829
|
}
|
|
@@ -63741,8 +63844,8 @@ var readerCoreStakedRatio = (entry) => {
|
|
|
63741
63844
|
],
|
|
63742
63845
|
abis: [CoreTotalStakedAbi, TotalSupplyAbi],
|
|
63743
63846
|
parse: ([staked, supply]) => {
|
|
63744
|
-
const totalStaked =
|
|
63745
|
-
const totalSupply =
|
|
63847
|
+
const totalStaked = toBigInt14(staked);
|
|
63848
|
+
const totalSupply = toBigInt14(supply);
|
|
63746
63849
|
if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
|
|
63747
63850
|
return void 0;
|
|
63748
63851
|
}
|
|
@@ -63781,8 +63884,8 @@ var readerKintsuSMon = (entry) => ({
|
|
|
63781
63884
|
],
|
|
63782
63885
|
abis: [KintsuSMonAbi, KintsuSMonAbi],
|
|
63783
63886
|
parse: ([pooled, shares]) => {
|
|
63784
|
-
const totalAssets =
|
|
63785
|
-
const totalSupply =
|
|
63887
|
+
const totalAssets = toBigInt14(pooled);
|
|
63888
|
+
const totalSupply = toBigInt14(shares);
|
|
63786
63889
|
if (totalAssets === void 0 || totalSupply === void 0) return void 0;
|
|
63787
63890
|
const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E1812 / totalSupply : ONE_E1812;
|
|
63788
63891
|
return { totalAssets, totalSupply, exchangeRate };
|
|
@@ -63890,18 +63993,18 @@ var readerTreehouseTAsset = (entry) => {
|
|
|
63890
63993
|
queueFee,
|
|
63891
63994
|
queueMin
|
|
63892
63995
|
] = slice2;
|
|
63893
|
-
const totalAssets =
|
|
63894
|
-
const totalSupply =
|
|
63895
|
-
const exchangeRate =
|
|
63996
|
+
const totalAssets = toBigInt14(assets);
|
|
63997
|
+
const totalSupply = toBigInt14(supply);
|
|
63998
|
+
const exchangeRate = toBigInt14(rate);
|
|
63896
63999
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
63897
64000
|
return void 0;
|
|
63898
64001
|
}
|
|
63899
|
-
const liquidity =
|
|
63900
|
-
const wait =
|
|
63901
|
-
const instantFeeBps = asBps(
|
|
63902
|
-
const queuedFeeBps = asBps(
|
|
63903
|
-
const instantMin =
|
|
63904
|
-
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);
|
|
63905
64008
|
const instant = {
|
|
63906
64009
|
id: "instant",
|
|
63907
64010
|
kind: "instant",
|
|
@@ -64587,7 +64690,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
64587
64690
|
const validatorsByAddress = new Map(validatorEntries);
|
|
64588
64691
|
const idleByAddress = /* @__PURE__ */ new Map();
|
|
64589
64692
|
idleEntries.forEach((e, i) => {
|
|
64590
|
-
const bal =
|
|
64693
|
+
const bal = toBigInt14(idleResults[i]);
|
|
64591
64694
|
if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
|
|
64592
64695
|
});
|
|
64593
64696
|
const rawResults = new Array(allCalls.length);
|
|
@@ -64745,7 +64848,7 @@ var BeetsStSWithdrawalAbi = [
|
|
|
64745
64848
|
];
|
|
64746
64849
|
|
|
64747
64850
|
// src/vaults/lst/withdrawals/readers/shared.ts
|
|
64748
|
-
var
|
|
64851
|
+
var toBigInt15 = (v) => {
|
|
64749
64852
|
if (v === void 0 || v === null) return void 0;
|
|
64750
64853
|
if (typeof v === "bigint") return v;
|
|
64751
64854
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -64760,7 +64863,7 @@ var toBigInt14 = (v) => {
|
|
|
64760
64863
|
return void 0;
|
|
64761
64864
|
};
|
|
64762
64865
|
var toNumber = (v) => {
|
|
64763
|
-
const b =
|
|
64866
|
+
const b = toBigInt15(v);
|
|
64764
64867
|
if (b === void 0) return void 0;
|
|
64765
64868
|
if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
|
|
64766
64869
|
return Number(b);
|
|
@@ -64797,7 +64900,7 @@ var readerBeets = {
|
|
|
64797
64900
|
const out = [];
|
|
64798
64901
|
for (let i = 0; i < reqs.length; i++) {
|
|
64799
64902
|
const r = reqs[i];
|
|
64800
|
-
const amount4 =
|
|
64903
|
+
const amount4 = toBigInt15(r.assetAmount);
|
|
64801
64904
|
const ts = toNumber(r.requestTimestamp);
|
|
64802
64905
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
64803
64906
|
if (amount4 === void 0 || ts === void 0) continue;
|
|
@@ -64889,13 +64992,13 @@ var readerBeHype = {
|
|
|
64889
64992
|
const q = stage2[i * 2];
|
|
64890
64993
|
const canClaim = Boolean(stage2[i * 2 + 1]);
|
|
64891
64994
|
if (!q) continue;
|
|
64892
|
-
const hypeAmount = Array.isArray(q) ?
|
|
64995
|
+
const hypeAmount = Array.isArray(q) ? toBigInt15(q[2]) : toBigInt15(q.hypeAmount);
|
|
64893
64996
|
if (hypeAmount === void 0) continue;
|
|
64894
64997
|
out.push({
|
|
64895
64998
|
lst: entry.lst,
|
|
64896
64999
|
brand: entry.brand,
|
|
64897
65000
|
symbol: entry.symbol,
|
|
64898
|
-
requestId: String(
|
|
65001
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
64899
65002
|
amountUnderlying: hypeAmount.toString(),
|
|
64900
65003
|
status: canClaim ? "claimable" : "pending"
|
|
64901
65004
|
});
|
|
@@ -64998,7 +65101,7 @@ var readerBenqi = {
|
|
|
64998
65101
|
for (let i = 0; i < reqs.length; i++) {
|
|
64999
65102
|
const r = reqs[i];
|
|
65000
65103
|
const startedAt = toNumber(r.startedAt);
|
|
65001
|
-
const shareAmount =
|
|
65104
|
+
const shareAmount = toBigInt15(r.shareAmount);
|
|
65002
65105
|
if (startedAt === void 0 || shareAmount === void 0) continue;
|
|
65003
65106
|
const readyAt = startedAt + cooldown;
|
|
65004
65107
|
const expiresAt = readyAt + claimWindow;
|
|
@@ -65087,8 +65190,8 @@ var readerBinanceWbeth2 = {
|
|
|
65087
65190
|
for (let i = 0; i < reqs.length; i++) {
|
|
65088
65191
|
const r = reqs[i];
|
|
65089
65192
|
const triggerTime = toNumber(r.triggerTime);
|
|
65090
|
-
const ethAmount =
|
|
65091
|
-
const wbethAmount =
|
|
65193
|
+
const ethAmount = toBigInt15(r.ethAmount);
|
|
65194
|
+
const wbethAmount = toBigInt15(r.wbethAmount);
|
|
65092
65195
|
if (triggerTime === void 0 || ethAmount === void 0) continue;
|
|
65093
65196
|
const readyAt = triggerTime + lockTime;
|
|
65094
65197
|
const claimed = (toNumber(r.claimTime) ?? 0) > 0;
|
|
@@ -65151,8 +65254,8 @@ var readerBeraPaw = {
|
|
|
65151
65254
|
}
|
|
65152
65255
|
const pos = res[0];
|
|
65153
65256
|
if (!pos) return [];
|
|
65154
|
-
const queued = Array.isArray(pos) ?
|
|
65155
|
-
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);
|
|
65156
65259
|
const out = [];
|
|
65157
65260
|
if (available !== void 0 && available > 0n) {
|
|
65158
65261
|
out.push({
|
|
@@ -65234,7 +65337,7 @@ var readerIbera = {
|
|
|
65234
65337
|
return [];
|
|
65235
65338
|
}
|
|
65236
65339
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65237
|
-
const frontier =
|
|
65340
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65238
65341
|
if (length === 0) return [];
|
|
65239
65342
|
const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
|
|
65240
65343
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65258,7 +65361,7 @@ var readerIbera = {
|
|
|
65258
65361
|
const r = stage2[k];
|
|
65259
65362
|
if (!r) continue;
|
|
65260
65363
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
65261
|
-
const amount4 = Array.isArray(r) ?
|
|
65364
|
+
const amount4 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
|
|
65262
65365
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount4 === void 0 || amount4 === 0n) {
|
|
65263
65366
|
continue;
|
|
65264
65367
|
}
|
|
@@ -65331,7 +65434,7 @@ var readerPrimeStaking = {
|
|
|
65331
65434
|
return [];
|
|
65332
65435
|
}
|
|
65333
65436
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65334
|
-
const frontier =
|
|
65437
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65335
65438
|
if (length === 0) return [];
|
|
65336
65439
|
const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
|
|
65337
65440
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65355,7 +65458,7 @@ var readerPrimeStaking = {
|
|
|
65355
65458
|
const r = stage2[k];
|
|
65356
65459
|
if (!r) continue;
|
|
65357
65460
|
const receiver = Array.isArray(r) ? r[1] : r.receiver;
|
|
65358
|
-
const assets = Array.isArray(r) ?
|
|
65461
|
+
const assets = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.assets);
|
|
65359
65462
|
const processed = Array.isArray(r) ? r[4] : r.processed;
|
|
65360
65463
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
|
|
65361
65464
|
continue;
|
|
@@ -65426,8 +65529,8 @@ var readerErc7540 = {
|
|
|
65426
65529
|
],
|
|
65427
65530
|
abi: [Erc7540Abi, Erc7540Abi]
|
|
65428
65531
|
});
|
|
65429
|
-
const pending =
|
|
65430
|
-
const claimable =
|
|
65532
|
+
const pending = toBigInt15(stage1[0]) ?? 0n;
|
|
65533
|
+
const claimable = toBigInt15(stage1[1]) ?? 0n;
|
|
65431
65534
|
const out = [];
|
|
65432
65535
|
if (claimable > 0n) {
|
|
65433
65536
|
const stage2 = await multicallRetry({
|
|
@@ -65441,7 +65544,7 @@ var readerErc7540 = {
|
|
|
65441
65544
|
],
|
|
65442
65545
|
abi: [Erc7540Abi]
|
|
65443
65546
|
});
|
|
65444
|
-
const amount4 =
|
|
65547
|
+
const amount4 = toBigInt15(stage2[0]) ?? claimable;
|
|
65445
65548
|
out.push({
|
|
65446
65549
|
lst: entry.lst,
|
|
65447
65550
|
brand: entry.brand,
|
|
@@ -65498,11 +65601,11 @@ var readerEthenaCooldown = {
|
|
|
65498
65601
|
let cooldownEnd;
|
|
65499
65602
|
let amount4;
|
|
65500
65603
|
if (Array.isArray(cell)) {
|
|
65501
|
-
cooldownEnd =
|
|
65502
|
-
amount4 =
|
|
65604
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65605
|
+
amount4 = toBigInt15(cell[1]);
|
|
65503
65606
|
} else if (cell && typeof cell === "object") {
|
|
65504
|
-
cooldownEnd =
|
|
65505
|
-
amount4 =
|
|
65607
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65608
|
+
amount4 = toBigInt15(cell.underlyingAmount);
|
|
65506
65609
|
}
|
|
65507
65610
|
if (!amount4 || amount4 === 0n) return [];
|
|
65508
65611
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65558,13 +65661,13 @@ var readerSusd3Cooldown = {
|
|
|
65558
65661
|
let windowEnd;
|
|
65559
65662
|
let shares;
|
|
65560
65663
|
if (Array.isArray(cell)) {
|
|
65561
|
-
cooldownEnd =
|
|
65562
|
-
windowEnd =
|
|
65563
|
-
shares =
|
|
65664
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65665
|
+
windowEnd = toBigInt15(cell[1]);
|
|
65666
|
+
shares = toBigInt15(cell[2]);
|
|
65564
65667
|
} else if (cell && typeof cell === "object") {
|
|
65565
|
-
cooldownEnd =
|
|
65566
|
-
windowEnd =
|
|
65567
|
-
shares =
|
|
65668
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65669
|
+
windowEnd = toBigInt15(cell.windowEnd);
|
|
65670
|
+
shares = toBigInt15(cell.shares);
|
|
65568
65671
|
}
|
|
65569
65672
|
if (!shares || shares === 0n) return [];
|
|
65570
65673
|
let amount4 = shares;
|
|
@@ -65576,7 +65679,7 @@ var readerSusd3Cooldown = {
|
|
|
65576
65679
|
],
|
|
65577
65680
|
abi: [Susd3CooldownStatusAbi]
|
|
65578
65681
|
});
|
|
65579
|
-
amount4 =
|
|
65682
|
+
amount4 = toBigInt15(stage2[0]) ?? shares;
|
|
65580
65683
|
} catch {
|
|
65581
65684
|
}
|
|
65582
65685
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65650,12 +65753,12 @@ var readerStrataCooldown = {
|
|
|
65650
65753
|
let claimable;
|
|
65651
65754
|
let nextUnlockAt;
|
|
65652
65755
|
if (Array.isArray(cell)) {
|
|
65653
|
-
pending =
|
|
65654
|
-
claimable =
|
|
65756
|
+
pending = toBigInt15(cell[0]);
|
|
65757
|
+
claimable = toBigInt15(cell[1]);
|
|
65655
65758
|
nextUnlockAt = toNumber(cell[2]);
|
|
65656
65759
|
} else if (cell && typeof cell === "object") {
|
|
65657
|
-
pending =
|
|
65658
|
-
claimable =
|
|
65760
|
+
pending = toBigInt15(cell.pending);
|
|
65761
|
+
claimable = toBigInt15(cell.claimable);
|
|
65659
65762
|
nextUnlockAt = toNumber(cell.nextUnlockAt);
|
|
65660
65763
|
}
|
|
65661
65764
|
const escrow = { withdrawQueue: contracts[i], claimToken: escrowToken };
|
|
@@ -65763,7 +65866,7 @@ var readerEtherFi = {
|
|
|
65763
65866
|
calls: enumCalls,
|
|
65764
65867
|
abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
|
|
65765
65868
|
});
|
|
65766
|
-
const ids = stage2.map(
|
|
65869
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
65767
65870
|
if (ids.length === 0) return [];
|
|
65768
65871
|
const detailCalls = ids.flatMap((id) => [
|
|
65769
65872
|
{ address: entry.withdrawalContract, name: "getRequest", params: [id] },
|
|
@@ -65783,7 +65886,7 @@ var readerEtherFi = {
|
|
|
65783
65886
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
65784
65887
|
if (!req) continue;
|
|
65785
65888
|
if (!isValid) continue;
|
|
65786
|
-
const amount4 =
|
|
65889
|
+
const amount4 = toBigInt15(req.amountOfEEth);
|
|
65787
65890
|
if (amount4 === void 0) continue;
|
|
65788
65891
|
out.push({
|
|
65789
65892
|
lst: entry.lst,
|
|
@@ -65878,7 +65981,7 @@ var readerKelp = {
|
|
|
65878
65981
|
}
|
|
65879
65982
|
],
|
|
65880
65983
|
abi: [KelpWithdrawalManagerAbi]
|
|
65881
|
-
}).then((res) =>
|
|
65984
|
+
}).then((res) => toBigInt15(res[0]) ?? 0n)
|
|
65882
65985
|
]);
|
|
65883
65986
|
lengths = storageReads;
|
|
65884
65987
|
currentBlock = block;
|
|
@@ -65910,9 +66013,9 @@ var readerKelp = {
|
|
|
65910
66013
|
for (let i = 0; i < detailCalls.length; i++) {
|
|
65911
66014
|
const r = stage2[i];
|
|
65912
66015
|
if (!r) continue;
|
|
65913
|
-
const expected = Array.isArray(r) ?
|
|
65914
|
-
const startBlock = Array.isArray(r) ?
|
|
65915
|
-
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);
|
|
65916
66019
|
if (expected === void 0 || startBlock === void 0) continue;
|
|
65917
66020
|
const claimable = currentBlock >= startBlock + delayBlocks;
|
|
65918
66021
|
out.push({
|
|
@@ -65989,7 +66092,7 @@ var readerLido = {
|
|
|
65989
66092
|
abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
|
|
65990
66093
|
});
|
|
65991
66094
|
const ids = stage1[0];
|
|
65992
|
-
const frontier =
|
|
66095
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65993
66096
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
65994
66097
|
const stage2 = await multicallRetry({
|
|
65995
66098
|
chain: chainId,
|
|
@@ -66006,10 +66109,10 @@ var readerLido = {
|
|
|
66006
66109
|
if (!Array.isArray(statuses)) return [];
|
|
66007
66110
|
const out = [];
|
|
66008
66111
|
for (let i = 0; i < ids.length; i++) {
|
|
66009
|
-
const id =
|
|
66112
|
+
const id = toBigInt15(ids[i]);
|
|
66010
66113
|
const s = statuses[i];
|
|
66011
66114
|
if (id === void 0 || !s) continue;
|
|
66012
|
-
const amountOfStETH =
|
|
66115
|
+
const amountOfStETH = toBigInt15(s.amountOfStETH);
|
|
66013
66116
|
const isFinalized = Boolean(s.isFinalized);
|
|
66014
66117
|
const isClaimed = Boolean(s.isClaimed);
|
|
66015
66118
|
if (amountOfStETH === void 0) continue;
|
|
@@ -66118,11 +66221,11 @@ var readerLista = {
|
|
|
66118
66221
|
const status = stage2[i];
|
|
66119
66222
|
if (!status) continue;
|
|
66120
66223
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
66121
|
-
const bnbAmount = Array.isArray(status) ?
|
|
66122
|
-
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);
|
|
66123
66226
|
const amount4 = bnbAmount ?? snbnbAmount;
|
|
66124
66227
|
if (amount4 === void 0) continue;
|
|
66125
|
-
const uuid = Array.isArray(req) ?
|
|
66228
|
+
const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
|
|
66126
66229
|
out.push({
|
|
66127
66230
|
lst: entry.lst,
|
|
66128
66231
|
brand: entry.brand,
|
|
@@ -66207,7 +66310,7 @@ var readerRenzo = {
|
|
|
66207
66310
|
for (let i = 0; i < count; i++) {
|
|
66208
66311
|
const tup = stage2[i];
|
|
66209
66312
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66210
|
-
const amountToRedeem =
|
|
66313
|
+
const amountToRedeem = toBigInt15(tup[2]);
|
|
66211
66314
|
const createdAt = toNumber(tup[4]);
|
|
66212
66315
|
if (amountToRedeem === void 0 || createdAt === void 0) continue;
|
|
66213
66316
|
const readyAt = createdAt + cooldown;
|
|
@@ -66280,9 +66383,9 @@ var readerStaderEthx2 = {
|
|
|
66280
66383
|
]
|
|
66281
66384
|
});
|
|
66282
66385
|
const ids = stage1[0];
|
|
66283
|
-
const frontier =
|
|
66386
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
66284
66387
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
66285
|
-
const idBigInts = ids.map(
|
|
66388
|
+
const idBigInts = ids.map(toBigInt15).filter((v) => v !== void 0);
|
|
66286
66389
|
const detailCalls = idBigInts.map((id) => ({
|
|
66287
66390
|
address: entry.withdrawalContract,
|
|
66288
66391
|
name: "userWithdrawRequests",
|
|
@@ -66298,8 +66401,8 @@ var readerStaderEthx2 = {
|
|
|
66298
66401
|
const id = idBigInts[i];
|
|
66299
66402
|
const tup = stage2[i];
|
|
66300
66403
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66301
|
-
const ethExpected =
|
|
66302
|
-
const ethFinalized =
|
|
66404
|
+
const ethExpected = toBigInt15(tup[2]) ?? 0n;
|
|
66405
|
+
const ethFinalized = toBigInt15(tup[3]) ?? 0n;
|
|
66303
66406
|
const isFinalized = id < frontier && ethFinalized > 0n;
|
|
66304
66407
|
const queuePosition = isFinalized ? 0 : Number(id - frontier);
|
|
66305
66408
|
out.push({
|
|
@@ -66378,13 +66481,13 @@ var readerStaderMaticX2 = {
|
|
|
66378
66481
|
});
|
|
66379
66482
|
const arr = stage1[0];
|
|
66380
66483
|
if (!Array.isArray(arr)) return [];
|
|
66381
|
-
const currentEpoch = stakeManager ?
|
|
66382
|
-
const delay = stakeManager ?
|
|
66484
|
+
const currentEpoch = stakeManager ? toBigInt15(stage1[1]) ?? 0n : 0n;
|
|
66485
|
+
const delay = stakeManager ? toBigInt15(stage1[2]) ?? 0n : 0n;
|
|
66383
66486
|
const out = [];
|
|
66384
66487
|
for (let i = 0; i < arr.length; i++) {
|
|
66385
66488
|
const r = arr[i];
|
|
66386
|
-
const amount4 =
|
|
66387
|
-
const requestEpoch =
|
|
66489
|
+
const amount4 = toBigInt15(r.amount) ?? 0n;
|
|
66490
|
+
const requestEpoch = toBigInt15(r.requestEpoch);
|
|
66388
66491
|
if (requestEpoch === void 0) continue;
|
|
66389
66492
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
66390
66493
|
out.push({
|
|
@@ -66469,9 +66572,9 @@ var readerMantle = {
|
|
|
66469
66572
|
if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
|
|
66470
66573
|
continue;
|
|
66471
66574
|
}
|
|
66472
|
-
const ethRequested = Array.isArray(detail) ?
|
|
66575
|
+
const ethRequested = Array.isArray(detail) ? toBigInt15(detail[3]) : toBigInt15(detail.ethRequested);
|
|
66473
66576
|
const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
|
|
66474
|
-
const claimable = Array.isArray(info) ?
|
|
66577
|
+
const claimable = Array.isArray(info) ? toBigInt15(info[1]) : toBigInt15(info.claimableAmount);
|
|
66475
66578
|
if (ethRequested === void 0) continue;
|
|
66476
66579
|
out.push({
|
|
66477
66580
|
lst: entry.lst,
|
|
@@ -66550,8 +66653,8 @@ var readerPuffer = {
|
|
|
66550
66653
|
calls,
|
|
66551
66654
|
abi: calls.map(() => PufferWithdrawalManagerAbi)
|
|
66552
66655
|
});
|
|
66553
|
-
const finalizedBatch =
|
|
66554
|
-
const batchSize =
|
|
66656
|
+
const finalizedBatch = toBigInt15(results[detailCalls.length]) ?? 0n;
|
|
66657
|
+
const batchSize = toBigInt15(results[detailCalls.length + 1]) ?? 0n;
|
|
66555
66658
|
const out = [];
|
|
66556
66659
|
const lcUser = user.toLowerCase();
|
|
66557
66660
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -66561,7 +66664,7 @@ var readerPuffer = {
|
|
|
66561
66664
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
66562
66665
|
continue;
|
|
66563
66666
|
}
|
|
66564
|
-
const pufETHAmount = Array.isArray(d) ?
|
|
66667
|
+
const pufETHAmount = Array.isArray(d) ? toBigInt15(d[0]) : toBigInt15(d.pufETHAmount);
|
|
66565
66668
|
if (pufETHAmount === void 0) continue;
|
|
66566
66669
|
const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
|
|
66567
66670
|
const claimable = batchIdx <= finalizedBatch;
|
|
@@ -66659,7 +66762,7 @@ var readerKinetiq = {
|
|
|
66659
66762
|
for (let i = 0; i < count; i++) {
|
|
66660
66763
|
const r = stage2[i];
|
|
66661
66764
|
if (!r) continue;
|
|
66662
|
-
const hypeAmount = Array.isArray(r) ?
|
|
66765
|
+
const hypeAmount = Array.isArray(r) ? toBigInt15(r[0]) : toBigInt15(r.hypeAmount);
|
|
66663
66766
|
const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
|
|
66664
66767
|
if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
|
|
66665
66768
|
continue;
|
|
@@ -66787,7 +66890,7 @@ var readerStakeWise = {
|
|
|
66787
66890
|
const claimedByIdx = /* @__PURE__ */ new Map();
|
|
66788
66891
|
for (let i = 0; i < onChainChecks.length; i++) {
|
|
66789
66892
|
const cell = checkResults[i];
|
|
66790
|
-
const claimed = Array.isArray(cell) ?
|
|
66893
|
+
const claimed = Array.isArray(cell) ? toBigInt15(cell[2]) : toBigInt15(cell?.claimedAssets);
|
|
66791
66894
|
if (claimed !== void 0 && claimed > 0n) {
|
|
66792
66895
|
claimedByIdx.set(onChainChecks[i].idx, claimed);
|
|
66793
66896
|
}
|
|
@@ -66795,7 +66898,7 @@ var readerStakeWise = {
|
|
|
66795
66898
|
const out = [];
|
|
66796
66899
|
for (let i = 0; i < requests.length; i++) {
|
|
66797
66900
|
const r = requests[i];
|
|
66798
|
-
const amount4 =
|
|
66901
|
+
const amount4 = toBigInt15(r.totalAssets) ?? 0n;
|
|
66799
66902
|
const onChainClaimed = claimedByIdx.get(i);
|
|
66800
66903
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
66801
66904
|
out.push({
|
|
@@ -66852,7 +66955,7 @@ var readerStCelo2 = {
|
|
|
66852
66955
|
const timestamps = cell[1] ?? [];
|
|
66853
66956
|
const out = [];
|
|
66854
66957
|
for (let i = 0; i < values.length; i++) {
|
|
66855
|
-
const amount4 =
|
|
66958
|
+
const amount4 = toBigInt15(values[i]);
|
|
66856
66959
|
const readyAt = toNumber(timestamps[i]);
|
|
66857
66960
|
if (amount4 === void 0 || readyAt === void 0) continue;
|
|
66858
66961
|
out.push({
|
|
@@ -66932,7 +67035,7 @@ var readerSwell = {
|
|
|
66932
67035
|
abi: [SwellRswExitAbi, SwellRswExitAbi]
|
|
66933
67036
|
});
|
|
66934
67037
|
const count = toNumber(stage1[0]) ?? 0;
|
|
66935
|
-
const lastProcessed =
|
|
67038
|
+
const lastProcessed = toBigInt15(stage1[1]) ?? 0n;
|
|
66936
67039
|
if (count === 0) return [];
|
|
66937
67040
|
const enumCalls = Array.from({ length: count }, (_3, i) => ({
|
|
66938
67041
|
address: entry.withdrawalContract,
|
|
@@ -66944,7 +67047,7 @@ var readerSwell = {
|
|
|
66944
67047
|
calls: enumCalls,
|
|
66945
67048
|
abi: enumCalls.map(() => SwellRswExitAbi)
|
|
66946
67049
|
});
|
|
66947
|
-
const ids = stage2.map(
|
|
67050
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
66948
67051
|
if (ids.length === 0) return [];
|
|
66949
67052
|
const detailCalls = ids.map((id) => ({
|
|
66950
67053
|
address: entry.withdrawalContract,
|
|
@@ -66961,7 +67064,7 @@ var readerSwell = {
|
|
|
66961
67064
|
const id = ids[i];
|
|
66962
67065
|
const r = stage3[i];
|
|
66963
67066
|
if (!r) continue;
|
|
66964
|
-
const amount4 =
|
|
67067
|
+
const amount4 = toBigInt15(r.amount);
|
|
66965
67068
|
if (amount4 === void 0) continue;
|
|
66966
67069
|
const claimable = id <= lastProcessed;
|
|
66967
67070
|
out.push({
|
|
@@ -67035,14 +67138,14 @@ var readerValantis = {
|
|
|
67035
67138
|
for (let i = 0; i < burns.length; i++) {
|
|
67036
67139
|
const b = burns[i];
|
|
67037
67140
|
if (!b) continue;
|
|
67038
|
-
const amount4 = Array.isArray(b) ?
|
|
67141
|
+
const amount4 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
|
|
67039
67142
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
67040
67143
|
if (amount4 === void 0 || completed) continue;
|
|
67041
67144
|
out.push({
|
|
67042
67145
|
lst: entry.lst,
|
|
67043
67146
|
brand: entry.brand,
|
|
67044
67147
|
symbol: entry.symbol,
|
|
67045
|
-
requestId: String(
|
|
67148
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
67046
67149
|
amountUnderlying: amount4.toString(),
|
|
67047
67150
|
status: redeemable[i] ? "claimable" : "pending"
|
|
67048
67151
|
});
|
|
@@ -67109,8 +67212,8 @@ var readerTreehouseRedemption = {
|
|
|
67109
67212
|
for (let i = 0; i < reqs.length; i++) {
|
|
67110
67213
|
const r = reqs[i];
|
|
67111
67214
|
const startTime = toNumber(r.startTime);
|
|
67112
|
-
const assets =
|
|
67113
|
-
const shares =
|
|
67215
|
+
const assets = toBigInt15(r.assets);
|
|
67216
|
+
const shares = toBigInt15(r.shares);
|
|
67114
67217
|
if (startTime === void 0 || assets === void 0) continue;
|
|
67115
67218
|
const readyAt = startTime + waitingPeriod;
|
|
67116
67219
|
out.push({
|
|
@@ -67193,7 +67296,7 @@ var readerTruFin = {
|
|
|
67193
67296
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
67194
67297
|
continue;
|
|
67195
67298
|
}
|
|
67196
|
-
const amount4 = Array.isArray(w) ?
|
|
67299
|
+
const amount4 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
|
|
67197
67300
|
if (amount4 === void 0 || amount4 === 0n) continue;
|
|
67198
67301
|
out.push({
|
|
67199
67302
|
lst: entry.lst,
|
|
@@ -67289,7 +67392,7 @@ var readerYieldNest = {
|
|
|
67289
67392
|
calls: enumCalls,
|
|
67290
67393
|
abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
|
|
67291
67394
|
});
|
|
67292
|
-
const ids = stage2.map(
|
|
67395
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
67293
67396
|
if (ids.length === 0) return [];
|
|
67294
67397
|
const detailCalls = ids.map((id) => ({
|
|
67295
67398
|
address: entry.withdrawalContract,
|
|
@@ -67308,7 +67411,7 @@ var readerYieldNest = {
|
|
|
67308
67411
|
const id = ids[i];
|
|
67309
67412
|
const r = stage3[i];
|
|
67310
67413
|
if (!r) continue;
|
|
67311
|
-
const amount4 =
|
|
67414
|
+
const amount4 = toBigInt15(r.amount);
|
|
67312
67415
|
const created = toNumber(r.creationTimestamp);
|
|
67313
67416
|
const processed = Boolean(r.processed);
|
|
67314
67417
|
if (amount4 === void 0 || created === void 0) continue;
|
|
@@ -68258,7 +68361,7 @@ var NavOracleReadAbi = [
|
|
|
68258
68361
|
|
|
68259
68362
|
// src/vaults/savings/readers/shared.ts
|
|
68260
68363
|
var ONE_E1814 = 10n ** 18n;
|
|
68261
|
-
var
|
|
68364
|
+
var toBigInt16 = (v) => {
|
|
68262
68365
|
if (v === void 0 || v === null) return void 0;
|
|
68263
68366
|
if (typeof v === "bigint") return v;
|
|
68264
68367
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -68289,9 +68392,9 @@ var readerErc46262 = (entry) => {
|
|
|
68289
68392
|
],
|
|
68290
68393
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
68291
68394
|
parse: ([assets, supply, rate]) => {
|
|
68292
|
-
const totalAssets =
|
|
68293
|
-
const totalSupply =
|
|
68294
|
-
const convertToAssetsRaw =
|
|
68395
|
+
const totalAssets = toBigInt16(assets);
|
|
68396
|
+
const totalSupply = toBigInt16(supply);
|
|
68397
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68295
68398
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68296
68399
|
return void 0;
|
|
68297
68400
|
}
|
|
@@ -68319,13 +68422,13 @@ var readerErc4626Cooldown = (entry) => {
|
|
|
68319
68422
|
],
|
|
68320
68423
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, cooldownAbi],
|
|
68321
68424
|
parse: ([assets, supply, rate, cooldown]) => {
|
|
68322
|
-
const totalAssets =
|
|
68323
|
-
const totalSupply =
|
|
68324
|
-
const convertToAssetsRaw =
|
|
68425
|
+
const totalAssets = toBigInt16(assets);
|
|
68426
|
+
const totalSupply = toBigInt16(supply);
|
|
68427
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68325
68428
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68326
68429
|
return void 0;
|
|
68327
68430
|
}
|
|
68328
|
-
const cooldownSecs =
|
|
68431
|
+
const cooldownSecs = toBigInt16(cooldown);
|
|
68329
68432
|
return {
|
|
68330
68433
|
totalAssets,
|
|
68331
68434
|
totalSupply,
|
|
@@ -69004,13 +69107,13 @@ var readerErc4626Idle = (entry) => {
|
|
|
69004
69107
|
],
|
|
69005
69108
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, BalanceOfAbi],
|
|
69006
69109
|
parse: ([assets, supply, rate, inventoryBalance]) => {
|
|
69007
|
-
const totalAssets =
|
|
69008
|
-
const totalSupply =
|
|
69009
|
-
const convertToAssetsRaw =
|
|
69110
|
+
const totalAssets = toBigInt16(assets);
|
|
69111
|
+
const totalSupply = toBigInt16(supply);
|
|
69112
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69010
69113
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69011
69114
|
return void 0;
|
|
69012
69115
|
}
|
|
69013
|
-
const capacity =
|
|
69116
|
+
const capacity = toBigInt16(inventoryBalance);
|
|
69014
69117
|
return {
|
|
69015
69118
|
totalAssets,
|
|
69016
69119
|
totalSupply,
|
|
@@ -69053,13 +69156,13 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
69053
69156
|
AvailableWithdrawLimitAbi
|
|
69054
69157
|
],
|
|
69055
69158
|
parse: ([assets, supply, rate, withdrawLimit]) => {
|
|
69056
|
-
const totalAssets =
|
|
69057
|
-
const totalSupply =
|
|
69058
|
-
const convertToAssetsRaw =
|
|
69159
|
+
const totalAssets = toBigInt16(assets);
|
|
69160
|
+
const totalSupply = toBigInt16(supply);
|
|
69161
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69059
69162
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69060
69163
|
return void 0;
|
|
69061
69164
|
}
|
|
69062
|
-
const capacity =
|
|
69165
|
+
const capacity = toBigInt16(withdrawLimit);
|
|
69063
69166
|
return {
|
|
69064
69167
|
totalAssets,
|
|
69065
69168
|
totalSupply,
|
|
@@ -69077,6 +69180,7 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
69077
69180
|
// src/vaults/savings/readers/bitfiBfbtc.ts
|
|
69078
69181
|
var BITFI_RATIO_SCALE = 10n ** 8n;
|
|
69079
69182
|
var CLOSED_DEPOSIT_MIN = 10n ** 20n;
|
|
69183
|
+
var CLOSED_FLAT_FEE = 10n ** 8n;
|
|
69080
69184
|
var readerBitfiBfbtc = (entry) => {
|
|
69081
69185
|
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
69082
69186
|
const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
|
|
@@ -69098,18 +69202,25 @@ var readerBitfiBfbtc = (entry) => {
|
|
|
69098
69202
|
BfbtcReadAbi
|
|
69099
69203
|
],
|
|
69100
69204
|
parse: ([supply, ratio, evmFee, nativeFee, minDeposit, paused]) => {
|
|
69101
|
-
const totalSupply =
|
|
69102
|
-
const currentRatio =
|
|
69205
|
+
const totalSupply = toBigInt16(supply);
|
|
69206
|
+
const currentRatio = toBigInt16(ratio);
|
|
69103
69207
|
if (totalSupply === void 0) return void 0;
|
|
69104
69208
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69105
69209
|
const exchangeRate = ONE_E1814 * BITFI_RATIO_SCALE / currentRatio;
|
|
69106
69210
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69107
|
-
const
|
|
69108
|
-
|
|
69109
|
-
|
|
69110
|
-
|
|
69111
|
-
|
|
69112
|
-
|
|
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);
|
|
69113
69224
|
const depositsClosed = minDep !== void 0 && minDep >= CLOSED_DEPOSIT_MIN;
|
|
69114
69225
|
const isPaused = paused === true;
|
|
69115
69226
|
return {
|
|
@@ -69158,16 +69269,16 @@ var readerBitfiVault = (entry) => {
|
|
|
69158
69269
|
BfusdVaultReadAbi
|
|
69159
69270
|
],
|
|
69160
69271
|
parse: ([assets, supply, ratio, depositRatio, cap, paused]) => {
|
|
69161
|
-
const totalAssets =
|
|
69162
|
-
const totalSupply =
|
|
69163
|
-
const currentRatio =
|
|
69272
|
+
const totalAssets = toBigInt16(assets);
|
|
69273
|
+
const totalSupply = toBigInt16(supply);
|
|
69274
|
+
const currentRatio = toBigInt16(ratio);
|
|
69164
69275
|
if (totalAssets === void 0 || totalSupply === void 0)
|
|
69165
69276
|
return void 0;
|
|
69166
69277
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69167
69278
|
const exchangeRate = currentRatio * ONE_E1814 / BITFI_RATIO_SCALE;
|
|
69168
|
-
const depRatio =
|
|
69279
|
+
const depRatio = toBigInt16(depositRatio);
|
|
69169
69280
|
const fundamentalExchangeRate = depRatio !== void 0 && depRatio > 0n ? depRatio * ONE_E1814 / BITFI_RATIO_SCALE : void 0;
|
|
69170
|
-
const supplyCap =
|
|
69281
|
+
const supplyCap = toBigInt16(cap);
|
|
69171
69282
|
const isPaused = paused === true;
|
|
69172
69283
|
let depositCapacity;
|
|
69173
69284
|
if (isPaused) {
|
|
@@ -69221,13 +69332,13 @@ var readerBitwayVault = (entry) => {
|
|
|
69221
69332
|
BitwayVaultReadAbi
|
|
69222
69333
|
],
|
|
69223
69334
|
parse: ([supply, rate, buffer, waitingTime]) => {
|
|
69224
|
-
const totalSupply =
|
|
69225
|
-
const exchangeRate =
|
|
69335
|
+
const totalSupply = toBigInt16(supply);
|
|
69336
|
+
const exchangeRate = toBigInt16(rate);
|
|
69226
69337
|
if (totalSupply === void 0 || exchangeRate === void 0 || exchangeRate === 0n) {
|
|
69227
69338
|
return void 0;
|
|
69228
69339
|
}
|
|
69229
|
-
const capacity =
|
|
69230
|
-
const wait =
|
|
69340
|
+
const capacity = toBigInt16(buffer);
|
|
69341
|
+
const wait = toBigInt16(waitingTime);
|
|
69231
69342
|
return {
|
|
69232
69343
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69233
69344
|
// (Every live leg is 18/18-dec — BSC stables are 18-dec — but the
|
|
@@ -69257,9 +69368,9 @@ var readerFrankencoinSavings = (entry) => ({
|
|
|
69257
69368
|
],
|
|
69258
69369
|
abis: [BalanceOfAbi, FrankencoinSavingsReadAbi],
|
|
69259
69370
|
parse: ([balance, ratePPM]) => {
|
|
69260
|
-
const deposits =
|
|
69371
|
+
const deposits = toBigInt16(balance);
|
|
69261
69372
|
if (deposits === void 0) return void 0;
|
|
69262
|
-
if (
|
|
69373
|
+
if (toBigInt16(ratePPM) === void 0) return void 0;
|
|
69263
69374
|
return {
|
|
69264
69375
|
totalAssets: deposits,
|
|
69265
69376
|
// No shares exist; the "supply" IS the deposited principal, and
|
|
@@ -69303,15 +69414,15 @@ var readerHyperbeatVault = (entry) => {
|
|
|
69303
69414
|
HyperbeatQueueReadAbi
|
|
69304
69415
|
],
|
|
69305
69416
|
parse: ([supply, rate, rateDecimals, inventory, fee, instantPaused]) => {
|
|
69306
|
-
const totalSupply =
|
|
69307
|
-
const rawRate =
|
|
69308
|
-
const rateDec =
|
|
69417
|
+
const totalSupply = toBigInt16(supply);
|
|
69418
|
+
const rawRate = toBigInt16(rate);
|
|
69419
|
+
const rateDec = toBigInt16(rateDecimals);
|
|
69309
69420
|
if (totalSupply === void 0 || rawRate === void 0 || rateDec === void 0 || rawRate === 0n) {
|
|
69310
69421
|
return void 0;
|
|
69311
69422
|
}
|
|
69312
69423
|
const exchangeRate = rateDec <= 18n ? rawRate * 10n ** (18n - rateDec) : rawRate / 10n ** (rateDec - 18n);
|
|
69313
|
-
const capacity =
|
|
69314
|
-
const feeRaw =
|
|
69424
|
+
const capacity = toBigInt16(inventory);
|
|
69425
|
+
const feeRaw = toBigInt16(fee);
|
|
69315
69426
|
return {
|
|
69316
69427
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69317
69428
|
totalAssets: totalSupply * exchangeRate * underlyingUnit / (shareUnit * ONE_E1814),
|
|
@@ -69346,10 +69457,10 @@ var readerNavOracle = (entry) => {
|
|
|
69346
69457
|
],
|
|
69347
69458
|
abis: [TotalSupplyAbi2, NavOracleReadAbi],
|
|
69348
69459
|
parse: ([supply, round]) => {
|
|
69349
|
-
const totalSupply =
|
|
69460
|
+
const totalSupply = toBigInt16(supply);
|
|
69350
69461
|
if (totalSupply === void 0) return void 0;
|
|
69351
69462
|
const raw = Array.isArray(round) ? round[1] : round?.answer;
|
|
69352
|
-
const answer =
|
|
69463
|
+
const answer = toBigInt16(raw);
|
|
69353
69464
|
if (answer === void 0 || answer <= 0n) return void 0;
|
|
69354
69465
|
const exchangeRate = answer * ONE_E1814 / oracleScale;
|
|
69355
69466
|
return {
|
|
@@ -69392,14 +69503,14 @@ var readerNativeWnlp = (entry) => {
|
|
|
69392
69503
|
NativeWithdrawQueueReadAbi
|
|
69393
69504
|
],
|
|
69394
69505
|
parse: ([supply, rate, feeBips, instantEnabled, inventory, window]) => {
|
|
69395
|
-
const totalSupply =
|
|
69396
|
-
const exchangeRate =
|
|
69506
|
+
const totalSupply = toBigInt16(supply);
|
|
69507
|
+
const exchangeRate = toBigInt16(rate);
|
|
69397
69508
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
69398
69509
|
return void 0;
|
|
69399
69510
|
}
|
|
69400
|
-
const capacity =
|
|
69401
|
-
const windowSeconds =
|
|
69402
|
-
const bips =
|
|
69511
|
+
const capacity = toBigInt16(inventory);
|
|
69512
|
+
const windowSeconds = toBigInt16(window);
|
|
69513
|
+
const bips = toBigInt16(feeBips);
|
|
69403
69514
|
return {
|
|
69404
69515
|
totalAssets: totalSupply * exchangeRate / ONE_E1814,
|
|
69405
69516
|
totalSupply,
|
|
@@ -69444,15 +69555,15 @@ var readerSaturnVault = (entry) => {
|
|
|
69444
69555
|
SaturnMinWithdrawalAbi
|
|
69445
69556
|
],
|
|
69446
69557
|
parse: ([assets, supply, rate, previewShares, feeBps, minWithdrawal]) => {
|
|
69447
|
-
const totalAssets =
|
|
69448
|
-
const totalSupply =
|
|
69449
|
-
const convertToAssetsRaw =
|
|
69558
|
+
const totalAssets = toBigInt16(assets);
|
|
69559
|
+
const totalSupply = toBigInt16(supply);
|
|
69560
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69450
69561
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69451
69562
|
return void 0;
|
|
69452
69563
|
}
|
|
69453
|
-
const entryShares =
|
|
69454
|
-
const depositFeeBps =
|
|
69455
|
-
const exitMinAmount =
|
|
69564
|
+
const entryShares = toBigInt16(previewShares);
|
|
69565
|
+
const depositFeeBps = toBigInt16(feeBps);
|
|
69566
|
+
const exitMinAmount = toBigInt16(minWithdrawal);
|
|
69456
69567
|
return {
|
|
69457
69568
|
totalAssets,
|
|
69458
69569
|
totalSupply,
|
|
@@ -69537,17 +69648,17 @@ var readerVenusHub = (entry) => {
|
|
|
69537
69648
|
calls,
|
|
69538
69649
|
abis,
|
|
69539
69650
|
parse: (slice2) => {
|
|
69540
|
-
const totalAssets =
|
|
69541
|
-
const totalSupply =
|
|
69542
|
-
const convertToAssetsRaw =
|
|
69651
|
+
const totalAssets = toBigInt16(slice2[0]);
|
|
69652
|
+
const totalSupply = toBigInt16(slice2[1]);
|
|
69653
|
+
const convertToAssetsRaw = toBigInt16(slice2[2]);
|
|
69543
69654
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69544
69655
|
return void 0;
|
|
69545
69656
|
}
|
|
69546
69657
|
const paused = slice2[4] === true;
|
|
69547
|
-
const maxWithdrawalSize =
|
|
69548
|
-
const redeemFeeBps =
|
|
69549
|
-
const idle =
|
|
69550
|
-
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]);
|
|
69551
69662
|
let groupLiquid = 0n;
|
|
69552
69663
|
let weightedBps = 0n;
|
|
69553
69664
|
let rateWeight = 0n;
|
|
@@ -69555,9 +69666,9 @@ var readerVenusHub = (entry) => {
|
|
|
69555
69666
|
let groupsOk = groups.length > 0;
|
|
69556
69667
|
for (let i = 0; i < groups.length; i++) {
|
|
69557
69668
|
const base = 8 + i * 3;
|
|
69558
|
-
const liquid =
|
|
69559
|
-
const assets =
|
|
69560
|
-
const apyBps =
|
|
69669
|
+
const liquid = toBigInt16(slice2[base]);
|
|
69670
|
+
const assets = toBigInt16(slice2[base + 1]);
|
|
69671
|
+
const apyBps = toBigInt16(slice2[base + 2]);
|
|
69561
69672
|
if (liquid === void 0 || assets === void 0 || apyBps === void 0) {
|
|
69562
69673
|
groupsOk = false;
|
|
69563
69674
|
continue;
|
|
@@ -69600,12 +69711,12 @@ var readerVenusHub = (entry) => {
|
|
|
69600
69711
|
};
|
|
69601
69712
|
};
|
|
69602
69713
|
var parseStrandedRewards = (slice2, base, coreGroupAssets, hubTotalAssets) => {
|
|
69603
|
-
const blocksPerYear =
|
|
69604
|
-
const supplySpeed =
|
|
69605
|
-
const rewardPrice =
|
|
69606
|
-
const underlyingPrice =
|
|
69607
|
-
const vTokenSupply =
|
|
69608
|
-
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]);
|
|
69609
69720
|
if (blocksPerYear === void 0 || supplySpeed === void 0 || rewardPrice === void 0 || underlyingPrice === void 0 || vTokenSupply === void 0 || exchangeRateStored === void 0) {
|
|
69610
69721
|
return void 0;
|
|
69611
69722
|
}
|
|
@@ -69631,9 +69742,9 @@ var readerVesperPool = (entry) => {
|
|
|
69631
69742
|
],
|
|
69632
69743
|
abis: [VesperPoolReadAbi, VesperPoolReadAbi, VesperPoolReadAbi],
|
|
69633
69744
|
parse: ([value, supply, pps]) => {
|
|
69634
|
-
const totalAssets =
|
|
69635
|
-
const totalSupply =
|
|
69636
|
-
const pricePerShare =
|
|
69745
|
+
const totalAssets = toBigInt16(value);
|
|
69746
|
+
const totalSupply = toBigInt16(supply);
|
|
69747
|
+
const pricePerShare = toBigInt16(pps);
|
|
69637
69748
|
if (totalAssets === void 0 || totalSupply === void 0) {
|
|
69638
69749
|
return void 0;
|
|
69639
69750
|
}
|
|
@@ -69661,15 +69772,15 @@ var readerWrenNav = (entry) => {
|
|
|
69661
69772
|
],
|
|
69662
69773
|
abis: [TotalSupplyAbi2, WrenNavReadAbi, WrenNavReadAbi, WrenNavReadAbi],
|
|
69663
69774
|
parse: ([supply, burn, nav, burnable]) => {
|
|
69664
|
-
const totalSupply =
|
|
69665
|
-
const navPrice =
|
|
69775
|
+
const totalSupply = toBigInt16(supply);
|
|
69776
|
+
const navPrice = toBigInt16(nav);
|
|
69666
69777
|
if (totalSupply === void 0) return void 0;
|
|
69667
69778
|
if (navPrice === void 0 || navPrice <= 0n) return void 0;
|
|
69668
|
-
const burncost =
|
|
69779
|
+
const burncost = toBigInt16(burn);
|
|
69669
69780
|
const hasBurncost = burncost !== void 0 && burncost > 0n;
|
|
69670
69781
|
const exchangeRate = hasBurncost ? burncost : navPrice;
|
|
69671
69782
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69672
|
-
const burnFlag =
|
|
69783
|
+
const burnFlag = toBigInt16(burnable);
|
|
69673
69784
|
const instantRedeemEnabled = burnFlag === void 0 ? true : burnFlag > 0n;
|
|
69674
69785
|
return {
|
|
69675
69786
|
totalAssets,
|
|
@@ -69703,17 +69814,17 @@ var readerYieldBasisLt = (entry) => {
|
|
|
69703
69814
|
YieldBasisAmmReadAbi
|
|
69704
69815
|
],
|
|
69705
69816
|
parse: ([supply, pps, redeemPerShare, maxDebt, valueOracle]) => {
|
|
69706
|
-
const totalSupply =
|
|
69707
|
-
const fundamental =
|
|
69708
|
-
const redeemRaw =
|
|
69817
|
+
const totalSupply = toBigInt16(supply);
|
|
69818
|
+
const fundamental = toBigInt16(pps);
|
|
69819
|
+
const redeemRaw = toBigInt16(redeemPerShare);
|
|
69709
69820
|
if (totalSupply === void 0 || fundamental === void 0 || redeemRaw === void 0) {
|
|
69710
69821
|
return void 0;
|
|
69711
69822
|
}
|
|
69712
69823
|
if (totalSupply === 0n || redeemRaw === 0n) return void 0;
|
|
69713
69824
|
const totalAssets = totalSupply * redeemRaw / ONE_SHARE;
|
|
69714
69825
|
const exchangeRate = redeemRaw * ONE_E1814 / underlyingUnit;
|
|
69715
|
-
const equity = Array.isArray(valueOracle) ?
|
|
69716
|
-
const cap =
|
|
69826
|
+
const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
|
|
69827
|
+
const cap = toBigInt16(maxDebt);
|
|
69717
69828
|
let depositCapacity;
|
|
69718
69829
|
if (cap !== void 0 && equity !== void 0 && equity > 0n) {
|
|
69719
69830
|
const headroom = cap / 2n - equity;
|
|
@@ -69782,6 +69893,36 @@ var resolveSelfOnly = (chainId, vault) => {
|
|
|
69782
69893
|
var withSelfOnly = (routes2, selfOnly) => selfOnly === void 0 ? routes2 : routes2.map(
|
|
69783
69894
|
(r) => r.kind === "market" || r.selfOnly !== void 0 ? r : { ...r, selfOnly }
|
|
69784
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
|
+
};
|
|
69785
69926
|
var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList = {}) => {
|
|
69786
69927
|
const entries = getSavingsRegistry(chainId);
|
|
69787
69928
|
if (entries.length === 0) return {};
|
|
@@ -69917,7 +70058,10 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
69917
70058
|
// fee is left ABSENT rather than 0 because "not published" and "free"
|
|
69918
70059
|
// are different claims and only some protocols make the second.
|
|
69919
70060
|
exitRoutes: withSelfOnly(
|
|
69920
|
-
|
|
70061
|
+
bitfiExitRoutes(
|
|
70062
|
+
state.bitfiExit,
|
|
70063
|
+
state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds
|
|
70064
|
+
) ?? deriveExitRoutes({
|
|
69921
70065
|
withdrawalMode: entry.withdrawalMode,
|
|
69922
70066
|
withdrawFeeBps: state.withdrawFeeBps,
|
|
69923
70067
|
withdrawalCooldownSeconds: state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds,
|
|
@@ -70298,7 +70442,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
|
|
|
70298
70442
|
|
|
70299
70443
|
// src/vaults/aave-earn/fetchPublic.ts
|
|
70300
70444
|
var BRAND2 = "Aave";
|
|
70301
|
-
var
|
|
70445
|
+
var toBigInt17 = (v) => {
|
|
70302
70446
|
if (v === void 0 || v === null) return void 0;
|
|
70303
70447
|
if (typeof v === "bigint") return v;
|
|
70304
70448
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -70358,15 +70502,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
70358
70502
|
const token = v.usedReserve.underlyingToken;
|
|
70359
70503
|
const underlyingLc = token.address.toLowerCase();
|
|
70360
70504
|
const assetDecimals = token.decimals;
|
|
70361
|
-
const shareDecOnChain =
|
|
70505
|
+
const shareDecOnChain = toBigInt17(slice2[1]);
|
|
70362
70506
|
const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
|
|
70363
|
-
const totalSupply =
|
|
70507
|
+
const totalSupply = toBigInt17(slice2[2]);
|
|
70364
70508
|
if (totalSupply === void 0) continue;
|
|
70365
70509
|
const shareUnit = 10n ** BigInt(decimals);
|
|
70366
70510
|
const underlyingUnit = 10n ** BigInt(assetDecimals);
|
|
70367
|
-
const convertToAssets =
|
|
70511
|
+
const convertToAssets = toBigInt17(slice2[3]) ?? 0n;
|
|
70368
70512
|
const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
|
|
70369
|
-
const totalAssets =
|
|
70513
|
+
const totalAssets = toBigInt17(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
|
|
70370
70514
|
const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
|
|
70371
70515
|
const asset = tokenList[underlyingLc];
|
|
70372
70516
|
const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num7(v.balance.usdPerToken) : void 0);
|
|
@@ -76082,7 +76226,12 @@ function resolveAvailability(meta, maturity) {
|
|
|
76082
76226
|
// door open outward, and a matured bond is precisely the case where the
|
|
76083
76227
|
// holder still needs out. An explicit pause is the one thing that shuts
|
|
76084
76228
|
// both.
|
|
76085
|
-
|
|
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),
|
|
76086
76235
|
gating,
|
|
76087
76236
|
reason
|
|
76088
76237
|
};
|