@1delta/margin-fetcher 0.0.316 → 0.0.317
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.js +653 -197
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/fetchLenderAll.d.ts.map +1 -1
- package/dist/lending/public-data/fetchLenderExt.d.ts.map +1 -1
- package/dist/lending/public-data/midnight/apiClient.d.ts +21 -0
- package/dist/lending/public-data/midnight/apiClient.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/convertPublic.d.ts +25 -0
- package/dist/lending/public-data/midnight/convertPublic.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/fetchPublic.d.ts +12 -0
- package/dist/lending/public-data/midnight/fetchPublic.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/index.d.ts +6 -0
- package/dist/lending/public-data/midnight/index.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/live.test.d.ts +2 -0
- package/dist/lending/public-data/midnight/live.test.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/math.d.ts +22 -0
- package/dist/lending/public-data/midnight/math.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/math.test.d.ts +2 -0
- package/dist/lending/public-data/midnight/math.test.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/types.d.ts +45 -0
- package/dist/lending/public-data/midnight/types.d.ts.map +1 -0
- package/dist/lending/user-data/abis.d.ts.map +1 -1
- package/dist/lending/user-data/fetch-balances/parse.d.ts.map +1 -1
- package/dist/lending/user-data/fetch-balances/prepare.d.ts.map +1 -1
- package/dist/lending/user-data/midnight/index.d.ts +3 -0
- package/dist/lending/user-data/midnight/index.d.ts.map +1 -0
- package/dist/lending/user-data/midnight/userCallBuild.d.ts +16 -0
- package/dist/lending/user-data/midnight/userCallBuild.d.ts.map +1 -0
- package/dist/lending/user-data/midnight/userCallParse.d.ts +17 -0
- package/dist/lending/user-data/midnight/userCallParse.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { parseAbi, keccak256, encodeAbiParameters, formatEther, BaseError, encodeFunctionData, formatUnits, isAddress, getAddress, decodeFunctionResult, decodeAbiParameters, AbiEncodingLengthMismatchError, concatHex, pad, InvalidAddressError, stringToHex, boolToHex, integerRegex, numberToHex, bytesRegex, BytesSizeMismatchError, arrayRegex, UnsupportedPackedAbiType } from './chunk-Z3MGRQJR.js';
|
|
2
2
|
import './chunk-BYTNVMX7.js';
|
|
3
3
|
import './chunk-PR4QN5HX.js';
|
|
4
|
-
import { Lender, isAaveType, isCompoundV3, isMultiMarket, isSiloV2Type, isSiloV3Type, isDolomite, isEulerType, isAaveV4Type, isInit, isMorphoType, isCompoundV2Type, isVenusType, isSumerType, AAVE_V3_LENDERS, AAVE_V2_LENDERS, isAaveV2Type, isAaveV32Type, isAaveV3Type, isFluid, isGearboxV3, isYLDR, isCompoundV3Type, isLista, isTectonicType, isKineticType, isBenqiType } from '@1delta/lender-registry';
|
|
4
|
+
import { Lender, isAaveType, isCompoundV3, isMultiMarket, isSiloV2Type, isSiloV3Type, isDolomite, isEulerType, isAaveV4Type, isInit, isMorphoType, isCompoundV2Type, isVenusType, isSumerType, AAVE_V3_LENDERS, AAVE_V2_LENDERS, isAaveV2Type, isAaveV32Type, isAaveV3Type, isFluid, isGearboxV3, isMidnight, isYLDR, isCompoundV3Type, isLista, isTectonicType, isKineticType, isBenqiType } from '@1delta/lender-registry';
|
|
5
5
|
export { isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR } from '@1delta/lender-registry';
|
|
6
|
-
import { aavePools, compoundV3Pools, initConfig, morphoPools, compoundV2Pools, eulerVaults, siloMarkets, siloV2LenderKey, siloMarketsV3, siloV3LenderKey, aaveV4Spokes, aaveV4SpokeLenderKey, fluidResolvers, gearboxResolvers, dolomiteConfigs, aaveReserves, compoundV3Reserves, morphoTypeMarkets, getSiloV2MarketEntry, getSiloV3MarketEntry, dolomiteEmode, aaveTokens, morphoTypeVaults, eulerConfigs, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxV3LenderKey, parseAaveV4SpokeLenderKey, gearboxAccountCompressor, compoundV2Tokens, aaveOracles, aaveOraclesConfig, compoundV2Oracles, compoundV2TokenArray, compoundV2OraclesConfig, compoundV3OraclesData, compoundV3BaseData, compoundV2Reserves, fetchTokenLists, fetchTokenList, aaveV4Oracles } from '@1delta/data-sdk';
|
|
6
|
+
import { aavePools, compoundV3Pools, initConfig, morphoPools, compoundV2Pools, eulerVaults, siloMarkets, siloV2LenderKey, siloMarketsV3, siloV3LenderKey, aaveV4Spokes, aaveV4SpokeLenderKey, fluidResolvers, gearboxResolvers, dolomiteConfigs, midnightConfig, aaveReserves, compoundV3Reserves, morphoTypeMarkets, getSiloV2MarketEntry, getSiloV3MarketEntry, dolomiteEmode, aaveTokens, morphoTypeVaults, eulerConfigs, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxV3LenderKey, midnightMarketsByChain, parseAaveV4SpokeLenderKey, gearboxAccountCompressor, compoundV2Tokens, aaveOracles, aaveOraclesConfig, compoundV2Oracles, compoundV2TokenArray, compoundV2OraclesConfig, compoundV3OraclesData, compoundV3BaseData, compoundV2Reserves, fetchTokenLists, fetchTokenList, aaveV4Oracles } from '@1delta/data-sdk';
|
|
7
7
|
import lodash from 'lodash';
|
|
8
8
|
import { getEvmClient, getEvmChain, getEvmClientUniversal, multicallRetryUniversal } from '@1delta/providers';
|
|
9
|
-
import { MetaMorphoAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, MoolahVaultAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, GearboxCreditAccountCompressorV310Abi } from '@1delta/abis';
|
|
9
|
+
import { MetaMorphoAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, MoolahVaultAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, GearboxCreditAccountCompressorV310Abi } from '@1delta/abis';
|
|
10
10
|
export { MorphoLensAbi } from '@1delta/abis';
|
|
11
11
|
import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, InitMarginAddresses, getLstAcceptedInputs } from '@1delta/calldata-sdk';
|
|
12
12
|
import { proxyNativeFetch } from '@1delta/proxy-fetch';
|
|
@@ -7501,6 +7501,9 @@ var getLendersForChain = (c) => {
|
|
|
7501
7501
|
if (dolomiteConfigs()?.[c]?.dolomiteMargin) {
|
|
7502
7502
|
lenders.push(Lender.DOLOMITE);
|
|
7503
7503
|
}
|
|
7504
|
+
if (midnightConfig()?.[c]?.midnight) {
|
|
7505
|
+
lenders.push(Lender.MORPHO_MIDNIGHT);
|
|
7506
|
+
}
|
|
7504
7507
|
return lenders.filter((l) => !isExcludedLender(l));
|
|
7505
7508
|
};
|
|
7506
7509
|
var filterLendersByProtocol = (allLenders, protocolList) => {
|
|
@@ -13036,7 +13039,7 @@ var MathLib;
|
|
|
13036
13039
|
return x * y / denominator;
|
|
13037
13040
|
}
|
|
13038
13041
|
MathLib2.mulDivDown = mulDivDown;
|
|
13039
|
-
function
|
|
13042
|
+
function mulDivUp2(x, y, denominator) {
|
|
13040
13043
|
x = BigInt(x);
|
|
13041
13044
|
y = BigInt(y);
|
|
13042
13045
|
denominator = BigInt(denominator);
|
|
@@ -13044,7 +13047,7 @@ var MathLib;
|
|
|
13044
13047
|
const roundup = x * y % denominator > 0 ? 1n : 0n;
|
|
13045
13048
|
return x * y / denominator + roundup;
|
|
13046
13049
|
}
|
|
13047
|
-
MathLib2.mulDivUp =
|
|
13050
|
+
MathLib2.mulDivUp = mulDivUp2;
|
|
13048
13051
|
function mulDiv(x, y, denominator, rounding) {
|
|
13049
13052
|
return MathLib2[`mulDiv${rounding}`](x, y, denominator);
|
|
13050
13053
|
}
|
|
@@ -13151,7 +13154,7 @@ var MathLib;
|
|
|
13151
13154
|
} else {
|
|
13152
13155
|
const _newRateAtTarget = (la) => MathLib2.min(
|
|
13153
13156
|
MathLib2.max(
|
|
13154
|
-
MathLib2.wMulDown(startRateAtTarget,
|
|
13157
|
+
MathLib2.wMulDown(startRateAtTarget, wExp2(la)),
|
|
13155
13158
|
MIN_RATE_AT_TARGET
|
|
13156
13159
|
),
|
|
13157
13160
|
MAX_RATE_AT_TARGET
|
|
@@ -13180,7 +13183,7 @@ var MathLib;
|
|
|
13180
13183
|
const LN_WEI_INT = -41446531673892822312n;
|
|
13181
13184
|
const WEXP_UPPER_BOUND = 93859467695000404319n;
|
|
13182
13185
|
const WEXP_UPPER_VALUE = 57716089161558943949701069502944508345128422502756744429568n;
|
|
13183
|
-
function
|
|
13186
|
+
function wExp2(x) {
|
|
13184
13187
|
x = BigInt(x);
|
|
13185
13188
|
if (x < LN_WEI_INT) return 0n;
|
|
13186
13189
|
if (x >= WEXP_UPPER_BOUND) return WEXP_UPPER_VALUE;
|
|
@@ -13191,7 +13194,7 @@ var MathLib;
|
|
|
13191
13194
|
if (q >= 0n) return expR << q;
|
|
13192
13195
|
return expR >> -q;
|
|
13193
13196
|
}
|
|
13194
|
-
MathLib2.wExp =
|
|
13197
|
+
MathLib2.wExp = wExp2;
|
|
13195
13198
|
function _getBorrowRate(startUtilization, startRateAtTarget, elapsed) {
|
|
13196
13199
|
startUtilization = BigInt(startUtilization);
|
|
13197
13200
|
startRateAtTarget = BigInt(startRateAtTarget);
|
|
@@ -13215,7 +13218,7 @@ var MathLib;
|
|
|
13215
13218
|
} else {
|
|
13216
13219
|
const _newRateAtTarget = (linearAdaptation2) => MathLib2.min(
|
|
13217
13220
|
MathLib2.max(
|
|
13218
|
-
MathLib2.wMulDown(startRateAtTarget,
|
|
13221
|
+
MathLib2.wMulDown(startRateAtTarget, wExp2(linearAdaptation2)),
|
|
13219
13222
|
MIN_RATE_AT_TARGET
|
|
13220
13223
|
),
|
|
13221
13224
|
MAX_RATE_AT_TARGET
|
|
@@ -19582,7 +19585,7 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19582
19585
|
{ self: market.silo0, other: market.silo1 },
|
|
19583
19586
|
{ self: market.silo1, other: market.silo0 }
|
|
19584
19587
|
];
|
|
19585
|
-
const
|
|
19588
|
+
const toBigInt15 = (v) => {
|
|
19586
19589
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
19587
19590
|
if (typeof v === "bigint") return v;
|
|
19588
19591
|
try {
|
|
@@ -19594,8 +19597,8 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19594
19597
|
for (let s = 0; s < 2; s++) {
|
|
19595
19598
|
const { self, other } = sides[s];
|
|
19596
19599
|
const slot = s * SILO_V2_CALLS_PER_SIDE;
|
|
19597
|
-
const totalAssetsRaw =
|
|
19598
|
-
const debtAssetsRaw =
|
|
19600
|
+
const totalAssetsRaw = toBigInt15(data[slot]);
|
|
19601
|
+
const debtAssetsRaw = toBigInt15(data[slot + 1]);
|
|
19599
19602
|
const irmConfigRaw = data[slot + 2];
|
|
19600
19603
|
const decimals = self.decimals;
|
|
19601
19604
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -19750,7 +19753,7 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19750
19753
|
{ self: market.silo0, other: market.silo1 },
|
|
19751
19754
|
{ self: market.silo1, other: market.silo0 }
|
|
19752
19755
|
];
|
|
19753
|
-
const
|
|
19756
|
+
const toBigInt15 = (v) => {
|
|
19754
19757
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
19755
19758
|
if (typeof v === "bigint") return v;
|
|
19756
19759
|
try {
|
|
@@ -19762,8 +19765,8 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
19762
19765
|
for (let s = 0; s < 2; s++) {
|
|
19763
19766
|
const { self, other } = sides[s];
|
|
19764
19767
|
const slot = s * SILO_V3_CALLS_PER_SIDE;
|
|
19765
|
-
const totalAssetsRaw =
|
|
19766
|
-
const debtAssetsRaw =
|
|
19768
|
+
const totalAssetsRaw = toBigInt15(data[slot]);
|
|
19769
|
+
const debtAssetsRaw = toBigInt15(data[slot + 1]);
|
|
19767
19770
|
const irmConfigRaw = data[slot + 2];
|
|
19768
19771
|
const decimals = self.decimals;
|
|
19769
19772
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -20751,6 +20754,310 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
|
|
|
20751
20754
|
}
|
|
20752
20755
|
return lenderData;
|
|
20753
20756
|
};
|
|
20757
|
+
var DEFAULT_MIDNIGHT_API = "https://api.morpho.org/v0/midnight";
|
|
20758
|
+
var warn = (...args) => {
|
|
20759
|
+
};
|
|
20760
|
+
function midnightApiBaseUrl(chainId) {
|
|
20761
|
+
const base = midnightConfig()?.[chainId]?.apiBaseUrl;
|
|
20762
|
+
return (base && base.length > 0 ? base : DEFAULT_MIDNIGHT_API).replace(/\/+$/, "");
|
|
20763
|
+
}
|
|
20764
|
+
var toBig2 = (v) => {
|
|
20765
|
+
try {
|
|
20766
|
+
if (v == null) return 0n;
|
|
20767
|
+
if (typeof v === "bigint") return v;
|
|
20768
|
+
if (typeof v === "number") return BigInt(Math.trunc(v));
|
|
20769
|
+
return BigInt(String(v));
|
|
20770
|
+
} catch {
|
|
20771
|
+
return 0n;
|
|
20772
|
+
}
|
|
20773
|
+
};
|
|
20774
|
+
function parseLevel(raw) {
|
|
20775
|
+
const tick = toBig2(raw?.tick);
|
|
20776
|
+
const units = toBig2(raw?.units);
|
|
20777
|
+
let assets = toBig2(raw?.assets);
|
|
20778
|
+
if (assets === 0n && units > 0n && raw?.price != null) {
|
|
20779
|
+
assets = toBig2(raw.price) * units / 1000000000000000000n;
|
|
20780
|
+
}
|
|
20781
|
+
return { tick, units, assets };
|
|
20782
|
+
}
|
|
20783
|
+
function reduceTop(bids, asks) {
|
|
20784
|
+
let bestBorrowTick;
|
|
20785
|
+
let bestSupplyTick;
|
|
20786
|
+
let borrowDepthUnits = 0n;
|
|
20787
|
+
let borrowDepthAssets = 0n;
|
|
20788
|
+
let supplyDepthUnits = 0n;
|
|
20789
|
+
let supplyDepthAssets = 0n;
|
|
20790
|
+
for (const l of bids) {
|
|
20791
|
+
borrowDepthUnits += l.units;
|
|
20792
|
+
borrowDepthAssets += l.assets;
|
|
20793
|
+
if (bestBorrowTick === void 0 || l.tick > bestBorrowTick) bestBorrowTick = l.tick;
|
|
20794
|
+
}
|
|
20795
|
+
for (const l of asks) {
|
|
20796
|
+
supplyDepthUnits += l.units;
|
|
20797
|
+
supplyDepthAssets += l.assets;
|
|
20798
|
+
if (bestSupplyTick === void 0 || l.tick < bestSupplyTick) bestSupplyTick = l.tick;
|
|
20799
|
+
}
|
|
20800
|
+
return {
|
|
20801
|
+
bestBorrowTick,
|
|
20802
|
+
bestSupplyTick,
|
|
20803
|
+
borrowDepthUnits,
|
|
20804
|
+
borrowDepthAssets,
|
|
20805
|
+
supplyDepthUnits,
|
|
20806
|
+
supplyDepthAssets
|
|
20807
|
+
};
|
|
20808
|
+
}
|
|
20809
|
+
var ApiBookSource = class {
|
|
20810
|
+
constructor(baseUrl, fetchImpl = fetch) {
|
|
20811
|
+
this.baseUrl = baseUrl;
|
|
20812
|
+
this.fetchImpl = fetchImpl;
|
|
20813
|
+
}
|
|
20814
|
+
baseUrl;
|
|
20815
|
+
fetchImpl;
|
|
20816
|
+
async getBookTop(marketId) {
|
|
20817
|
+
const url = `${this.baseUrl}/books/${marketId}`;
|
|
20818
|
+
try {
|
|
20819
|
+
const res = await this.fetchImpl(url);
|
|
20820
|
+
if (!res.ok) {
|
|
20821
|
+
warn(`book ${marketId} \u2192 HTTP ${res.status}`);
|
|
20822
|
+
return null;
|
|
20823
|
+
}
|
|
20824
|
+
const json = await res.json();
|
|
20825
|
+
const book = json?.data ?? json;
|
|
20826
|
+
const bids = Array.isArray(book?.bids) ? book.bids.map(parseLevel) : [];
|
|
20827
|
+
const asks = Array.isArray(book?.asks) ? book.asks.map(parseLevel) : [];
|
|
20828
|
+
return reduceTop(bids, asks);
|
|
20829
|
+
} catch (e) {
|
|
20830
|
+
warn(`book ${marketId} fetch failed:`, e?.message ?? e);
|
|
20831
|
+
return null;
|
|
20832
|
+
}
|
|
20833
|
+
}
|
|
20834
|
+
};
|
|
20835
|
+
function createMidnightBookSource(chainId, fetchImpl = fetch) {
|
|
20836
|
+
return new ApiBookSource(midnightApiBaseUrl(chainId), fetchImpl);
|
|
20837
|
+
}
|
|
20838
|
+
|
|
20839
|
+
// src/lending/public-data/midnight/fetchPublic.ts
|
|
20840
|
+
async function fetchMidnightMarkets(chainId, source = createMidnightBookSource(chainId)) {
|
|
20841
|
+
const markets = midnightMarketsByChain(chainId);
|
|
20842
|
+
if (markets.length === 0) return [];
|
|
20843
|
+
return Promise.all(
|
|
20844
|
+
markets.map(async (config) => ({
|
|
20845
|
+
config,
|
|
20846
|
+
top: await source.getBookTop(config.marketId).catch(() => null)
|
|
20847
|
+
}))
|
|
20848
|
+
);
|
|
20849
|
+
}
|
|
20850
|
+
|
|
20851
|
+
// src/lending/public-data/midnight/math.ts
|
|
20852
|
+
var WAD2 = 1000000000000000000n;
|
|
20853
|
+
var WAD_SQUARED = 1000000000000000000000000000000000000n;
|
|
20854
|
+
var LN_ONE_PLUS_DELTA = 4987541511039073n;
|
|
20855
|
+
var LN_2 = 693147180559945309n;
|
|
20856
|
+
var EXP_OFFSET = 322611214989459870n;
|
|
20857
|
+
var MAX_TICK = 6744n;
|
|
20858
|
+
var PRICE_ROUNDING_STEP = 100000000000n;
|
|
20859
|
+
var SECONDS_PER_YEAR7 = 31536000n;
|
|
20860
|
+
var mulDivUp = (x, y, d) => (x * y + (d - 1n)) / d;
|
|
20861
|
+
var divHalfDownUnchecked = (x, d) => (x + (d - 1n) / 2n) / d;
|
|
20862
|
+
function wExp(x) {
|
|
20863
|
+
if (x < 0n) return WAD_SQUARED / wExp(-x);
|
|
20864
|
+
const q = (x + EXP_OFFSET) / LN_2;
|
|
20865
|
+
const r = x - q * LN_2;
|
|
20866
|
+
const secondTerm = r * r / (2n * WAD2);
|
|
20867
|
+
const thirdTerm = secondTerm * r / (3n * WAD2);
|
|
20868
|
+
const expR = WAD2 + r + secondTerm + thirdTerm;
|
|
20869
|
+
return expR << q;
|
|
20870
|
+
}
|
|
20871
|
+
function tickToPrice(tick) {
|
|
20872
|
+
if (tick < 0n || tick > MAX_TICK)
|
|
20873
|
+
throw new Error(`midnight tick out of range: ${tick}`);
|
|
20874
|
+
const exponent = LN_ONE_PLUS_DELTA * (MAX_TICK / 2n - tick);
|
|
20875
|
+
const rawPrice = divHalfDownUnchecked(WAD_SQUARED, WAD2 + wExp(exponent));
|
|
20876
|
+
return divHalfDownUnchecked(rawPrice, PRICE_ROUNDING_STEP) * PRICE_ROUNDING_STEP;
|
|
20877
|
+
}
|
|
20878
|
+
function tickToRate(tick) {
|
|
20879
|
+
const price2 = tickToPrice(tick);
|
|
20880
|
+
if (price2 === 0n) throw new Error("midnight tick price is zero");
|
|
20881
|
+
return mulDivUp(WAD2, WAD2, price2) - WAD2;
|
|
20882
|
+
}
|
|
20883
|
+
function tickToApr(tick, timeToMaturity) {
|
|
20884
|
+
if (timeToMaturity <= 0n) return 0n;
|
|
20885
|
+
return mulDivUp(tickToRate(tick), SECONDS_PER_YEAR7, timeToMaturity);
|
|
20886
|
+
}
|
|
20887
|
+
function tickToAprNumber(tick, timeToMaturity) {
|
|
20888
|
+
return Number(tickToApr(tick, timeToMaturity)) / 1e18;
|
|
20889
|
+
}
|
|
20890
|
+
|
|
20891
|
+
// src/lending/public-data/midnight/convertPublic.ts
|
|
20892
|
+
var nowSec = () => Math.floor(Date.now() / 1e3);
|
|
20893
|
+
function midnightLenderKey(marketId) {
|
|
20894
|
+
return "MORPHO_MIDNIGHT_" + marketId.slice(2).toUpperCase();
|
|
20895
|
+
}
|
|
20896
|
+
function currencyFor(address, decimals, tokens) {
|
|
20897
|
+
const lower = address.toLowerCase();
|
|
20898
|
+
return tokens[lower] ?? {
|
|
20899
|
+
address: lower,
|
|
20900
|
+
symbol: "",
|
|
20901
|
+
name: "",
|
|
20902
|
+
decimals
|
|
20903
|
+
};
|
|
20904
|
+
}
|
|
20905
|
+
function convertMidnightMarketsToResponse(raw, chainId, prices = {}, _additionalYields = {
|
|
20906
|
+
intrinsicYields: {},
|
|
20907
|
+
lenderRewards: {},
|
|
20908
|
+
loaded: true
|
|
20909
|
+
}, tokens = {}) {
|
|
20910
|
+
const out = {};
|
|
20911
|
+
const now = nowSec();
|
|
20912
|
+
for (const { config, top } of raw) {
|
|
20913
|
+
if (!config?.marketId || !config.loanToken) continue;
|
|
20914
|
+
const m = midnightLenderKey(config.marketId);
|
|
20915
|
+
const maturity = Number(config.maturity);
|
|
20916
|
+
const ttm = maturity - now;
|
|
20917
|
+
const matured = ttm <= 0;
|
|
20918
|
+
const ttmBig = BigInt(Math.max(0, ttm));
|
|
20919
|
+
const supplyAprPct = top?.bestSupplyTick != null && !matured ? tickToAprNumber(top.bestSupplyTick, ttmBig) * 100 : 0;
|
|
20920
|
+
const borrowAprPct = top?.bestBorrowTick != null && !matured ? tickToAprNumber(top.bestBorrowTick, ttmBig) * 100 : 0;
|
|
20921
|
+
const terms = borrowAprPct > 0 && !matured ? [
|
|
20922
|
+
{
|
|
20923
|
+
termId: 0,
|
|
20924
|
+
durationSecs: Math.max(0, ttm),
|
|
20925
|
+
durationDays: ttm / 86400,
|
|
20926
|
+
apr: borrowAprPct
|
|
20927
|
+
}
|
|
20928
|
+
] : void 0;
|
|
20929
|
+
const loanAddr = config.loanToken.toLowerCase();
|
|
20930
|
+
const loanPrice = prices[loanAddr] ?? 0;
|
|
20931
|
+
const supplyLiquidity = formatNr(top?.supplyDepthAssets ?? 0n, config.loanDecimals);
|
|
20932
|
+
const borrowLiquidity = formatNr(top?.borrowDepthAssets ?? 0n, config.loanDecimals);
|
|
20933
|
+
const entry = { data: {} };
|
|
20934
|
+
const loanUid = createMarketUid(chainId, m, loanAddr);
|
|
20935
|
+
entry.data[loanUid] = {
|
|
20936
|
+
marketUid: loanUid,
|
|
20937
|
+
name: "Loan " + (tokens[loanAddr]?.symbol ?? ""),
|
|
20938
|
+
poolId: loanAddr,
|
|
20939
|
+
underlying: loanAddr,
|
|
20940
|
+
asset: currencyFor(loanAddr, config.loanDecimals, tokens),
|
|
20941
|
+
totalDeposits: supplyLiquidity,
|
|
20942
|
+
totalDebtStable: 0,
|
|
20943
|
+
totalDebt: 0,
|
|
20944
|
+
totalLiquidity: borrowLiquidity,
|
|
20945
|
+
borrowLiquidity,
|
|
20946
|
+
totalLiquidityUSD: borrowLiquidity * loanPrice,
|
|
20947
|
+
borrowLiquidityUSD: borrowLiquidity * loanPrice,
|
|
20948
|
+
totalDepositsUSD: supplyLiquidity * loanPrice,
|
|
20949
|
+
totalDebtStableUSD: 0,
|
|
20950
|
+
totalDebtUSD: 0,
|
|
20951
|
+
utilization: 0,
|
|
20952
|
+
depositRate: supplyAprPct,
|
|
20953
|
+
variableBorrowRate: borrowAprPct,
|
|
20954
|
+
// Midnight is fixed-rate: expose the fixed borrow APR on stableBorrowRate
|
|
20955
|
+
// too, so fixed-rate consumers pick it up like a term product.
|
|
20956
|
+
stableBorrowRate: borrowAprPct,
|
|
20957
|
+
intrinsicYield: 0,
|
|
20958
|
+
rewards: void 0,
|
|
20959
|
+
decimals: config.loanDecimals,
|
|
20960
|
+
config: {
|
|
20961
|
+
0: {
|
|
20962
|
+
category: 0,
|
|
20963
|
+
borrowCollateralFactor: 0,
|
|
20964
|
+
collateralFactor: 0,
|
|
20965
|
+
borrowFactor: 1,
|
|
20966
|
+
liquidationPenalty: 0,
|
|
20967
|
+
closeFactor: 1,
|
|
20968
|
+
collateralDisabled: true,
|
|
20969
|
+
debtDisabled: false
|
|
20970
|
+
}
|
|
20971
|
+
},
|
|
20972
|
+
closeFactor: 1,
|
|
20973
|
+
collateralActive: false,
|
|
20974
|
+
borrowingEnabled: !matured,
|
|
20975
|
+
depositsEnabled: !matured,
|
|
20976
|
+
hasStable: false,
|
|
20977
|
+
// Midnight borrowing is fixed-term (carried via `terms` + `maturity` on
|
|
20978
|
+
// params.market), but it IS borrowable — do NOT mark variable borrow
|
|
20979
|
+
// disabled, or borrowable-only filters would hide the market.
|
|
20980
|
+
variableBorrowDisabled: false,
|
|
20981
|
+
isActive: true,
|
|
20982
|
+
isFrozen: false
|
|
20983
|
+
};
|
|
20984
|
+
config.collateralParams.forEach((c) => {
|
|
20985
|
+
const collAddr = c.token.toLowerCase();
|
|
20986
|
+
const ltv = parseLtv(c.lltv);
|
|
20987
|
+
const liquidationPenalty = liquidationPenaltyFromLltv(ltv);
|
|
20988
|
+
const collUid = createMarketUid(chainId, m, collAddr);
|
|
20989
|
+
entry.data[collUid] = {
|
|
20990
|
+
marketUid: collUid,
|
|
20991
|
+
name: "Collateral " + (tokens[collAddr]?.symbol ?? ""),
|
|
20992
|
+
poolId: collAddr,
|
|
20993
|
+
underlying: collAddr,
|
|
20994
|
+
asset: currencyFor(collAddr, c.decimals, tokens),
|
|
20995
|
+
totalDeposits: 0,
|
|
20996
|
+
totalDebtStable: 0,
|
|
20997
|
+
totalDebt: 0,
|
|
20998
|
+
totalLiquidity: 0,
|
|
20999
|
+
borrowLiquidity: 0,
|
|
21000
|
+
totalLiquidityUSD: 0,
|
|
21001
|
+
borrowLiquidityUSD: 0,
|
|
21002
|
+
totalDepositsUSD: 0,
|
|
21003
|
+
totalDebtStableUSD: 0,
|
|
21004
|
+
totalDebtUSD: 0,
|
|
21005
|
+
utilization: 0,
|
|
21006
|
+
depositRate: 0,
|
|
21007
|
+
variableBorrowRate: 0,
|
|
21008
|
+
stableBorrowRate: 0,
|
|
21009
|
+
intrinsicYield: 0,
|
|
21010
|
+
rewards: void 0,
|
|
21011
|
+
decimals: c.decimals,
|
|
21012
|
+
config: {
|
|
21013
|
+
0: {
|
|
21014
|
+
category: 0,
|
|
21015
|
+
borrowCollateralFactor: ltv,
|
|
21016
|
+
collateralFactor: ltv,
|
|
21017
|
+
borrowFactor: 1,
|
|
21018
|
+
liquidationPenalty,
|
|
21019
|
+
closeFactor: 1,
|
|
21020
|
+
collateralDisabled: false,
|
|
21021
|
+
debtDisabled: true
|
|
21022
|
+
}
|
|
21023
|
+
},
|
|
21024
|
+
closeFactor: 1,
|
|
21025
|
+
collateralActive: true,
|
|
21026
|
+
borrowingEnabled: false,
|
|
21027
|
+
depositsEnabled: !matured,
|
|
21028
|
+
hasStable: false,
|
|
21029
|
+
isActive: true,
|
|
21030
|
+
isFrozen: false
|
|
21031
|
+
};
|
|
21032
|
+
});
|
|
21033
|
+
const primaryCollateral = config.collateralParams[0];
|
|
21034
|
+
entry.params = {
|
|
21035
|
+
market: {
|
|
21036
|
+
lender: m,
|
|
21037
|
+
name: config.name,
|
|
21038
|
+
loanDecimals: config.loanDecimals,
|
|
21039
|
+
collateralDecimals: primaryCollateral?.decimals,
|
|
21040
|
+
id: config.marketId,
|
|
21041
|
+
lltv: primaryCollateral?.lltv ?? "0",
|
|
21042
|
+
oracle: primaryCollateral?.oracle ?? zeroAddress,
|
|
21043
|
+
irm: zeroAddress,
|
|
21044
|
+
collateralAddress: primaryCollateral?.token ?? zeroAddress,
|
|
21045
|
+
loanAddress: loanAddr,
|
|
21046
|
+
// Fixed-term rate card (single maturity); undefined when no live rate.
|
|
21047
|
+
terms,
|
|
21048
|
+
// Midnight-specific extras (consumed by calldata / worker-api resolvers)
|
|
21049
|
+
maturity: config.maturity,
|
|
21050
|
+
rcfThreshold: config.rcfThreshold,
|
|
21051
|
+
enterGate: config.enterGate,
|
|
21052
|
+
liquidatorGate: config.liquidatorGate,
|
|
21053
|
+
collateralParams: config.collateralParams
|
|
21054
|
+
}
|
|
21055
|
+
};
|
|
21056
|
+
entry.chainId = chainId;
|
|
21057
|
+
out[m] = entry;
|
|
21058
|
+
}
|
|
21059
|
+
return out;
|
|
21060
|
+
}
|
|
20754
21061
|
|
|
20755
21062
|
// src/lending/public-data/silo-v2/fetchPublic.ts
|
|
20756
21063
|
var BASE_URL2 = "https://api-v3.silo.finance";
|
|
@@ -21348,16 +21655,25 @@ function convertDolomiteSubgraphMarkets(raw, chainId, prices, additionalYields,
|
|
|
21348
21655
|
}
|
|
21349
21656
|
return { data: result, chainId };
|
|
21350
21657
|
}
|
|
21351
|
-
var
|
|
21658
|
+
var warn2 = (...args) => {
|
|
21352
21659
|
};
|
|
21353
21660
|
async function getLenderDataFromApi(lender, chainId, prices, additionalYields, includeUnlisted = false) {
|
|
21354
21661
|
if (isMorphoType(lender))
|
|
21355
21662
|
return await fetchMorphoMarkets(chainId, includeUnlisted);
|
|
21663
|
+
if (isMidnight(lender)) return await fetchMidnightMarkets(chainId);
|
|
21356
21664
|
return {};
|
|
21357
21665
|
}
|
|
21358
21666
|
function convertLenderDataFromApi(lender, chainId, data, prices, additionalYields, list = {}) {
|
|
21359
21667
|
if (isMorphoType(lender))
|
|
21360
21668
|
return convertMarketsToMorphoResponse(data, chainId, additionalYields, list);
|
|
21669
|
+
if (isMidnight(lender))
|
|
21670
|
+
return convertMidnightMarketsToResponse(
|
|
21671
|
+
data,
|
|
21672
|
+
chainId,
|
|
21673
|
+
prices,
|
|
21674
|
+
additionalYields,
|
|
21675
|
+
list
|
|
21676
|
+
);
|
|
21361
21677
|
return {};
|
|
21362
21678
|
}
|
|
21363
21679
|
var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYields, tokenList = async () => {
|
|
@@ -21398,7 +21714,7 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21398
21714
|
const listResult = settled[0];
|
|
21399
21715
|
const list = listResult.status === "fulfilled" ? listResult.value : {};
|
|
21400
21716
|
if (listResult.status === "rejected") {
|
|
21401
|
-
|
|
21717
|
+
warn2(
|
|
21402
21718
|
`[lending] tokenList fetch failed on chain ${chainId}:`,
|
|
21403
21719
|
listResult.reason
|
|
21404
21720
|
);
|
|
@@ -21420,13 +21736,13 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21420
21736
|
if (converted[lk]) lenderData[lk] = converted[lk];
|
|
21421
21737
|
}
|
|
21422
21738
|
} catch (e) {
|
|
21423
|
-
|
|
21739
|
+
warn2(
|
|
21424
21740
|
`[lending] Silo v2 API convert failed on chain ${chainId}:`,
|
|
21425
21741
|
e?.message ?? e
|
|
21426
21742
|
);
|
|
21427
21743
|
}
|
|
21428
21744
|
} else {
|
|
21429
|
-
|
|
21745
|
+
warn2(
|
|
21430
21746
|
`[lending] Silo v2 API fetch failed on chain ${chainId}:`,
|
|
21431
21747
|
siloV2Result.reason?.message ?? siloV2Result.reason
|
|
21432
21748
|
);
|
|
@@ -21448,13 +21764,13 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21448
21764
|
if (converted[lk]) lenderData[lk] = converted[lk];
|
|
21449
21765
|
}
|
|
21450
21766
|
} catch (e) {
|
|
21451
|
-
|
|
21767
|
+
warn2(
|
|
21452
21768
|
`[lending] Silo v3 API convert failed on chain ${chainId}:`,
|
|
21453
21769
|
e?.message ?? e
|
|
21454
21770
|
);
|
|
21455
21771
|
}
|
|
21456
21772
|
} else {
|
|
21457
|
-
|
|
21773
|
+
warn2(
|
|
21458
21774
|
`[lending] Silo v3 API fetch failed on chain ${chainId}:`,
|
|
21459
21775
|
siloV3Result.reason?.message ?? siloV3Result.reason
|
|
21460
21776
|
);
|
|
@@ -21464,7 +21780,7 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21464
21780
|
try {
|
|
21465
21781
|
const result = settled[i + 3];
|
|
21466
21782
|
if (result.status === "rejected") {
|
|
21467
|
-
|
|
21783
|
+
warn2(
|
|
21468
21784
|
`[lending] API fetch failed for ${otherLenders[i]} on chain ${chainId}:`,
|
|
21469
21785
|
result.reason?.message ?? result.reason
|
|
21470
21786
|
);
|
|
@@ -21508,13 +21824,13 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21508
21824
|
);
|
|
21509
21825
|
for (const lk of dolomiteLenders) lenderData[lk] = converted;
|
|
21510
21826
|
} catch (e) {
|
|
21511
|
-
|
|
21827
|
+
warn2(
|
|
21512
21828
|
`[lending] Dolomite subgraph convert failed on chain ${chainId}:`,
|
|
21513
21829
|
e?.message ?? e
|
|
21514
21830
|
);
|
|
21515
21831
|
}
|
|
21516
21832
|
} else if (dolomiteResult.status === "rejected") {
|
|
21517
|
-
|
|
21833
|
+
warn2(
|
|
21518
21834
|
`[lending] Dolomite subgraph fetch failed on chain ${chainId}:`,
|
|
21519
21835
|
dolomiteResult.reason?.message ?? dolomiteResult.reason
|
|
21520
21836
|
);
|
|
@@ -21522,7 +21838,7 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
21522
21838
|
}
|
|
21523
21839
|
return lenderData;
|
|
21524
21840
|
};
|
|
21525
|
-
var
|
|
21841
|
+
var warn3 = (...args) => {
|
|
21526
21842
|
};
|
|
21527
21843
|
function lenderApiOnly(lender, chainId) {
|
|
21528
21844
|
if (lender === Lender.MORPHO_BLUE) {
|
|
@@ -21541,6 +21857,7 @@ function lenderApiOnly(lender, chainId) {
|
|
|
21541
21857
|
if (chainId === "4114") return false;
|
|
21542
21858
|
return true;
|
|
21543
21859
|
}
|
|
21860
|
+
if (isMidnight(lender)) return true;
|
|
21544
21861
|
return false;
|
|
21545
21862
|
}
|
|
21546
21863
|
function lenderApiWithOnChainFallback(lender, chainId) {
|
|
@@ -21568,7 +21885,7 @@ var getLenderPublicDataAll = async (chainId, lenders, prices, additionalYields,
|
|
|
21568
21885
|
includeUnlistedMorphoMarkets
|
|
21569
21886
|
);
|
|
21570
21887
|
} catch (e) {
|
|
21571
|
-
|
|
21888
|
+
warn3(
|
|
21572
21889
|
`[lending] API fetch failed for chain ${chainId}:`,
|
|
21573
21890
|
e?.message ?? e
|
|
21574
21891
|
);
|
|
@@ -21591,7 +21908,7 @@ var getLenderPublicDataAll = async (chainId, lenders, prices, additionalYields,
|
|
|
21591
21908
|
tokenList
|
|
21592
21909
|
);
|
|
21593
21910
|
} catch (e) {
|
|
21594
|
-
|
|
21911
|
+
warn3(
|
|
21595
21912
|
`[lending] on-chain fetch failed for chain ${chainId}:`,
|
|
21596
21913
|
e?.message ?? e
|
|
21597
21914
|
);
|
|
@@ -22231,6 +22548,28 @@ var buildDolomiteUserCall = async (chainId, _lender, account, accountNumbers) =>
|
|
|
22231
22548
|
params: [{ owner: account, number }]
|
|
22232
22549
|
}));
|
|
22233
22550
|
};
|
|
22551
|
+
var midnightMarketCallCount = (collateralCount) => 1 + collateralCount;
|
|
22552
|
+
var buildMidnightUserCall = (chainId, _lender, account) => {
|
|
22553
|
+
const midnight = midnightConfig()?.[chainId]?.midnight;
|
|
22554
|
+
const markets = midnightMarketsByChain(chainId);
|
|
22555
|
+
if (!midnight || markets.length === 0) return [];
|
|
22556
|
+
const calls = [];
|
|
22557
|
+
for (const market of markets) {
|
|
22558
|
+
calls.push({
|
|
22559
|
+
address: midnight,
|
|
22560
|
+
name: "position",
|
|
22561
|
+
params: [market.marketId, account]
|
|
22562
|
+
});
|
|
22563
|
+
for (let index = 0; index < market.collateralParams.length; index++) {
|
|
22564
|
+
calls.push({
|
|
22565
|
+
address: midnight,
|
|
22566
|
+
name: "collateral",
|
|
22567
|
+
params: [market.marketId, account, BigInt(index)]
|
|
22568
|
+
});
|
|
22569
|
+
}
|
|
22570
|
+
}
|
|
22571
|
+
return calls;
|
|
22572
|
+
};
|
|
22234
22573
|
|
|
22235
22574
|
// src/lending/user-data/fetch-balances/prepare.ts
|
|
22236
22575
|
async function buildUserCall(chainId, lender, account, params, getClient) {
|
|
@@ -22246,6 +22585,7 @@ async function buildUserCall(chainId, lender, account, params, getClient) {
|
|
|
22246
22585
|
params,
|
|
22247
22586
|
getClient
|
|
22248
22587
|
);
|
|
22588
|
+
if (isMidnight(lender)) return buildMidnightUserCall(chainId, lender, account);
|
|
22249
22589
|
if (isCompoundV3Type(lender))
|
|
22250
22590
|
return buildCompoundV3UserCall(chainId, lender, account);
|
|
22251
22591
|
if (isEulerType(lender))
|
|
@@ -24474,6 +24814,119 @@ function normalizeUnderlying3(token) {
|
|
|
24474
24814
|
const lower = token.toLowerCase();
|
|
24475
24815
|
return Object.values(WETH_BY_CHAIN).includes(lower) ? zeroAddress : lower;
|
|
24476
24816
|
}
|
|
24817
|
+
var MIDNIGHT_UNIT_DECIMALS = 18;
|
|
24818
|
+
function toBigInt10(v) {
|
|
24819
|
+
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
24820
|
+
if (typeof v === "bigint") return v;
|
|
24821
|
+
try {
|
|
24822
|
+
return BigInt(v);
|
|
24823
|
+
} catch {
|
|
24824
|
+
return 0n;
|
|
24825
|
+
}
|
|
24826
|
+
}
|
|
24827
|
+
function readDebtUnits(positionResult) {
|
|
24828
|
+
if (Array.isArray(positionResult)) return toBigInt10(positionResult[4]);
|
|
24829
|
+
if (positionResult && typeof positionResult === "object")
|
|
24830
|
+
return toBigInt10(positionResult.debt);
|
|
24831
|
+
return 0n;
|
|
24832
|
+
}
|
|
24833
|
+
var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
24834
|
+
const markets = midnightMarketsByChain(chainId);
|
|
24835
|
+
const totalCalls = markets.reduce(
|
|
24836
|
+
(sum, m) => sum + midnightMarketCallCount(m.collateralParams.length),
|
|
24837
|
+
0
|
|
24838
|
+
);
|
|
24839
|
+
return [
|
|
24840
|
+
(data) => {
|
|
24841
|
+
if (!data || data.length < totalCalls) return void 0;
|
|
24842
|
+
const out = {};
|
|
24843
|
+
let cursor = 0;
|
|
24844
|
+
for (const market of markets) {
|
|
24845
|
+
const positionResult = data[cursor];
|
|
24846
|
+
const collateralResults = market.collateralParams.map(
|
|
24847
|
+
(_c, i) => data[cursor + 1 + i]
|
|
24848
|
+
);
|
|
24849
|
+
cursor += midnightMarketCallCount(market.collateralParams.length);
|
|
24850
|
+
const lenderKey = midnightLenderKey(market.marketId);
|
|
24851
|
+
const metaMap = meta?.[lenderKey];
|
|
24852
|
+
if (!metaMap) continue;
|
|
24853
|
+
const loanAddr = market.loanToken.toLowerCase();
|
|
24854
|
+
const loanUid = createMarketUid(chainId, lenderKey, loanAddr);
|
|
24855
|
+
const loanMeta = metaMap[loanUid];
|
|
24856
|
+
const loanDisplayPrice = loanMeta ? getDisplayPrice(loanMeta) : 0;
|
|
24857
|
+
const loanOraclePrice = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
24858
|
+
const loanPriceHist = loanMeta?.price?.priceUsd24h ?? loanDisplayPrice;
|
|
24859
|
+
const debtUnits = readDebtUnits(positionResult);
|
|
24860
|
+
const debtStr = parseRawAmount(debtUnits.toString(), MIDNIGHT_UNIT_DECIMALS);
|
|
24861
|
+
const debtNum = Number(debtStr);
|
|
24862
|
+
const posData = {};
|
|
24863
|
+
let anyBalance = debtUnits > 0n;
|
|
24864
|
+
let depositsUSD24h = 0;
|
|
24865
|
+
posData[loanUid] = {
|
|
24866
|
+
marketUid: loanUid,
|
|
24867
|
+
underlying: loanAddr,
|
|
24868
|
+
deposits: "0",
|
|
24869
|
+
debt: debtStr,
|
|
24870
|
+
debtStable: "0",
|
|
24871
|
+
depositsUSD: 0,
|
|
24872
|
+
debtUSD: debtNum * loanDisplayPrice,
|
|
24873
|
+
debtStableUSD: 0,
|
|
24874
|
+
depositsUSDOracle: 0,
|
|
24875
|
+
debtUSDOracle: debtNum * loanOraclePrice,
|
|
24876
|
+
debtStableUSDOracle: 0,
|
|
24877
|
+
stableBorrowRate: "0",
|
|
24878
|
+
collateralEnabled: false,
|
|
24879
|
+
claimableRewards: 0
|
|
24880
|
+
};
|
|
24881
|
+
market.collateralParams.forEach((c, i) => {
|
|
24882
|
+
const collAmt = toBigInt10(collateralResults[i]);
|
|
24883
|
+
if (collAmt === 0n) return;
|
|
24884
|
+
anyBalance = true;
|
|
24885
|
+
const collAddr = c.token.toLowerCase();
|
|
24886
|
+
const collUid = createMarketUid(chainId, lenderKey, collAddr);
|
|
24887
|
+
const collMeta = metaMap[collUid];
|
|
24888
|
+
const collDec = collMeta?.asset?.decimals ?? c.decimals;
|
|
24889
|
+
const collDisplayPrice = collMeta ? getDisplayPrice(collMeta) : 0;
|
|
24890
|
+
const collOraclePrice = collMeta ? getOraclePrice(collMeta) : 0;
|
|
24891
|
+
const collPriceHist = collMeta?.price?.priceUsd24h ?? collDisplayPrice;
|
|
24892
|
+
const depositsStr = parseRawAmount(collAmt.toString(), collDec);
|
|
24893
|
+
const depositsNum = Number(depositsStr);
|
|
24894
|
+
depositsUSD24h += depositsNum * collPriceHist;
|
|
24895
|
+
posData[collUid] = {
|
|
24896
|
+
marketUid: collUid,
|
|
24897
|
+
underlying: collAddr,
|
|
24898
|
+
deposits: depositsStr,
|
|
24899
|
+
debt: "0",
|
|
24900
|
+
debtStable: "0",
|
|
24901
|
+
depositsUSD: depositsNum * collDisplayPrice,
|
|
24902
|
+
debtUSD: 0,
|
|
24903
|
+
debtStableUSD: 0,
|
|
24904
|
+
depositsUSDOracle: depositsNum * collOraclePrice,
|
|
24905
|
+
debtUSDOracle: 0,
|
|
24906
|
+
debtStableUSDOracle: 0,
|
|
24907
|
+
stableBorrowRate: "0",
|
|
24908
|
+
collateralEnabled: true,
|
|
24909
|
+
claimableRewards: 0
|
|
24910
|
+
};
|
|
24911
|
+
});
|
|
24912
|
+
if (!anyBalance) continue;
|
|
24913
|
+
const userData = createMultiAccountTypeUserState(
|
|
24914
|
+
{
|
|
24915
|
+
chainId,
|
|
24916
|
+
account,
|
|
24917
|
+
lendingPositions: { "0": posData },
|
|
24918
|
+
modes: { "0": 0 }
|
|
24919
|
+
},
|
|
24920
|
+
metaMap,
|
|
24921
|
+
{ "0": { totalDeposits24h: depositsUSD24h, totalDebt24h: debtNum * loanPriceHist } }
|
|
24922
|
+
);
|
|
24923
|
+
if (userData && userData.data.length > 0) out[lenderKey] = userData;
|
|
24924
|
+
}
|
|
24925
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
24926
|
+
},
|
|
24927
|
+
totalCalls
|
|
24928
|
+
];
|
|
24929
|
+
};
|
|
24477
24930
|
|
|
24478
24931
|
// src/lending/user-data/fetch-balances/parse.ts
|
|
24479
24932
|
function getUserDataConverter(lender, chainId, account, params, meta) {
|
|
@@ -24495,6 +24948,8 @@ function getUserDataConverter(lender, chainId, account, params, meta) {
|
|
|
24495
24948
|
params,
|
|
24496
24949
|
meta
|
|
24497
24950
|
);
|
|
24951
|
+
if (isMidnight(lender))
|
|
24952
|
+
return getMidnightUserDataConverter(lender, chainId, account, meta);
|
|
24498
24953
|
if (isCompoundV3Type(lender))
|
|
24499
24954
|
return getCompoundV3UserDataConverter(
|
|
24500
24955
|
lender,
|
|
@@ -29249,6 +29704,7 @@ var getAbi2 = (lender) => {
|
|
|
29249
29704
|
if (isCompoundV3(lender))
|
|
29250
29705
|
return [...CometAbi, ...CometExtAbi, ...CometRewardsAbi];
|
|
29251
29706
|
if (isMorphoType(lender)) return [...MorphoBlueAbi, ...MorphoLensAbi];
|
|
29707
|
+
if (isMidnight(lender)) return [...MidnightAbi];
|
|
29252
29708
|
if (isInit(lender)) return InitLensAbi;
|
|
29253
29709
|
if (isEulerType(lender)) return accountLensAbi;
|
|
29254
29710
|
if (isCompoundV2Type(lender))
|
|
@@ -32436,8 +32892,8 @@ var TIMEOUT_MS = 8e3;
|
|
|
32436
32892
|
var slisBnbFetcher = {
|
|
32437
32893
|
label: "SLISBNB",
|
|
32438
32894
|
fetch: async () => {
|
|
32439
|
-
const
|
|
32440
|
-
const url = `${HISTORY_URL}?name=slisBNBRate&cycle=1&startTime=${
|
|
32895
|
+
const nowSec2 = Math.floor(Date.now() / 1e3);
|
|
32896
|
+
const url = `${HISTORY_URL}?name=slisBNBRate&cycle=1&startTime=${nowSec2 - LOOKBACK_SECONDS}&endTime=${nowSec2}`;
|
|
32441
32897
|
const controller = new AbortController();
|
|
32442
32898
|
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
32443
32899
|
try {
|
|
@@ -40174,7 +40630,7 @@ var Multicall3BalanceAbi = [
|
|
|
40174
40630
|
outputs: [{ type: "uint256" }]
|
|
40175
40631
|
}
|
|
40176
40632
|
];
|
|
40177
|
-
var
|
|
40633
|
+
var toBigInt11 = (v) => {
|
|
40178
40634
|
if (v === void 0 || v === null) return void 0;
|
|
40179
40635
|
if (typeof v === "bigint") return v;
|
|
40180
40636
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -40198,12 +40654,12 @@ var readerBeetsStS = (entry) => ({
|
|
|
40198
40654
|
],
|
|
40199
40655
|
abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
|
|
40200
40656
|
parse: ([supply, rate, pool]) => {
|
|
40201
|
-
const totalSupply =
|
|
40202
|
-
const exchangeRate =
|
|
40657
|
+
const totalSupply = toBigInt11(supply);
|
|
40658
|
+
const exchangeRate = toBigInt11(rate);
|
|
40203
40659
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40204
40660
|
return void 0;
|
|
40205
40661
|
}
|
|
40206
|
-
const liquidity =
|
|
40662
|
+
const liquidity = toBigInt11(pool);
|
|
40207
40663
|
return {
|
|
40208
40664
|
totalAssets: totalSupply * exchangeRate / ONE_E186,
|
|
40209
40665
|
totalSupply,
|
|
@@ -40244,12 +40700,12 @@ var readerBenqiSavax = (entry) => ({
|
|
|
40244
40700
|
],
|
|
40245
40701
|
abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
|
|
40246
40702
|
parse: ([supply, rate, totalPooled]) => {
|
|
40247
|
-
const totalSupply =
|
|
40248
|
-
const exchangeRate =
|
|
40703
|
+
const totalSupply = toBigInt11(supply);
|
|
40704
|
+
const exchangeRate = toBigInt11(rate);
|
|
40249
40705
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40250
40706
|
return void 0;
|
|
40251
40707
|
}
|
|
40252
|
-
const totalAssets =
|
|
40708
|
+
const totalAssets = toBigInt11(totalPooled) ?? totalSupply * exchangeRate / ONE_E186;
|
|
40253
40709
|
return {
|
|
40254
40710
|
totalAssets,
|
|
40255
40711
|
totalSupply,
|
|
@@ -40263,7 +40719,7 @@ var readerBgtWrapper1to1 = (entry) => ({
|
|
|
40263
40719
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40264
40720
|
abis: [TotalSupplyAbi],
|
|
40265
40721
|
parse: ([supply]) => {
|
|
40266
|
-
const totalSupply =
|
|
40722
|
+
const totalSupply = toBigInt11(supply);
|
|
40267
40723
|
if (totalSupply === void 0) return void 0;
|
|
40268
40724
|
return {
|
|
40269
40725
|
totalAssets: totalSupply,
|
|
@@ -40292,8 +40748,8 @@ var readerDineroBeraEth = (entry) => ({
|
|
|
40292
40748
|
],
|
|
40293
40749
|
abis: [TotalSupplyAbi, DineroBeraEthAbi],
|
|
40294
40750
|
parse: ([supply, rate]) => {
|
|
40295
|
-
const totalSupply =
|
|
40296
|
-
const exchangeRate =
|
|
40751
|
+
const totalSupply = toBigInt11(supply);
|
|
40752
|
+
const exchangeRate = toBigInt11(rate);
|
|
40297
40753
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40298
40754
|
return void 0;
|
|
40299
40755
|
}
|
|
@@ -40314,9 +40770,9 @@ var readerErc4626 = (entry) => ({
|
|
|
40314
40770
|
],
|
|
40315
40771
|
abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
|
|
40316
40772
|
parse: ([assets, supply, rate]) => {
|
|
40317
|
-
const totalAssets =
|
|
40318
|
-
const totalSupply =
|
|
40319
|
-
const exchangeRate =
|
|
40773
|
+
const totalAssets = toBigInt11(assets);
|
|
40774
|
+
const totalSupply = toBigInt11(supply);
|
|
40775
|
+
const exchangeRate = toBigInt11(rate);
|
|
40320
40776
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
40321
40777
|
return void 0;
|
|
40322
40778
|
}
|
|
@@ -40331,9 +40787,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
|
|
|
40331
40787
|
],
|
|
40332
40788
|
abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
|
|
40333
40789
|
parse: ([assets, supply, rate]) => {
|
|
40334
|
-
const totalAssets =
|
|
40335
|
-
const totalSupply =
|
|
40336
|
-
const exchangeRate =
|
|
40790
|
+
const totalAssets = toBigInt11(assets);
|
|
40791
|
+
const totalSupply = toBigInt11(supply);
|
|
40792
|
+
const exchangeRate = toBigInt11(rate);
|
|
40337
40793
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
40338
40794
|
return void 0;
|
|
40339
40795
|
}
|
|
@@ -40393,15 +40849,15 @@ var readerEtherFiWeEth = (entry) => {
|
|
|
40393
40849
|
calls,
|
|
40394
40850
|
abis,
|
|
40395
40851
|
parse: (slice) => {
|
|
40396
|
-
const totalSupply =
|
|
40397
|
-
const exchangeRate =
|
|
40852
|
+
const totalSupply = toBigInt11(slice[0]);
|
|
40853
|
+
const exchangeRate = toBigInt11(slice[1]);
|
|
40398
40854
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40399
40855
|
return void 0;
|
|
40400
40856
|
}
|
|
40401
40857
|
let liquidity;
|
|
40402
40858
|
if (lp) {
|
|
40403
|
-
const lpBalance =
|
|
40404
|
-
const locked =
|
|
40859
|
+
const lpBalance = toBigInt11(slice[2]);
|
|
40860
|
+
const locked = toBigInt11(slice[3]);
|
|
40405
40861
|
if (lpBalance !== void 0 && locked !== void 0) {
|
|
40406
40862
|
liquidity = lpBalance > locked ? lpBalance - locked : 0n;
|
|
40407
40863
|
}
|
|
@@ -40435,7 +40891,7 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
40435
40891
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40436
40892
|
abis: [TotalSupplyAbi],
|
|
40437
40893
|
parse: ([supply]) => {
|
|
40438
|
-
const totalSupply =
|
|
40894
|
+
const totalSupply = toBigInt11(supply);
|
|
40439
40895
|
if (totalSupply === void 0) return void 0;
|
|
40440
40896
|
return {
|
|
40441
40897
|
totalAssets: totalSupply,
|
|
@@ -40452,8 +40908,8 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
40452
40908
|
],
|
|
40453
40909
|
abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
|
|
40454
40910
|
parse: ([supply, rate]) => {
|
|
40455
|
-
const totalSupply =
|
|
40456
|
-
const exchangeRate =
|
|
40911
|
+
const totalSupply = toBigInt11(supply);
|
|
40912
|
+
const exchangeRate = toBigInt11(rate);
|
|
40457
40913
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40458
40914
|
return void 0;
|
|
40459
40915
|
}
|
|
@@ -40485,7 +40941,7 @@ var readerKelpRsEth = (entry) => {
|
|
|
40485
40941
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40486
40942
|
abis: [TotalSupplyAbi],
|
|
40487
40943
|
parse: ([supply]) => {
|
|
40488
|
-
const totalSupply =
|
|
40944
|
+
const totalSupply = toBigInt11(supply);
|
|
40489
40945
|
if (totalSupply === void 0) return void 0;
|
|
40490
40946
|
return {
|
|
40491
40947
|
totalAssets: totalSupply,
|
|
@@ -40502,8 +40958,8 @@ var readerKelpRsEth = (entry) => {
|
|
|
40502
40958
|
],
|
|
40503
40959
|
abis: [TotalSupplyAbi, KelpLrtOracleAbi],
|
|
40504
40960
|
parse: ([supply, rate]) => {
|
|
40505
|
-
const totalSupply =
|
|
40506
|
-
const exchangeRate =
|
|
40961
|
+
const totalSupply = toBigInt11(supply);
|
|
40962
|
+
const exchangeRate = toBigInt11(rate);
|
|
40507
40963
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40508
40964
|
return void 0;
|
|
40509
40965
|
}
|
|
@@ -40535,7 +40991,7 @@ var readerKinetiqKHype = (entry) => {
|
|
|
40535
40991
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40536
40992
|
abis: [TotalSupplyAbi],
|
|
40537
40993
|
parse: ([supply]) => {
|
|
40538
|
-
const totalSupply =
|
|
40994
|
+
const totalSupply = toBigInt11(supply);
|
|
40539
40995
|
if (totalSupply === void 0) return void 0;
|
|
40540
40996
|
return {
|
|
40541
40997
|
totalAssets: totalSupply,
|
|
@@ -40552,8 +41008,8 @@ var readerKinetiqKHype = (entry) => {
|
|
|
40552
41008
|
],
|
|
40553
41009
|
abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
|
|
40554
41010
|
parse: ([supply, rate]) => {
|
|
40555
|
-
const totalSupply =
|
|
40556
|
-
const exchangeRate =
|
|
41011
|
+
const totalSupply = toBigInt11(supply);
|
|
41012
|
+
const exchangeRate = toBigInt11(rate);
|
|
40557
41013
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40558
41014
|
return void 0;
|
|
40559
41015
|
}
|
|
@@ -40593,12 +41049,12 @@ var readerLairStKaia = (entry) => ({
|
|
|
40593
41049
|
],
|
|
40594
41050
|
abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
|
|
40595
41051
|
parse: ([supply, rate, totalStaking]) => {
|
|
40596
|
-
const totalSupply =
|
|
40597
|
-
const exchangeRate =
|
|
41052
|
+
const totalSupply = toBigInt11(supply);
|
|
41053
|
+
const exchangeRate = toBigInt11(rate);
|
|
40598
41054
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40599
41055
|
return void 0;
|
|
40600
41056
|
}
|
|
40601
|
-
const totalAssets =
|
|
41057
|
+
const totalAssets = toBigInt11(totalStaking) ?? totalSupply * exchangeRate / ONE_E186;
|
|
40602
41058
|
return {
|
|
40603
41059
|
totalAssets,
|
|
40604
41060
|
totalSupply,
|
|
@@ -40626,8 +41082,8 @@ var readerLidoWstEth = (entry) => ({
|
|
|
40626
41082
|
],
|
|
40627
41083
|
abis: [TotalSupplyAbi, LidoWstEthAbi],
|
|
40628
41084
|
parse: ([supply, rate]) => {
|
|
40629
|
-
const totalSupply =
|
|
40630
|
-
const exchangeRate =
|
|
41085
|
+
const totalSupply = toBigInt11(supply);
|
|
41086
|
+
const exchangeRate = toBigInt11(rate);
|
|
40631
41087
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40632
41088
|
return void 0;
|
|
40633
41089
|
}
|
|
@@ -40665,7 +41121,7 @@ var readerListaSlisBnb = (entry) => {
|
|
|
40665
41121
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40666
41122
|
abis: [TotalSupplyAbi],
|
|
40667
41123
|
parse: ([supply]) => {
|
|
40668
|
-
const totalSupply =
|
|
41124
|
+
const totalSupply = toBigInt11(supply);
|
|
40669
41125
|
if (totalSupply === void 0) return void 0;
|
|
40670
41126
|
return {
|
|
40671
41127
|
totalAssets: totalSupply,
|
|
@@ -40683,12 +41139,12 @@ var readerListaSlisBnb = (entry) => {
|
|
|
40683
41139
|
],
|
|
40684
41140
|
abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
|
|
40685
41141
|
parse: ([supply, rate, pooled]) => {
|
|
40686
|
-
const totalSupply =
|
|
40687
|
-
const exchangeRate =
|
|
41142
|
+
const totalSupply = toBigInt11(supply);
|
|
41143
|
+
const exchangeRate = toBigInt11(rate);
|
|
40688
41144
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40689
41145
|
return void 0;
|
|
40690
41146
|
}
|
|
40691
|
-
const pooledBnb =
|
|
41147
|
+
const pooledBnb = toBigInt11(pooled);
|
|
40692
41148
|
const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E186;
|
|
40693
41149
|
return { totalAssets, totalSupply, exchangeRate };
|
|
40694
41150
|
}
|
|
@@ -40714,7 +41170,7 @@ var readerMantleMEth = (entry) => {
|
|
|
40714
41170
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40715
41171
|
abis: [TotalSupplyAbi],
|
|
40716
41172
|
parse: ([supply]) => {
|
|
40717
|
-
const totalSupply =
|
|
41173
|
+
const totalSupply = toBigInt11(supply);
|
|
40718
41174
|
if (totalSupply === void 0) return void 0;
|
|
40719
41175
|
return {
|
|
40720
41176
|
totalAssets: totalSupply,
|
|
@@ -40731,8 +41187,8 @@ var readerMantleMEth = (entry) => {
|
|
|
40731
41187
|
],
|
|
40732
41188
|
abis: [TotalSupplyAbi, MantleStakingAbi],
|
|
40733
41189
|
parse: ([supply, rate]) => {
|
|
40734
|
-
const totalSupply =
|
|
40735
|
-
const exchangeRate =
|
|
41190
|
+
const totalSupply = toBigInt11(supply);
|
|
41191
|
+
const exchangeRate = toBigInt11(rate);
|
|
40736
41192
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40737
41193
|
return void 0;
|
|
40738
41194
|
}
|
|
@@ -40753,7 +41209,7 @@ var readerOffChain = (entry) => {
|
|
|
40753
41209
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40754
41210
|
abis: [TotalSupplyAbi],
|
|
40755
41211
|
parse: ([supply]) => {
|
|
40756
|
-
const totalSupply =
|
|
41212
|
+
const totalSupply = toBigInt11(supply);
|
|
40757
41213
|
if (totalSupply === void 0) return void 0;
|
|
40758
41214
|
return {
|
|
40759
41215
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -40787,7 +41243,7 @@ var readerRenzoEzEth = (entry) => {
|
|
|
40787
41243
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40788
41244
|
abis: [TotalSupplyAbi],
|
|
40789
41245
|
parse: ([supply]) => {
|
|
40790
|
-
const totalSupply =
|
|
41246
|
+
const totalSupply = toBigInt11(supply);
|
|
40791
41247
|
if (totalSupply === void 0) return void 0;
|
|
40792
41248
|
return {
|
|
40793
41249
|
totalAssets: totalSupply,
|
|
@@ -40804,9 +41260,9 @@ var readerRenzoEzEth = (entry) => {
|
|
|
40804
41260
|
],
|
|
40805
41261
|
abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
|
|
40806
41262
|
parse: ([supply, tvls]) => {
|
|
40807
|
-
const totalSupply =
|
|
41263
|
+
const totalSupply = toBigInt11(supply);
|
|
40808
41264
|
if (totalSupply === void 0 || totalSupply === 0n) return void 0;
|
|
40809
|
-
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ?
|
|
41265
|
+
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt11(tvls[2]) : void 0;
|
|
40810
41266
|
if (totalTvl === void 0) return void 0;
|
|
40811
41267
|
return {
|
|
40812
41268
|
totalAssets: totalTvl,
|
|
@@ -40860,12 +41316,12 @@ var readerRocketReth = (entry) => {
|
|
|
40860
41316
|
calls,
|
|
40861
41317
|
abis,
|
|
40862
41318
|
parse: (slice) => {
|
|
40863
|
-
const totalSupply =
|
|
40864
|
-
const exchangeRate =
|
|
41319
|
+
const totalSupply = toBigInt11(slice[0]);
|
|
41320
|
+
const exchangeRate = toBigInt11(slice[1]);
|
|
40865
41321
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40866
41322
|
return void 0;
|
|
40867
41323
|
}
|
|
40868
|
-
const liquidity = depositPool ?
|
|
41324
|
+
const liquidity = depositPool ? toBigInt11(slice[2]) : void 0;
|
|
40869
41325
|
return {
|
|
40870
41326
|
totalAssets: totalSupply * exchangeRate / ONE_E186,
|
|
40871
41327
|
totalSupply,
|
|
@@ -40904,7 +41360,7 @@ var readerStaderEthx = (entry) => {
|
|
|
40904
41360
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40905
41361
|
abis: [TotalSupplyAbi],
|
|
40906
41362
|
parse: ([supply]) => {
|
|
40907
|
-
const totalSupply =
|
|
41363
|
+
const totalSupply = toBigInt11(supply);
|
|
40908
41364
|
if (totalSupply === void 0) return void 0;
|
|
40909
41365
|
return {
|
|
40910
41366
|
totalAssets: totalSupply,
|
|
@@ -40921,8 +41377,8 @@ var readerStaderEthx = (entry) => {
|
|
|
40921
41377
|
],
|
|
40922
41378
|
abis: [TotalSupplyAbi, StaderEthxAbi],
|
|
40923
41379
|
parse: ([supply, rate]) => {
|
|
40924
|
-
const totalSupply =
|
|
40925
|
-
const exchangeRate =
|
|
41380
|
+
const totalSupply = toBigInt11(supply);
|
|
41381
|
+
const exchangeRate = toBigInt11(rate);
|
|
40926
41382
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
40927
41383
|
return void 0;
|
|
40928
41384
|
}
|
|
@@ -40950,10 +41406,10 @@ var readerStaderMaticX = (entry) => {
|
|
|
40950
41406
|
],
|
|
40951
41407
|
abis: [TotalSupplyAbi, StaderMaticXAbi],
|
|
40952
41408
|
parse: ([supply, tup]) => {
|
|
40953
|
-
const totalSupply =
|
|
41409
|
+
const totalSupply = toBigInt11(supply);
|
|
40954
41410
|
if (!Array.isArray(tup) || tup.length < 3) return void 0;
|
|
40955
|
-
const amountInMatic =
|
|
40956
|
-
const totalPooledMatic =
|
|
41411
|
+
const amountInMatic = toBigInt11(tup[0]);
|
|
41412
|
+
const totalPooledMatic = toBigInt11(tup[2]);
|
|
40957
41413
|
if (totalSupply === void 0 || amountInMatic === void 0) {
|
|
40958
41414
|
return void 0;
|
|
40959
41415
|
}
|
|
@@ -40986,7 +41442,7 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
40986
41442
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
40987
41443
|
abis: [TotalSupplyAbi],
|
|
40988
41444
|
parse: ([supply]) => {
|
|
40989
|
-
const totalSupply =
|
|
41445
|
+
const totalSupply = toBigInt11(supply);
|
|
40990
41446
|
if (totalSupply === void 0) return void 0;
|
|
40991
41447
|
return {
|
|
40992
41448
|
totalAssets: totalSupply,
|
|
@@ -41003,8 +41459,8 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
41003
41459
|
],
|
|
41004
41460
|
abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
|
|
41005
41461
|
parse: ([supply, rate]) => {
|
|
41006
|
-
const totalSupply =
|
|
41007
|
-
const exchangeRate =
|
|
41462
|
+
const totalSupply = toBigInt11(supply);
|
|
41463
|
+
const exchangeRate = toBigInt11(rate);
|
|
41008
41464
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
41009
41465
|
return void 0;
|
|
41010
41466
|
}
|
|
@@ -41036,7 +41492,7 @@ var readerStCelo = (entry) => {
|
|
|
41036
41492
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
41037
41493
|
abis: [TotalSupplyAbi],
|
|
41038
41494
|
parse: ([supply]) => {
|
|
41039
|
-
const totalSupply =
|
|
41495
|
+
const totalSupply = toBigInt11(supply);
|
|
41040
41496
|
if (totalSupply === void 0) return void 0;
|
|
41041
41497
|
return {
|
|
41042
41498
|
totalAssets: totalSupply,
|
|
@@ -41053,8 +41509,8 @@ var readerStCelo = (entry) => {
|
|
|
41053
41509
|
],
|
|
41054
41510
|
abis: [TotalSupplyAbi, StCeloManagerAbi],
|
|
41055
41511
|
parse: ([supply, rate]) => {
|
|
41056
|
-
const totalSupply =
|
|
41057
|
-
const exchangeRate =
|
|
41512
|
+
const totalSupply = toBigInt11(supply);
|
|
41513
|
+
const exchangeRate = toBigInt11(rate);
|
|
41058
41514
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
41059
41515
|
return void 0;
|
|
41060
41516
|
}
|
|
@@ -41086,8 +41542,8 @@ var readerSwellGetRate = (entry) => ({
|
|
|
41086
41542
|
],
|
|
41087
41543
|
abis: [TotalSupplyAbi, SwellGetRateAbi],
|
|
41088
41544
|
parse: ([supply, rate]) => {
|
|
41089
|
-
const totalSupply =
|
|
41090
|
-
const exchangeRate =
|
|
41545
|
+
const totalSupply = toBigInt11(supply);
|
|
41546
|
+
const exchangeRate = toBigInt11(rate);
|
|
41091
41547
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
41092
41548
|
return void 0;
|
|
41093
41549
|
}
|
|
@@ -41118,7 +41574,7 @@ var readerValantisWstHype = (entry) => {
|
|
|
41118
41574
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
41119
41575
|
abis: [TotalSupplyAbi],
|
|
41120
41576
|
parse: ([supply]) => {
|
|
41121
|
-
const totalSupply =
|
|
41577
|
+
const totalSupply = toBigInt11(supply);
|
|
41122
41578
|
if (totalSupply === void 0) return void 0;
|
|
41123
41579
|
return {
|
|
41124
41580
|
totalAssets: totalSupply,
|
|
@@ -41135,8 +41591,8 @@ var readerValantisWstHype = (entry) => {
|
|
|
41135
41591
|
],
|
|
41136
41592
|
abis: [TotalSupplyAbi, ValantisStHypeAbi],
|
|
41137
41593
|
parse: ([supply, rate]) => {
|
|
41138
|
-
const totalSupply =
|
|
41139
|
-
const exchangeRate =
|
|
41594
|
+
const totalSupply = toBigInt11(supply);
|
|
41595
|
+
const exchangeRate = toBigInt11(rate);
|
|
41140
41596
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
41141
41597
|
return void 0;
|
|
41142
41598
|
}
|
|
@@ -41170,7 +41626,7 @@ var readerVedaAccountant = (entry) => {
|
|
|
41170
41626
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
41171
41627
|
abis: [TotalSupplyAbi],
|
|
41172
41628
|
parse: ([supply]) => {
|
|
41173
|
-
const totalSupply =
|
|
41629
|
+
const totalSupply = toBigInt11(supply);
|
|
41174
41630
|
if (totalSupply === void 0) return void 0;
|
|
41175
41631
|
return {
|
|
41176
41632
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -41188,8 +41644,8 @@ var readerVedaAccountant = (entry) => {
|
|
|
41188
41644
|
],
|
|
41189
41645
|
abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
|
|
41190
41646
|
parse: ([supply, rate]) => {
|
|
41191
|
-
const totalSupply =
|
|
41192
|
-
const rawRate =
|
|
41647
|
+
const totalSupply = toBigInt11(supply);
|
|
41648
|
+
const rawRate = toBigInt11(rate);
|
|
41193
41649
|
if (totalSupply === void 0 || rawRate === void 0) return void 0;
|
|
41194
41650
|
const exchangeRate = rawRate * scale;
|
|
41195
41651
|
return {
|
|
@@ -41224,8 +41680,8 @@ var readerAnkrRatio = (entry) => ({
|
|
|
41224
41680
|
],
|
|
41225
41681
|
abis: [TotalSupplyAbi, AnkrRatioAbi],
|
|
41226
41682
|
parse: ([supply, ratio]) => {
|
|
41227
|
-
const totalSupply =
|
|
41228
|
-
const r =
|
|
41683
|
+
const totalSupply = toBigInt11(supply);
|
|
41684
|
+
const r = toBigInt11(ratio);
|
|
41229
41685
|
if (totalSupply === void 0 || r === void 0 || r === 0n) {
|
|
41230
41686
|
return void 0;
|
|
41231
41687
|
}
|
|
@@ -41268,8 +41724,8 @@ var readerCoreEarnRate = (entry) => {
|
|
|
41268
41724
|
],
|
|
41269
41725
|
abis: [CoreEarnRateAbi, TotalSupplyAbi],
|
|
41270
41726
|
parse: ([rate, supply]) => {
|
|
41271
|
-
const r =
|
|
41272
|
-
const totalSupply =
|
|
41727
|
+
const r = toBigInt11(rate);
|
|
41728
|
+
const totalSupply = toBigInt11(supply);
|
|
41273
41729
|
if (r === void 0 || r === 0n || totalSupply === void 0) {
|
|
41274
41730
|
return void 0;
|
|
41275
41731
|
}
|
|
@@ -41290,8 +41746,8 @@ var readerCoreStakedRatio = (entry) => {
|
|
|
41290
41746
|
],
|
|
41291
41747
|
abis: [CoreTotalStakedAbi, TotalSupplyAbi],
|
|
41292
41748
|
parse: ([staked, supply]) => {
|
|
41293
|
-
const totalStaked =
|
|
41294
|
-
const totalSupply =
|
|
41749
|
+
const totalStaked = toBigInt11(staked);
|
|
41750
|
+
const totalSupply = toBigInt11(supply);
|
|
41295
41751
|
if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
|
|
41296
41752
|
return void 0;
|
|
41297
41753
|
}
|
|
@@ -41335,12 +41791,12 @@ var readerStellaStDot = (entry) => ({
|
|
|
41335
41791
|
],
|
|
41336
41792
|
abis: [TotalSupplyAbi, StellaStDotAbi, StellaStDotAbi],
|
|
41337
41793
|
parse: ([supply, rate, pooled]) => {
|
|
41338
|
-
const totalSupply =
|
|
41339
|
-
const exchangeRate =
|
|
41794
|
+
const totalSupply = toBigInt11(supply);
|
|
41795
|
+
const exchangeRate = toBigInt11(rate);
|
|
41340
41796
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
41341
41797
|
return void 0;
|
|
41342
41798
|
}
|
|
41343
|
-
const totalAssets =
|
|
41799
|
+
const totalAssets = toBigInt11(pooled) ?? totalSupply * exchangeRate / ONE_E186;
|
|
41344
41800
|
return {
|
|
41345
41801
|
totalAssets,
|
|
41346
41802
|
totalSupply,
|
|
@@ -41375,8 +41831,8 @@ var readerKintsuSMon = (entry) => ({
|
|
|
41375
41831
|
],
|
|
41376
41832
|
abis: [KintsuSMonAbi, KintsuSMonAbi],
|
|
41377
41833
|
parse: ([pooled, shares]) => {
|
|
41378
|
-
const totalAssets =
|
|
41379
|
-
const totalSupply =
|
|
41834
|
+
const totalAssets = toBigInt11(pooled);
|
|
41835
|
+
const totalSupply = toBigInt11(shares);
|
|
41380
41836
|
if (totalAssets === void 0 || totalSupply === void 0) return void 0;
|
|
41381
41837
|
const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E186 / totalSupply : ONE_E186;
|
|
41382
41838
|
return { totalAssets, totalSupply, exchangeRate };
|
|
@@ -41893,7 +42349,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
41893
42349
|
const validatorsByAddress = new Map(validatorEntries);
|
|
41894
42350
|
const idleByAddress = /* @__PURE__ */ new Map();
|
|
41895
42351
|
idleEntries.forEach((e, i) => {
|
|
41896
|
-
const bal =
|
|
42352
|
+
const bal = toBigInt11(idleResults[i]);
|
|
41897
42353
|
if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
|
|
41898
42354
|
});
|
|
41899
42355
|
const rawResults = new Array(allCalls.length);
|
|
@@ -42023,7 +42479,7 @@ var BeetsStSWithdrawalAbi = [
|
|
|
42023
42479
|
];
|
|
42024
42480
|
|
|
42025
42481
|
// src/vaults/lst/withdrawals/readers/shared.ts
|
|
42026
|
-
var
|
|
42482
|
+
var toBigInt12 = (v) => {
|
|
42027
42483
|
if (v === void 0 || v === null) return void 0;
|
|
42028
42484
|
if (typeof v === "bigint") return v;
|
|
42029
42485
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -42038,7 +42494,7 @@ var toBigInt11 = (v) => {
|
|
|
42038
42494
|
return void 0;
|
|
42039
42495
|
};
|
|
42040
42496
|
var toNumber = (v) => {
|
|
42041
|
-
const b =
|
|
42497
|
+
const b = toBigInt12(v);
|
|
42042
42498
|
if (b === void 0) return void 0;
|
|
42043
42499
|
if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
|
|
42044
42500
|
return Number(b);
|
|
@@ -42075,7 +42531,7 @@ var readerBeets = {
|
|
|
42075
42531
|
const out = [];
|
|
42076
42532
|
for (let i = 0; i < reqs.length; i++) {
|
|
42077
42533
|
const r = reqs[i];
|
|
42078
|
-
const amount =
|
|
42534
|
+
const amount = toBigInt12(r.assetAmount);
|
|
42079
42535
|
const ts = toNumber(r.requestTimestamp);
|
|
42080
42536
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
42081
42537
|
if (amount === void 0 || ts === void 0) continue;
|
|
@@ -42167,13 +42623,13 @@ var readerBeHype = {
|
|
|
42167
42623
|
const q = stage2[i * 2];
|
|
42168
42624
|
const canClaim = Boolean(stage2[i * 2 + 1]);
|
|
42169
42625
|
if (!q) continue;
|
|
42170
|
-
const hypeAmount = Array.isArray(q) ?
|
|
42626
|
+
const hypeAmount = Array.isArray(q) ? toBigInt12(q[2]) : toBigInt12(q.hypeAmount);
|
|
42171
42627
|
if (hypeAmount === void 0) continue;
|
|
42172
42628
|
out.push({
|
|
42173
42629
|
lst: entry.lst,
|
|
42174
42630
|
brand: entry.brand,
|
|
42175
42631
|
symbol: entry.symbol,
|
|
42176
|
-
requestId: String(
|
|
42632
|
+
requestId: String(toBigInt12(ids[i]) ?? i),
|
|
42177
42633
|
amountUnderlying: hypeAmount.toString(),
|
|
42178
42634
|
status: canClaim ? "claimable" : "pending"
|
|
42179
42635
|
});
|
|
@@ -42276,7 +42732,7 @@ var readerBenqi = {
|
|
|
42276
42732
|
for (let i = 0; i < reqs.length; i++) {
|
|
42277
42733
|
const r = reqs[i];
|
|
42278
42734
|
const startedAt = toNumber(r.startedAt);
|
|
42279
|
-
const shareAmount =
|
|
42735
|
+
const shareAmount = toBigInt12(r.shareAmount);
|
|
42280
42736
|
if (startedAt === void 0 || shareAmount === void 0) continue;
|
|
42281
42737
|
const readyAt = startedAt + cooldown;
|
|
42282
42738
|
const expiresAt = readyAt + claimWindow;
|
|
@@ -42339,8 +42795,8 @@ var readerBeraPaw = {
|
|
|
42339
42795
|
}
|
|
42340
42796
|
const pos = res[0];
|
|
42341
42797
|
if (!pos) return [];
|
|
42342
|
-
const queued = Array.isArray(pos) ?
|
|
42343
|
-
const available = Array.isArray(pos) ?
|
|
42798
|
+
const queued = Array.isArray(pos) ? toBigInt12(pos[0]) : toBigInt12(pos.queued);
|
|
42799
|
+
const available = Array.isArray(pos) ? toBigInt12(pos[1]) : toBigInt12(pos.available);
|
|
42344
42800
|
const out = [];
|
|
42345
42801
|
if (available !== void 0 && available > 0n) {
|
|
42346
42802
|
out.push({
|
|
@@ -42422,7 +42878,7 @@ var readerIbera = {
|
|
|
42422
42878
|
return [];
|
|
42423
42879
|
}
|
|
42424
42880
|
const length = toNumber(stage1[0]) ?? 0;
|
|
42425
|
-
const frontier =
|
|
42881
|
+
const frontier = toBigInt12(stage1[1]) ?? 0n;
|
|
42426
42882
|
if (length === 0) return [];
|
|
42427
42883
|
const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
|
|
42428
42884
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -42446,7 +42902,7 @@ var readerIbera = {
|
|
|
42446
42902
|
const r = stage2[k];
|
|
42447
42903
|
if (!r) continue;
|
|
42448
42904
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
42449
|
-
const amount = Array.isArray(r) ?
|
|
42905
|
+
const amount = Array.isArray(r) ? toBigInt12(r[3]) : toBigInt12(r.amount);
|
|
42450
42906
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount === void 0 || amount === 0n) {
|
|
42451
42907
|
continue;
|
|
42452
42908
|
}
|
|
@@ -42519,7 +42975,7 @@ var readerPrimeStaking = {
|
|
|
42519
42975
|
return [];
|
|
42520
42976
|
}
|
|
42521
42977
|
const length = toNumber(stage1[0]) ?? 0;
|
|
42522
|
-
const frontier =
|
|
42978
|
+
const frontier = toBigInt12(stage1[1]) ?? 0n;
|
|
42523
42979
|
if (length === 0) return [];
|
|
42524
42980
|
const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
|
|
42525
42981
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -42543,7 +42999,7 @@ var readerPrimeStaking = {
|
|
|
42543
42999
|
const r = stage2[k];
|
|
42544
43000
|
if (!r) continue;
|
|
42545
43001
|
const receiver = Array.isArray(r) ? r[1] : r.receiver;
|
|
42546
|
-
const assets = Array.isArray(r) ?
|
|
43002
|
+
const assets = Array.isArray(r) ? toBigInt12(r[3]) : toBigInt12(r.assets);
|
|
42547
43003
|
const processed = Array.isArray(r) ? r[4] : r.processed;
|
|
42548
43004
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
|
|
42549
43005
|
continue;
|
|
@@ -42613,8 +43069,8 @@ var readerErc7540 = {
|
|
|
42613
43069
|
],
|
|
42614
43070
|
abi: [Erc7540Abi, Erc7540Abi]
|
|
42615
43071
|
});
|
|
42616
|
-
const pending =
|
|
42617
|
-
const claimable =
|
|
43072
|
+
const pending = toBigInt12(stage1[0]) ?? 0n;
|
|
43073
|
+
const claimable = toBigInt12(stage1[1]) ?? 0n;
|
|
42618
43074
|
const out = [];
|
|
42619
43075
|
if (claimable > 0n) {
|
|
42620
43076
|
const stage2 = await multicallRetry({
|
|
@@ -42628,7 +43084,7 @@ var readerErc7540 = {
|
|
|
42628
43084
|
],
|
|
42629
43085
|
abi: [Erc7540Abi]
|
|
42630
43086
|
});
|
|
42631
|
-
const amount =
|
|
43087
|
+
const amount = toBigInt12(stage2[0]) ?? claimable;
|
|
42632
43088
|
out.push({
|
|
42633
43089
|
lst: entry.lst,
|
|
42634
43090
|
brand: entry.brand,
|
|
@@ -42682,11 +43138,11 @@ var readerEthenaCooldown = {
|
|
|
42682
43138
|
let cooldownEnd;
|
|
42683
43139
|
let amount;
|
|
42684
43140
|
if (Array.isArray(cell)) {
|
|
42685
|
-
cooldownEnd =
|
|
42686
|
-
amount =
|
|
43141
|
+
cooldownEnd = toBigInt12(cell[0]);
|
|
43142
|
+
amount = toBigInt12(cell[1]);
|
|
42687
43143
|
} else if (cell && typeof cell === "object") {
|
|
42688
|
-
cooldownEnd =
|
|
42689
|
-
amount =
|
|
43144
|
+
cooldownEnd = toBigInt12(cell.cooldownEnd);
|
|
43145
|
+
amount = toBigInt12(cell.underlyingAmount);
|
|
42690
43146
|
}
|
|
42691
43147
|
if (!amount || amount === 0n) return [];
|
|
42692
43148
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -42781,7 +43237,7 @@ var readerEtherFi = {
|
|
|
42781
43237
|
calls: enumCalls,
|
|
42782
43238
|
abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
|
|
42783
43239
|
});
|
|
42784
|
-
const ids = stage2.map(
|
|
43240
|
+
const ids = stage2.map(toBigInt12).filter((v) => v !== void 0);
|
|
42785
43241
|
if (ids.length === 0) return [];
|
|
42786
43242
|
const detailCalls = ids.flatMap((id) => [
|
|
42787
43243
|
{ address: entry.withdrawalContract, name: "getRequest", params: [id] },
|
|
@@ -42801,7 +43257,7 @@ var readerEtherFi = {
|
|
|
42801
43257
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
42802
43258
|
if (!req) continue;
|
|
42803
43259
|
if (!isValid) continue;
|
|
42804
|
-
const amount =
|
|
43260
|
+
const amount = toBigInt12(req.amountOfEEth);
|
|
42805
43261
|
if (amount === void 0) continue;
|
|
42806
43262
|
out.push({
|
|
42807
43263
|
lst: entry.lst,
|
|
@@ -42896,7 +43352,7 @@ var readerKelp = {
|
|
|
42896
43352
|
}
|
|
42897
43353
|
],
|
|
42898
43354
|
abi: [KelpWithdrawalManagerAbi]
|
|
42899
|
-
}).then((res) =>
|
|
43355
|
+
}).then((res) => toBigInt12(res[0]) ?? 0n)
|
|
42900
43356
|
]);
|
|
42901
43357
|
lengths = storageReads;
|
|
42902
43358
|
currentBlock = block;
|
|
@@ -42926,9 +43382,9 @@ var readerKelp = {
|
|
|
42926
43382
|
for (let i = 0; i < detailCalls.length; i++) {
|
|
42927
43383
|
const r = stage2[i];
|
|
42928
43384
|
if (!r) continue;
|
|
42929
|
-
const expected = Array.isArray(r) ?
|
|
42930
|
-
const startBlock = Array.isArray(r) ?
|
|
42931
|
-
const nonce = Array.isArray(r) ?
|
|
43385
|
+
const expected = Array.isArray(r) ? toBigInt12(r[1]) : toBigInt12(r.expectedAssetAmount);
|
|
43386
|
+
const startBlock = Array.isArray(r) ? toBigInt12(r[2]) : toBigInt12(r.withdrawalStartBlock);
|
|
43387
|
+
const nonce = Array.isArray(r) ? toBigInt12(r[3]) : toBigInt12(r.userNonce);
|
|
42932
43388
|
if (expected === void 0 || startBlock === void 0) continue;
|
|
42933
43389
|
const claimable = currentBlock >= startBlock + delayBlocks;
|
|
42934
43390
|
out.push({
|
|
@@ -43005,7 +43461,7 @@ var readerLido = {
|
|
|
43005
43461
|
abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
|
|
43006
43462
|
});
|
|
43007
43463
|
const ids = stage1[0];
|
|
43008
|
-
const frontier =
|
|
43464
|
+
const frontier = toBigInt12(stage1[1]) ?? 0n;
|
|
43009
43465
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
43010
43466
|
const stage2 = await multicallRetry({
|
|
43011
43467
|
chain: chainId,
|
|
@@ -43022,10 +43478,10 @@ var readerLido = {
|
|
|
43022
43478
|
if (!Array.isArray(statuses)) return [];
|
|
43023
43479
|
const out = [];
|
|
43024
43480
|
for (let i = 0; i < ids.length; i++) {
|
|
43025
|
-
const id =
|
|
43481
|
+
const id = toBigInt12(ids[i]);
|
|
43026
43482
|
const s = statuses[i];
|
|
43027
43483
|
if (id === void 0 || !s) continue;
|
|
43028
|
-
const amountOfStETH =
|
|
43484
|
+
const amountOfStETH = toBigInt12(s.amountOfStETH);
|
|
43029
43485
|
const isFinalized = Boolean(s.isFinalized);
|
|
43030
43486
|
const isClaimed = Boolean(s.isClaimed);
|
|
43031
43487
|
if (amountOfStETH === void 0) continue;
|
|
@@ -43134,11 +43590,11 @@ var readerLista = {
|
|
|
43134
43590
|
const status = stage2[i];
|
|
43135
43591
|
if (!status) continue;
|
|
43136
43592
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
43137
|
-
const bnbAmount = Array.isArray(status) ?
|
|
43138
|
-
const snbnbAmount = Array.isArray(req) ?
|
|
43593
|
+
const bnbAmount = Array.isArray(status) ? toBigInt12(status[1]) : toBigInt12(status._amount);
|
|
43594
|
+
const snbnbAmount = Array.isArray(req) ? toBigInt12(req[1]) : toBigInt12(req?.amountInSnBnb);
|
|
43139
43595
|
const amount = bnbAmount ?? snbnbAmount;
|
|
43140
43596
|
if (amount === void 0) continue;
|
|
43141
|
-
const uuid = Array.isArray(req) ?
|
|
43597
|
+
const uuid = Array.isArray(req) ? toBigInt12(req[0]) : toBigInt12(req?.uuid);
|
|
43142
43598
|
out.push({
|
|
43143
43599
|
lst: entry.lst,
|
|
43144
43600
|
brand: entry.brand,
|
|
@@ -43223,7 +43679,7 @@ var readerRenzo = {
|
|
|
43223
43679
|
for (let i = 0; i < count; i++) {
|
|
43224
43680
|
const tup = stage2[i];
|
|
43225
43681
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
43226
|
-
const amountToRedeem =
|
|
43682
|
+
const amountToRedeem = toBigInt12(tup[2]);
|
|
43227
43683
|
const createdAt = toNumber(tup[4]);
|
|
43228
43684
|
if (amountToRedeem === void 0 || createdAt === void 0) continue;
|
|
43229
43685
|
const readyAt = createdAt + cooldown;
|
|
@@ -43296,9 +43752,9 @@ var readerStaderEthx2 = {
|
|
|
43296
43752
|
]
|
|
43297
43753
|
});
|
|
43298
43754
|
const ids = stage1[0];
|
|
43299
|
-
const frontier =
|
|
43755
|
+
const frontier = toBigInt12(stage1[1]) ?? 0n;
|
|
43300
43756
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
43301
|
-
const idBigInts = ids.map(
|
|
43757
|
+
const idBigInts = ids.map(toBigInt12).filter((v) => v !== void 0);
|
|
43302
43758
|
const detailCalls = idBigInts.map((id) => ({
|
|
43303
43759
|
address: entry.withdrawalContract,
|
|
43304
43760
|
name: "userWithdrawRequests",
|
|
@@ -43314,8 +43770,8 @@ var readerStaderEthx2 = {
|
|
|
43314
43770
|
const id = idBigInts[i];
|
|
43315
43771
|
const tup = stage2[i];
|
|
43316
43772
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
43317
|
-
const ethExpected =
|
|
43318
|
-
const ethFinalized =
|
|
43773
|
+
const ethExpected = toBigInt12(tup[2]) ?? 0n;
|
|
43774
|
+
const ethFinalized = toBigInt12(tup[3]) ?? 0n;
|
|
43319
43775
|
const isFinalized = id < frontier && ethFinalized > 0n;
|
|
43320
43776
|
const queuePosition = isFinalized ? 0 : Number(id - frontier);
|
|
43321
43777
|
out.push({
|
|
@@ -43394,13 +43850,13 @@ var readerStaderMaticX2 = {
|
|
|
43394
43850
|
});
|
|
43395
43851
|
const arr = stage1[0];
|
|
43396
43852
|
if (!Array.isArray(arr)) return [];
|
|
43397
|
-
const currentEpoch = stakeManager ?
|
|
43398
|
-
const delay = stakeManager ?
|
|
43853
|
+
const currentEpoch = stakeManager ? toBigInt12(stage1[1]) ?? 0n : 0n;
|
|
43854
|
+
const delay = stakeManager ? toBigInt12(stage1[2]) ?? 0n : 0n;
|
|
43399
43855
|
const out = [];
|
|
43400
43856
|
for (let i = 0; i < arr.length; i++) {
|
|
43401
43857
|
const r = arr[i];
|
|
43402
|
-
const amount =
|
|
43403
|
-
const requestEpoch =
|
|
43858
|
+
const amount = toBigInt12(r.amount) ?? 0n;
|
|
43859
|
+
const requestEpoch = toBigInt12(r.requestEpoch);
|
|
43404
43860
|
if (requestEpoch === void 0) continue;
|
|
43405
43861
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
43406
43862
|
out.push({
|
|
@@ -43487,9 +43943,9 @@ var readerMantle = {
|
|
|
43487
43943
|
if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
|
|
43488
43944
|
continue;
|
|
43489
43945
|
}
|
|
43490
|
-
const ethRequested = Array.isArray(detail) ?
|
|
43946
|
+
const ethRequested = Array.isArray(detail) ? toBigInt12(detail[3]) : toBigInt12(detail.ethRequested);
|
|
43491
43947
|
const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
|
|
43492
|
-
const claimable = Array.isArray(info) ?
|
|
43948
|
+
const claimable = Array.isArray(info) ? toBigInt12(info[1]) : toBigInt12(info.claimableAmount);
|
|
43493
43949
|
if (ethRequested === void 0) continue;
|
|
43494
43950
|
out.push({
|
|
43495
43951
|
lst: entry.lst,
|
|
@@ -43568,8 +44024,8 @@ var readerPuffer = {
|
|
|
43568
44024
|
calls,
|
|
43569
44025
|
abi: calls.map(() => PufferWithdrawalManagerAbi)
|
|
43570
44026
|
});
|
|
43571
|
-
const finalizedBatch =
|
|
43572
|
-
const batchSize =
|
|
44027
|
+
const finalizedBatch = toBigInt12(results[detailCalls.length]) ?? 0n;
|
|
44028
|
+
const batchSize = toBigInt12(results[detailCalls.length + 1]) ?? 0n;
|
|
43573
44029
|
const out = [];
|
|
43574
44030
|
const lcUser = user.toLowerCase();
|
|
43575
44031
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -43579,7 +44035,7 @@ var readerPuffer = {
|
|
|
43579
44035
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
43580
44036
|
continue;
|
|
43581
44037
|
}
|
|
43582
|
-
const pufETHAmount = Array.isArray(d) ?
|
|
44038
|
+
const pufETHAmount = Array.isArray(d) ? toBigInt12(d[0]) : toBigInt12(d.pufETHAmount);
|
|
43583
44039
|
if (pufETHAmount === void 0) continue;
|
|
43584
44040
|
const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
|
|
43585
44041
|
const claimable = batchIdx <= finalizedBatch;
|
|
@@ -43677,7 +44133,7 @@ var readerKinetiq = {
|
|
|
43677
44133
|
for (let i = 0; i < count; i++) {
|
|
43678
44134
|
const r = stage2[i];
|
|
43679
44135
|
if (!r) continue;
|
|
43680
|
-
const hypeAmount = Array.isArray(r) ?
|
|
44136
|
+
const hypeAmount = Array.isArray(r) ? toBigInt12(r[0]) : toBigInt12(r.hypeAmount);
|
|
43681
44137
|
const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
|
|
43682
44138
|
if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
|
|
43683
44139
|
continue;
|
|
@@ -43805,7 +44261,7 @@ var readerStakeWise = {
|
|
|
43805
44261
|
const claimedByIdx = /* @__PURE__ */ new Map();
|
|
43806
44262
|
for (let i = 0; i < onChainChecks.length; i++) {
|
|
43807
44263
|
const cell = checkResults[i];
|
|
43808
|
-
const claimed = Array.isArray(cell) ?
|
|
44264
|
+
const claimed = Array.isArray(cell) ? toBigInt12(cell[2]) : toBigInt12(cell?.claimedAssets);
|
|
43809
44265
|
if (claimed !== void 0 && claimed > 0n) {
|
|
43810
44266
|
claimedByIdx.set(onChainChecks[i].idx, claimed);
|
|
43811
44267
|
}
|
|
@@ -43813,7 +44269,7 @@ var readerStakeWise = {
|
|
|
43813
44269
|
const out = [];
|
|
43814
44270
|
for (let i = 0; i < requests.length; i++) {
|
|
43815
44271
|
const r = requests[i];
|
|
43816
|
-
const amount =
|
|
44272
|
+
const amount = toBigInt12(r.totalAssets) ?? 0n;
|
|
43817
44273
|
const onChainClaimed = claimedByIdx.get(i);
|
|
43818
44274
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
43819
44275
|
out.push({
|
|
@@ -43870,7 +44326,7 @@ var readerStCelo2 = {
|
|
|
43870
44326
|
const timestamps = cell[1] ?? [];
|
|
43871
44327
|
const out = [];
|
|
43872
44328
|
for (let i = 0; i < values.length; i++) {
|
|
43873
|
-
const amount =
|
|
44329
|
+
const amount = toBigInt12(values[i]);
|
|
43874
44330
|
const readyAt = toNumber(timestamps[i]);
|
|
43875
44331
|
if (amount === void 0 || readyAt === void 0) continue;
|
|
43876
44332
|
out.push({
|
|
@@ -43915,11 +44371,11 @@ var readerStellaUnbond = {
|
|
|
43915
44371
|
let waiting;
|
|
43916
44372
|
let unbonded;
|
|
43917
44373
|
if (Array.isArray(cell)) {
|
|
43918
|
-
waiting =
|
|
43919
|
-
unbonded =
|
|
44374
|
+
waiting = toBigInt12(cell[0]);
|
|
44375
|
+
unbonded = toBigInt12(cell[1]);
|
|
43920
44376
|
} else if (cell && typeof cell === "object") {
|
|
43921
|
-
waiting =
|
|
43922
|
-
unbonded =
|
|
44377
|
+
waiting = toBigInt12(cell.waiting);
|
|
44378
|
+
unbonded = toBigInt12(cell.unbonded);
|
|
43923
44379
|
}
|
|
43924
44380
|
const out = [];
|
|
43925
44381
|
if (unbonded && unbonded > 0n) {
|
|
@@ -44009,7 +44465,7 @@ var readerSwell = {
|
|
|
44009
44465
|
abi: [SwellRswExitAbi, SwellRswExitAbi]
|
|
44010
44466
|
});
|
|
44011
44467
|
const count = toNumber(stage1[0]) ?? 0;
|
|
44012
|
-
const lastProcessed =
|
|
44468
|
+
const lastProcessed = toBigInt12(stage1[1]) ?? 0n;
|
|
44013
44469
|
if (count === 0) return [];
|
|
44014
44470
|
const enumCalls = Array.from({ length: count }, (_3, i) => ({
|
|
44015
44471
|
address: entry.withdrawalContract,
|
|
@@ -44021,7 +44477,7 @@ var readerSwell = {
|
|
|
44021
44477
|
calls: enumCalls,
|
|
44022
44478
|
abi: enumCalls.map(() => SwellRswExitAbi)
|
|
44023
44479
|
});
|
|
44024
|
-
const ids = stage2.map(
|
|
44480
|
+
const ids = stage2.map(toBigInt12).filter((v) => v !== void 0);
|
|
44025
44481
|
if (ids.length === 0) return [];
|
|
44026
44482
|
const detailCalls = ids.map((id) => ({
|
|
44027
44483
|
address: entry.withdrawalContract,
|
|
@@ -44038,7 +44494,7 @@ var readerSwell = {
|
|
|
44038
44494
|
const id = ids[i];
|
|
44039
44495
|
const r = stage3[i];
|
|
44040
44496
|
if (!r) continue;
|
|
44041
|
-
const amount =
|
|
44497
|
+
const amount = toBigInt12(r.amount);
|
|
44042
44498
|
if (amount === void 0) continue;
|
|
44043
44499
|
const claimable = id <= lastProcessed;
|
|
44044
44500
|
out.push({
|
|
@@ -44112,14 +44568,14 @@ var readerValantis = {
|
|
|
44112
44568
|
for (let i = 0; i < burns.length; i++) {
|
|
44113
44569
|
const b = burns[i];
|
|
44114
44570
|
if (!b) continue;
|
|
44115
|
-
const amount = Array.isArray(b) ?
|
|
44571
|
+
const amount = Array.isArray(b) ? toBigInt12(b[0]) : toBigInt12(b.amount);
|
|
44116
44572
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
44117
44573
|
if (amount === void 0 || completed) continue;
|
|
44118
44574
|
out.push({
|
|
44119
44575
|
lst: entry.lst,
|
|
44120
44576
|
brand: entry.brand,
|
|
44121
44577
|
symbol: entry.symbol,
|
|
44122
|
-
requestId: String(
|
|
44578
|
+
requestId: String(toBigInt12(ids[i]) ?? i),
|
|
44123
44579
|
amountUnderlying: amount.toString(),
|
|
44124
44580
|
status: redeemable[i] ? "claimable" : "pending"
|
|
44125
44581
|
});
|
|
@@ -44192,7 +44648,7 @@ var readerTruFin = {
|
|
|
44192
44648
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
44193
44649
|
continue;
|
|
44194
44650
|
}
|
|
44195
|
-
const amount = Array.isArray(w) ?
|
|
44651
|
+
const amount = Array.isArray(w) ? toBigInt12(w[1]) : toBigInt12(w.amount);
|
|
44196
44652
|
if (amount === void 0 || amount === 0n) continue;
|
|
44197
44653
|
out.push({
|
|
44198
44654
|
lst: entry.lst,
|
|
@@ -44288,7 +44744,7 @@ var readerYieldNest = {
|
|
|
44288
44744
|
calls: enumCalls,
|
|
44289
44745
|
abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
|
|
44290
44746
|
});
|
|
44291
|
-
const ids = stage2.map(
|
|
44747
|
+
const ids = stage2.map(toBigInt12).filter((v) => v !== void 0);
|
|
44292
44748
|
if (ids.length === 0) return [];
|
|
44293
44749
|
const detailCalls = ids.map((id) => ({
|
|
44294
44750
|
address: entry.withdrawalContract,
|
|
@@ -44307,7 +44763,7 @@ var readerYieldNest = {
|
|
|
44307
44763
|
const id = ids[i];
|
|
44308
44764
|
const r = stage3[i];
|
|
44309
44765
|
if (!r) continue;
|
|
44310
|
-
const amount =
|
|
44766
|
+
const amount = toBigInt12(r.amount);
|
|
44311
44767
|
const created = toNumber(r.creationTimestamp);
|
|
44312
44768
|
const processed = Boolean(r.processed);
|
|
44313
44769
|
if (amount === void 0 || created === void 0) continue;
|
|
@@ -44900,7 +45356,7 @@ var getLstWithdrawalRegistry = (chainId, extraEntries) => {
|
|
|
44900
45356
|
const extra = extraEntries.filter((e) => !seen.has(e.lst.toLowerCase()));
|
|
44901
45357
|
return extra.length === 0 ? base : [...base, ...extra];
|
|
44902
45358
|
};
|
|
44903
|
-
var
|
|
45359
|
+
var warn4 = (...args) => {
|
|
44904
45360
|
};
|
|
44905
45361
|
var getLstWithdrawalRequests = async (user, chainId, multicallRetry, options) => {
|
|
44906
45362
|
const entries = getLstWithdrawalRegistry(chainId, options?.extraEntries);
|
|
@@ -44915,7 +45371,7 @@ var getLstWithdrawalRequests = async (user, chainId, multicallRetry, options) =>
|
|
|
44915
45371
|
try {
|
|
44916
45372
|
return await reader.fetch(lcUser, multicallRetry, chainId, entry, ids);
|
|
44917
45373
|
} catch (e) {
|
|
44918
|
-
|
|
45374
|
+
warn4(
|
|
44919
45375
|
`[lst-withdrawals] ${entry.brand} ${entry.symbol} (${entry.lst}) failed:`,
|
|
44920
45376
|
e?.message ?? e
|
|
44921
45377
|
);
|
|
@@ -44960,7 +45416,7 @@ var Erc4626ReadAbi2 = [
|
|
|
44960
45416
|
|
|
44961
45417
|
// src/vaults/savings/readers/shared.ts
|
|
44962
45418
|
var ONE_E188 = 10n ** 18n;
|
|
44963
|
-
var
|
|
45419
|
+
var toBigInt13 = (v) => {
|
|
44964
45420
|
if (v === void 0 || v === null) return void 0;
|
|
44965
45421
|
if (typeof v === "bigint") return v;
|
|
44966
45422
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -44991,9 +45447,9 @@ var readerErc46262 = (entry) => {
|
|
|
44991
45447
|
],
|
|
44992
45448
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
44993
45449
|
parse: ([assets, supply, rate]) => {
|
|
44994
|
-
const totalAssets =
|
|
44995
|
-
const totalSupply =
|
|
44996
|
-
const convertToAssetsRaw =
|
|
45450
|
+
const totalAssets = toBigInt13(assets);
|
|
45451
|
+
const totalSupply = toBigInt13(supply);
|
|
45452
|
+
const convertToAssetsRaw = toBigInt13(rate);
|
|
44997
45453
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
44998
45454
|
return void 0;
|
|
44999
45455
|
}
|
|
@@ -45828,7 +46284,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
|
|
|
45828
46284
|
|
|
45829
46285
|
// src/vaults/aave-earn/fetchPublic.ts
|
|
45830
46286
|
var BRAND2 = "Aave";
|
|
45831
|
-
var
|
|
46287
|
+
var toBigInt14 = (v) => {
|
|
45832
46288
|
if (v === void 0 || v === null) return void 0;
|
|
45833
46289
|
if (typeof v === "bigint") return v;
|
|
45834
46290
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -45888,15 +46344,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
45888
46344
|
const token = v.usedReserve.underlyingToken;
|
|
45889
46345
|
const underlyingLc = token.address.toLowerCase();
|
|
45890
46346
|
const assetDecimals = token.decimals;
|
|
45891
|
-
const shareDecOnChain =
|
|
46347
|
+
const shareDecOnChain = toBigInt14(slice[1]);
|
|
45892
46348
|
const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
|
|
45893
|
-
const totalSupply =
|
|
46349
|
+
const totalSupply = toBigInt14(slice[2]);
|
|
45894
46350
|
if (totalSupply === void 0) continue;
|
|
45895
46351
|
const shareUnit = 10n ** BigInt(decimals);
|
|
45896
46352
|
const underlyingUnit = 10n ** BigInt(assetDecimals);
|
|
45897
|
-
const convertToAssets =
|
|
46353
|
+
const convertToAssets = toBigInt14(slice[3]) ?? 0n;
|
|
45898
46354
|
const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
|
|
45899
|
-
const totalAssets =
|
|
46355
|
+
const totalAssets = toBigInt14(slice[0]) ?? totalSupply * convertToAssets / shareUnit;
|
|
45900
46356
|
const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
|
|
45901
46357
|
const asset = tokenList[underlyingLc];
|
|
45902
46358
|
const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num2(v.balance.usdPerToken) : void 0);
|
|
@@ -47915,7 +48371,7 @@ function buildVaultLookup(data) {
|
|
|
47915
48371
|
addEntries(data.yearn, "yearn");
|
|
47916
48372
|
return map;
|
|
47917
48373
|
}
|
|
47918
|
-
var
|
|
48374
|
+
var warn5 = (...args) => {
|
|
47919
48375
|
};
|
|
47920
48376
|
var HYPERCORE_PROVIDER_CHAIN = "999";
|
|
47921
48377
|
var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices = {}, tokenList = {}, options) => {
|
|
@@ -47928,7 +48384,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47928
48384
|
fetchFluidFTokens(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
47929
48385
|
out.fluid = res;
|
|
47930
48386
|
}).catch((e) => {
|
|
47931
|
-
|
|
48387
|
+
warn5(
|
|
47932
48388
|
`[vaults] fluid fetch failed for chain ${chainId}:`,
|
|
47933
48389
|
e?.message ?? e
|
|
47934
48390
|
);
|
|
@@ -47940,7 +48396,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47940
48396
|
fetchGearboxV3Pools(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
47941
48397
|
out.gearbox = res;
|
|
47942
48398
|
}).catch((e) => {
|
|
47943
|
-
|
|
48399
|
+
warn5(
|
|
47944
48400
|
`[vaults] gearbox fetch failed for chain ${chainId}:`,
|
|
47945
48401
|
e?.message ?? e
|
|
47946
48402
|
);
|
|
@@ -47952,7 +48408,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47952
48408
|
fetchMorphoVaults(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
47953
48409
|
out.morpho = res;
|
|
47954
48410
|
}).catch((e) => {
|
|
47955
|
-
|
|
48411
|
+
warn5(
|
|
47956
48412
|
`[vaults] morpho fetch failed for chain ${chainId}:`,
|
|
47957
48413
|
e?.message ?? e
|
|
47958
48414
|
);
|
|
@@ -47964,7 +48420,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47964
48420
|
fetchListaVaultsFromChain(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
47965
48421
|
out.lista = res;
|
|
47966
48422
|
}).catch((e) => {
|
|
47967
|
-
|
|
48423
|
+
warn5(
|
|
47968
48424
|
`[vaults] lista fetch failed for chain ${chainId}:`,
|
|
47969
48425
|
e?.message ?? e
|
|
47970
48426
|
);
|
|
@@ -47979,7 +48435,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47979
48435
|
}).then((res) => {
|
|
47980
48436
|
out.silo = res;
|
|
47981
48437
|
}).catch((e) => {
|
|
47982
|
-
|
|
48438
|
+
warn5(
|
|
47983
48439
|
`[vaults] silo fetch failed for chain ${chainId}:`,
|
|
47984
48440
|
e?.message ?? e
|
|
47985
48441
|
);
|
|
@@ -47991,7 +48447,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
47991
48447
|
fetchEulerEarnVaults(chainId, prices, tokenList, multicallRetry).then((res) => {
|
|
47992
48448
|
out["euler-earn"] = res;
|
|
47993
48449
|
}).catch((e) => {
|
|
47994
|
-
|
|
48450
|
+
warn5(
|
|
47995
48451
|
`[vaults] euler-earn fetch failed for chain ${chainId}:`,
|
|
47996
48452
|
e?.message ?? e
|
|
47997
48453
|
);
|
|
@@ -48003,7 +48459,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48003
48459
|
fetchLstShareTokens(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
48004
48460
|
out.lst = res;
|
|
48005
48461
|
}).catch((e) => {
|
|
48006
|
-
|
|
48462
|
+
warn5(
|
|
48007
48463
|
`[vaults] lst fetch failed for chain ${chainId}:`,
|
|
48008
48464
|
e?.message ?? e
|
|
48009
48465
|
);
|
|
@@ -48015,7 +48471,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48015
48471
|
fetchSavingsVaults(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
48016
48472
|
out.savings = res;
|
|
48017
48473
|
}).catch((e) => {
|
|
48018
|
-
|
|
48474
|
+
warn5(
|
|
48019
48475
|
`[vaults] savings fetch failed for chain ${chainId}:`,
|
|
48020
48476
|
e?.message ?? e
|
|
48021
48477
|
);
|
|
@@ -48027,7 +48483,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48027
48483
|
fetchLagoonVaults(chainId, prices, tokenList).then((res) => {
|
|
48028
48484
|
out.lagoon = res;
|
|
48029
48485
|
}).catch((e) => {
|
|
48030
|
-
|
|
48486
|
+
warn5(
|
|
48031
48487
|
`[vaults] lagoon fetch failed for chain ${chainId}:`,
|
|
48032
48488
|
e?.message ?? e
|
|
48033
48489
|
);
|
|
@@ -48039,7 +48495,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48039
48495
|
fetchAaveEarnVaults(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
48040
48496
|
out["aave-earn"] = res;
|
|
48041
48497
|
}).catch((e) => {
|
|
48042
|
-
|
|
48498
|
+
warn5(
|
|
48043
48499
|
`[vaults] aave-earn fetch failed for chain ${chainId}:`,
|
|
48044
48500
|
e?.message ?? e
|
|
48045
48501
|
);
|
|
@@ -48051,7 +48507,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48051
48507
|
fetchUpshiftVaults(chainId, prices, tokenList).then((res) => {
|
|
48052
48508
|
out.upshift = res;
|
|
48053
48509
|
}).catch((e) => {
|
|
48054
|
-
|
|
48510
|
+
warn5(
|
|
48055
48511
|
`[vaults] upshift fetch failed for chain ${chainId}:`,
|
|
48056
48512
|
e?.message ?? e
|
|
48057
48513
|
);
|
|
@@ -48063,7 +48519,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48063
48519
|
fetchYearnVaults(chainId, multicallRetry, prices, tokenList).then((res) => {
|
|
48064
48520
|
out.yearn = res;
|
|
48065
48521
|
}).catch((e) => {
|
|
48066
|
-
|
|
48522
|
+
warn5(
|
|
48067
48523
|
`[vaults] yearn fetch failed for chain ${chainId}:`,
|
|
48068
48524
|
e?.message ?? e
|
|
48069
48525
|
);
|
|
@@ -48075,7 +48531,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48075
48531
|
fetchHypercoreVaults().then((res) => {
|
|
48076
48532
|
out.hypercore = res;
|
|
48077
48533
|
}).catch((e) => {
|
|
48078
|
-
|
|
48534
|
+
warn5(
|
|
48079
48535
|
`[vaults] hypercore fetch failed for chain ${chainId}:`,
|
|
48080
48536
|
e?.message ?? e
|
|
48081
48537
|
);
|
|
@@ -48087,7 +48543,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48087
48543
|
fetchGmxVaults(chainId, multicallRetry).then((res) => {
|
|
48088
48544
|
out.gmx = res;
|
|
48089
48545
|
}).catch((e) => {
|
|
48090
|
-
|
|
48546
|
+
warn5(
|
|
48091
48547
|
`[vaults] gmx fetch failed for chain ${chainId}:`,
|
|
48092
48548
|
e?.message ?? e
|
|
48093
48549
|
);
|
|
@@ -48103,7 +48559,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
48103
48559
|
);
|
|
48104
48560
|
if (fees) out.gmxExecutionFees = fees;
|
|
48105
48561
|
})().catch((e) => {
|
|
48106
|
-
|
|
48562
|
+
warn5(
|
|
48107
48563
|
`[vaults] gmx execution-fee fetch failed for chain ${chainId}:`,
|
|
48108
48564
|
e?.message ?? e
|
|
48109
48565
|
);
|