@1delta/margin-fetcher 5.0.77 → 5.0.79
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 +581 -380
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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,
|
|
@@ -60508,6 +60611,52 @@ function computeV2Allocation(decimals, totalAssetsFormatted, feePercent2, priceU
|
|
|
60508
60611
|
};
|
|
60509
60612
|
}
|
|
60510
60613
|
|
|
60614
|
+
// src/vaults/morpho/stubVaults.ts
|
|
60615
|
+
var MORPHO_STUB_VAULTS = {
|
|
60616
|
+
"14": ["0x5eae7e544258e421cb2774e508e15ee8dade8200"],
|
|
60617
|
+
// Flare
|
|
60618
|
+
"146": ["0xd7f2f89e1991de2b9d62fbeeeb3bc0b01d032328"],
|
|
60619
|
+
// Sonic
|
|
60620
|
+
"239": ["0x2903a9e55bb8a05e6cbdd5c5d00203bf527fa9db"],
|
|
60621
|
+
// TAC
|
|
60622
|
+
"1135": ["0x389724731cea95c4a46cc93e96f211f389f31405"],
|
|
60623
|
+
// Lisk
|
|
60624
|
+
"1672": ["0x79ded579756072372510ff3a86f884433a697b5c"],
|
|
60625
|
+
// Pharos
|
|
60626
|
+
"1868": ["0x94665e0df3c8c25119d80b2e3c703ccd127bf37e"],
|
|
60627
|
+
// Soneium
|
|
60628
|
+
"2741": ["0x225c6e63970bb04d0780b3abb047dba659ad3cec"],
|
|
60629
|
+
// Abstract
|
|
60630
|
+
"2818": ["0x7cf2c1a184c2f17e0413a13b21b1fdafd51df08c"],
|
|
60631
|
+
// Morph
|
|
60632
|
+
"4114": ["0xc063aca30b0d56ff0a9e446a94f8cdb421ab89fb"],
|
|
60633
|
+
// Citrea
|
|
60634
|
+
"4326": ["0xf55c695ebaf1f4eefeda0833ef6a29c90e7b7f05"],
|
|
60635
|
+
// MegaETH
|
|
60636
|
+
"34443": ["0xf4461806c58d9e7cd74e79b113d81d127634b807"],
|
|
60637
|
+
// Mode
|
|
60638
|
+
"42220": ["0x099272b39ae8e6d7d415e8ba252c3d2c59432087"],
|
|
60639
|
+
// Celo
|
|
60640
|
+
"43111": ["0x339b3b6413345b4d3beb524c12cd3910c6dd8dbb"],
|
|
60641
|
+
// Hemi
|
|
60642
|
+
"57073": ["0xb00123b1058c13559408b9d609ed417617f588ed"],
|
|
60643
|
+
// Ink
|
|
60644
|
+
"59144": ["0x3e89134a270b8f0dc3dfd8bf6e249fddb2f7a634"],
|
|
60645
|
+
// Linea
|
|
60646
|
+
"98866": [
|
|
60647
|
+
"0x6f8acb9c03abb7ba6ba24b4698b019ffe96eae60",
|
|
60648
|
+
"0xd2586890224ab02bf31334e15872cd9c93f68ba8"
|
|
60649
|
+
]
|
|
60650
|
+
// Plume
|
|
60651
|
+
};
|
|
60652
|
+
var STUB_SET = new Map(
|
|
60653
|
+
Object.entries(MORPHO_STUB_VAULTS).map(([chainId, list]) => [
|
|
60654
|
+
chainId,
|
|
60655
|
+
new Set(list.map((a) => a.toLowerCase()))
|
|
60656
|
+
])
|
|
60657
|
+
);
|
|
60658
|
+
var isMorphoStubVault = (chainId, vault) => STUB_SET.get(chainId)?.has(vault.toLowerCase()) ?? false;
|
|
60659
|
+
|
|
60511
60660
|
// src/vaults/morpho/fetchFromChain.ts
|
|
60512
60661
|
var { chunk: chunk5 } = lodash;
|
|
60513
60662
|
var VAULT_CALLS = [
|
|
@@ -60603,7 +60752,13 @@ var collectEntries = (chainId, protocols, skip) => {
|
|
|
60603
60752
|
return out;
|
|
60604
60753
|
};
|
|
60605
60754
|
var fetchMorphoVaultsFromChain = async (chainId, multicallRetry, prices = {}, tokenList = {}, opts = {}) => {
|
|
60606
|
-
const entries = opts.vaultsOverride ? opts.vaultsOverride.map((entry) => ({ protocol: "", entry })) : collectEntries(chainId, opts.protocols, DEFAULT_SKIP_PROTOCOLS)
|
|
60755
|
+
const entries = (opts.vaultsOverride ? opts.vaultsOverride.map((entry) => ({ protocol: "", entry })) : collectEntries(chainId, opts.protocols, DEFAULT_SKIP_PROTOCOLS)).filter(({ entry }) => {
|
|
60756
|
+
if (!isMorphoStubVault(chainId, entry.vault)) return true;
|
|
60757
|
+
console.warn(
|
|
60758
|
+
`[morpho vaults] chain ${chainId}: skipping ${entry.vault} \u2014 factory smoke-test vault (stub underlying)`
|
|
60759
|
+
);
|
|
60760
|
+
return false;
|
|
60761
|
+
});
|
|
60607
60762
|
if (entries.length === 0) return {};
|
|
60608
60763
|
const phase1Calls = entries.flatMap(
|
|
60609
60764
|
({ entry }) => PHASE1_CALLS.map((name) => ({
|
|
@@ -62593,7 +62748,7 @@ var Multicall3BalanceAbi = [
|
|
|
62593
62748
|
outputs: [{ type: "uint256" }]
|
|
62594
62749
|
}
|
|
62595
62750
|
];
|
|
62596
|
-
var
|
|
62751
|
+
var toBigInt14 = (v) => {
|
|
62597
62752
|
if (v === void 0 || v === null) return void 0;
|
|
62598
62753
|
if (typeof v === "bigint") return v;
|
|
62599
62754
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -62617,12 +62772,12 @@ var readerBeetsStS = (entry) => ({
|
|
|
62617
62772
|
],
|
|
62618
62773
|
abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
|
|
62619
62774
|
parse: ([supply, rate, pool]) => {
|
|
62620
|
-
const totalSupply =
|
|
62621
|
-
const exchangeRate =
|
|
62775
|
+
const totalSupply = toBigInt14(supply);
|
|
62776
|
+
const exchangeRate = toBigInt14(rate);
|
|
62622
62777
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62623
62778
|
return void 0;
|
|
62624
62779
|
}
|
|
62625
|
-
const liquidity =
|
|
62780
|
+
const liquidity = toBigInt14(pool);
|
|
62626
62781
|
return {
|
|
62627
62782
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
62628
62783
|
totalSupply,
|
|
@@ -62663,12 +62818,12 @@ var readerBenqiSavax = (entry) => ({
|
|
|
62663
62818
|
],
|
|
62664
62819
|
abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
|
|
62665
62820
|
parse: ([supply, rate, totalPooled]) => {
|
|
62666
|
-
const totalSupply =
|
|
62667
|
-
const exchangeRate =
|
|
62821
|
+
const totalSupply = toBigInt14(supply);
|
|
62822
|
+
const exchangeRate = toBigInt14(rate);
|
|
62668
62823
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62669
62824
|
return void 0;
|
|
62670
62825
|
}
|
|
62671
|
-
const totalAssets =
|
|
62826
|
+
const totalAssets = toBigInt14(totalPooled) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
62672
62827
|
return {
|
|
62673
62828
|
totalAssets,
|
|
62674
62829
|
totalSupply,
|
|
@@ -62682,7 +62837,7 @@ var readerBgtWrapper1to1 = (entry) => ({
|
|
|
62682
62837
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62683
62838
|
abis: [TotalSupplyAbi],
|
|
62684
62839
|
parse: ([supply]) => {
|
|
62685
|
-
const totalSupply =
|
|
62840
|
+
const totalSupply = toBigInt14(supply);
|
|
62686
62841
|
if (totalSupply === void 0) return void 0;
|
|
62687
62842
|
return {
|
|
62688
62843
|
totalAssets: totalSupply,
|
|
@@ -62711,8 +62866,8 @@ var readerDineroBeraEth = (entry) => ({
|
|
|
62711
62866
|
],
|
|
62712
62867
|
abis: [TotalSupplyAbi, DineroBeraEthAbi],
|
|
62713
62868
|
parse: ([supply, rate]) => {
|
|
62714
|
-
const totalSupply =
|
|
62715
|
-
const exchangeRate =
|
|
62869
|
+
const totalSupply = toBigInt14(supply);
|
|
62870
|
+
const exchangeRate = toBigInt14(rate);
|
|
62716
62871
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62717
62872
|
return void 0;
|
|
62718
62873
|
}
|
|
@@ -62733,9 +62888,9 @@ var readerErc4626 = (entry) => ({
|
|
|
62733
62888
|
],
|
|
62734
62889
|
abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
|
|
62735
62890
|
parse: ([assets, supply, rate]) => {
|
|
62736
|
-
const totalAssets =
|
|
62737
|
-
const totalSupply =
|
|
62738
|
-
const exchangeRate =
|
|
62891
|
+
const totalAssets = toBigInt14(assets);
|
|
62892
|
+
const totalSupply = toBigInt14(supply);
|
|
62893
|
+
const exchangeRate = toBigInt14(rate);
|
|
62739
62894
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62740
62895
|
return void 0;
|
|
62741
62896
|
}
|
|
@@ -62750,9 +62905,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
|
|
|
62750
62905
|
],
|
|
62751
62906
|
abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
|
|
62752
62907
|
parse: ([assets, supply, rate]) => {
|
|
62753
|
-
const totalAssets =
|
|
62754
|
-
const totalSupply =
|
|
62755
|
-
const exchangeRate =
|
|
62908
|
+
const totalAssets = toBigInt14(assets);
|
|
62909
|
+
const totalSupply = toBigInt14(supply);
|
|
62910
|
+
const exchangeRate = toBigInt14(rate);
|
|
62756
62911
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
62757
62912
|
return void 0;
|
|
62758
62913
|
}
|
|
@@ -62812,15 +62967,15 @@ var readerEtherFiWeEth = (entry) => {
|
|
|
62812
62967
|
calls,
|
|
62813
62968
|
abis,
|
|
62814
62969
|
parse: (slice2) => {
|
|
62815
|
-
const totalSupply =
|
|
62816
|
-
const exchangeRate =
|
|
62970
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
62971
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
62817
62972
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62818
62973
|
return void 0;
|
|
62819
62974
|
}
|
|
62820
62975
|
let liquidity;
|
|
62821
62976
|
if (lp) {
|
|
62822
|
-
const lpBalance =
|
|
62823
|
-
const locked =
|
|
62977
|
+
const lpBalance = toBigInt14(slice2[2]);
|
|
62978
|
+
const locked = toBigInt14(slice2[3]);
|
|
62824
62979
|
if (lpBalance !== void 0 && locked !== void 0) {
|
|
62825
62980
|
liquidity = lpBalance > locked ? lpBalance - locked : 0n;
|
|
62826
62981
|
}
|
|
@@ -62854,7 +63009,7 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62854
63009
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62855
63010
|
abis: [TotalSupplyAbi],
|
|
62856
63011
|
parse: ([supply]) => {
|
|
62857
|
-
const totalSupply =
|
|
63012
|
+
const totalSupply = toBigInt14(supply);
|
|
62858
63013
|
if (totalSupply === void 0) return void 0;
|
|
62859
63014
|
return {
|
|
62860
63015
|
totalAssets: totalSupply,
|
|
@@ -62871,8 +63026,8 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
62871
63026
|
],
|
|
62872
63027
|
abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
|
|
62873
63028
|
parse: ([supply, rate]) => {
|
|
62874
|
-
const totalSupply =
|
|
62875
|
-
const exchangeRate =
|
|
63029
|
+
const totalSupply = toBigInt14(supply);
|
|
63030
|
+
const exchangeRate = toBigInt14(rate);
|
|
62876
63031
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62877
63032
|
return void 0;
|
|
62878
63033
|
}
|
|
@@ -62904,7 +63059,7 @@ var readerKelpRsEth = (entry) => {
|
|
|
62904
63059
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62905
63060
|
abis: [TotalSupplyAbi],
|
|
62906
63061
|
parse: ([supply]) => {
|
|
62907
|
-
const totalSupply =
|
|
63062
|
+
const totalSupply = toBigInt14(supply);
|
|
62908
63063
|
if (totalSupply === void 0) return void 0;
|
|
62909
63064
|
return {
|
|
62910
63065
|
totalAssets: totalSupply,
|
|
@@ -62921,8 +63076,8 @@ var readerKelpRsEth = (entry) => {
|
|
|
62921
63076
|
],
|
|
62922
63077
|
abis: [TotalSupplyAbi, KelpLrtOracleAbi],
|
|
62923
63078
|
parse: ([supply, rate]) => {
|
|
62924
|
-
const totalSupply =
|
|
62925
|
-
const exchangeRate =
|
|
63079
|
+
const totalSupply = toBigInt14(supply);
|
|
63080
|
+
const exchangeRate = toBigInt14(rate);
|
|
62926
63081
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62927
63082
|
return void 0;
|
|
62928
63083
|
}
|
|
@@ -62954,7 +63109,7 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62954
63109
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
62955
63110
|
abis: [TotalSupplyAbi],
|
|
62956
63111
|
parse: ([supply]) => {
|
|
62957
|
-
const totalSupply =
|
|
63112
|
+
const totalSupply = toBigInt14(supply);
|
|
62958
63113
|
if (totalSupply === void 0) return void 0;
|
|
62959
63114
|
return {
|
|
62960
63115
|
totalAssets: totalSupply,
|
|
@@ -62971,8 +63126,8 @@ var readerKinetiqKHype = (entry) => {
|
|
|
62971
63126
|
],
|
|
62972
63127
|
abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
|
|
62973
63128
|
parse: ([supply, rate]) => {
|
|
62974
|
-
const totalSupply =
|
|
62975
|
-
const exchangeRate =
|
|
63129
|
+
const totalSupply = toBigInt14(supply);
|
|
63130
|
+
const exchangeRate = toBigInt14(rate);
|
|
62976
63131
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
62977
63132
|
return void 0;
|
|
62978
63133
|
}
|
|
@@ -63012,12 +63167,12 @@ var readerLairStKaia = (entry) => ({
|
|
|
63012
63167
|
],
|
|
63013
63168
|
abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
|
|
63014
63169
|
parse: ([supply, rate, totalStaking]) => {
|
|
63015
|
-
const totalSupply =
|
|
63016
|
-
const exchangeRate =
|
|
63170
|
+
const totalSupply = toBigInt14(supply);
|
|
63171
|
+
const exchangeRate = toBigInt14(rate);
|
|
63017
63172
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63018
63173
|
return void 0;
|
|
63019
63174
|
}
|
|
63020
|
-
const totalAssets =
|
|
63175
|
+
const totalAssets = toBigInt14(totalStaking) ?? totalSupply * exchangeRate / ONE_E1812;
|
|
63021
63176
|
return {
|
|
63022
63177
|
totalAssets,
|
|
63023
63178
|
totalSupply,
|
|
@@ -63045,8 +63200,8 @@ var readerLidoWstEth = (entry) => ({
|
|
|
63045
63200
|
],
|
|
63046
63201
|
abis: [TotalSupplyAbi, LidoWstEthAbi],
|
|
63047
63202
|
parse: ([supply, rate]) => {
|
|
63048
|
-
const totalSupply =
|
|
63049
|
-
const exchangeRate =
|
|
63203
|
+
const totalSupply = toBigInt14(supply);
|
|
63204
|
+
const exchangeRate = toBigInt14(rate);
|
|
63050
63205
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63051
63206
|
return void 0;
|
|
63052
63207
|
}
|
|
@@ -63084,7 +63239,7 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63084
63239
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63085
63240
|
abis: [TotalSupplyAbi],
|
|
63086
63241
|
parse: ([supply]) => {
|
|
63087
|
-
const totalSupply =
|
|
63242
|
+
const totalSupply = toBigInt14(supply);
|
|
63088
63243
|
if (totalSupply === void 0) return void 0;
|
|
63089
63244
|
return {
|
|
63090
63245
|
totalAssets: totalSupply,
|
|
@@ -63102,12 +63257,12 @@ var readerListaSlisBnb = (entry) => {
|
|
|
63102
63257
|
],
|
|
63103
63258
|
abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
|
|
63104
63259
|
parse: ([supply, rate, pooled]) => {
|
|
63105
|
-
const totalSupply =
|
|
63106
|
-
const exchangeRate =
|
|
63260
|
+
const totalSupply = toBigInt14(supply);
|
|
63261
|
+
const exchangeRate = toBigInt14(rate);
|
|
63107
63262
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63108
63263
|
return void 0;
|
|
63109
63264
|
}
|
|
63110
|
-
const pooledBnb =
|
|
63265
|
+
const pooledBnb = toBigInt14(pooled);
|
|
63111
63266
|
const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E1812;
|
|
63112
63267
|
return { totalAssets, totalSupply, exchangeRate };
|
|
63113
63268
|
}
|
|
@@ -63133,7 +63288,7 @@ var readerMantleMEth = (entry) => {
|
|
|
63133
63288
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63134
63289
|
abis: [TotalSupplyAbi],
|
|
63135
63290
|
parse: ([supply]) => {
|
|
63136
|
-
const totalSupply =
|
|
63291
|
+
const totalSupply = toBigInt14(supply);
|
|
63137
63292
|
if (totalSupply === void 0) return void 0;
|
|
63138
63293
|
return {
|
|
63139
63294
|
totalAssets: totalSupply,
|
|
@@ -63150,8 +63305,8 @@ var readerMantleMEth = (entry) => {
|
|
|
63150
63305
|
],
|
|
63151
63306
|
abis: [TotalSupplyAbi, MantleStakingAbi],
|
|
63152
63307
|
parse: ([supply, rate]) => {
|
|
63153
|
-
const totalSupply =
|
|
63154
|
-
const exchangeRate =
|
|
63308
|
+
const totalSupply = toBigInt14(supply);
|
|
63309
|
+
const exchangeRate = toBigInt14(rate);
|
|
63155
63310
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63156
63311
|
return void 0;
|
|
63157
63312
|
}
|
|
@@ -63172,7 +63327,7 @@ var readerOffChain = (entry) => {
|
|
|
63172
63327
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63173
63328
|
abis: [TotalSupplyAbi],
|
|
63174
63329
|
parse: ([supply]) => {
|
|
63175
|
-
const totalSupply =
|
|
63330
|
+
const totalSupply = toBigInt14(supply);
|
|
63176
63331
|
if (totalSupply === void 0) return void 0;
|
|
63177
63332
|
return {
|
|
63178
63333
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63206,7 +63361,7 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63206
63361
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63207
63362
|
abis: [TotalSupplyAbi],
|
|
63208
63363
|
parse: ([supply]) => {
|
|
63209
|
-
const totalSupply =
|
|
63364
|
+
const totalSupply = toBigInt14(supply);
|
|
63210
63365
|
if (totalSupply === void 0) return void 0;
|
|
63211
63366
|
return {
|
|
63212
63367
|
totalAssets: totalSupply,
|
|
@@ -63223,9 +63378,9 @@ var readerRenzoEzEth = (entry) => {
|
|
|
63223
63378
|
],
|
|
63224
63379
|
abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
|
|
63225
63380
|
parse: ([supply, tvls]) => {
|
|
63226
|
-
const totalSupply =
|
|
63381
|
+
const totalSupply = toBigInt14(supply);
|
|
63227
63382
|
if (totalSupply === void 0 || totalSupply === 0n) return void 0;
|
|
63228
|
-
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ?
|
|
63383
|
+
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt14(tvls[2]) : void 0;
|
|
63229
63384
|
if (totalTvl === void 0) return void 0;
|
|
63230
63385
|
return {
|
|
63231
63386
|
totalAssets: totalTvl,
|
|
@@ -63279,12 +63434,12 @@ var readerRocketReth = (entry) => {
|
|
|
63279
63434
|
calls,
|
|
63280
63435
|
abis,
|
|
63281
63436
|
parse: (slice2) => {
|
|
63282
|
-
const totalSupply =
|
|
63283
|
-
const exchangeRate =
|
|
63437
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
63438
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
63284
63439
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63285
63440
|
return void 0;
|
|
63286
63441
|
}
|
|
63287
|
-
const liquidity = depositPool ?
|
|
63442
|
+
const liquidity = depositPool ? toBigInt14(slice2[2]) : void 0;
|
|
63288
63443
|
return {
|
|
63289
63444
|
totalAssets: totalSupply * exchangeRate / ONE_E1812,
|
|
63290
63445
|
totalSupply,
|
|
@@ -63323,7 +63478,7 @@ var readerStaderEthx = (entry) => {
|
|
|
63323
63478
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63324
63479
|
abis: [TotalSupplyAbi],
|
|
63325
63480
|
parse: ([supply]) => {
|
|
63326
|
-
const totalSupply =
|
|
63481
|
+
const totalSupply = toBigInt14(supply);
|
|
63327
63482
|
if (totalSupply === void 0) return void 0;
|
|
63328
63483
|
return {
|
|
63329
63484
|
totalAssets: totalSupply,
|
|
@@ -63340,8 +63495,8 @@ var readerStaderEthx = (entry) => {
|
|
|
63340
63495
|
],
|
|
63341
63496
|
abis: [TotalSupplyAbi, StaderEthxAbi],
|
|
63342
63497
|
parse: ([supply, rate]) => {
|
|
63343
|
-
const totalSupply =
|
|
63344
|
-
const exchangeRate =
|
|
63498
|
+
const totalSupply = toBigInt14(supply);
|
|
63499
|
+
const exchangeRate = toBigInt14(rate);
|
|
63345
63500
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63346
63501
|
return void 0;
|
|
63347
63502
|
}
|
|
@@ -63369,10 +63524,10 @@ var readerStaderMaticX = (entry) => {
|
|
|
63369
63524
|
],
|
|
63370
63525
|
abis: [TotalSupplyAbi, StaderMaticXAbi],
|
|
63371
63526
|
parse: ([supply, tup]) => {
|
|
63372
|
-
const totalSupply =
|
|
63527
|
+
const totalSupply = toBigInt14(supply);
|
|
63373
63528
|
if (!Array.isArray(tup) || tup.length < 3) return void 0;
|
|
63374
|
-
const amountInMatic =
|
|
63375
|
-
const totalPooledMatic =
|
|
63529
|
+
const amountInMatic = toBigInt14(tup[0]);
|
|
63530
|
+
const totalPooledMatic = toBigInt14(tup[2]);
|
|
63376
63531
|
if (totalSupply === void 0 || amountInMatic === void 0) {
|
|
63377
63532
|
return void 0;
|
|
63378
63533
|
}
|
|
@@ -63405,7 +63560,7 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63405
63560
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63406
63561
|
abis: [TotalSupplyAbi],
|
|
63407
63562
|
parse: ([supply]) => {
|
|
63408
|
-
const totalSupply =
|
|
63563
|
+
const totalSupply = toBigInt14(supply);
|
|
63409
63564
|
if (totalSupply === void 0) return void 0;
|
|
63410
63565
|
return {
|
|
63411
63566
|
totalAssets: totalSupply,
|
|
@@ -63422,8 +63577,8 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
63422
63577
|
],
|
|
63423
63578
|
abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
|
|
63424
63579
|
parse: ([supply, rate]) => {
|
|
63425
|
-
const totalSupply =
|
|
63426
|
-
const exchangeRate =
|
|
63580
|
+
const totalSupply = toBigInt14(supply);
|
|
63581
|
+
const exchangeRate = toBigInt14(rate);
|
|
63427
63582
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63428
63583
|
return void 0;
|
|
63429
63584
|
}
|
|
@@ -63455,7 +63610,7 @@ var readerStCelo = (entry) => {
|
|
|
63455
63610
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63456
63611
|
abis: [TotalSupplyAbi],
|
|
63457
63612
|
parse: ([supply]) => {
|
|
63458
|
-
const totalSupply =
|
|
63613
|
+
const totalSupply = toBigInt14(supply);
|
|
63459
63614
|
if (totalSupply === void 0) return void 0;
|
|
63460
63615
|
return {
|
|
63461
63616
|
totalAssets: totalSupply,
|
|
@@ -63472,8 +63627,8 @@ var readerStCelo = (entry) => {
|
|
|
63472
63627
|
],
|
|
63473
63628
|
abis: [TotalSupplyAbi, StCeloManagerAbi],
|
|
63474
63629
|
parse: ([supply, rate]) => {
|
|
63475
|
-
const totalSupply =
|
|
63476
|
-
const exchangeRate =
|
|
63630
|
+
const totalSupply = toBigInt14(supply);
|
|
63631
|
+
const exchangeRate = toBigInt14(rate);
|
|
63477
63632
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63478
63633
|
return void 0;
|
|
63479
63634
|
}
|
|
@@ -63505,8 +63660,8 @@ var readerSwellGetRate = (entry) => ({
|
|
|
63505
63660
|
],
|
|
63506
63661
|
abis: [TotalSupplyAbi, SwellGetRateAbi],
|
|
63507
63662
|
parse: ([supply, rate]) => {
|
|
63508
|
-
const totalSupply =
|
|
63509
|
-
const exchangeRate =
|
|
63663
|
+
const totalSupply = toBigInt14(supply);
|
|
63664
|
+
const exchangeRate = toBigInt14(rate);
|
|
63510
63665
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63511
63666
|
return void 0;
|
|
63512
63667
|
}
|
|
@@ -63537,7 +63692,7 @@ var readerValantisWstHype = (entry) => {
|
|
|
63537
63692
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63538
63693
|
abis: [TotalSupplyAbi],
|
|
63539
63694
|
parse: ([supply]) => {
|
|
63540
|
-
const totalSupply =
|
|
63695
|
+
const totalSupply = toBigInt14(supply);
|
|
63541
63696
|
if (totalSupply === void 0) return void 0;
|
|
63542
63697
|
return {
|
|
63543
63698
|
totalAssets: totalSupply,
|
|
@@ -63554,8 +63709,8 @@ var readerValantisWstHype = (entry) => {
|
|
|
63554
63709
|
],
|
|
63555
63710
|
abis: [TotalSupplyAbi, ValantisStHypeAbi],
|
|
63556
63711
|
parse: ([supply, rate]) => {
|
|
63557
|
-
const totalSupply =
|
|
63558
|
-
const exchangeRate =
|
|
63712
|
+
const totalSupply = toBigInt14(supply);
|
|
63713
|
+
const exchangeRate = toBigInt14(rate);
|
|
63559
63714
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63560
63715
|
return void 0;
|
|
63561
63716
|
}
|
|
@@ -63589,7 +63744,7 @@ var readerVedaAccountant = (entry) => {
|
|
|
63589
63744
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
63590
63745
|
abis: [TotalSupplyAbi],
|
|
63591
63746
|
parse: ([supply]) => {
|
|
63592
|
-
const totalSupply =
|
|
63747
|
+
const totalSupply = toBigInt14(supply);
|
|
63593
63748
|
if (totalSupply === void 0) return void 0;
|
|
63594
63749
|
return {
|
|
63595
63750
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -63607,8 +63762,8 @@ var readerVedaAccountant = (entry) => {
|
|
|
63607
63762
|
],
|
|
63608
63763
|
abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
|
|
63609
63764
|
parse: ([supply, rate]) => {
|
|
63610
|
-
const totalSupply =
|
|
63611
|
-
const rawRate =
|
|
63765
|
+
const totalSupply = toBigInt14(supply);
|
|
63766
|
+
const rawRate = toBigInt14(rate);
|
|
63612
63767
|
if (totalSupply === void 0 || rawRate === void 0) return void 0;
|
|
63613
63768
|
const exchangeRate = rawRate * scale3;
|
|
63614
63769
|
return {
|
|
@@ -63643,8 +63798,8 @@ var readerAnkrRatio = (entry) => ({
|
|
|
63643
63798
|
],
|
|
63644
63799
|
abis: [TotalSupplyAbi, AnkrRatioAbi],
|
|
63645
63800
|
parse: ([supply, ratio]) => {
|
|
63646
|
-
const totalSupply =
|
|
63647
|
-
const r =
|
|
63801
|
+
const totalSupply = toBigInt14(supply);
|
|
63802
|
+
const r = toBigInt14(ratio);
|
|
63648
63803
|
if (totalSupply === void 0 || r === void 0 || r === 0n) {
|
|
63649
63804
|
return void 0;
|
|
63650
63805
|
}
|
|
@@ -63675,8 +63830,8 @@ var readerBinanceWbeth = (entry) => ({
|
|
|
63675
63830
|
],
|
|
63676
63831
|
abis: [TotalSupplyAbi, WbethExchangeRateAbi],
|
|
63677
63832
|
parse: ([supply, rate]) => {
|
|
63678
|
-
const totalSupply =
|
|
63679
|
-
const exchangeRate =
|
|
63833
|
+
const totalSupply = toBigInt14(supply);
|
|
63834
|
+
const exchangeRate = toBigInt14(rate);
|
|
63680
63835
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
63681
63836
|
return void 0;
|
|
63682
63837
|
}
|
|
@@ -63719,8 +63874,8 @@ var readerCoreEarnRate = (entry) => {
|
|
|
63719
63874
|
],
|
|
63720
63875
|
abis: [CoreEarnRateAbi, TotalSupplyAbi],
|
|
63721
63876
|
parse: ([rate, supply]) => {
|
|
63722
|
-
const r =
|
|
63723
|
-
const totalSupply =
|
|
63877
|
+
const r = toBigInt14(rate);
|
|
63878
|
+
const totalSupply = toBigInt14(supply);
|
|
63724
63879
|
if (r === void 0 || r === 0n || totalSupply === void 0) {
|
|
63725
63880
|
return void 0;
|
|
63726
63881
|
}
|
|
@@ -63741,8 +63896,8 @@ var readerCoreStakedRatio = (entry) => {
|
|
|
63741
63896
|
],
|
|
63742
63897
|
abis: [CoreTotalStakedAbi, TotalSupplyAbi],
|
|
63743
63898
|
parse: ([staked, supply]) => {
|
|
63744
|
-
const totalStaked =
|
|
63745
|
-
const totalSupply =
|
|
63899
|
+
const totalStaked = toBigInt14(staked);
|
|
63900
|
+
const totalSupply = toBigInt14(supply);
|
|
63746
63901
|
if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
|
|
63747
63902
|
return void 0;
|
|
63748
63903
|
}
|
|
@@ -63781,8 +63936,8 @@ var readerKintsuSMon = (entry) => ({
|
|
|
63781
63936
|
],
|
|
63782
63937
|
abis: [KintsuSMonAbi, KintsuSMonAbi],
|
|
63783
63938
|
parse: ([pooled, shares]) => {
|
|
63784
|
-
const totalAssets =
|
|
63785
|
-
const totalSupply =
|
|
63939
|
+
const totalAssets = toBigInt14(pooled);
|
|
63940
|
+
const totalSupply = toBigInt14(shares);
|
|
63786
63941
|
if (totalAssets === void 0 || totalSupply === void 0) return void 0;
|
|
63787
63942
|
const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E1812 / totalSupply : ONE_E1812;
|
|
63788
63943
|
return { totalAssets, totalSupply, exchangeRate };
|
|
@@ -63890,18 +64045,18 @@ var readerTreehouseTAsset = (entry) => {
|
|
|
63890
64045
|
queueFee,
|
|
63891
64046
|
queueMin
|
|
63892
64047
|
] = slice2;
|
|
63893
|
-
const totalAssets =
|
|
63894
|
-
const totalSupply =
|
|
63895
|
-
const exchangeRate =
|
|
64048
|
+
const totalAssets = toBigInt14(assets);
|
|
64049
|
+
const totalSupply = toBigInt14(supply);
|
|
64050
|
+
const exchangeRate = toBigInt14(rate);
|
|
63896
64051
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
63897
64052
|
return void 0;
|
|
63898
64053
|
}
|
|
63899
|
-
const liquidity =
|
|
63900
|
-
const wait =
|
|
63901
|
-
const instantFeeBps = asBps(
|
|
63902
|
-
const queuedFeeBps = asBps(
|
|
63903
|
-
const instantMin =
|
|
63904
|
-
const queuedMin =
|
|
64054
|
+
const liquidity = toBigInt14(redeemable) ?? 0n;
|
|
64055
|
+
const wait = toBigInt14(waiting);
|
|
64056
|
+
const instantFeeBps = asBps(toBigInt14(fastFee));
|
|
64057
|
+
const queuedFeeBps = asBps(toBigInt14(queueFee));
|
|
64058
|
+
const instantMin = toBigInt14(fastMin);
|
|
64059
|
+
const queuedMin = toBigInt14(queueMin);
|
|
63905
64060
|
const instant = {
|
|
63906
64061
|
id: "instant",
|
|
63907
64062
|
kind: "instant",
|
|
@@ -64587,7 +64742,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
64587
64742
|
const validatorsByAddress = new Map(validatorEntries);
|
|
64588
64743
|
const idleByAddress = /* @__PURE__ */ new Map();
|
|
64589
64744
|
idleEntries.forEach((e, i) => {
|
|
64590
|
-
const bal =
|
|
64745
|
+
const bal = toBigInt14(idleResults[i]);
|
|
64591
64746
|
if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
|
|
64592
64747
|
});
|
|
64593
64748
|
const rawResults = new Array(allCalls.length);
|
|
@@ -64745,7 +64900,7 @@ var BeetsStSWithdrawalAbi = [
|
|
|
64745
64900
|
];
|
|
64746
64901
|
|
|
64747
64902
|
// src/vaults/lst/withdrawals/readers/shared.ts
|
|
64748
|
-
var
|
|
64903
|
+
var toBigInt15 = (v) => {
|
|
64749
64904
|
if (v === void 0 || v === null) return void 0;
|
|
64750
64905
|
if (typeof v === "bigint") return v;
|
|
64751
64906
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -64760,7 +64915,7 @@ var toBigInt14 = (v) => {
|
|
|
64760
64915
|
return void 0;
|
|
64761
64916
|
};
|
|
64762
64917
|
var toNumber = (v) => {
|
|
64763
|
-
const b =
|
|
64918
|
+
const b = toBigInt15(v);
|
|
64764
64919
|
if (b === void 0) return void 0;
|
|
64765
64920
|
if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
|
|
64766
64921
|
return Number(b);
|
|
@@ -64797,7 +64952,7 @@ var readerBeets = {
|
|
|
64797
64952
|
const out = [];
|
|
64798
64953
|
for (let i = 0; i < reqs.length; i++) {
|
|
64799
64954
|
const r = reqs[i];
|
|
64800
|
-
const amount4 =
|
|
64955
|
+
const amount4 = toBigInt15(r.assetAmount);
|
|
64801
64956
|
const ts = toNumber(r.requestTimestamp);
|
|
64802
64957
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
64803
64958
|
if (amount4 === void 0 || ts === void 0) continue;
|
|
@@ -64889,13 +65044,13 @@ var readerBeHype = {
|
|
|
64889
65044
|
const q = stage2[i * 2];
|
|
64890
65045
|
const canClaim = Boolean(stage2[i * 2 + 1]);
|
|
64891
65046
|
if (!q) continue;
|
|
64892
|
-
const hypeAmount = Array.isArray(q) ?
|
|
65047
|
+
const hypeAmount = Array.isArray(q) ? toBigInt15(q[2]) : toBigInt15(q.hypeAmount);
|
|
64893
65048
|
if (hypeAmount === void 0) continue;
|
|
64894
65049
|
out.push({
|
|
64895
65050
|
lst: entry.lst,
|
|
64896
65051
|
brand: entry.brand,
|
|
64897
65052
|
symbol: entry.symbol,
|
|
64898
|
-
requestId: String(
|
|
65053
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
64899
65054
|
amountUnderlying: hypeAmount.toString(),
|
|
64900
65055
|
status: canClaim ? "claimable" : "pending"
|
|
64901
65056
|
});
|
|
@@ -64998,7 +65153,7 @@ var readerBenqi = {
|
|
|
64998
65153
|
for (let i = 0; i < reqs.length; i++) {
|
|
64999
65154
|
const r = reqs[i];
|
|
65000
65155
|
const startedAt = toNumber(r.startedAt);
|
|
65001
|
-
const shareAmount =
|
|
65156
|
+
const shareAmount = toBigInt15(r.shareAmount);
|
|
65002
65157
|
if (startedAt === void 0 || shareAmount === void 0) continue;
|
|
65003
65158
|
const readyAt = startedAt + cooldown;
|
|
65004
65159
|
const expiresAt = readyAt + claimWindow;
|
|
@@ -65087,8 +65242,8 @@ var readerBinanceWbeth2 = {
|
|
|
65087
65242
|
for (let i = 0; i < reqs.length; i++) {
|
|
65088
65243
|
const r = reqs[i];
|
|
65089
65244
|
const triggerTime = toNumber(r.triggerTime);
|
|
65090
|
-
const ethAmount =
|
|
65091
|
-
const wbethAmount =
|
|
65245
|
+
const ethAmount = toBigInt15(r.ethAmount);
|
|
65246
|
+
const wbethAmount = toBigInt15(r.wbethAmount);
|
|
65092
65247
|
if (triggerTime === void 0 || ethAmount === void 0) continue;
|
|
65093
65248
|
const readyAt = triggerTime + lockTime;
|
|
65094
65249
|
const claimed = (toNumber(r.claimTime) ?? 0) > 0;
|
|
@@ -65151,8 +65306,8 @@ var readerBeraPaw = {
|
|
|
65151
65306
|
}
|
|
65152
65307
|
const pos = res[0];
|
|
65153
65308
|
if (!pos) return [];
|
|
65154
|
-
const queued = Array.isArray(pos) ?
|
|
65155
|
-
const available = Array.isArray(pos) ?
|
|
65309
|
+
const queued = Array.isArray(pos) ? toBigInt15(pos[0]) : toBigInt15(pos.queued);
|
|
65310
|
+
const available = Array.isArray(pos) ? toBigInt15(pos[1]) : toBigInt15(pos.available);
|
|
65156
65311
|
const out = [];
|
|
65157
65312
|
if (available !== void 0 && available > 0n) {
|
|
65158
65313
|
out.push({
|
|
@@ -65234,7 +65389,7 @@ var readerIbera = {
|
|
|
65234
65389
|
return [];
|
|
65235
65390
|
}
|
|
65236
65391
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65237
|
-
const frontier =
|
|
65392
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65238
65393
|
if (length === 0) return [];
|
|
65239
65394
|
const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
|
|
65240
65395
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65258,7 +65413,7 @@ var readerIbera = {
|
|
|
65258
65413
|
const r = stage2[k];
|
|
65259
65414
|
if (!r) continue;
|
|
65260
65415
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
65261
|
-
const amount4 = Array.isArray(r) ?
|
|
65416
|
+
const amount4 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
|
|
65262
65417
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount4 === void 0 || amount4 === 0n) {
|
|
65263
65418
|
continue;
|
|
65264
65419
|
}
|
|
@@ -65331,7 +65486,7 @@ var readerPrimeStaking = {
|
|
|
65331
65486
|
return [];
|
|
65332
65487
|
}
|
|
65333
65488
|
const length = toNumber(stage1[0]) ?? 0;
|
|
65334
|
-
const frontier =
|
|
65489
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65335
65490
|
if (length === 0) return [];
|
|
65336
65491
|
const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
|
|
65337
65492
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -65355,7 +65510,7 @@ var readerPrimeStaking = {
|
|
|
65355
65510
|
const r = stage2[k];
|
|
65356
65511
|
if (!r) continue;
|
|
65357
65512
|
const receiver = Array.isArray(r) ? r[1] : r.receiver;
|
|
65358
|
-
const assets = Array.isArray(r) ?
|
|
65513
|
+
const assets = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.assets);
|
|
65359
65514
|
const processed = Array.isArray(r) ? r[4] : r.processed;
|
|
65360
65515
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
|
|
65361
65516
|
continue;
|
|
@@ -65426,8 +65581,8 @@ var readerErc7540 = {
|
|
|
65426
65581
|
],
|
|
65427
65582
|
abi: [Erc7540Abi, Erc7540Abi]
|
|
65428
65583
|
});
|
|
65429
|
-
const pending =
|
|
65430
|
-
const claimable =
|
|
65584
|
+
const pending = toBigInt15(stage1[0]) ?? 0n;
|
|
65585
|
+
const claimable = toBigInt15(stage1[1]) ?? 0n;
|
|
65431
65586
|
const out = [];
|
|
65432
65587
|
if (claimable > 0n) {
|
|
65433
65588
|
const stage2 = await multicallRetry({
|
|
@@ -65441,7 +65596,7 @@ var readerErc7540 = {
|
|
|
65441
65596
|
],
|
|
65442
65597
|
abi: [Erc7540Abi]
|
|
65443
65598
|
});
|
|
65444
|
-
const amount4 =
|
|
65599
|
+
const amount4 = toBigInt15(stage2[0]) ?? claimable;
|
|
65445
65600
|
out.push({
|
|
65446
65601
|
lst: entry.lst,
|
|
65447
65602
|
brand: entry.brand,
|
|
@@ -65498,11 +65653,11 @@ var readerEthenaCooldown = {
|
|
|
65498
65653
|
let cooldownEnd;
|
|
65499
65654
|
let amount4;
|
|
65500
65655
|
if (Array.isArray(cell)) {
|
|
65501
|
-
cooldownEnd =
|
|
65502
|
-
amount4 =
|
|
65656
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65657
|
+
amount4 = toBigInt15(cell[1]);
|
|
65503
65658
|
} else if (cell && typeof cell === "object") {
|
|
65504
|
-
cooldownEnd =
|
|
65505
|
-
amount4 =
|
|
65659
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65660
|
+
amount4 = toBigInt15(cell.underlyingAmount);
|
|
65506
65661
|
}
|
|
65507
65662
|
if (!amount4 || amount4 === 0n) return [];
|
|
65508
65663
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65558,13 +65713,13 @@ var readerSusd3Cooldown = {
|
|
|
65558
65713
|
let windowEnd;
|
|
65559
65714
|
let shares;
|
|
65560
65715
|
if (Array.isArray(cell)) {
|
|
65561
|
-
cooldownEnd =
|
|
65562
|
-
windowEnd =
|
|
65563
|
-
shares =
|
|
65716
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
65717
|
+
windowEnd = toBigInt15(cell[1]);
|
|
65718
|
+
shares = toBigInt15(cell[2]);
|
|
65564
65719
|
} else if (cell && typeof cell === "object") {
|
|
65565
|
-
cooldownEnd =
|
|
65566
|
-
windowEnd =
|
|
65567
|
-
shares =
|
|
65720
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
65721
|
+
windowEnd = toBigInt15(cell.windowEnd);
|
|
65722
|
+
shares = toBigInt15(cell.shares);
|
|
65568
65723
|
}
|
|
65569
65724
|
if (!shares || shares === 0n) return [];
|
|
65570
65725
|
let amount4 = shares;
|
|
@@ -65576,7 +65731,7 @@ var readerSusd3Cooldown = {
|
|
|
65576
65731
|
],
|
|
65577
65732
|
abi: [Susd3CooldownStatusAbi]
|
|
65578
65733
|
});
|
|
65579
|
-
amount4 =
|
|
65734
|
+
amount4 = toBigInt15(stage2[0]) ?? shares;
|
|
65580
65735
|
} catch {
|
|
65581
65736
|
}
|
|
65582
65737
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -65650,12 +65805,12 @@ var readerStrataCooldown = {
|
|
|
65650
65805
|
let claimable;
|
|
65651
65806
|
let nextUnlockAt;
|
|
65652
65807
|
if (Array.isArray(cell)) {
|
|
65653
|
-
pending =
|
|
65654
|
-
claimable =
|
|
65808
|
+
pending = toBigInt15(cell[0]);
|
|
65809
|
+
claimable = toBigInt15(cell[1]);
|
|
65655
65810
|
nextUnlockAt = toNumber(cell[2]);
|
|
65656
65811
|
} else if (cell && typeof cell === "object") {
|
|
65657
|
-
pending =
|
|
65658
|
-
claimable =
|
|
65812
|
+
pending = toBigInt15(cell.pending);
|
|
65813
|
+
claimable = toBigInt15(cell.claimable);
|
|
65659
65814
|
nextUnlockAt = toNumber(cell.nextUnlockAt);
|
|
65660
65815
|
}
|
|
65661
65816
|
const escrow = { withdrawQueue: contracts[i], claimToken: escrowToken };
|
|
@@ -65763,7 +65918,7 @@ var readerEtherFi = {
|
|
|
65763
65918
|
calls: enumCalls,
|
|
65764
65919
|
abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
|
|
65765
65920
|
});
|
|
65766
|
-
const ids = stage2.map(
|
|
65921
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
65767
65922
|
if (ids.length === 0) return [];
|
|
65768
65923
|
const detailCalls = ids.flatMap((id) => [
|
|
65769
65924
|
{ address: entry.withdrawalContract, name: "getRequest", params: [id] },
|
|
@@ -65783,7 +65938,7 @@ var readerEtherFi = {
|
|
|
65783
65938
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
65784
65939
|
if (!req) continue;
|
|
65785
65940
|
if (!isValid) continue;
|
|
65786
|
-
const amount4 =
|
|
65941
|
+
const amount4 = toBigInt15(req.amountOfEEth);
|
|
65787
65942
|
if (amount4 === void 0) continue;
|
|
65788
65943
|
out.push({
|
|
65789
65944
|
lst: entry.lst,
|
|
@@ -65878,7 +66033,7 @@ var readerKelp = {
|
|
|
65878
66033
|
}
|
|
65879
66034
|
],
|
|
65880
66035
|
abi: [KelpWithdrawalManagerAbi]
|
|
65881
|
-
}).then((res) =>
|
|
66036
|
+
}).then((res) => toBigInt15(res[0]) ?? 0n)
|
|
65882
66037
|
]);
|
|
65883
66038
|
lengths = storageReads;
|
|
65884
66039
|
currentBlock = block;
|
|
@@ -65910,9 +66065,9 @@ var readerKelp = {
|
|
|
65910
66065
|
for (let i = 0; i < detailCalls.length; i++) {
|
|
65911
66066
|
const r = stage2[i];
|
|
65912
66067
|
if (!r) continue;
|
|
65913
|
-
const expected = Array.isArray(r) ?
|
|
65914
|
-
const startBlock = Array.isArray(r) ?
|
|
65915
|
-
const nonce = Array.isArray(r) ?
|
|
66068
|
+
const expected = Array.isArray(r) ? toBigInt15(r[1]) : toBigInt15(r.expectedAssetAmount);
|
|
66069
|
+
const startBlock = Array.isArray(r) ? toBigInt15(r[2]) : toBigInt15(r.withdrawalStartBlock);
|
|
66070
|
+
const nonce = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.userNonce);
|
|
65916
66071
|
if (expected === void 0 || startBlock === void 0) continue;
|
|
65917
66072
|
const claimable = currentBlock >= startBlock + delayBlocks;
|
|
65918
66073
|
out.push({
|
|
@@ -65989,7 +66144,7 @@ var readerLido = {
|
|
|
65989
66144
|
abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
|
|
65990
66145
|
});
|
|
65991
66146
|
const ids = stage1[0];
|
|
65992
|
-
const frontier =
|
|
66147
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
65993
66148
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
65994
66149
|
const stage2 = await multicallRetry({
|
|
65995
66150
|
chain: chainId,
|
|
@@ -66006,10 +66161,10 @@ var readerLido = {
|
|
|
66006
66161
|
if (!Array.isArray(statuses)) return [];
|
|
66007
66162
|
const out = [];
|
|
66008
66163
|
for (let i = 0; i < ids.length; i++) {
|
|
66009
|
-
const id =
|
|
66164
|
+
const id = toBigInt15(ids[i]);
|
|
66010
66165
|
const s = statuses[i];
|
|
66011
66166
|
if (id === void 0 || !s) continue;
|
|
66012
|
-
const amountOfStETH =
|
|
66167
|
+
const amountOfStETH = toBigInt15(s.amountOfStETH);
|
|
66013
66168
|
const isFinalized = Boolean(s.isFinalized);
|
|
66014
66169
|
const isClaimed = Boolean(s.isClaimed);
|
|
66015
66170
|
if (amountOfStETH === void 0) continue;
|
|
@@ -66118,11 +66273,11 @@ var readerLista = {
|
|
|
66118
66273
|
const status = stage2[i];
|
|
66119
66274
|
if (!status) continue;
|
|
66120
66275
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
66121
|
-
const bnbAmount = Array.isArray(status) ?
|
|
66122
|
-
const snbnbAmount = Array.isArray(req) ?
|
|
66276
|
+
const bnbAmount = Array.isArray(status) ? toBigInt15(status[1]) : toBigInt15(status._amount);
|
|
66277
|
+
const snbnbAmount = Array.isArray(req) ? toBigInt15(req[1]) : toBigInt15(req?.amountInSnBnb);
|
|
66123
66278
|
const amount4 = bnbAmount ?? snbnbAmount;
|
|
66124
66279
|
if (amount4 === void 0) continue;
|
|
66125
|
-
const uuid = Array.isArray(req) ?
|
|
66280
|
+
const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
|
|
66126
66281
|
out.push({
|
|
66127
66282
|
lst: entry.lst,
|
|
66128
66283
|
brand: entry.brand,
|
|
@@ -66207,7 +66362,7 @@ var readerRenzo = {
|
|
|
66207
66362
|
for (let i = 0; i < count; i++) {
|
|
66208
66363
|
const tup = stage2[i];
|
|
66209
66364
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66210
|
-
const amountToRedeem =
|
|
66365
|
+
const amountToRedeem = toBigInt15(tup[2]);
|
|
66211
66366
|
const createdAt = toNumber(tup[4]);
|
|
66212
66367
|
if (amountToRedeem === void 0 || createdAt === void 0) continue;
|
|
66213
66368
|
const readyAt = createdAt + cooldown;
|
|
@@ -66280,9 +66435,9 @@ var readerStaderEthx2 = {
|
|
|
66280
66435
|
]
|
|
66281
66436
|
});
|
|
66282
66437
|
const ids = stage1[0];
|
|
66283
|
-
const frontier =
|
|
66438
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
66284
66439
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
66285
|
-
const idBigInts = ids.map(
|
|
66440
|
+
const idBigInts = ids.map(toBigInt15).filter((v) => v !== void 0);
|
|
66286
66441
|
const detailCalls = idBigInts.map((id) => ({
|
|
66287
66442
|
address: entry.withdrawalContract,
|
|
66288
66443
|
name: "userWithdrawRequests",
|
|
@@ -66298,8 +66453,8 @@ var readerStaderEthx2 = {
|
|
|
66298
66453
|
const id = idBigInts[i];
|
|
66299
66454
|
const tup = stage2[i];
|
|
66300
66455
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
66301
|
-
const ethExpected =
|
|
66302
|
-
const ethFinalized =
|
|
66456
|
+
const ethExpected = toBigInt15(tup[2]) ?? 0n;
|
|
66457
|
+
const ethFinalized = toBigInt15(tup[3]) ?? 0n;
|
|
66303
66458
|
const isFinalized = id < frontier && ethFinalized > 0n;
|
|
66304
66459
|
const queuePosition = isFinalized ? 0 : Number(id - frontier);
|
|
66305
66460
|
out.push({
|
|
@@ -66378,13 +66533,13 @@ var readerStaderMaticX2 = {
|
|
|
66378
66533
|
});
|
|
66379
66534
|
const arr = stage1[0];
|
|
66380
66535
|
if (!Array.isArray(arr)) return [];
|
|
66381
|
-
const currentEpoch = stakeManager ?
|
|
66382
|
-
const delay = stakeManager ?
|
|
66536
|
+
const currentEpoch = stakeManager ? toBigInt15(stage1[1]) ?? 0n : 0n;
|
|
66537
|
+
const delay = stakeManager ? toBigInt15(stage1[2]) ?? 0n : 0n;
|
|
66383
66538
|
const out = [];
|
|
66384
66539
|
for (let i = 0; i < arr.length; i++) {
|
|
66385
66540
|
const r = arr[i];
|
|
66386
|
-
const amount4 =
|
|
66387
|
-
const requestEpoch =
|
|
66541
|
+
const amount4 = toBigInt15(r.amount) ?? 0n;
|
|
66542
|
+
const requestEpoch = toBigInt15(r.requestEpoch);
|
|
66388
66543
|
if (requestEpoch === void 0) continue;
|
|
66389
66544
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
66390
66545
|
out.push({
|
|
@@ -66469,9 +66624,9 @@ var readerMantle = {
|
|
|
66469
66624
|
if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
|
|
66470
66625
|
continue;
|
|
66471
66626
|
}
|
|
66472
|
-
const ethRequested = Array.isArray(detail) ?
|
|
66627
|
+
const ethRequested = Array.isArray(detail) ? toBigInt15(detail[3]) : toBigInt15(detail.ethRequested);
|
|
66473
66628
|
const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
|
|
66474
|
-
const claimable = Array.isArray(info) ?
|
|
66629
|
+
const claimable = Array.isArray(info) ? toBigInt15(info[1]) : toBigInt15(info.claimableAmount);
|
|
66475
66630
|
if (ethRequested === void 0) continue;
|
|
66476
66631
|
out.push({
|
|
66477
66632
|
lst: entry.lst,
|
|
@@ -66550,8 +66705,8 @@ var readerPuffer = {
|
|
|
66550
66705
|
calls,
|
|
66551
66706
|
abi: calls.map(() => PufferWithdrawalManagerAbi)
|
|
66552
66707
|
});
|
|
66553
|
-
const finalizedBatch =
|
|
66554
|
-
const batchSize =
|
|
66708
|
+
const finalizedBatch = toBigInt15(results[detailCalls.length]) ?? 0n;
|
|
66709
|
+
const batchSize = toBigInt15(results[detailCalls.length + 1]) ?? 0n;
|
|
66555
66710
|
const out = [];
|
|
66556
66711
|
const lcUser = user.toLowerCase();
|
|
66557
66712
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -66561,7 +66716,7 @@ var readerPuffer = {
|
|
|
66561
66716
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
66562
66717
|
continue;
|
|
66563
66718
|
}
|
|
66564
|
-
const pufETHAmount = Array.isArray(d) ?
|
|
66719
|
+
const pufETHAmount = Array.isArray(d) ? toBigInt15(d[0]) : toBigInt15(d.pufETHAmount);
|
|
66565
66720
|
if (pufETHAmount === void 0) continue;
|
|
66566
66721
|
const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
|
|
66567
66722
|
const claimable = batchIdx <= finalizedBatch;
|
|
@@ -66659,7 +66814,7 @@ var readerKinetiq = {
|
|
|
66659
66814
|
for (let i = 0; i < count; i++) {
|
|
66660
66815
|
const r = stage2[i];
|
|
66661
66816
|
if (!r) continue;
|
|
66662
|
-
const hypeAmount = Array.isArray(r) ?
|
|
66817
|
+
const hypeAmount = Array.isArray(r) ? toBigInt15(r[0]) : toBigInt15(r.hypeAmount);
|
|
66663
66818
|
const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
|
|
66664
66819
|
if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
|
|
66665
66820
|
continue;
|
|
@@ -66787,7 +66942,7 @@ var readerStakeWise = {
|
|
|
66787
66942
|
const claimedByIdx = /* @__PURE__ */ new Map();
|
|
66788
66943
|
for (let i = 0; i < onChainChecks.length; i++) {
|
|
66789
66944
|
const cell = checkResults[i];
|
|
66790
|
-
const claimed = Array.isArray(cell) ?
|
|
66945
|
+
const claimed = Array.isArray(cell) ? toBigInt15(cell[2]) : toBigInt15(cell?.claimedAssets);
|
|
66791
66946
|
if (claimed !== void 0 && claimed > 0n) {
|
|
66792
66947
|
claimedByIdx.set(onChainChecks[i].idx, claimed);
|
|
66793
66948
|
}
|
|
@@ -66795,7 +66950,7 @@ var readerStakeWise = {
|
|
|
66795
66950
|
const out = [];
|
|
66796
66951
|
for (let i = 0; i < requests.length; i++) {
|
|
66797
66952
|
const r = requests[i];
|
|
66798
|
-
const amount4 =
|
|
66953
|
+
const amount4 = toBigInt15(r.totalAssets) ?? 0n;
|
|
66799
66954
|
const onChainClaimed = claimedByIdx.get(i);
|
|
66800
66955
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
66801
66956
|
out.push({
|
|
@@ -66852,7 +67007,7 @@ var readerStCelo2 = {
|
|
|
66852
67007
|
const timestamps = cell[1] ?? [];
|
|
66853
67008
|
const out = [];
|
|
66854
67009
|
for (let i = 0; i < values.length; i++) {
|
|
66855
|
-
const amount4 =
|
|
67010
|
+
const amount4 = toBigInt15(values[i]);
|
|
66856
67011
|
const readyAt = toNumber(timestamps[i]);
|
|
66857
67012
|
if (amount4 === void 0 || readyAt === void 0) continue;
|
|
66858
67013
|
out.push({
|
|
@@ -66932,7 +67087,7 @@ var readerSwell = {
|
|
|
66932
67087
|
abi: [SwellRswExitAbi, SwellRswExitAbi]
|
|
66933
67088
|
});
|
|
66934
67089
|
const count = toNumber(stage1[0]) ?? 0;
|
|
66935
|
-
const lastProcessed =
|
|
67090
|
+
const lastProcessed = toBigInt15(stage1[1]) ?? 0n;
|
|
66936
67091
|
if (count === 0) return [];
|
|
66937
67092
|
const enumCalls = Array.from({ length: count }, (_3, i) => ({
|
|
66938
67093
|
address: entry.withdrawalContract,
|
|
@@ -66944,7 +67099,7 @@ var readerSwell = {
|
|
|
66944
67099
|
calls: enumCalls,
|
|
66945
67100
|
abi: enumCalls.map(() => SwellRswExitAbi)
|
|
66946
67101
|
});
|
|
66947
|
-
const ids = stage2.map(
|
|
67102
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
66948
67103
|
if (ids.length === 0) return [];
|
|
66949
67104
|
const detailCalls = ids.map((id) => ({
|
|
66950
67105
|
address: entry.withdrawalContract,
|
|
@@ -66961,7 +67116,7 @@ var readerSwell = {
|
|
|
66961
67116
|
const id = ids[i];
|
|
66962
67117
|
const r = stage3[i];
|
|
66963
67118
|
if (!r) continue;
|
|
66964
|
-
const amount4 =
|
|
67119
|
+
const amount4 = toBigInt15(r.amount);
|
|
66965
67120
|
if (amount4 === void 0) continue;
|
|
66966
67121
|
const claimable = id <= lastProcessed;
|
|
66967
67122
|
out.push({
|
|
@@ -67035,14 +67190,14 @@ var readerValantis = {
|
|
|
67035
67190
|
for (let i = 0; i < burns.length; i++) {
|
|
67036
67191
|
const b = burns[i];
|
|
67037
67192
|
if (!b) continue;
|
|
67038
|
-
const amount4 = Array.isArray(b) ?
|
|
67193
|
+
const amount4 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
|
|
67039
67194
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
67040
67195
|
if (amount4 === void 0 || completed) continue;
|
|
67041
67196
|
out.push({
|
|
67042
67197
|
lst: entry.lst,
|
|
67043
67198
|
brand: entry.brand,
|
|
67044
67199
|
symbol: entry.symbol,
|
|
67045
|
-
requestId: String(
|
|
67200
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
67046
67201
|
amountUnderlying: amount4.toString(),
|
|
67047
67202
|
status: redeemable[i] ? "claimable" : "pending"
|
|
67048
67203
|
});
|
|
@@ -67109,8 +67264,8 @@ var readerTreehouseRedemption = {
|
|
|
67109
67264
|
for (let i = 0; i < reqs.length; i++) {
|
|
67110
67265
|
const r = reqs[i];
|
|
67111
67266
|
const startTime = toNumber(r.startTime);
|
|
67112
|
-
const assets =
|
|
67113
|
-
const shares =
|
|
67267
|
+
const assets = toBigInt15(r.assets);
|
|
67268
|
+
const shares = toBigInt15(r.shares);
|
|
67114
67269
|
if (startTime === void 0 || assets === void 0) continue;
|
|
67115
67270
|
const readyAt = startTime + waitingPeriod;
|
|
67116
67271
|
out.push({
|
|
@@ -67193,7 +67348,7 @@ var readerTruFin = {
|
|
|
67193
67348
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
67194
67349
|
continue;
|
|
67195
67350
|
}
|
|
67196
|
-
const amount4 = Array.isArray(w) ?
|
|
67351
|
+
const amount4 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
|
|
67197
67352
|
if (amount4 === void 0 || amount4 === 0n) continue;
|
|
67198
67353
|
out.push({
|
|
67199
67354
|
lst: entry.lst,
|
|
@@ -67289,7 +67444,7 @@ var readerYieldNest = {
|
|
|
67289
67444
|
calls: enumCalls,
|
|
67290
67445
|
abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
|
|
67291
67446
|
});
|
|
67292
|
-
const ids = stage2.map(
|
|
67447
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
67293
67448
|
if (ids.length === 0) return [];
|
|
67294
67449
|
const detailCalls = ids.map((id) => ({
|
|
67295
67450
|
address: entry.withdrawalContract,
|
|
@@ -67308,7 +67463,7 @@ var readerYieldNest = {
|
|
|
67308
67463
|
const id = ids[i];
|
|
67309
67464
|
const r = stage3[i];
|
|
67310
67465
|
if (!r) continue;
|
|
67311
|
-
const amount4 =
|
|
67466
|
+
const amount4 = toBigInt15(r.amount);
|
|
67312
67467
|
const created = toNumber(r.creationTimestamp);
|
|
67313
67468
|
const processed = Boolean(r.processed);
|
|
67314
67469
|
if (amount4 === void 0 || created === void 0) continue;
|
|
@@ -68258,7 +68413,7 @@ var NavOracleReadAbi = [
|
|
|
68258
68413
|
|
|
68259
68414
|
// src/vaults/savings/readers/shared.ts
|
|
68260
68415
|
var ONE_E1814 = 10n ** 18n;
|
|
68261
|
-
var
|
|
68416
|
+
var toBigInt16 = (v) => {
|
|
68262
68417
|
if (v === void 0 || v === null) return void 0;
|
|
68263
68418
|
if (typeof v === "bigint") return v;
|
|
68264
68419
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -68289,9 +68444,9 @@ var readerErc46262 = (entry) => {
|
|
|
68289
68444
|
],
|
|
68290
68445
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
68291
68446
|
parse: ([assets, supply, rate]) => {
|
|
68292
|
-
const totalAssets =
|
|
68293
|
-
const totalSupply =
|
|
68294
|
-
const convertToAssetsRaw =
|
|
68447
|
+
const totalAssets = toBigInt16(assets);
|
|
68448
|
+
const totalSupply = toBigInt16(supply);
|
|
68449
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68295
68450
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68296
68451
|
return void 0;
|
|
68297
68452
|
}
|
|
@@ -68319,13 +68474,13 @@ var readerErc4626Cooldown = (entry) => {
|
|
|
68319
68474
|
],
|
|
68320
68475
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, cooldownAbi],
|
|
68321
68476
|
parse: ([assets, supply, rate, cooldown]) => {
|
|
68322
|
-
const totalAssets =
|
|
68323
|
-
const totalSupply =
|
|
68324
|
-
const convertToAssetsRaw =
|
|
68477
|
+
const totalAssets = toBigInt16(assets);
|
|
68478
|
+
const totalSupply = toBigInt16(supply);
|
|
68479
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
68325
68480
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
68326
68481
|
return void 0;
|
|
68327
68482
|
}
|
|
68328
|
-
const cooldownSecs =
|
|
68483
|
+
const cooldownSecs = toBigInt16(cooldown);
|
|
68329
68484
|
return {
|
|
68330
68485
|
totalAssets,
|
|
68331
68486
|
totalSupply,
|
|
@@ -69004,13 +69159,13 @@ var readerErc4626Idle = (entry) => {
|
|
|
69004
69159
|
],
|
|
69005
69160
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, BalanceOfAbi],
|
|
69006
69161
|
parse: ([assets, supply, rate, inventoryBalance]) => {
|
|
69007
|
-
const totalAssets =
|
|
69008
|
-
const totalSupply =
|
|
69009
|
-
const convertToAssetsRaw =
|
|
69162
|
+
const totalAssets = toBigInt16(assets);
|
|
69163
|
+
const totalSupply = toBigInt16(supply);
|
|
69164
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69010
69165
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69011
69166
|
return void 0;
|
|
69012
69167
|
}
|
|
69013
|
-
const capacity =
|
|
69168
|
+
const capacity = toBigInt16(inventoryBalance);
|
|
69014
69169
|
return {
|
|
69015
69170
|
totalAssets,
|
|
69016
69171
|
totalSupply,
|
|
@@ -69053,13 +69208,13 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
69053
69208
|
AvailableWithdrawLimitAbi
|
|
69054
69209
|
],
|
|
69055
69210
|
parse: ([assets, supply, rate, withdrawLimit]) => {
|
|
69056
|
-
const totalAssets =
|
|
69057
|
-
const totalSupply =
|
|
69058
|
-
const convertToAssetsRaw =
|
|
69211
|
+
const totalAssets = toBigInt16(assets);
|
|
69212
|
+
const totalSupply = toBigInt16(supply);
|
|
69213
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69059
69214
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69060
69215
|
return void 0;
|
|
69061
69216
|
}
|
|
69062
|
-
const capacity =
|
|
69217
|
+
const capacity = toBigInt16(withdrawLimit);
|
|
69063
69218
|
return {
|
|
69064
69219
|
totalAssets,
|
|
69065
69220
|
totalSupply,
|
|
@@ -69077,6 +69232,7 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
69077
69232
|
// src/vaults/savings/readers/bitfiBfbtc.ts
|
|
69078
69233
|
var BITFI_RATIO_SCALE = 10n ** 8n;
|
|
69079
69234
|
var CLOSED_DEPOSIT_MIN = 10n ** 20n;
|
|
69235
|
+
var CLOSED_FLAT_FEE = 10n ** 8n;
|
|
69080
69236
|
var readerBitfiBfbtc = (entry) => {
|
|
69081
69237
|
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
69082
69238
|
const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
|
|
@@ -69098,18 +69254,25 @@ var readerBitfiBfbtc = (entry) => {
|
|
|
69098
69254
|
BfbtcReadAbi
|
|
69099
69255
|
],
|
|
69100
69256
|
parse: ([supply, ratio, evmFee, nativeFee, minDeposit, paused]) => {
|
|
69101
|
-
const totalSupply =
|
|
69102
|
-
const currentRatio =
|
|
69257
|
+
const totalSupply = toBigInt16(supply);
|
|
69258
|
+
const currentRatio = toBigInt16(ratio);
|
|
69103
69259
|
if (totalSupply === void 0) return void 0;
|
|
69104
69260
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69105
69261
|
const exchangeRate = ONE_E1814 * BITFI_RATIO_SCALE / currentRatio;
|
|
69106
69262
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69107
|
-
const
|
|
69108
|
-
|
|
69109
|
-
|
|
69110
|
-
|
|
69111
|
-
|
|
69112
|
-
|
|
69263
|
+
const feeOf = (cell) => {
|
|
69264
|
+
if (!Array.isArray(cell)) return void 0;
|
|
69265
|
+
const pct3 = toBigInt16(cell[0]);
|
|
69266
|
+
const fixed = toBigInt16(cell[1]);
|
|
69267
|
+
return pct3 === void 0 || fixed === void 0 ? void 0 : { pct: pct3, fixed };
|
|
69268
|
+
};
|
|
69269
|
+
const evm = feeOf(evmFee);
|
|
69270
|
+
const native = feeOf(nativeFee);
|
|
69271
|
+
const routeOpen = (f) => f === void 0 || f.pct < BITFI_FEE_PRECISION && f.fixed < CLOSED_FLAT_FEE;
|
|
69272
|
+
const evmExitEnabled = routeOpen(evm);
|
|
69273
|
+
const nativeExitEnabled = routeOpen(native);
|
|
69274
|
+
const evmPct = evm?.pct;
|
|
69275
|
+
const minDep = toBigInt16(minDeposit);
|
|
69113
69276
|
const depositsClosed = minDep !== void 0 && minDep >= CLOSED_DEPOSIT_MIN;
|
|
69114
69277
|
const isPaused = paused === true;
|
|
69115
69278
|
return {
|
|
@@ -69158,16 +69321,16 @@ var readerBitfiVault = (entry) => {
|
|
|
69158
69321
|
BfusdVaultReadAbi
|
|
69159
69322
|
],
|
|
69160
69323
|
parse: ([assets, supply, ratio, depositRatio, cap, paused]) => {
|
|
69161
|
-
const totalAssets =
|
|
69162
|
-
const totalSupply =
|
|
69163
|
-
const currentRatio =
|
|
69324
|
+
const totalAssets = toBigInt16(assets);
|
|
69325
|
+
const totalSupply = toBigInt16(supply);
|
|
69326
|
+
const currentRatio = toBigInt16(ratio);
|
|
69164
69327
|
if (totalAssets === void 0 || totalSupply === void 0)
|
|
69165
69328
|
return void 0;
|
|
69166
69329
|
if (currentRatio === void 0 || currentRatio <= 0n) return void 0;
|
|
69167
69330
|
const exchangeRate = currentRatio * ONE_E1814 / BITFI_RATIO_SCALE;
|
|
69168
|
-
const depRatio =
|
|
69331
|
+
const depRatio = toBigInt16(depositRatio);
|
|
69169
69332
|
const fundamentalExchangeRate = depRatio !== void 0 && depRatio > 0n ? depRatio * ONE_E1814 / BITFI_RATIO_SCALE : void 0;
|
|
69170
|
-
const supplyCap =
|
|
69333
|
+
const supplyCap = toBigInt16(cap);
|
|
69171
69334
|
const isPaused = paused === true;
|
|
69172
69335
|
let depositCapacity;
|
|
69173
69336
|
if (isPaused) {
|
|
@@ -69221,13 +69384,13 @@ var readerBitwayVault = (entry) => {
|
|
|
69221
69384
|
BitwayVaultReadAbi
|
|
69222
69385
|
],
|
|
69223
69386
|
parse: ([supply, rate, buffer, waitingTime]) => {
|
|
69224
|
-
const totalSupply =
|
|
69225
|
-
const exchangeRate =
|
|
69387
|
+
const totalSupply = toBigInt16(supply);
|
|
69388
|
+
const exchangeRate = toBigInt16(rate);
|
|
69226
69389
|
if (totalSupply === void 0 || exchangeRate === void 0 || exchangeRate === 0n) {
|
|
69227
69390
|
return void 0;
|
|
69228
69391
|
}
|
|
69229
|
-
const capacity =
|
|
69230
|
-
const wait =
|
|
69392
|
+
const capacity = toBigInt16(buffer);
|
|
69393
|
+
const wait = toBigInt16(waitingTime);
|
|
69231
69394
|
return {
|
|
69232
69395
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69233
69396
|
// (Every live leg is 18/18-dec — BSC stables are 18-dec — but the
|
|
@@ -69257,9 +69420,9 @@ var readerFrankencoinSavings = (entry) => ({
|
|
|
69257
69420
|
],
|
|
69258
69421
|
abis: [BalanceOfAbi, FrankencoinSavingsReadAbi],
|
|
69259
69422
|
parse: ([balance, ratePPM]) => {
|
|
69260
|
-
const deposits =
|
|
69423
|
+
const deposits = toBigInt16(balance);
|
|
69261
69424
|
if (deposits === void 0) return void 0;
|
|
69262
|
-
if (
|
|
69425
|
+
if (toBigInt16(ratePPM) === void 0) return void 0;
|
|
69263
69426
|
return {
|
|
69264
69427
|
totalAssets: deposits,
|
|
69265
69428
|
// No shares exist; the "supply" IS the deposited principal, and
|
|
@@ -69303,15 +69466,15 @@ var readerHyperbeatVault = (entry) => {
|
|
|
69303
69466
|
HyperbeatQueueReadAbi
|
|
69304
69467
|
],
|
|
69305
69468
|
parse: ([supply, rate, rateDecimals, inventory, fee, instantPaused]) => {
|
|
69306
|
-
const totalSupply =
|
|
69307
|
-
const rawRate =
|
|
69308
|
-
const rateDec =
|
|
69469
|
+
const totalSupply = toBigInt16(supply);
|
|
69470
|
+
const rawRate = toBigInt16(rate);
|
|
69471
|
+
const rateDec = toBigInt16(rateDecimals);
|
|
69309
69472
|
if (totalSupply === void 0 || rawRate === void 0 || rateDec === void 0 || rawRate === 0n) {
|
|
69310
69473
|
return void 0;
|
|
69311
69474
|
}
|
|
69312
69475
|
const exchangeRate = rateDec <= 18n ? rawRate * 10n ** (18n - rateDec) : rawRate / 10n ** (rateDec - 18n);
|
|
69313
|
-
const capacity =
|
|
69314
|
-
const feeRaw =
|
|
69476
|
+
const capacity = toBigInt16(inventory);
|
|
69477
|
+
const feeRaw = toBigInt16(fee);
|
|
69315
69478
|
return {
|
|
69316
69479
|
// totalSupply is in raw share units; convert to raw underlying.
|
|
69317
69480
|
totalAssets: totalSupply * exchangeRate * underlyingUnit / (shareUnit * ONE_E1814),
|
|
@@ -69346,10 +69509,10 @@ var readerNavOracle = (entry) => {
|
|
|
69346
69509
|
],
|
|
69347
69510
|
abis: [TotalSupplyAbi2, NavOracleReadAbi],
|
|
69348
69511
|
parse: ([supply, round]) => {
|
|
69349
|
-
const totalSupply =
|
|
69512
|
+
const totalSupply = toBigInt16(supply);
|
|
69350
69513
|
if (totalSupply === void 0) return void 0;
|
|
69351
69514
|
const raw = Array.isArray(round) ? round[1] : round?.answer;
|
|
69352
|
-
const answer =
|
|
69515
|
+
const answer = toBigInt16(raw);
|
|
69353
69516
|
if (answer === void 0 || answer <= 0n) return void 0;
|
|
69354
69517
|
const exchangeRate = answer * ONE_E1814 / oracleScale;
|
|
69355
69518
|
return {
|
|
@@ -69392,14 +69555,14 @@ var readerNativeWnlp = (entry) => {
|
|
|
69392
69555
|
NativeWithdrawQueueReadAbi
|
|
69393
69556
|
],
|
|
69394
69557
|
parse: ([supply, rate, feeBips, instantEnabled, inventory, window]) => {
|
|
69395
|
-
const totalSupply =
|
|
69396
|
-
const exchangeRate =
|
|
69558
|
+
const totalSupply = toBigInt16(supply);
|
|
69559
|
+
const exchangeRate = toBigInt16(rate);
|
|
69397
69560
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
69398
69561
|
return void 0;
|
|
69399
69562
|
}
|
|
69400
|
-
const capacity =
|
|
69401
|
-
const windowSeconds =
|
|
69402
|
-
const bips =
|
|
69563
|
+
const capacity = toBigInt16(inventory);
|
|
69564
|
+
const windowSeconds = toBigInt16(window);
|
|
69565
|
+
const bips = toBigInt16(feeBips);
|
|
69403
69566
|
return {
|
|
69404
69567
|
totalAssets: totalSupply * exchangeRate / ONE_E1814,
|
|
69405
69568
|
totalSupply,
|
|
@@ -69444,15 +69607,15 @@ var readerSaturnVault = (entry) => {
|
|
|
69444
69607
|
SaturnMinWithdrawalAbi
|
|
69445
69608
|
],
|
|
69446
69609
|
parse: ([assets, supply, rate, previewShares, feeBps, minWithdrawal]) => {
|
|
69447
|
-
const totalAssets =
|
|
69448
|
-
const totalSupply =
|
|
69449
|
-
const convertToAssetsRaw =
|
|
69610
|
+
const totalAssets = toBigInt16(assets);
|
|
69611
|
+
const totalSupply = toBigInt16(supply);
|
|
69612
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
69450
69613
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69451
69614
|
return void 0;
|
|
69452
69615
|
}
|
|
69453
|
-
const entryShares =
|
|
69454
|
-
const depositFeeBps =
|
|
69455
|
-
const exitMinAmount =
|
|
69616
|
+
const entryShares = toBigInt16(previewShares);
|
|
69617
|
+
const depositFeeBps = toBigInt16(feeBps);
|
|
69618
|
+
const exitMinAmount = toBigInt16(minWithdrawal);
|
|
69456
69619
|
return {
|
|
69457
69620
|
totalAssets,
|
|
69458
69621
|
totalSupply,
|
|
@@ -69537,17 +69700,17 @@ var readerVenusHub = (entry) => {
|
|
|
69537
69700
|
calls,
|
|
69538
69701
|
abis,
|
|
69539
69702
|
parse: (slice2) => {
|
|
69540
|
-
const totalAssets =
|
|
69541
|
-
const totalSupply =
|
|
69542
|
-
const convertToAssetsRaw =
|
|
69703
|
+
const totalAssets = toBigInt16(slice2[0]);
|
|
69704
|
+
const totalSupply = toBigInt16(slice2[1]);
|
|
69705
|
+
const convertToAssetsRaw = toBigInt16(slice2[2]);
|
|
69543
69706
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
69544
69707
|
return void 0;
|
|
69545
69708
|
}
|
|
69546
69709
|
const paused = slice2[4] === true;
|
|
69547
|
-
const maxWithdrawalSize =
|
|
69548
|
-
const redeemFeeBps =
|
|
69549
|
-
const idle =
|
|
69550
|
-
const depositCapacity =
|
|
69710
|
+
const maxWithdrawalSize = toBigInt16(slice2[5]);
|
|
69711
|
+
const redeemFeeBps = toBigInt16(slice2[6]);
|
|
69712
|
+
const idle = toBigInt16(slice2[7]);
|
|
69713
|
+
const depositCapacity = toBigInt16(slice2[3]);
|
|
69551
69714
|
let groupLiquid = 0n;
|
|
69552
69715
|
let weightedBps = 0n;
|
|
69553
69716
|
let rateWeight = 0n;
|
|
@@ -69555,9 +69718,9 @@ var readerVenusHub = (entry) => {
|
|
|
69555
69718
|
let groupsOk = groups.length > 0;
|
|
69556
69719
|
for (let i = 0; i < groups.length; i++) {
|
|
69557
69720
|
const base = 8 + i * 3;
|
|
69558
|
-
const liquid =
|
|
69559
|
-
const assets =
|
|
69560
|
-
const apyBps =
|
|
69721
|
+
const liquid = toBigInt16(slice2[base]);
|
|
69722
|
+
const assets = toBigInt16(slice2[base + 1]);
|
|
69723
|
+
const apyBps = toBigInt16(slice2[base + 2]);
|
|
69561
69724
|
if (liquid === void 0 || assets === void 0 || apyBps === void 0) {
|
|
69562
69725
|
groupsOk = false;
|
|
69563
69726
|
continue;
|
|
@@ -69600,12 +69763,12 @@ var readerVenusHub = (entry) => {
|
|
|
69600
69763
|
};
|
|
69601
69764
|
};
|
|
69602
69765
|
var parseStrandedRewards = (slice2, base, coreGroupAssets, hubTotalAssets) => {
|
|
69603
|
-
const blocksPerYear =
|
|
69604
|
-
const supplySpeed =
|
|
69605
|
-
const rewardPrice =
|
|
69606
|
-
const underlyingPrice =
|
|
69607
|
-
const vTokenSupply =
|
|
69608
|
-
const exchangeRateStored =
|
|
69766
|
+
const blocksPerYear = toBigInt16(slice2[base]);
|
|
69767
|
+
const supplySpeed = toBigInt16(slice2[base + 1]);
|
|
69768
|
+
const rewardPrice = toBigInt16(slice2[base + 2]);
|
|
69769
|
+
const underlyingPrice = toBigInt16(slice2[base + 3]);
|
|
69770
|
+
const vTokenSupply = toBigInt16(slice2[base + 4]);
|
|
69771
|
+
const exchangeRateStored = toBigInt16(slice2[base + 5]);
|
|
69609
69772
|
if (blocksPerYear === void 0 || supplySpeed === void 0 || rewardPrice === void 0 || underlyingPrice === void 0 || vTokenSupply === void 0 || exchangeRateStored === void 0) {
|
|
69610
69773
|
return void 0;
|
|
69611
69774
|
}
|
|
@@ -69631,9 +69794,9 @@ var readerVesperPool = (entry) => {
|
|
|
69631
69794
|
],
|
|
69632
69795
|
abis: [VesperPoolReadAbi, VesperPoolReadAbi, VesperPoolReadAbi],
|
|
69633
69796
|
parse: ([value, supply, pps]) => {
|
|
69634
|
-
const totalAssets =
|
|
69635
|
-
const totalSupply =
|
|
69636
|
-
const pricePerShare =
|
|
69797
|
+
const totalAssets = toBigInt16(value);
|
|
69798
|
+
const totalSupply = toBigInt16(supply);
|
|
69799
|
+
const pricePerShare = toBigInt16(pps);
|
|
69637
69800
|
if (totalAssets === void 0 || totalSupply === void 0) {
|
|
69638
69801
|
return void 0;
|
|
69639
69802
|
}
|
|
@@ -69661,15 +69824,15 @@ var readerWrenNav = (entry) => {
|
|
|
69661
69824
|
],
|
|
69662
69825
|
abis: [TotalSupplyAbi2, WrenNavReadAbi, WrenNavReadAbi, WrenNavReadAbi],
|
|
69663
69826
|
parse: ([supply, burn, nav, burnable]) => {
|
|
69664
|
-
const totalSupply =
|
|
69665
|
-
const navPrice =
|
|
69827
|
+
const totalSupply = toBigInt16(supply);
|
|
69828
|
+
const navPrice = toBigInt16(nav);
|
|
69666
69829
|
if (totalSupply === void 0) return void 0;
|
|
69667
69830
|
if (navPrice === void 0 || navPrice <= 0n) return void 0;
|
|
69668
|
-
const burncost =
|
|
69831
|
+
const burncost = toBigInt16(burn);
|
|
69669
69832
|
const hasBurncost = burncost !== void 0 && burncost > 0n;
|
|
69670
69833
|
const exchangeRate = hasBurncost ? burncost : navPrice;
|
|
69671
69834
|
const totalAssets = totalSupply * exchangeRate * underlyingUnit / (ONE_E1814 * shareUnit);
|
|
69672
|
-
const burnFlag =
|
|
69835
|
+
const burnFlag = toBigInt16(burnable);
|
|
69673
69836
|
const instantRedeemEnabled = burnFlag === void 0 ? true : burnFlag > 0n;
|
|
69674
69837
|
return {
|
|
69675
69838
|
totalAssets,
|
|
@@ -69703,17 +69866,17 @@ var readerYieldBasisLt = (entry) => {
|
|
|
69703
69866
|
YieldBasisAmmReadAbi
|
|
69704
69867
|
],
|
|
69705
69868
|
parse: ([supply, pps, redeemPerShare, maxDebt, valueOracle]) => {
|
|
69706
|
-
const totalSupply =
|
|
69707
|
-
const fundamental =
|
|
69708
|
-
const redeemRaw =
|
|
69869
|
+
const totalSupply = toBigInt16(supply);
|
|
69870
|
+
const fundamental = toBigInt16(pps);
|
|
69871
|
+
const redeemRaw = toBigInt16(redeemPerShare);
|
|
69709
69872
|
if (totalSupply === void 0 || fundamental === void 0 || redeemRaw === void 0) {
|
|
69710
69873
|
return void 0;
|
|
69711
69874
|
}
|
|
69712
69875
|
if (totalSupply === 0n || redeemRaw === 0n) return void 0;
|
|
69713
69876
|
const totalAssets = totalSupply * redeemRaw / ONE_SHARE;
|
|
69714
69877
|
const exchangeRate = redeemRaw * ONE_E1814 / underlyingUnit;
|
|
69715
|
-
const equity = Array.isArray(valueOracle) ?
|
|
69716
|
-
const cap =
|
|
69878
|
+
const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
|
|
69879
|
+
const cap = toBigInt16(maxDebt);
|
|
69717
69880
|
let depositCapacity;
|
|
69718
69881
|
if (cap !== void 0 && equity !== void 0 && equity > 0n) {
|
|
69719
69882
|
const headroom = cap / 2n - equity;
|
|
@@ -69782,6 +69945,36 @@ var resolveSelfOnly = (chainId, vault) => {
|
|
|
69782
69945
|
var withSelfOnly = (routes2, selfOnly) => selfOnly === void 0 ? routes2 : routes2.map(
|
|
69783
69946
|
(r) => r.kind === "market" || r.selfOnly !== void 0 ? r : { ...r, selfOnly }
|
|
69784
69947
|
);
|
|
69948
|
+
var bitfiExitRoutes = (exit, waitSeconds) => {
|
|
69949
|
+
if (!exit) return void 0;
|
|
69950
|
+
const routes2 = [];
|
|
69951
|
+
if (exit.evmExitEnabled) {
|
|
69952
|
+
routes2.push({
|
|
69953
|
+
id: "queued",
|
|
69954
|
+
kind: "queued",
|
|
69955
|
+
label: "Queued (multisig-approved)",
|
|
69956
|
+
settlement: "async",
|
|
69957
|
+
// The proportional fee is 0 on every open leg; the flat per-request fee
|
|
69958
|
+
// (0.000006–0.00009 bfBTC by chain) is stated on the row.
|
|
69959
|
+
feeBps: 0,
|
|
69960
|
+
waitSeconds,
|
|
69961
|
+
description: "Burns the bfBTC and books a request that BitFi's Safe must approve before it can be claimed; no on-chain deadline."
|
|
69962
|
+
});
|
|
69963
|
+
}
|
|
69964
|
+
if (exit.nativeExitEnabled) {
|
|
69965
|
+
routes2.push({
|
|
69966
|
+
id: "queued-bitcoin",
|
|
69967
|
+
kind: "queued",
|
|
69968
|
+
label: "Bitcoin network",
|
|
69969
|
+
settlement: "async",
|
|
69970
|
+
feeBps: 0,
|
|
69971
|
+
waitSeconds,
|
|
69972
|
+
selfOnly: true,
|
|
69973
|
+
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."
|
|
69974
|
+
});
|
|
69975
|
+
}
|
|
69976
|
+
return routes2;
|
|
69977
|
+
};
|
|
69785
69978
|
var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList = {}) => {
|
|
69786
69979
|
const entries = getSavingsRegistry(chainId);
|
|
69787
69980
|
if (entries.length === 0) return {};
|
|
@@ -69917,7 +70110,10 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
69917
70110
|
// fee is left ABSENT rather than 0 because "not published" and "free"
|
|
69918
70111
|
// are different claims and only some protocols make the second.
|
|
69919
70112
|
exitRoutes: withSelfOnly(
|
|
69920
|
-
|
|
70113
|
+
bitfiExitRoutes(
|
|
70114
|
+
state.bitfiExit,
|
|
70115
|
+
state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds
|
|
70116
|
+
) ?? deriveExitRoutes({
|
|
69921
70117
|
withdrawalMode: entry.withdrawalMode,
|
|
69922
70118
|
withdrawFeeBps: state.withdrawFeeBps,
|
|
69923
70119
|
withdrawalCooldownSeconds: state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds,
|
|
@@ -70298,7 +70494,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
|
|
|
70298
70494
|
|
|
70299
70495
|
// src/vaults/aave-earn/fetchPublic.ts
|
|
70300
70496
|
var BRAND2 = "Aave";
|
|
70301
|
-
var
|
|
70497
|
+
var toBigInt17 = (v) => {
|
|
70302
70498
|
if (v === void 0 || v === null) return void 0;
|
|
70303
70499
|
if (typeof v === "bigint") return v;
|
|
70304
70500
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -70358,15 +70554,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
70358
70554
|
const token = v.usedReserve.underlyingToken;
|
|
70359
70555
|
const underlyingLc = token.address.toLowerCase();
|
|
70360
70556
|
const assetDecimals = token.decimals;
|
|
70361
|
-
const shareDecOnChain =
|
|
70557
|
+
const shareDecOnChain = toBigInt17(slice2[1]);
|
|
70362
70558
|
const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
|
|
70363
|
-
const totalSupply =
|
|
70559
|
+
const totalSupply = toBigInt17(slice2[2]);
|
|
70364
70560
|
if (totalSupply === void 0) continue;
|
|
70365
70561
|
const shareUnit = 10n ** BigInt(decimals);
|
|
70366
70562
|
const underlyingUnit = 10n ** BigInt(assetDecimals);
|
|
70367
|
-
const convertToAssets =
|
|
70563
|
+
const convertToAssets = toBigInt17(slice2[3]) ?? 0n;
|
|
70368
70564
|
const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
|
|
70369
|
-
const totalAssets =
|
|
70565
|
+
const totalAssets = toBigInt17(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
|
|
70370
70566
|
const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
|
|
70371
70567
|
const asset = tokenList[underlyingLc];
|
|
70372
70568
|
const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num7(v.balance.usdPerToken) : void 0);
|
|
@@ -76082,7 +76278,12 @@ function resolveAvailability(meta, maturity) {
|
|
|
76082
76278
|
// door open outward, and a matured bond is precisely the case where the
|
|
76083
76279
|
// holder still needs out. An explicit pause is the one thing that shuts
|
|
76084
76280
|
// both.
|
|
76085
|
-
|
|
76281
|
+
// ...and so is an EMPTY route list. `exitRoutes` is derived for every row
|
|
76282
|
+
// and the invariant is "at least one route", so `[]` is never a default —
|
|
76283
|
+
// it is a reader saying every leg is shut (BitFi publishes its two queues
|
|
76284
|
+
// from live fee flags, and a chain can have both switched off). Absent is
|
|
76285
|
+
// the ordinary case and says nothing.
|
|
76286
|
+
canWithdraw: meta.paused !== true && !(Array.isArray(meta.exitRoutes) && meta.exitRoutes.length === 0),
|
|
76086
76287
|
gating,
|
|
76087
76288
|
reason
|
|
76088
76289
|
};
|