@1delta/margin-fetcher 5.0.40 → 5.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +238 -10
- package/dist/index.js +1051 -605
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fetchTokenLists, fetchTokenList, aavePools, compoundV3Pools, initConfig
|
|
|
7
7
|
import lodash from 'lodash';
|
|
8
8
|
import { Chain } from '@1delta/chain-registry';
|
|
9
9
|
import { multicallRetryUniversal, getEvmClient, getEvmChain, getEvmClientUniversal } from '@1delta/providers';
|
|
10
|
-
import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, MetaMorphoAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
|
|
10
|
+
import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, MetaMorphoAbi, FluidDexResolverAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
|
|
11
11
|
export { MorphoLensAbi } from '@1delta/abis';
|
|
12
12
|
import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, bandLtvCurve, InitMarginAddresses } from '@1delta/calldata-sdk';
|
|
13
13
|
import { proxyNativeFetch } from '@1delta/proxy-fetch';
|
|
@@ -10121,11 +10121,11 @@ async function resolveListaBrokers(chainId, marketKeys, getClient = getEvmClient
|
|
|
10121
10121
|
const moolah = morphoPools()?.LISTA_DAO?.[chainId];
|
|
10122
10122
|
const out = {};
|
|
10123
10123
|
if (!moolah || marketKeys.length === 0) return out;
|
|
10124
|
-
const
|
|
10124
|
+
const cache4 = BROKER_CACHE[chainId] ??= {};
|
|
10125
10125
|
const missing = [];
|
|
10126
10126
|
for (const key3 of marketKeys) {
|
|
10127
10127
|
const id = toBytes32MarketId(key3);
|
|
10128
|
-
if (
|
|
10128
|
+
if (cache4[id] === void 0) missing.push(id);
|
|
10129
10129
|
}
|
|
10130
10130
|
if (missing.length > 0) {
|
|
10131
10131
|
try {
|
|
@@ -10142,14 +10142,14 @@ async function resolveListaBrokers(chainId, marketKeys, getClient = getEvmClient
|
|
|
10142
10142
|
results.forEach((r, i) => {
|
|
10143
10143
|
const id = missing[i];
|
|
10144
10144
|
const addr3 = r.status === "success" && r.result ? r.result : zeroAddress;
|
|
10145
|
-
|
|
10145
|
+
cache4[id] = addr3.toLowerCase();
|
|
10146
10146
|
});
|
|
10147
10147
|
} catch {
|
|
10148
10148
|
}
|
|
10149
10149
|
}
|
|
10150
10150
|
for (const key3 of marketKeys) {
|
|
10151
10151
|
const id = toBytes32MarketId(key3);
|
|
10152
|
-
const broker =
|
|
10152
|
+
const broker = cache4[id];
|
|
10153
10153
|
if (broker && broker !== zeroAddress) out[id] = broker;
|
|
10154
10154
|
}
|
|
10155
10155
|
return out;
|
|
@@ -10170,7 +10170,7 @@ async function fetchListaFixedTerms(chainId, marketKeys) {
|
|
|
10170
10170
|
args: []
|
|
10171
10171
|
}))
|
|
10172
10172
|
});
|
|
10173
|
-
const
|
|
10173
|
+
const cache4 = FIXED_TERMS_CACHE[chainId] ??= {};
|
|
10174
10174
|
results.forEach((r, i) => {
|
|
10175
10175
|
const id = ids[i];
|
|
10176
10176
|
if (r.status !== "success" || !r.result) return;
|
|
@@ -10184,7 +10184,7 @@ async function fetchListaFixedTerms(chainId, marketKeys) {
|
|
|
10184
10184
|
};
|
|
10185
10185
|
});
|
|
10186
10186
|
out[id] = terms;
|
|
10187
|
-
|
|
10187
|
+
cache4[id] = terms;
|
|
10188
10188
|
});
|
|
10189
10189
|
} catch {
|
|
10190
10190
|
}
|
|
@@ -11574,12 +11574,12 @@ function rateToApy(rate) {
|
|
|
11574
11574
|
);
|
|
11575
11575
|
}
|
|
11576
11576
|
function parseLtv(ltv) {
|
|
11577
|
-
let
|
|
11577
|
+
let str8 = 0;
|
|
11578
11578
|
try {
|
|
11579
|
-
|
|
11579
|
+
str8 = Number(formatUnits(BigInt(ltv), 18));
|
|
11580
11580
|
} catch (e) {
|
|
11581
11581
|
}
|
|
11582
|
-
return
|
|
11582
|
+
return str8;
|
|
11583
11583
|
}
|
|
11584
11584
|
function liquidationPenaltyFromLltv(lltv) {
|
|
11585
11585
|
if (!lltv || lltv <= 0) return 0;
|
|
@@ -18727,7 +18727,7 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
18727
18727
|
{ self: market.silo0, other: market.silo1 },
|
|
18728
18728
|
{ self: market.silo1, other: market.silo0 }
|
|
18729
18729
|
];
|
|
18730
|
-
const
|
|
18730
|
+
const toBigInt18 = (v) => {
|
|
18731
18731
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
18732
18732
|
if (typeof v === "bigint") return v;
|
|
18733
18733
|
try {
|
|
@@ -18739,8 +18739,8 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
18739
18739
|
for (let s = 0; s < 2; s++) {
|
|
18740
18740
|
const { self, other } = sides[s];
|
|
18741
18741
|
const slot = s * SILO_V2_CALLS_PER_SIDE;
|
|
18742
|
-
const totalAssetsRaw =
|
|
18743
|
-
const debtAssetsRaw =
|
|
18742
|
+
const totalAssetsRaw = toBigInt18(data[slot]);
|
|
18743
|
+
const debtAssetsRaw = toBigInt18(data[slot + 1]);
|
|
18744
18744
|
const irmConfigRaw = data[slot + 2];
|
|
18745
18745
|
const decimals = self.decimals;
|
|
18746
18746
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -18895,7 +18895,7 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
18895
18895
|
{ self: market.silo0, other: market.silo1 },
|
|
18896
18896
|
{ self: market.silo1, other: market.silo0 }
|
|
18897
18897
|
];
|
|
18898
|
-
const
|
|
18898
|
+
const toBigInt18 = (v) => {
|
|
18899
18899
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
18900
18900
|
if (typeof v === "bigint") return v;
|
|
18901
18901
|
try {
|
|
@@ -18907,8 +18907,8 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
18907
18907
|
for (let s = 0; s < 2; s++) {
|
|
18908
18908
|
const { self, other } = sides[s];
|
|
18909
18909
|
const slot = s * SILO_V3_CALLS_PER_SIDE;
|
|
18910
|
-
const totalAssetsRaw =
|
|
18911
|
-
const debtAssetsRaw =
|
|
18910
|
+
const totalAssetsRaw = toBigInt18(data[slot]);
|
|
18911
|
+
const debtAssetsRaw = toBigInt18(data[slot + 1]);
|
|
18912
18912
|
const irmConfigRaw = data[slot + 2];
|
|
18913
18913
|
const decimals = self.decimals;
|
|
18914
18914
|
const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
|
|
@@ -19031,6 +19031,152 @@ var buildFluidCall = (chainId, _lender) => {
|
|
|
19031
19031
|
];
|
|
19032
19032
|
};
|
|
19033
19033
|
|
|
19034
|
+
// src/lending/public-data/fluid/apiData.ts
|
|
19035
|
+
var FLUID_API_BASE = "https://api.fluid.instadapp.io/v2";
|
|
19036
|
+
var SUPPORTED_CHAINS = /* @__PURE__ */ new Set(["1", "56", "137", "8453", "9745", "42161"]);
|
|
19037
|
+
var TTL_MS = 6e4;
|
|
19038
|
+
var ZERO_ADDRESS4 = "0x0000000000000000000000000000000000000000";
|
|
19039
|
+
var cache = {};
|
|
19040
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
19041
|
+
var isRealDex = (d) => !!d && String(d.id ?? "0") !== "0" && String(d.address ?? ZERO_ADDRESS4).toLowerCase() !== ZERO_ADDRESS4;
|
|
19042
|
+
var toBigInt6 = (v) => {
|
|
19043
|
+
try {
|
|
19044
|
+
return BigInt(v ?? 0);
|
|
19045
|
+
} catch {
|
|
19046
|
+
return 0n;
|
|
19047
|
+
}
|
|
19048
|
+
};
|
|
19049
|
+
var parseSide = (d, sideToken) => {
|
|
19050
|
+
if (!isRealDex(d)) return void 0;
|
|
19051
|
+
const token0PerShare = toBigInt6(d.token0PerShare);
|
|
19052
|
+
const token1PerShare = toBigInt6(d.token1PerShare);
|
|
19053
|
+
if (token0PerShare === 0n && token1PerShare === 0n) return void 0;
|
|
19054
|
+
const d0 = Number(sideToken?.token0?.decimals);
|
|
19055
|
+
const d1 = Number(sideToken?.token1?.decimals);
|
|
19056
|
+
if (!Number.isFinite(d0) || !Number.isFinite(d1)) return void 0;
|
|
19057
|
+
return {
|
|
19058
|
+
dex: String(d.address).toLowerCase(),
|
|
19059
|
+
token0PerShare,
|
|
19060
|
+
token1PerShare,
|
|
19061
|
+
token0Decimals: d0,
|
|
19062
|
+
token1Decimals: d1
|
|
19063
|
+
};
|
|
19064
|
+
};
|
|
19065
|
+
var parseChainPayload = (raw) => {
|
|
19066
|
+
const out = {};
|
|
19067
|
+
for (const v of raw ?? []) {
|
|
19068
|
+
const vaultId = Number(v?.id ?? NaN);
|
|
19069
|
+
if (!Number.isFinite(vaultId)) continue;
|
|
19070
|
+
const vaultType = Number(v?.type ?? 0);
|
|
19071
|
+
out[vaultId] = {
|
|
19072
|
+
vaultId,
|
|
19073
|
+
vaultType,
|
|
19074
|
+
supplyShares: parseSide(v?.supplyDexData, v?.supplyToken),
|
|
19075
|
+
borrowShares: parseSide(v?.borrowDexData, v?.borrowToken),
|
|
19076
|
+
supplyDexTradingRate: Number(v?.supplyRate?.dex?.trading ?? 0),
|
|
19077
|
+
borrowDexTradingRate: Number(v?.borrowRate?.dex?.trading ?? 0)
|
|
19078
|
+
};
|
|
19079
|
+
}
|
|
19080
|
+
return out;
|
|
19081
|
+
};
|
|
19082
|
+
var fetchFluidApiData = async (chainId) => {
|
|
19083
|
+
if (!SUPPORTED_CHAINS.has(chainId)) return void 0;
|
|
19084
|
+
const hit = cache[chainId];
|
|
19085
|
+
if (hit && Date.now() - hit.at < TTL_MS) return hit.data;
|
|
19086
|
+
const pending = inflight.get(chainId);
|
|
19087
|
+
if (pending) return pending;
|
|
19088
|
+
const run = (async () => {
|
|
19089
|
+
try {
|
|
19090
|
+
const res = await fetch(`${FLUID_API_BASE}/${chainId}/vaults`);
|
|
19091
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
19092
|
+
const json = await res.json();
|
|
19093
|
+
if (!Array.isArray(json)) throw new Error("unexpected payload");
|
|
19094
|
+
const data = parseChainPayload(json);
|
|
19095
|
+
cache[chainId] = { at: Date.now(), data };
|
|
19096
|
+
return data;
|
|
19097
|
+
} catch {
|
|
19098
|
+
const prev = cache[chainId]?.data;
|
|
19099
|
+
cache[chainId] = { at: Date.now(), data: prev };
|
|
19100
|
+
return prev;
|
|
19101
|
+
} finally {
|
|
19102
|
+
inflight.delete(chainId);
|
|
19103
|
+
}
|
|
19104
|
+
})();
|
|
19105
|
+
inflight.set(chainId, run);
|
|
19106
|
+
return run;
|
|
19107
|
+
};
|
|
19108
|
+
var getCachedFluidApiData = (chainId) => cache[chainId]?.data;
|
|
19109
|
+
var DEX_RESOLVER_FALLBACK = {
|
|
19110
|
+
"1": "0x11D80CfF056Cef4F9E6d23da8672fE9873e5cC07",
|
|
19111
|
+
"137": "0x11D80CfF056Cef4F9E6d23da8672fE9873e5cC07",
|
|
19112
|
+
"8453": "0x11D80CfF056Cef4F9E6d23da8672fE9873e5cC07",
|
|
19113
|
+
"42161": "0x11D80CfF056Cef4F9E6d23da8672fE9873e5cC07",
|
|
19114
|
+
"56": "0xAf572EfC84d905926F7b05C1B7bE04e4E89542B0",
|
|
19115
|
+
"9745": "0xAf572EfC84d905926F7b05C1B7bE04e4E89542B0"
|
|
19116
|
+
};
|
|
19117
|
+
var dexResolverFor = (chainId) => fluidResolvers()?.[chainId]?.dexResolver ?? DEX_RESOLVER_FALLBACK[chainId];
|
|
19118
|
+
var ZERO_ADDRESS5 = "0x0000000000000000000000000000000000000000";
|
|
19119
|
+
var TTL_MS2 = 6e4;
|
|
19120
|
+
var cache2 = {};
|
|
19121
|
+
var inflight2 = /* @__PURE__ */ new Map();
|
|
19122
|
+
var fetchFluidDexState = async (chainId, multicallRetry, extraDexAddresses = []) => {
|
|
19123
|
+
const resolver = dexResolverFor(chainId);
|
|
19124
|
+
if (!resolver) return void 0;
|
|
19125
|
+
const hit = cache2[chainId];
|
|
19126
|
+
if (hit && Date.now() - hit.at < TTL_MS2) return hit.data;
|
|
19127
|
+
const pending = inflight2.get(chainId);
|
|
19128
|
+
if (pending) return pending;
|
|
19129
|
+
const run = (async () => {
|
|
19130
|
+
try {
|
|
19131
|
+
const [addresses] = await multicallRetry({
|
|
19132
|
+
chain: chainId,
|
|
19133
|
+
calls: [{ address: resolver, name: "getAllDexAddresses", params: [] }],
|
|
19134
|
+
abi: [FluidDexResolverAbi]
|
|
19135
|
+
});
|
|
19136
|
+
const list = [
|
|
19137
|
+
...new Set(
|
|
19138
|
+
[...addresses ?? [], ...extraDexAddresses].filter((a) => !!a && a !== ZERO_ADDRESS5).map((a) => a.toLowerCase())
|
|
19139
|
+
)
|
|
19140
|
+
];
|
|
19141
|
+
if (!list.length) throw new Error("no dex addresses");
|
|
19142
|
+
const states = await multicallRetry({
|
|
19143
|
+
chain: chainId,
|
|
19144
|
+
calls: list.map((dex) => ({
|
|
19145
|
+
address: resolver,
|
|
19146
|
+
name: "getDexState",
|
|
19147
|
+
params: [dex]
|
|
19148
|
+
})),
|
|
19149
|
+
abi: list.map(() => FluidDexResolverAbi)
|
|
19150
|
+
});
|
|
19151
|
+
const data = {};
|
|
19152
|
+
for (let i = 0; i < list.length; i++) {
|
|
19153
|
+
const s = states?.[i];
|
|
19154
|
+
if (!s || s.token0PerSupplyShare === void 0) continue;
|
|
19155
|
+
data[list[i]] = {
|
|
19156
|
+
dex: list[i],
|
|
19157
|
+
token0PerSupplyShare: BigInt(s.token0PerSupplyShare ?? 0),
|
|
19158
|
+
token1PerSupplyShare: BigInt(s.token1PerSupplyShare ?? 0),
|
|
19159
|
+
token0PerBorrowShare: BigInt(s.token0PerBorrowShare ?? 0),
|
|
19160
|
+
token1PerBorrowShare: BigInt(s.token1PerBorrowShare ?? 0),
|
|
19161
|
+
totalSupplyShares: BigInt(s.totalSupplyShares ?? 0),
|
|
19162
|
+
totalBorrowShares: BigInt(s.totalBorrowShares ?? 0)
|
|
19163
|
+
};
|
|
19164
|
+
}
|
|
19165
|
+
cache2[chainId] = { at: Date.now(), data };
|
|
19166
|
+
return data;
|
|
19167
|
+
} catch {
|
|
19168
|
+
const prev = cache2[chainId]?.data;
|
|
19169
|
+
cache2[chainId] = { at: Date.now(), data: prev };
|
|
19170
|
+
return prev;
|
|
19171
|
+
} finally {
|
|
19172
|
+
inflight2.delete(chainId);
|
|
19173
|
+
}
|
|
19174
|
+
})();
|
|
19175
|
+
inflight2.set(chainId, run);
|
|
19176
|
+
return run;
|
|
19177
|
+
};
|
|
19178
|
+
var getCachedFluidDexState = (chainId) => cache2[chainId]?.data;
|
|
19179
|
+
|
|
19034
19180
|
// src/lending/public-data/fluid/publicCallParse.ts
|
|
19035
19181
|
var FLUID_EEE_LOWER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
19036
19182
|
var normalizeUnderlying = (addr3) => addr3 === FLUID_EEE_LOWER ? zeroAddress : addr3;
|
|
@@ -19069,6 +19215,8 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
|
|
|
19069
19215
|
if (data.length !== expectedNumberOfCalls) return void 0;
|
|
19070
19216
|
const [vaultEntireData, overallTokensData] = data;
|
|
19071
19217
|
const liquidityByToken = parseOverallTokensData(overallTokensData);
|
|
19218
|
+
const dexState = getCachedFluidDexState(chainId);
|
|
19219
|
+
const apiData = getCachedFluidApiData(chainId);
|
|
19072
19220
|
const out = {};
|
|
19073
19221
|
for (const vault of vaultEntireData ?? []) {
|
|
19074
19222
|
const parsed = parseVault(
|
|
@@ -19077,7 +19225,9 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
|
|
|
19077
19225
|
prices,
|
|
19078
19226
|
additionalYields,
|
|
19079
19227
|
tokenList,
|
|
19080
|
-
liquidityByToken
|
|
19228
|
+
liquidityByToken,
|
|
19229
|
+
apiData?.[Number(vault?.constantVariables?.vaultId ?? -1)],
|
|
19230
|
+
dexState
|
|
19081
19231
|
);
|
|
19082
19232
|
if (parsed) {
|
|
19083
19233
|
out[parsed.lender] = {
|
|
@@ -19092,7 +19242,42 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
|
|
|
19092
19242
|
expectedNumberOfCalls
|
|
19093
19243
|
];
|
|
19094
19244
|
};
|
|
19095
|
-
|
|
19245
|
+
var SMART_DEBT_TRADING_SIGN = -1;
|
|
19246
|
+
var splitSide = (tokens, rawTotal, rawAvailable, simpleDecimals, shares, rateFor) => {
|
|
19247
|
+
if (!shares) {
|
|
19248
|
+
const token = tokens[0];
|
|
19249
|
+
if (!token) return [];
|
|
19250
|
+
return [
|
|
19251
|
+
{
|
|
19252
|
+
token,
|
|
19253
|
+
decimals: simpleDecimals,
|
|
19254
|
+
amount: Number(parseRawAmount(rawTotal.toString(), simpleDecimals)),
|
|
19255
|
+
available: Number(
|
|
19256
|
+
parseRawAmount(rawAvailable.toString(), simpleDecimals)
|
|
19257
|
+
),
|
|
19258
|
+
rate: rateFor(token, 0)
|
|
19259
|
+
}
|
|
19260
|
+
];
|
|
19261
|
+
}
|
|
19262
|
+
const perShare = shares.perShare;
|
|
19263
|
+
const decimals = shares.decimals;
|
|
19264
|
+
const legs = [];
|
|
19265
|
+
for (let i = 0; i < tokens.length && i < 2; i++) {
|
|
19266
|
+
const token = tokens[i];
|
|
19267
|
+
if (!token) continue;
|
|
19268
|
+
const amountRaw = rawTotal * perShare[i] / 10n ** 18n;
|
|
19269
|
+
const availableRaw = rawAvailable * perShare[i] / 10n ** 18n;
|
|
19270
|
+
legs.push({
|
|
19271
|
+
token,
|
|
19272
|
+
decimals: decimals[i],
|
|
19273
|
+
amount: Number(parseRawAmount(amountRaw.toString(), decimals[i])),
|
|
19274
|
+
available: Number(parseRawAmount(availableRaw.toString(), decimals[i])),
|
|
19275
|
+
rate: rateFor(token, i)
|
|
19276
|
+
});
|
|
19277
|
+
}
|
|
19278
|
+
return legs;
|
|
19279
|
+
};
|
|
19280
|
+
function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidityByToken = {}, api, dexState) {
|
|
19096
19281
|
const vaultAddress = (vault.vault ?? "").toLowerCase();
|
|
19097
19282
|
const constants = vault.constantVariables;
|
|
19098
19283
|
const configs = vault.configs;
|
|
@@ -19102,160 +19287,223 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
19102
19287
|
if (!vaultAddress || !constants || !configs || !rates || !totals) {
|
|
19103
19288
|
return void 0;
|
|
19104
19289
|
}
|
|
19105
|
-
|
|
19106
|
-
const
|
|
19107
|
-
const
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19290
|
+
const isSmartCol = !!vault.isSmartCol;
|
|
19291
|
+
const isSmartDebt = !!vault.isSmartDebt;
|
|
19292
|
+
const sideTokens = (side, isSmart) => {
|
|
19293
|
+
const raw = side?.token0 !== void 0 ? side : { token0: side };
|
|
19294
|
+
const t0 = normalizeUnderlying((raw?.token0 ?? "").toString().toLowerCase());
|
|
19295
|
+
if (!isSmart) return [t0];
|
|
19296
|
+
const t1 = normalizeUnderlying((raw?.token1 ?? "").toString().toLowerCase());
|
|
19297
|
+
return [t0, t1];
|
|
19298
|
+
};
|
|
19299
|
+
const colTokens = sideTokens(constants.supplyToken, isSmartCol);
|
|
19300
|
+
const debtTokens = sideTokens(constants.borrowToken, isSmartDebt);
|
|
19301
|
+
if (!colTokens[0] || !debtTokens[0]) return void 0;
|
|
19302
|
+
if (isSmartCol && colTokens.length < 2) return void 0;
|
|
19303
|
+
if (isSmartDebt && debtTokens.length < 2) return void 0;
|
|
19111
19304
|
const vaultId = Number(constants.vaultId ?? 0);
|
|
19305
|
+
const vaultType = Number(constants.vaultType ?? 0);
|
|
19112
19306
|
const lender = `FLUID_${chainId}_${vaultId}`;
|
|
19113
|
-
const
|
|
19114
|
-
const
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
const
|
|
19122
|
-
|
|
19307
|
+
const isSmartVault = isSmartCol || isSmartDebt;
|
|
19308
|
+
const simpleDecimals = (token, resolverValue) => {
|
|
19309
|
+
const listed = tokenList[token]?.decimals;
|
|
19310
|
+
if (listed !== void 0 && listed !== null) return Number(listed);
|
|
19311
|
+
if (resolverValue !== void 0 && resolverValue !== null)
|
|
19312
|
+
return Number(resolverValue);
|
|
19313
|
+
return isSmartVault ? void 0 : 18;
|
|
19314
|
+
};
|
|
19315
|
+
const colDecimals = simpleDecimals(colTokens[0], constants.supplyDecimals);
|
|
19316
|
+
const debtDecimals = simpleDecimals(debtTokens[0], constants.borrowDecimals);
|
|
19317
|
+
if (!isSmartCol && colDecimals === void 0 || !isSmartDebt && debtDecimals === void 0) {
|
|
19318
|
+
return void 0;
|
|
19319
|
+
}
|
|
19320
|
+
const resolveShares = (isSmart, sideContract, tokens, onChainPerShare, apiSide) => {
|
|
19321
|
+
if (!isSmart) return void 0;
|
|
19322
|
+
const dex = String(sideContract ?? "").toLowerCase();
|
|
19323
|
+
const decimalsFor = (token, fallback) => {
|
|
19324
|
+
const d = tokenList[token]?.decimals;
|
|
19325
|
+
if (d !== void 0 && d !== null) return Number(d);
|
|
19326
|
+
return fallback;
|
|
19327
|
+
};
|
|
19328
|
+
const onChain = dex ? dexState?.[dex] : void 0;
|
|
19329
|
+
const perShare = onChain ? onChainPerShare(onChain) : apiSide ? [apiSide.token0PerShare, apiSide.token1PerShare] : void 0;
|
|
19330
|
+
if (!perShare) return void 0;
|
|
19331
|
+
const d0 = decimalsFor(tokens[0], apiSide?.token0Decimals);
|
|
19332
|
+
const d1 = decimalsFor(tokens[1], apiSide?.token1Decimals);
|
|
19333
|
+
if (d0 === void 0 || d1 === void 0) return void 0;
|
|
19334
|
+
return { dex, perShare, decimals: [d0, d1] };
|
|
19335
|
+
};
|
|
19336
|
+
const colShares = resolveShares(
|
|
19337
|
+
isSmartCol,
|
|
19338
|
+
constants.supply,
|
|
19339
|
+
colTokens,
|
|
19340
|
+
(s) => [s.token0PerSupplyShare, s.token1PerSupplyShare],
|
|
19341
|
+
api?.supplyShares
|
|
19123
19342
|
);
|
|
19124
|
-
const
|
|
19125
|
-
|
|
19343
|
+
const debtShares = resolveShares(
|
|
19344
|
+
isSmartDebt,
|
|
19345
|
+
constants.borrow,
|
|
19346
|
+
debtTokens,
|
|
19347
|
+
(s) => [s.token0PerBorrowShare, s.token1PerBorrowShare],
|
|
19348
|
+
api?.borrowShares
|
|
19126
19349
|
);
|
|
19127
|
-
|
|
19128
|
-
|
|
19350
|
+
if (isSmartCol && !colShares || isSmartDebt && !debtShares) {
|
|
19351
|
+
return void 0;
|
|
19352
|
+
}
|
|
19353
|
+
const supplyRate = scaleFluidRate(rates.supplyRateVault);
|
|
19354
|
+
const borrowRate = scaleFluidRate(rates.borrowRateVault);
|
|
19355
|
+
const supplyDexTrading = (api?.supplyDexTradingRate ?? 0) / FLUID_RATE_SCALE;
|
|
19356
|
+
const borrowDexTrading = (api?.borrowDexTradingRate ?? 0) / FLUID_RATE_SCALE;
|
|
19357
|
+
const colLegs = splitSide(
|
|
19358
|
+
colTokens,
|
|
19359
|
+
BigInt(totals.totalSupplyVault?.toString() ?? "0"),
|
|
19360
|
+
BigInt(limits?.withdrawable?.toString() ?? "0"),
|
|
19361
|
+
colDecimals ?? 18,
|
|
19362
|
+
colShares,
|
|
19363
|
+
(token) => (
|
|
19364
|
+
// Simple side: the vault's own supply rate is authoritative on-chain.
|
|
19365
|
+
// Smart side: that field is 0, so the rate is the token's own
|
|
19366
|
+
// Liquidity-layer supply rate plus the DEX trading yield the LP earns.
|
|
19367
|
+
isSmartCol ? (liquidityByToken[token]?.supplyRate ?? 0) + supplyDexTrading : supplyRate
|
|
19368
|
+
)
|
|
19129
19369
|
);
|
|
19130
|
-
const
|
|
19131
|
-
|
|
19370
|
+
const debtLegs = splitSide(
|
|
19371
|
+
debtTokens,
|
|
19372
|
+
BigInt(totals.totalBorrowVault?.toString() ?? "0"),
|
|
19373
|
+
BigInt(limits?.borrowable?.toString() ?? "0"),
|
|
19374
|
+
debtDecimals ?? 18,
|
|
19375
|
+
debtShares,
|
|
19376
|
+
(token) => isSmartDebt ? (liquidityByToken[token]?.borrowRate ?? 0) + SMART_DEBT_TRADING_SIGN * borrowDexTrading : borrowRate
|
|
19132
19377
|
);
|
|
19378
|
+
if (!colLegs.length || !debtLegs.length) return void 0;
|
|
19133
19379
|
const totalSupplyRaw = BigInt(totals.totalSupplyVault?.toString() ?? "0");
|
|
19134
19380
|
const withdrawLimitRaw = BigInt(limits?.withdrawLimit?.toString() ?? "0");
|
|
19135
19381
|
const lockupRatio = totalSupplyRaw > 0n ? Number(withdrawLimitRaw * 10000n / totalSupplyRaw) / 1e4 : 0;
|
|
19136
|
-
const collateralPriceKey = toOracleKey(collateralMeta?.assetGroup) ?? toGenericPriceKey(collateralAddress, chainId);
|
|
19137
|
-
const loanPriceKey = toOracleKey(loanMeta?.assetGroup) ?? toGenericPriceKey(loanAddress, chainId);
|
|
19138
|
-
const collateralPrice = prices[collateralPriceKey] ?? 0;
|
|
19139
|
-
const loanPrice = prices[loanPriceKey] ?? 0;
|
|
19140
19382
|
const ltv = Number(configs.collateralFactor ?? 0) / BPS;
|
|
19141
19383
|
const liquidationThreshold = Number(configs.liquidationThreshold ?? 0) / BPS;
|
|
19142
19384
|
const liquidationPenalty = Number(configs.liquidationPenalty ?? 0) / BPS;
|
|
19143
|
-
const
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19385
|
+
const priceKeyFor = (token) => {
|
|
19386
|
+
const meta = tokenList[token];
|
|
19387
|
+
return toOracleKey(meta?.assetGroup) ?? toGenericPriceKey(token, chainId);
|
|
19388
|
+
};
|
|
19147
19389
|
const irmTotals = (state, decimals) => state ? {
|
|
19148
19390
|
irmTotalDeposits: Number(parseRawAmount(state.totalSupply, decimals)),
|
|
19149
19391
|
irmTotalDebt: Number(parseRawAmount(state.totalBorrow, decimals))
|
|
19150
19392
|
} : {};
|
|
19151
19393
|
const data = {};
|
|
19152
|
-
const
|
|
19153
|
-
chainId,
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
depositRate: 0,
|
|
19230
|
-
variableBorrowRate: borrowRate,
|
|
19231
|
-
stableBorrowRate: 0,
|
|
19232
|
-
intrinsicYield: additionalYields?.intrinsicYields?.[loanPriceKey] ?? 0,
|
|
19233
|
-
rewards: [],
|
|
19234
|
-
decimals: borrowDecimals,
|
|
19235
|
-
config: {
|
|
19236
|
-
"0": {
|
|
19237
|
-
category: 0,
|
|
19238
|
-
borrowCollateralFactor: 0,
|
|
19239
|
-
collateralFactor: 0,
|
|
19240
|
-
borrowFactor: 1,
|
|
19241
|
-
liquidationPenalty: 0,
|
|
19242
|
-
closeFactor: 1,
|
|
19243
|
-
collateralDisabled: true,
|
|
19244
|
-
debtDisabled: false
|
|
19245
|
-
}
|
|
19246
|
-
},
|
|
19247
|
-
liquidationBonus: 0,
|
|
19248
|
-
closeFactor: 1,
|
|
19249
|
-
collateralActive: false,
|
|
19250
|
-
borrowingEnabled: true,
|
|
19251
|
-
depositsEnabled: false,
|
|
19252
|
-
hasStable: false,
|
|
19253
|
-
isActive: true,
|
|
19254
|
-
isFrozen: false
|
|
19394
|
+
const ensureRow = (leg) => {
|
|
19395
|
+
const marketUid = createMarketUid(chainId, lender, leg.token);
|
|
19396
|
+
if (data[marketUid]) return data[marketUid];
|
|
19397
|
+
const meta = tokenList[leg.token];
|
|
19398
|
+
const priceKey = priceKeyFor(leg.token);
|
|
19399
|
+
const liquidity = liquidityByToken[leg.token];
|
|
19400
|
+
const row = {
|
|
19401
|
+
marketUid,
|
|
19402
|
+
name: "",
|
|
19403
|
+
poolId: leg.token,
|
|
19404
|
+
underlying: leg.token,
|
|
19405
|
+
asset: meta,
|
|
19406
|
+
totalDeposits: 0,
|
|
19407
|
+
totalDebtStable: 0,
|
|
19408
|
+
totalDebt: 0,
|
|
19409
|
+
totalLiquidity: 0,
|
|
19410
|
+
borrowLiquidity: 0,
|
|
19411
|
+
totalDepositsUSD: 0,
|
|
19412
|
+
totalDebtStableUSD: 0,
|
|
19413
|
+
totalDebtUSD: 0,
|
|
19414
|
+
totalLiquidityUSD: 0,
|
|
19415
|
+
borrowLiquidityUSD: 0,
|
|
19416
|
+
// IRM x-coordinate: this token's Liquidity-layer utilization.
|
|
19417
|
+
utilization: liquidity?.utilization ?? 0,
|
|
19418
|
+
...irmTotals(liquidity, leg.decimals),
|
|
19419
|
+
lockupRatio,
|
|
19420
|
+
depositRate: 0,
|
|
19421
|
+
variableBorrowRate: 0,
|
|
19422
|
+
stableBorrowRate: 0,
|
|
19423
|
+
intrinsicYield: additionalYields?.intrinsicYields?.[priceKey] ?? 0,
|
|
19424
|
+
rewards: [],
|
|
19425
|
+
decimals: leg.decimals,
|
|
19426
|
+
config: {
|
|
19427
|
+
"0": {
|
|
19428
|
+
category: 0,
|
|
19429
|
+
borrowCollateralFactor: 0,
|
|
19430
|
+
collateralFactor: 0,
|
|
19431
|
+
borrowFactor: 1,
|
|
19432
|
+
liquidationPenalty: 0,
|
|
19433
|
+
closeFactor: 1,
|
|
19434
|
+
collateralDisabled: true,
|
|
19435
|
+
debtDisabled: true
|
|
19436
|
+
}
|
|
19437
|
+
},
|
|
19438
|
+
liquidationBonus: 0,
|
|
19439
|
+
closeFactor: 1,
|
|
19440
|
+
collateralActive: false,
|
|
19441
|
+
borrowingEnabled: false,
|
|
19442
|
+
depositsEnabled: false,
|
|
19443
|
+
hasStable: false,
|
|
19444
|
+
isActive: true,
|
|
19445
|
+
isFrozen: false,
|
|
19446
|
+
/**
|
|
19447
|
+
* Smart-vault descriptor, read by the Fluid term adapter.
|
|
19448
|
+
*
|
|
19449
|
+
* Present ONLY on a T2/T3/T4 row, where this leg is one half of a
|
|
19450
|
+
* two-token DEX LP position rather than a plain deposit or debt. Without
|
|
19451
|
+
* it a smart market is described as an ordinary pool — the generic
|
|
19452
|
+
* builder cannot tell them apart.
|
|
19453
|
+
*/
|
|
19454
|
+
fluid: isSmartVault ? {
|
|
19455
|
+
vaultType,
|
|
19456
|
+
isSmartCol,
|
|
19457
|
+
isSmartDebt,
|
|
19458
|
+
/** Both legs of the collateral LP, in token0/token1 order. */
|
|
19459
|
+
collateralPair: isSmartCol ? colTokens : void 0,
|
|
19460
|
+
/** Both legs of the debt LP, in token0/token1 order. */
|
|
19461
|
+
debtPair: isSmartDebt ? debtTokens : void 0,
|
|
19462
|
+
/** Percent APR the LP earns; supply ADDS it, debt NETS it off. */
|
|
19463
|
+
supplyDexTradingRate: supplyDexTrading,
|
|
19464
|
+
borrowDexTradingRate: borrowDexTrading
|
|
19465
|
+
} : void 0,
|
|
19466
|
+
// Price cached for the second pass; stripped before returning.
|
|
19467
|
+
__price: prices[priceKey] ?? 0
|
|
19468
|
+
};
|
|
19469
|
+
data[marketUid] = row;
|
|
19470
|
+
return row;
|
|
19255
19471
|
};
|
|
19472
|
+
for (const leg of colLegs) {
|
|
19473
|
+
const row = ensureRow(leg);
|
|
19474
|
+
const price2 = row.__price;
|
|
19475
|
+
row.totalDeposits += leg.amount;
|
|
19476
|
+
row.totalLiquidity += leg.amount;
|
|
19477
|
+
row.totalDepositsUSD += leg.amount * price2;
|
|
19478
|
+
row.totalLiquidityUSD += leg.amount * price2;
|
|
19479
|
+
row.depositRate = leg.rate;
|
|
19480
|
+
row.collateralActive = true;
|
|
19481
|
+
row.depositsEnabled = true;
|
|
19482
|
+
row.liquidationBonus = liquidationPenalty;
|
|
19483
|
+
row.config["0"].borrowCollateralFactor = ltv;
|
|
19484
|
+
row.config["0"].collateralFactor = liquidationThreshold;
|
|
19485
|
+
row.config["0"].liquidationPenalty = liquidationPenalty;
|
|
19486
|
+
row.config["0"].collateralDisabled = false;
|
|
19487
|
+
row.name = "Collateral " + (row.asset?.symbol ?? "");
|
|
19488
|
+
}
|
|
19489
|
+
for (const leg of debtLegs) {
|
|
19490
|
+
const row = ensureRow(leg);
|
|
19491
|
+
const price2 = row.__price;
|
|
19492
|
+
row.totalDebt += leg.amount;
|
|
19493
|
+
row.totalLiquidity += leg.available;
|
|
19494
|
+
row.borrowLiquidity += leg.available;
|
|
19495
|
+
row.totalDebtUSD += leg.amount * price2;
|
|
19496
|
+
row.totalLiquidityUSD += leg.available * price2;
|
|
19497
|
+
row.borrowLiquidityUSD += leg.available * price2;
|
|
19498
|
+
row.variableBorrowRate = leg.rate;
|
|
19499
|
+
row.borrowingEnabled = true;
|
|
19500
|
+
row.config["0"].debtDisabled = false;
|
|
19501
|
+
if (!row.collateralActive) row.name = "Loan " + (row.asset?.symbol ?? "");
|
|
19502
|
+
}
|
|
19503
|
+
for (const row of Object.values(data)) delete row.__price;
|
|
19256
19504
|
const llSupply = vault.liquidityUserSupplyData;
|
|
19257
19505
|
const liquidityUserSupply = llSupply ? {
|
|
19258
|
-
withdrawable,
|
|
19506
|
+
withdrawable: colLegs[0]?.available ?? 0,
|
|
19259
19507
|
withdrawalLimit: llSupply.withdrawalLimit?.toString() ?? "0",
|
|
19260
19508
|
baseWithdrawalLimit: llSupply.baseWithdrawalLimit?.toString() ?? "0",
|
|
19261
19509
|
expandPercent: Number(llSupply.expandPercent ?? 0),
|
|
@@ -19271,6 +19519,14 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
19271
19519
|
borrowRate: state.borrowRate,
|
|
19272
19520
|
supplyRate: state.supplyRate
|
|
19273
19521
|
} : void 0;
|
|
19522
|
+
const sideDescriptor = (legs, shares) => ({
|
|
19523
|
+
/** Underlying legs in the vault's own token0/token1 order. */
|
|
19524
|
+
assets: legs.map((l) => ({ underlying: l.token, decimals: l.decimals })),
|
|
19525
|
+
/** Fluid DEX pool backing this side; `null` when the side is simple. */
|
|
19526
|
+
dex: shares?.dex ?? null,
|
|
19527
|
+
/** Token units per 1e18 LP shares, parallel to `assets`. `null` when simple. */
|
|
19528
|
+
perShare: shares ? [shares.perShare[0].toString(), shares.perShare[1].toString()] : null
|
|
19529
|
+
});
|
|
19274
19530
|
return {
|
|
19275
19531
|
lender,
|
|
19276
19532
|
data,
|
|
@@ -19279,10 +19535,18 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
19279
19535
|
lender,
|
|
19280
19536
|
vaultAddress,
|
|
19281
19537
|
vaultId,
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19538
|
+
/** Raw `TYPE()` — 10000/20000/30000/40000 for T1/T2/T3/T4. */
|
|
19539
|
+
vaultType,
|
|
19540
|
+
// Kept for backwards compatibility: the FIRST leg of each side. On a
|
|
19541
|
+
// smart side this is token0 only — read `collateral` / `loan` below
|
|
19542
|
+
// for the full picture, and never assume a single asset per side.
|
|
19543
|
+
collateralAddress: colTokens[0],
|
|
19544
|
+
loanAddress: debtTokens[0],
|
|
19545
|
+
collateralDecimals: colLegs[0]?.decimals ?? colDecimals ?? 18,
|
|
19546
|
+
loanDecimals: debtLegs[0]?.decimals ?? debtDecimals ?? 18,
|
|
19547
|
+
/** Full per-side descriptor incl. the DEX and its share conversion. */
|
|
19548
|
+
collateral: sideDescriptor(colLegs, colShares),
|
|
19549
|
+
loan: sideDescriptor(debtLegs, debtShares),
|
|
19286
19550
|
oracle: configs.oracle,
|
|
19287
19551
|
rebalancer: configs.rebalancer,
|
|
19288
19552
|
liquidationThreshold,
|
|
@@ -19290,12 +19554,21 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
19290
19554
|
liquidationPenalty,
|
|
19291
19555
|
oraclePriceOperate: configs.oraclePriceOperate?.toString(),
|
|
19292
19556
|
oraclePriceLiquidate: configs.oraclePriceLiquidate?.toString(),
|
|
19293
|
-
isSmartCol
|
|
19294
|
-
isSmartDebt
|
|
19557
|
+
isSmartCol,
|
|
19558
|
+
isSmartDebt,
|
|
19559
|
+
/** DEX trading yield, percent APR. Supply ADDS it, debt NETS it off. */
|
|
19560
|
+
supplyDexTradingRate: supplyDexTrading,
|
|
19561
|
+
borrowDexTradingRate: borrowDexTrading,
|
|
19295
19562
|
liquidityUserSupply,
|
|
19296
19563
|
liquidity: {
|
|
19297
|
-
supplyToken: formatLiquidity(
|
|
19298
|
-
|
|
19564
|
+
supplyToken: formatLiquidity(
|
|
19565
|
+
liquidityByToken[colTokens[0]],
|
|
19566
|
+
colLegs[0]?.decimals ?? colDecimals ?? 18
|
|
19567
|
+
),
|
|
19568
|
+
borrowToken: formatLiquidity(
|
|
19569
|
+
liquidityByToken[debtTokens[0]],
|
|
19570
|
+
debtLegs[0]?.decimals ?? debtDecimals ?? 18
|
|
19571
|
+
)
|
|
19299
19572
|
}
|
|
19300
19573
|
}
|
|
19301
19574
|
}
|
|
@@ -19929,11 +20202,13 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
|
|
|
19929
20202
|
}) => {
|
|
19930
20203
|
let calls = [];
|
|
19931
20204
|
const validLenders = [];
|
|
20205
|
+
const sliceStart = {};
|
|
19932
20206
|
for (const lender of lenders) {
|
|
19933
20207
|
const abi = getAbi(lender);
|
|
19934
20208
|
const callData = buildLenderCall(chainId, lender);
|
|
19935
20209
|
if (callData.some((c) => !c.address)) continue;
|
|
19936
20210
|
const mappedCalls = callData.map((call) => ({ call, abi: call.abi ?? abi }));
|
|
20211
|
+
sliceStart[lender] = calls.length;
|
|
19937
20212
|
calls.push(...mappedCalls);
|
|
19938
20213
|
validLenders.push(lender);
|
|
19939
20214
|
}
|
|
@@ -19944,8 +20219,31 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
|
|
|
19944
20219
|
abi: calls.map((call) => call.abi),
|
|
19945
20220
|
batchSize: chainId === Chain.ETHEREUM_MAINNET ? 500 : void 0
|
|
19946
20221
|
}),
|
|
19947
|
-
tokenList()
|
|
20222
|
+
tokenList(),
|
|
20223
|
+
// Fluid SMART vaults (T2/T3/T4) need the DEX trading yield, which is
|
|
20224
|
+
// published nowhere on-chain. Cached + single-flighted; primed here
|
|
20225
|
+
// because the converters below are synchronous. If it fails, a smart row
|
|
20226
|
+
// still serves correct amounts and its liquidity-layer rate legs, just
|
|
20227
|
+
// without the trading leg. T1 is unaffected either way.
|
|
20228
|
+
validLenders.some(isFluid) ? fetchFluidApiData(chainId).catch(() => void 0) : Promise.resolve(void 0)
|
|
19948
20229
|
]);
|
|
20230
|
+
const fluidLender = validLenders.find(isFluid);
|
|
20231
|
+
if (fluidLender !== void 0) {
|
|
20232
|
+
try {
|
|
20233
|
+
const start = sliceStart[fluidLender] ?? 0;
|
|
20234
|
+
const vaults = rawResults?.[start];
|
|
20235
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
20236
|
+
for (const v of vaults ?? []) {
|
|
20237
|
+
if (!v?.isSmartCol && !v?.isSmartDebt) continue;
|
|
20238
|
+
if (v?.isSmartCol && v?.constantVariables?.supply)
|
|
20239
|
+
referenced.add(String(v.constantVariables.supply).toLowerCase());
|
|
20240
|
+
if (v?.isSmartDebt && v?.constantVariables?.borrow)
|
|
20241
|
+
referenced.add(String(v.constantVariables.borrow).toLowerCase());
|
|
20242
|
+
}
|
|
20243
|
+
await fetchFluidDexState(chainId, multicallRetry, [...referenced]);
|
|
20244
|
+
} catch {
|
|
20245
|
+
}
|
|
20246
|
+
}
|
|
19949
20247
|
const invalidLenders = [];
|
|
19950
20248
|
let lenderData = {};
|
|
19951
20249
|
let currentSlice = 0;
|
|
@@ -26474,7 +26772,7 @@ function bigintToLtv(v) {
|
|
|
26474
26772
|
return Number.isFinite(n) ? n / 1e18 : 0;
|
|
26475
26773
|
}
|
|
26476
26774
|
}
|
|
26477
|
-
var
|
|
26775
|
+
var ZERO_ADDRESS6 = "0x0000000000000000000000000000000000000000";
|
|
26478
26776
|
function convertSiloV3MarketsToPublicResponse(apiItems, chainId, prices, additionalYields = {
|
|
26479
26777
|
intrinsicYields: {},
|
|
26480
26778
|
lenderRewards: {},
|
|
@@ -26577,8 +26875,8 @@ function convertSiloV3MarketsToPublicResponse(apiItems, chainId, prices, additio
|
|
|
26577
26875
|
silo: self.silo.toLowerCase(),
|
|
26578
26876
|
counterpartySilo: other.silo.toLowerCase(),
|
|
26579
26877
|
siloConfig: registryEntry.siloConfig.toLowerCase(),
|
|
26580
|
-
oracle: (api.solvencyOracleAddress || self.solvencyOracle ||
|
|
26581
|
-
irm: (api.interestRateModelId || self.interestRateModel ||
|
|
26878
|
+
oracle: (api.solvencyOracleAddress || self.solvencyOracle || ZERO_ADDRESS6).toLowerCase(),
|
|
26879
|
+
irm: (api.interestRateModelId || self.interestRateModel || ZERO_ADDRESS6).toLowerCase(),
|
|
26582
26880
|
shareTokens: {
|
|
26583
26881
|
collateral: self.collateralShareToken,
|
|
26584
26882
|
protected: self.protectedShareToken,
|
|
@@ -30881,11 +31179,11 @@ var getSiloV2UserDataConverter = (lender, chainId, account, metaMap) => {
|
|
|
30881
31179
|
for (let s = 0; s < 2; s++) {
|
|
30882
31180
|
const { self } = sides[s];
|
|
30883
31181
|
const slot = s * SILO_V2_USER_CALLS_PER_SIDE;
|
|
30884
|
-
const collateralShares =
|
|
30885
|
-
const protectedShares =
|
|
30886
|
-
const collateralRate =
|
|
30887
|
-
const protectedRate =
|
|
30888
|
-
const repayRaw =
|
|
31182
|
+
const collateralShares = toBigInt7(data[slot]);
|
|
31183
|
+
const protectedShares = toBigInt7(data[slot + 1]);
|
|
31184
|
+
const collateralRate = toBigInt7(data[slot + 2]);
|
|
31185
|
+
const protectedRate = toBigInt7(data[slot + 3]);
|
|
31186
|
+
const repayRaw = toBigInt7(data[slot + 4]);
|
|
30889
31187
|
const decimals = self.decimals;
|
|
30890
31188
|
const oneUnit = BigInt(10) ** BigInt(decimals);
|
|
30891
31189
|
const collateralAssets = oneUnit > 0n ? collateralShares * collateralRate / oneUnit : 0n;
|
|
@@ -30966,7 +31264,7 @@ var getSiloV2UserDataConverter = (lender, chainId, account, metaMap) => {
|
|
|
30966
31264
|
SILO_V2_USER_CALLS_PER_PAIR
|
|
30967
31265
|
];
|
|
30968
31266
|
};
|
|
30969
|
-
function
|
|
31267
|
+
function toBigInt7(v) {
|
|
30970
31268
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
30971
31269
|
if (typeof v === "bigint") return v;
|
|
30972
31270
|
try {
|
|
@@ -30993,11 +31291,11 @@ var getSiloV3UserDataConverter = (lender, chainId, account, metaMap) => {
|
|
|
30993
31291
|
for (let s = 0; s < 2; s++) {
|
|
30994
31292
|
const { self } = sides[s];
|
|
30995
31293
|
const slot = s * SILO_V3_USER_CALLS_PER_SIDE;
|
|
30996
|
-
const collateralShares =
|
|
30997
|
-
const protectedShares =
|
|
30998
|
-
const collateralRate =
|
|
30999
|
-
const protectedRate =
|
|
31000
|
-
const repayRaw =
|
|
31294
|
+
const collateralShares = toBigInt8(data[slot]);
|
|
31295
|
+
const protectedShares = toBigInt8(data[slot + 1]);
|
|
31296
|
+
const collateralRate = toBigInt8(data[slot + 2]);
|
|
31297
|
+
const protectedRate = toBigInt8(data[slot + 3]);
|
|
31298
|
+
const repayRaw = toBigInt8(data[slot + 4]);
|
|
31001
31299
|
const decimals = self.decimals;
|
|
31002
31300
|
const oneUnit = BigInt(10) ** BigInt(decimals);
|
|
31003
31301
|
const collateralAssets = oneUnit > 0n ? collateralShares * collateralRate / oneUnit : 0n;
|
|
@@ -31076,7 +31374,7 @@ var getSiloV3UserDataConverter = (lender, chainId, account, metaMap) => {
|
|
|
31076
31374
|
SILO_V3_USER_CALLS_PER_PAIR
|
|
31077
31375
|
];
|
|
31078
31376
|
};
|
|
31079
|
-
function
|
|
31377
|
+
function toBigInt8(v) {
|
|
31080
31378
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
31081
31379
|
if (typeof v === "bigint") return v;
|
|
31082
31380
|
try {
|
|
@@ -31087,7 +31385,7 @@ function toBigInt7(v) {
|
|
|
31087
31385
|
}
|
|
31088
31386
|
var FLUID_EEE_LOWER2 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
31089
31387
|
var normalizeUnderlying2 = (addr3) => addr3 === FLUID_EEE_LOWER2 ? zeroAddress : addr3;
|
|
31090
|
-
function
|
|
31388
|
+
function toBigInt9(v) {
|
|
31091
31389
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
31092
31390
|
if (typeof v === "bigint") return v;
|
|
31093
31391
|
try {
|
|
@@ -31106,12 +31404,12 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
31106
31404
|
const vaults = result[1];
|
|
31107
31405
|
if (!Array.isArray(positions) || !Array.isArray(vaults) || positions.length === 0)
|
|
31108
31406
|
return void 0;
|
|
31407
|
+
const dexState = getCachedFluidDexState(chainId);
|
|
31109
31408
|
const perVault = /* @__PURE__ */ new Map();
|
|
31110
31409
|
for (let i = 0; i < positions.length; i++) {
|
|
31111
31410
|
const pos = positions[i];
|
|
31112
31411
|
const vault = vaults[i];
|
|
31113
31412
|
if (!vault?.constantVariables) continue;
|
|
31114
|
-
if (vault.isSmartCol || vault.isSmartDebt) continue;
|
|
31115
31413
|
if (pos.isLiquidated) continue;
|
|
31116
31414
|
const vaultId = Number(vault.constantVariables.vaultId ?? 0);
|
|
31117
31415
|
if (!perVault.has(vaultId)) perVault.set(vaultId, []);
|
|
@@ -31123,80 +31421,123 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
31123
31421
|
const lenderKey = `${Lender.FLUID}_${chainId}_${vaultId}`;
|
|
31124
31422
|
const metaMap = meta?.[lenderKey];
|
|
31125
31423
|
if (!metaMap) continue;
|
|
31126
|
-
const
|
|
31127
|
-
const
|
|
31128
|
-
const
|
|
31129
|
-
|
|
31130
|
-
const
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
|
|
31141
|
-
|
|
31142
|
-
|
|
31143
|
-
|
|
31424
|
+
const vaultData = nfts[0].vault;
|
|
31425
|
+
const constants = vaultData.constantVariables;
|
|
31426
|
+
const isSmartCol = !!vaultData.isSmartCol;
|
|
31427
|
+
const isSmartDebt = !!vaultData.isSmartDebt;
|
|
31428
|
+
const sideLegs = (side, isSmart, sideContract, perShareOf) => {
|
|
31429
|
+
const raw = side?.token0 !== void 0 ? side : { token0: side };
|
|
31430
|
+
const tokens = [
|
|
31431
|
+
normalizeUnderlying2((raw?.token0 ?? "").toString().toLowerCase())
|
|
31432
|
+
];
|
|
31433
|
+
if (isSmart)
|
|
31434
|
+
tokens.push(
|
|
31435
|
+
normalizeUnderlying2((raw?.token1 ?? "").toString().toLowerCase())
|
|
31436
|
+
);
|
|
31437
|
+
if (!tokens[0]) return void 0;
|
|
31438
|
+
let perShare;
|
|
31439
|
+
if (isSmart) {
|
|
31440
|
+
const state = dexState?.[String(sideContract ?? "").toLowerCase()];
|
|
31441
|
+
if (!state) return void 0;
|
|
31442
|
+
perShare = perShareOf(state);
|
|
31443
|
+
}
|
|
31444
|
+
const legs = [];
|
|
31445
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
31446
|
+
const token = tokens[i];
|
|
31447
|
+
const marketUid = createMarketUid(chainId, lenderKey, token);
|
|
31448
|
+
const m = metaMap[marketUid];
|
|
31449
|
+
if (!m) return void 0;
|
|
31450
|
+
legs.push({
|
|
31451
|
+
token,
|
|
31452
|
+
marketUid,
|
|
31453
|
+
decimals: m.asset?.decimals ?? 18,
|
|
31454
|
+
displayPrice: getDisplayPrice(m),
|
|
31455
|
+
oraclePrice: getOraclePrice(m),
|
|
31456
|
+
priceHist: m.price?.priceUsd24h ?? getDisplayPrice(m),
|
|
31457
|
+
// Simple side: the raw amount IS the token amount.
|
|
31458
|
+
// Smart side: it is a 1e18 LP share count, converted with the
|
|
31459
|
+
// DEX's per-share amounts (each already in ITS token's decimals).
|
|
31460
|
+
perShare: perShare?.[i]
|
|
31461
|
+
});
|
|
31462
|
+
}
|
|
31463
|
+
return legs;
|
|
31464
|
+
};
|
|
31465
|
+
const colLegs = sideLegs(
|
|
31466
|
+
constants.supplyToken,
|
|
31467
|
+
isSmartCol,
|
|
31468
|
+
constants.supply,
|
|
31469
|
+
(s) => [s.token0PerSupplyShare, s.token1PerSupplyShare]
|
|
31470
|
+
);
|
|
31471
|
+
const debtLegs = sideLegs(
|
|
31472
|
+
constants.borrowToken,
|
|
31473
|
+
isSmartDebt,
|
|
31474
|
+
constants.borrow,
|
|
31475
|
+
(s) => [s.token0PerBorrowShare, s.token1PerBorrowShare]
|
|
31476
|
+
);
|
|
31477
|
+
if (!colLegs || !debtLegs) continue;
|
|
31144
31478
|
const lendingPositions = {};
|
|
31145
31479
|
const modes = {};
|
|
31146
31480
|
const histData = {};
|
|
31147
31481
|
for (const { pos } of nfts) {
|
|
31148
31482
|
const nftId = pos.nftId.toString();
|
|
31149
|
-
const supplyRaw =
|
|
31150
|
-
const borrowRaw =
|
|
31483
|
+
const supplyRaw = toBigInt9(pos.supply);
|
|
31484
|
+
const borrowRaw = toBigInt9(pos.borrow) + toBigInt9(pos.dustBorrow);
|
|
31151
31485
|
if (supplyRaw === 0n && borrowRaw === 0n) continue;
|
|
31152
|
-
const depositsStr = parseRawAmount(
|
|
31153
|
-
supplyRaw.toString(),
|
|
31154
|
-
colDec
|
|
31155
|
-
);
|
|
31156
|
-
const debtStr = parseRawAmount(borrowRaw.toString(), loanDec);
|
|
31157
|
-
const depositsNum = Number(depositsStr);
|
|
31158
|
-
const debtNum = Number(debtStr);
|
|
31159
|
-
const depositsUSD = depositsNum * colDisplayPrice;
|
|
31160
|
-
const debtUSD = debtNum * loanDisplayPrice;
|
|
31161
|
-
const depositsUSDOracle = depositsNum * colOraclePrice;
|
|
31162
|
-
const debtUSDOracle = debtNum * loanOraclePrice;
|
|
31163
|
-
histData[nftId] = {
|
|
31164
|
-
totalDeposits24h: depositsNum * colPriceHist,
|
|
31165
|
-
totalDebt24h: debtNum * loanPriceHist
|
|
31166
|
-
};
|
|
31167
31486
|
modes[nftId] = 0;
|
|
31168
31487
|
const posData = {};
|
|
31169
|
-
|
|
31170
|
-
|
|
31171
|
-
|
|
31172
|
-
|
|
31173
|
-
|
|
31174
|
-
|
|
31175
|
-
|
|
31176
|
-
|
|
31177
|
-
|
|
31178
|
-
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
|
|
31182
|
-
|
|
31183
|
-
|
|
31488
|
+
let deposits24h = 0;
|
|
31489
|
+
let debt24h = 0;
|
|
31490
|
+
const entryFor = (leg) => {
|
|
31491
|
+
const existing = posData[leg.marketUid];
|
|
31492
|
+
if (existing) return existing;
|
|
31493
|
+
const created = {
|
|
31494
|
+
marketUid: leg.marketUid,
|
|
31495
|
+
underlying: leg.token,
|
|
31496
|
+
deposits: "0",
|
|
31497
|
+
debt: "0",
|
|
31498
|
+
debtStable: "0",
|
|
31499
|
+
depositsUSD: 0,
|
|
31500
|
+
debtUSD: 0,
|
|
31501
|
+
debtStableUSD: 0,
|
|
31502
|
+
depositsUSDOracle: 0,
|
|
31503
|
+
debtUSDOracle: 0,
|
|
31504
|
+
debtStableUSDOracle: 0,
|
|
31505
|
+
stableBorrowRate: "0",
|
|
31506
|
+
collateralEnabled: false,
|
|
31507
|
+
claimableRewards: 0
|
|
31508
|
+
};
|
|
31509
|
+
posData[leg.marketUid] = created;
|
|
31510
|
+
return created;
|
|
31184
31511
|
};
|
|
31185
|
-
|
|
31186
|
-
|
|
31187
|
-
|
|
31188
|
-
|
|
31189
|
-
|
|
31190
|
-
|
|
31191
|
-
|
|
31192
|
-
|
|
31193
|
-
|
|
31194
|
-
|
|
31195
|
-
|
|
31196
|
-
|
|
31197
|
-
|
|
31198
|
-
|
|
31199
|
-
|
|
31512
|
+
const legRaw = (leg, raw) => leg.perShare === void 0 ? raw : raw * leg.perShare / 10n ** 18n;
|
|
31513
|
+
for (const leg of colLegs) {
|
|
31514
|
+
const amountStr = parseRawAmount(
|
|
31515
|
+
legRaw(leg, supplyRaw).toString(),
|
|
31516
|
+
leg.decimals
|
|
31517
|
+
);
|
|
31518
|
+
const amount3 = Number(amountStr);
|
|
31519
|
+
const e = entryFor(leg);
|
|
31520
|
+
e.deposits = amountStr;
|
|
31521
|
+
e.depositsUSD = amount3 * leg.displayPrice;
|
|
31522
|
+
e.depositsUSDOracle = amount3 * leg.oraclePrice;
|
|
31523
|
+
e.collateralEnabled = supplyRaw > 0n;
|
|
31524
|
+
deposits24h += amount3 * leg.priceHist;
|
|
31525
|
+
}
|
|
31526
|
+
for (const leg of debtLegs) {
|
|
31527
|
+
const amountStr = parseRawAmount(
|
|
31528
|
+
legRaw(leg, borrowRaw).toString(),
|
|
31529
|
+
leg.decimals
|
|
31530
|
+
);
|
|
31531
|
+
const amount3 = Number(amountStr);
|
|
31532
|
+
const e = entryFor(leg);
|
|
31533
|
+
e.debt = amountStr;
|
|
31534
|
+
e.debtUSD = amount3 * leg.displayPrice;
|
|
31535
|
+
e.debtUSDOracle = amount3 * leg.oraclePrice;
|
|
31536
|
+
debt24h += amount3 * leg.priceHist;
|
|
31537
|
+
}
|
|
31538
|
+
histData[nftId] = {
|
|
31539
|
+
totalDeposits24h: deposits24h,
|
|
31540
|
+
totalDebt24h: debt24h
|
|
31200
31541
|
};
|
|
31201
31542
|
lendingPositions[nftId] = posData;
|
|
31202
31543
|
}
|
|
@@ -31220,7 +31561,7 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
31220
31561
|
FLUID_USER_CALL_COUNT
|
|
31221
31562
|
];
|
|
31222
31563
|
};
|
|
31223
|
-
function
|
|
31564
|
+
function toBigInt10(v) {
|
|
31224
31565
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
31225
31566
|
if (typeof v === "bigint") return v;
|
|
31226
31567
|
try {
|
|
@@ -31304,7 +31645,7 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31304
31645
|
for (const ca of accounts) {
|
|
31305
31646
|
const caAddress = (ca.creditAccount ?? ca.addr ?? "").toString().toLowerCase();
|
|
31306
31647
|
if (!caAddress) continue;
|
|
31307
|
-
const debtRaw =
|
|
31648
|
+
const debtRaw = toBigInt10(ca.debt);
|
|
31308
31649
|
const tokens = Array.isArray(ca.tokens) ? ca.tokens : Array.isArray(ca.balances) ? ca.balances : [];
|
|
31309
31650
|
modes[caAddress] = 0;
|
|
31310
31651
|
const posData = {};
|
|
@@ -31313,9 +31654,9 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31313
31654
|
const rawToken = (bal?.token ?? "").toString().toLowerCase();
|
|
31314
31655
|
if (!rawToken) continue;
|
|
31315
31656
|
const token = rawToken;
|
|
31316
|
-
const balRaw =
|
|
31657
|
+
const balRaw = toBigInt10(bal.balance);
|
|
31317
31658
|
if (balRaw === 0n) continue;
|
|
31318
|
-
const quotaRaw =
|
|
31659
|
+
const quotaRaw = toBigInt10(bal.quota);
|
|
31319
31660
|
const isQuoted = quotaRaw > 0n || !!bal?.isQuoted;
|
|
31320
31661
|
const colMarketUid = createMarketUid(chainId, lenderKey, token);
|
|
31321
31662
|
ensureMetaStub(metaMap, colMarketUid, token);
|
|
@@ -31490,7 +31831,7 @@ function normalizeUnderlying3(token) {
|
|
|
31490
31831
|
const lower3 = token.toLowerCase();
|
|
31491
31832
|
return Object.values(WETH_BY_CHAIN).includes(lower3) ? zeroAddress : lower3;
|
|
31492
31833
|
}
|
|
31493
|
-
function
|
|
31834
|
+
function toBigInt11(v) {
|
|
31494
31835
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
31495
31836
|
if (typeof v === "bigint") return v;
|
|
31496
31837
|
try {
|
|
@@ -31500,22 +31841,22 @@ function toBigInt10(v) {
|
|
|
31500
31841
|
}
|
|
31501
31842
|
}
|
|
31502
31843
|
function readDebtUnits(positionResult) {
|
|
31503
|
-
if (Array.isArray(positionResult)) return
|
|
31844
|
+
if (Array.isArray(positionResult)) return toBigInt11(positionResult[4]);
|
|
31504
31845
|
if (positionResult && typeof positionResult === "object")
|
|
31505
|
-
return
|
|
31846
|
+
return toBigInt11(positionResult.debt);
|
|
31506
31847
|
return 0n;
|
|
31507
31848
|
}
|
|
31508
31849
|
function readUpdatedLender(updateResult) {
|
|
31509
31850
|
if (Array.isArray(updateResult)) {
|
|
31510
31851
|
return {
|
|
31511
|
-
credit:
|
|
31512
|
-
pendingFee:
|
|
31852
|
+
credit: toBigInt11(updateResult[0]),
|
|
31853
|
+
pendingFee: toBigInt11(updateResult[1])
|
|
31513
31854
|
};
|
|
31514
31855
|
}
|
|
31515
31856
|
if (updateResult && typeof updateResult === "object") {
|
|
31516
31857
|
return {
|
|
31517
|
-
credit:
|
|
31518
|
-
pendingFee:
|
|
31858
|
+
credit: toBigInt11(updateResult.newCredit),
|
|
31859
|
+
pendingFee: toBigInt11(updateResult.newPendingFee)
|
|
31519
31860
|
};
|
|
31520
31861
|
}
|
|
31521
31862
|
return { credit: 0n, pendingFee: 0n };
|
|
@@ -31586,7 +31927,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31586
31927
|
pendingFee: pendingFeeStr
|
|
31587
31928
|
};
|
|
31588
31929
|
market.collateralParams.forEach((c, i) => {
|
|
31589
|
-
const collAmt =
|
|
31930
|
+
const collAmt = toBigInt11(collateralResults[i]);
|
|
31590
31931
|
if (collAmt === 0n) return;
|
|
31591
31932
|
anyBalance = true;
|
|
31592
31933
|
const collAddr = c.token.toLowerCase();
|
|
@@ -31635,7 +31976,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31635
31976
|
];
|
|
31636
31977
|
};
|
|
31637
31978
|
var WAD11 = 1000000000000000000n;
|
|
31638
|
-
function
|
|
31979
|
+
function toBigInt12(v) {
|
|
31639
31980
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
31640
31981
|
if (typeof v === "bigint") return v;
|
|
31641
31982
|
try {
|
|
@@ -31672,11 +32013,11 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31672
32013
|
const loanDisplayPrice = loanMeta ? getDisplayPrice(loanMeta) : 0;
|
|
31673
32014
|
const loanOraclePrice = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
31674
32015
|
const loanPriceHist = loanMeta?.price?.priceUsd24h ?? loanDisplayPrice;
|
|
31675
|
-
const debtUnits =
|
|
32016
|
+
const debtUnits = toBigInt12(obligationResult);
|
|
31676
32017
|
const debtStr = parseRawAmount(debtUnits.toString(), market.loanDecimals);
|
|
31677
32018
|
const debtNum = Number(debtStr);
|
|
31678
|
-
const repoBalance =
|
|
31679
|
-
const redemptionValue =
|
|
32019
|
+
const repoBalance = toBigInt12(balanceResult);
|
|
32020
|
+
const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD11;
|
|
31680
32021
|
const lentUnits = repoBalance * redemptionValue / WAD11;
|
|
31681
32022
|
const depositsStr = parseRawAmount(lentUnits.toString(), market.loanDecimals);
|
|
31682
32023
|
const depositsNum = Number(depositsStr);
|
|
@@ -31700,7 +32041,7 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
31700
32041
|
claimableRewards: 0
|
|
31701
32042
|
};
|
|
31702
32043
|
market.collateralParams.forEach((c, i) => {
|
|
31703
|
-
const collAmt =
|
|
32044
|
+
const collAmt = toBigInt12(collateralResults[i]);
|
|
31704
32045
|
if (collAmt === 0n) return;
|
|
31705
32046
|
anyBalance = true;
|
|
31706
32047
|
const collAddr = c.token.toLowerCase();
|
|
@@ -33361,7 +33702,7 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
33361
33702
|
];
|
|
33362
33703
|
};
|
|
33363
33704
|
var nowSec8 = () => Math.floor(Date.now() / 1e3);
|
|
33364
|
-
function
|
|
33705
|
+
function toBigInt13(v) {
|
|
33365
33706
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
33366
33707
|
if (typeof v === "bigint") return v;
|
|
33367
33708
|
try {
|
|
@@ -33378,18 +33719,18 @@ function field11(res, name, index) {
|
|
|
33378
33719
|
return void 0;
|
|
33379
33720
|
}
|
|
33380
33721
|
function parsePosition(res) {
|
|
33381
|
-
const ftBalance =
|
|
33382
|
-
const xtBalance =
|
|
33722
|
+
const ftBalance = toBigInt13(field11(res, "ftBalance", 2));
|
|
33723
|
+
const xtBalance = toBigInt13(field11(res, "xtBalance", 3));
|
|
33383
33724
|
const rawGts = field11(res, "gtInfo", 4);
|
|
33384
33725
|
const gts = [];
|
|
33385
33726
|
if (Array.isArray(rawGts)) {
|
|
33386
33727
|
for (const g of rawGts) {
|
|
33387
|
-
const loanId =
|
|
33728
|
+
const loanId = toBigInt13(field11(g, "loanId", 0));
|
|
33388
33729
|
if (loanId === 0n) continue;
|
|
33389
33730
|
gts.push({
|
|
33390
33731
|
loanId: loanId.toString(),
|
|
33391
|
-
collateralAmt:
|
|
33392
|
-
debtAmt:
|
|
33732
|
+
collateralAmt: toBigInt13(field11(g, "collateralAmt", 1)),
|
|
33733
|
+
debtAmt: toBigInt13(field11(g, "debtAmt", 2))
|
|
33393
33734
|
});
|
|
33394
33735
|
}
|
|
33395
33736
|
}
|
|
@@ -38942,7 +39283,7 @@ async function fetchJsonWithProxyFallback(url, body, proxyConfig) {
|
|
|
38942
39283
|
if (!proxyConfig) return void 0;
|
|
38943
39284
|
return attemptFetchJson(url, body, proxyConfig);
|
|
38944
39285
|
}
|
|
38945
|
-
var
|
|
39286
|
+
var inflight3 = /* @__PURE__ */ new Map();
|
|
38946
39287
|
var resolved = /* @__PURE__ */ new Map();
|
|
38947
39288
|
function cacheKey6(chainId, account) {
|
|
38948
39289
|
return `${chainId}:${account.toLowerCase()}`;
|
|
@@ -38954,15 +39295,15 @@ async function dedupedFetch(chainId, account, loader) {
|
|
|
38954
39295
|
if (cached && cached.expiresAt > now) {
|
|
38955
39296
|
return cached.value;
|
|
38956
39297
|
}
|
|
38957
|
-
const existing =
|
|
39298
|
+
const existing = inflight3.get(key3);
|
|
38958
39299
|
if (existing) return existing;
|
|
38959
39300
|
const promise = loader().then((value) => {
|
|
38960
39301
|
resolved.set(key3, { value, expiresAt: Date.now() + CACHE_TTL_MS5 });
|
|
38961
39302
|
return value;
|
|
38962
39303
|
}).finally(() => {
|
|
38963
|
-
|
|
39304
|
+
inflight3.delete(key3);
|
|
38964
39305
|
});
|
|
38965
|
-
|
|
39306
|
+
inflight3.set(key3, promise);
|
|
38966
39307
|
return promise;
|
|
38967
39308
|
}
|
|
38968
39309
|
function hasMorphoUserSubgraph(chainId) {
|
|
@@ -47815,7 +48156,7 @@ var DLEND_POOLS = [
|
|
|
47815
48156
|
pool: "0x6598DaD18Bda89A0E58A1F427c8CeBc0dE90F153"
|
|
47816
48157
|
}
|
|
47817
48158
|
];
|
|
47818
|
-
var
|
|
48159
|
+
var ZERO_ADDRESS7 = "0x0000000000000000000000000000000000000000";
|
|
47819
48160
|
var SECONDS_PER_YEAR12 = 31536e3;
|
|
47820
48161
|
var ABI = [
|
|
47821
48162
|
{
|
|
@@ -47932,7 +48273,7 @@ var DTRINITY_SOURCE = {
|
|
|
47932
48273
|
link: "https://docs.dtrinity.org/protocol-components/dlend",
|
|
47933
48274
|
platform: "protocol"
|
|
47934
48275
|
};
|
|
47935
|
-
var isZero = (a) => !a || a.toLowerCase() ===
|
|
48276
|
+
var isZero = (a) => !a || a.toLowerCase() === ZERO_ADDRESS7;
|
|
47936
48277
|
var scale = (raw, decimals) => Number(raw) / 10 ** decimals;
|
|
47937
48278
|
function emptyReward2() {
|
|
47938
48279
|
return {
|
|
@@ -50692,7 +51033,7 @@ var SiloOracleAbi = [
|
|
|
50692
51033
|
type: "function"
|
|
50693
51034
|
}
|
|
50694
51035
|
];
|
|
50695
|
-
var
|
|
51036
|
+
var ZERO_ADDRESS8 = "0x0000000000000000000000000000000000000000";
|
|
50696
51037
|
function lookupUSD(context, asset) {
|
|
50697
51038
|
const lc = asset.toLowerCase();
|
|
50698
51039
|
const groupKey = context.tokenList?.[lc]?.assetGroup ?? `${context.chainId}-${lc}`;
|
|
@@ -50704,7 +51045,7 @@ function getSiloV2Calls(chainId) {
|
|
|
50704
51045
|
const tokensWithRealOracle = /* @__PURE__ */ new Set();
|
|
50705
51046
|
for (const market of allMarkets) {
|
|
50706
51047
|
for (const half of [market.silo0, market.silo1]) {
|
|
50707
|
-
if (half.solvencyOracle && half.solvencyOracle !==
|
|
51048
|
+
if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS8) {
|
|
50708
51049
|
tokensWithRealOracle.add(half.token.toLowerCase());
|
|
50709
51050
|
}
|
|
50710
51051
|
}
|
|
@@ -50717,7 +51058,7 @@ function getSiloV2Calls(chainId) {
|
|
|
50717
51058
|
const lenderKey = siloV2LenderKey(market.siloConfig);
|
|
50718
51059
|
const halves = [market.silo0, market.silo1];
|
|
50719
51060
|
const isStatic = halves.map(
|
|
50720
|
-
(h) => !h.solvencyOracle || h.solvencyOracle ===
|
|
51061
|
+
(h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS8
|
|
50721
51062
|
);
|
|
50722
51063
|
if (isStatic[0] && isStatic[1]) {
|
|
50723
51064
|
const t0 = halves[0].token.toLowerCase();
|
|
@@ -50737,7 +51078,7 @@ function getSiloV2Calls(chainId) {
|
|
|
50737
51078
|
decimals: half.decimals,
|
|
50738
51079
|
silo: half.silo.toLowerCase(),
|
|
50739
51080
|
lenderKey,
|
|
50740
|
-
oracle:
|
|
51081
|
+
oracle: ZERO_ADDRESS8,
|
|
50741
51082
|
partnerToken: partnerLc,
|
|
50742
51083
|
isStatic: true
|
|
50743
51084
|
});
|
|
@@ -50861,7 +51202,7 @@ var SiloOracleAbi2 = [
|
|
|
50861
51202
|
type: "function"
|
|
50862
51203
|
}
|
|
50863
51204
|
];
|
|
50864
|
-
var
|
|
51205
|
+
var ZERO_ADDRESS9 = "0x0000000000000000000000000000000000000000";
|
|
50865
51206
|
function lookupUSD2(context, asset) {
|
|
50866
51207
|
const lc = asset.toLowerCase();
|
|
50867
51208
|
const groupKey = context.tokenList?.[lc]?.assetGroup ?? `${context.chainId}-${lc}`;
|
|
@@ -50873,7 +51214,7 @@ function getSiloV3Calls(chainId) {
|
|
|
50873
51214
|
const tokensWithRealOracle = /* @__PURE__ */ new Set();
|
|
50874
51215
|
for (const market of allMarkets) {
|
|
50875
51216
|
for (const half of [market.silo0, market.silo1]) {
|
|
50876
|
-
if (half.solvencyOracle && half.solvencyOracle !==
|
|
51217
|
+
if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS9) {
|
|
50877
51218
|
tokensWithRealOracle.add(half.token.toLowerCase());
|
|
50878
51219
|
}
|
|
50879
51220
|
}
|
|
@@ -50886,7 +51227,7 @@ function getSiloV3Calls(chainId) {
|
|
|
50886
51227
|
const lenderKey = siloV3LenderKey(market.siloConfig);
|
|
50887
51228
|
const halves = [market.silo0, market.silo1];
|
|
50888
51229
|
const isStatic = halves.map(
|
|
50889
|
-
(h) => !h.solvencyOracle || h.solvencyOracle ===
|
|
51230
|
+
(h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS9
|
|
50890
51231
|
);
|
|
50891
51232
|
if (isStatic[0] && isStatic[1]) {
|
|
50892
51233
|
const t0 = halves[0].token.toLowerCase();
|
|
@@ -50906,7 +51247,7 @@ function getSiloV3Calls(chainId) {
|
|
|
50906
51247
|
decimals: half.decimals,
|
|
50907
51248
|
silo: half.silo.toLowerCase(),
|
|
50908
51249
|
lenderKey,
|
|
50909
|
-
oracle:
|
|
51250
|
+
oracle: ZERO_ADDRESS9,
|
|
50910
51251
|
partnerToken: partnerLc,
|
|
50911
51252
|
isStatic: true
|
|
50912
51253
|
});
|
|
@@ -51285,7 +51626,7 @@ function lookupUSD3(context, asset) {
|
|
|
51285
51626
|
return context.usdPrices[groupKey] ?? context.usdPrices[lc] ?? 0;
|
|
51286
51627
|
}
|
|
51287
51628
|
function parseSiloV2GraphQLResults(items, context) {
|
|
51288
|
-
const
|
|
51629
|
+
const ZERO_ADDRESS11 = "0x0000000000000000000000000000000000000000";
|
|
51289
51630
|
const out = [];
|
|
51290
51631
|
const seen = /* @__PURE__ */ new Set();
|
|
51291
51632
|
for (const item of items) {
|
|
@@ -51308,8 +51649,8 @@ function parseSiloV2GraphQLResults(items, context) {
|
|
|
51308
51649
|
const partnerTokenLc = other.token.toLowerCase();
|
|
51309
51650
|
const dedupKey = `${lenderKey}:${tokenLc}`;
|
|
51310
51651
|
if (seen.has(dedupKey)) continue;
|
|
51311
|
-
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ??
|
|
51312
|
-
const isStatic = !oracleAddr || oracleAddr ===
|
|
51652
|
+
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS11).toLowerCase();
|
|
51653
|
+
const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS11;
|
|
51313
51654
|
const siloAddrLc = self.silo.toLowerCase();
|
|
51314
51655
|
try {
|
|
51315
51656
|
let priceUSD = 0;
|
|
@@ -51427,7 +51768,7 @@ function lookupUSD4(context, asset) {
|
|
|
51427
51768
|
return context.usdPrices[groupKey] ?? context.usdPrices[lc] ?? 0;
|
|
51428
51769
|
}
|
|
51429
51770
|
function parseSiloV3GraphQLResults(items, context) {
|
|
51430
|
-
const
|
|
51771
|
+
const ZERO_ADDRESS11 = "0x0000000000000000000000000000000000000000";
|
|
51431
51772
|
const out = [];
|
|
51432
51773
|
const seen = /* @__PURE__ */ new Set();
|
|
51433
51774
|
for (const item of items) {
|
|
@@ -51450,8 +51791,8 @@ function parseSiloV3GraphQLResults(items, context) {
|
|
|
51450
51791
|
const partnerTokenLc = other.token.toLowerCase();
|
|
51451
51792
|
const dedupKey = `${lenderKey}:${tokenLc}`;
|
|
51452
51793
|
if (seen.has(dedupKey)) continue;
|
|
51453
|
-
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ??
|
|
51454
|
-
const isStatic = !oracleAddr || oracleAddr ===
|
|
51794
|
+
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS11).toLowerCase();
|
|
51795
|
+
const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS11;
|
|
51455
51796
|
const siloAddrLc = self.silo.toLowerCase();
|
|
51456
51797
|
try {
|
|
51457
51798
|
let priceUSD = 0;
|
|
@@ -51573,7 +51914,7 @@ var AGGREGATOR_ABI = [...ChainlinkAggregatorAbi, ...DESCRIPTION_ABI];
|
|
|
51573
51914
|
function isFailed(r) {
|
|
51574
51915
|
return r === "0x" || r === void 0 || r === null;
|
|
51575
51916
|
}
|
|
51576
|
-
var
|
|
51917
|
+
var ZERO_ADDRESS10 = "0x0000000000000000000000000000000000000000";
|
|
51577
51918
|
async function probeAaveFeedTimestamps(chainId, options = {}) {
|
|
51578
51919
|
const { rpcOverrides, batchSize, retries = 2 } = options;
|
|
51579
51920
|
const result = {};
|
|
@@ -51610,7 +51951,7 @@ async function probeAaveFeedTimestamps(chainId, options = {}) {
|
|
|
51610
51951
|
const raw = sourceResults[i];
|
|
51611
51952
|
if (isFailed(raw)) return;
|
|
51612
51953
|
const source = String(raw).toLowerCase();
|
|
51613
|
-
if (source ===
|
|
51954
|
+
if (source === ZERO_ADDRESS10) return;
|
|
51614
51955
|
sourceOf.set(i, source);
|
|
51615
51956
|
if (!sourceIndex.has(source)) {
|
|
51616
51957
|
sourceIndex.set(source, uniqueSources.length);
|
|
@@ -56030,7 +56371,7 @@ var Multicall3BalanceAbi = [
|
|
|
56030
56371
|
outputs: [{ type: "uint256" }]
|
|
56031
56372
|
}
|
|
56032
56373
|
];
|
|
56033
|
-
var
|
|
56374
|
+
var toBigInt14 = (v) => {
|
|
56034
56375
|
if (v === void 0 || v === null) return void 0;
|
|
56035
56376
|
if (typeof v === "bigint") return v;
|
|
56036
56377
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -56054,12 +56395,12 @@ var readerBeetsStS = (entry) => ({
|
|
|
56054
56395
|
],
|
|
56055
56396
|
abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
|
|
56056
56397
|
parse: ([supply, rate, pool]) => {
|
|
56057
|
-
const totalSupply =
|
|
56058
|
-
const exchangeRate =
|
|
56398
|
+
const totalSupply = toBigInt14(supply);
|
|
56399
|
+
const exchangeRate = toBigInt14(rate);
|
|
56059
56400
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56060
56401
|
return void 0;
|
|
56061
56402
|
}
|
|
56062
|
-
const liquidity =
|
|
56403
|
+
const liquidity = toBigInt14(pool);
|
|
56063
56404
|
return {
|
|
56064
56405
|
totalAssets: totalSupply * exchangeRate / ONE_E189,
|
|
56065
56406
|
totalSupply,
|
|
@@ -56100,12 +56441,12 @@ var readerBenqiSavax = (entry) => ({
|
|
|
56100
56441
|
],
|
|
56101
56442
|
abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
|
|
56102
56443
|
parse: ([supply, rate, totalPooled]) => {
|
|
56103
|
-
const totalSupply =
|
|
56104
|
-
const exchangeRate =
|
|
56444
|
+
const totalSupply = toBigInt14(supply);
|
|
56445
|
+
const exchangeRate = toBigInt14(rate);
|
|
56105
56446
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56106
56447
|
return void 0;
|
|
56107
56448
|
}
|
|
56108
|
-
const totalAssets =
|
|
56449
|
+
const totalAssets = toBigInt14(totalPooled) ?? totalSupply * exchangeRate / ONE_E189;
|
|
56109
56450
|
return {
|
|
56110
56451
|
totalAssets,
|
|
56111
56452
|
totalSupply,
|
|
@@ -56119,7 +56460,7 @@ var readerBgtWrapper1to1 = (entry) => ({
|
|
|
56119
56460
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56120
56461
|
abis: [TotalSupplyAbi],
|
|
56121
56462
|
parse: ([supply]) => {
|
|
56122
|
-
const totalSupply =
|
|
56463
|
+
const totalSupply = toBigInt14(supply);
|
|
56123
56464
|
if (totalSupply === void 0) return void 0;
|
|
56124
56465
|
return {
|
|
56125
56466
|
totalAssets: totalSupply,
|
|
@@ -56148,8 +56489,8 @@ var readerDineroBeraEth = (entry) => ({
|
|
|
56148
56489
|
],
|
|
56149
56490
|
abis: [TotalSupplyAbi, DineroBeraEthAbi],
|
|
56150
56491
|
parse: ([supply, rate]) => {
|
|
56151
|
-
const totalSupply =
|
|
56152
|
-
const exchangeRate =
|
|
56492
|
+
const totalSupply = toBigInt14(supply);
|
|
56493
|
+
const exchangeRate = toBigInt14(rate);
|
|
56153
56494
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56154
56495
|
return void 0;
|
|
56155
56496
|
}
|
|
@@ -56170,9 +56511,9 @@ var readerErc4626 = (entry) => ({
|
|
|
56170
56511
|
],
|
|
56171
56512
|
abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
|
|
56172
56513
|
parse: ([assets, supply, rate]) => {
|
|
56173
|
-
const totalAssets =
|
|
56174
|
-
const totalSupply =
|
|
56175
|
-
const exchangeRate =
|
|
56514
|
+
const totalAssets = toBigInt14(assets);
|
|
56515
|
+
const totalSupply = toBigInt14(supply);
|
|
56516
|
+
const exchangeRate = toBigInt14(rate);
|
|
56176
56517
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
56177
56518
|
return void 0;
|
|
56178
56519
|
}
|
|
@@ -56187,9 +56528,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
|
|
|
56187
56528
|
],
|
|
56188
56529
|
abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
|
|
56189
56530
|
parse: ([assets, supply, rate]) => {
|
|
56190
|
-
const totalAssets =
|
|
56191
|
-
const totalSupply =
|
|
56192
|
-
const exchangeRate =
|
|
56531
|
+
const totalAssets = toBigInt14(assets);
|
|
56532
|
+
const totalSupply = toBigInt14(supply);
|
|
56533
|
+
const exchangeRate = toBigInt14(rate);
|
|
56193
56534
|
if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
|
|
56194
56535
|
return void 0;
|
|
56195
56536
|
}
|
|
@@ -56249,15 +56590,15 @@ var readerEtherFiWeEth = (entry) => {
|
|
|
56249
56590
|
calls,
|
|
56250
56591
|
abis,
|
|
56251
56592
|
parse: (slice2) => {
|
|
56252
|
-
const totalSupply =
|
|
56253
|
-
const exchangeRate =
|
|
56593
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
56594
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
56254
56595
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56255
56596
|
return void 0;
|
|
56256
56597
|
}
|
|
56257
56598
|
let liquidity;
|
|
56258
56599
|
if (lp) {
|
|
56259
|
-
const lpBalance =
|
|
56260
|
-
const locked =
|
|
56600
|
+
const lpBalance = toBigInt14(slice2[2]);
|
|
56601
|
+
const locked = toBigInt14(slice2[3]);
|
|
56261
56602
|
if (lpBalance !== void 0 && locked !== void 0) {
|
|
56262
56603
|
liquidity = lpBalance > locked ? lpBalance - locked : 0n;
|
|
56263
56604
|
}
|
|
@@ -56291,7 +56632,7 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
56291
56632
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56292
56633
|
abis: [TotalSupplyAbi],
|
|
56293
56634
|
parse: ([supply]) => {
|
|
56294
|
-
const totalSupply =
|
|
56635
|
+
const totalSupply = toBigInt14(supply);
|
|
56295
56636
|
if (totalSupply === void 0) return void 0;
|
|
56296
56637
|
return {
|
|
56297
56638
|
totalAssets: totalSupply,
|
|
@@ -56308,8 +56649,8 @@ var readerHyperbeatBeHype = (entry) => {
|
|
|
56308
56649
|
],
|
|
56309
56650
|
abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
|
|
56310
56651
|
parse: ([supply, rate]) => {
|
|
56311
|
-
const totalSupply =
|
|
56312
|
-
const exchangeRate =
|
|
56652
|
+
const totalSupply = toBigInt14(supply);
|
|
56653
|
+
const exchangeRate = toBigInt14(rate);
|
|
56313
56654
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56314
56655
|
return void 0;
|
|
56315
56656
|
}
|
|
@@ -56341,7 +56682,7 @@ var readerKelpRsEth = (entry) => {
|
|
|
56341
56682
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56342
56683
|
abis: [TotalSupplyAbi],
|
|
56343
56684
|
parse: ([supply]) => {
|
|
56344
|
-
const totalSupply =
|
|
56685
|
+
const totalSupply = toBigInt14(supply);
|
|
56345
56686
|
if (totalSupply === void 0) return void 0;
|
|
56346
56687
|
return {
|
|
56347
56688
|
totalAssets: totalSupply,
|
|
@@ -56358,8 +56699,8 @@ var readerKelpRsEth = (entry) => {
|
|
|
56358
56699
|
],
|
|
56359
56700
|
abis: [TotalSupplyAbi, KelpLrtOracleAbi],
|
|
56360
56701
|
parse: ([supply, rate]) => {
|
|
56361
|
-
const totalSupply =
|
|
56362
|
-
const exchangeRate =
|
|
56702
|
+
const totalSupply = toBigInt14(supply);
|
|
56703
|
+
const exchangeRate = toBigInt14(rate);
|
|
56363
56704
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56364
56705
|
return void 0;
|
|
56365
56706
|
}
|
|
@@ -56391,7 +56732,7 @@ var readerKinetiqKHype = (entry) => {
|
|
|
56391
56732
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56392
56733
|
abis: [TotalSupplyAbi],
|
|
56393
56734
|
parse: ([supply]) => {
|
|
56394
|
-
const totalSupply =
|
|
56735
|
+
const totalSupply = toBigInt14(supply);
|
|
56395
56736
|
if (totalSupply === void 0) return void 0;
|
|
56396
56737
|
return {
|
|
56397
56738
|
totalAssets: totalSupply,
|
|
@@ -56408,8 +56749,8 @@ var readerKinetiqKHype = (entry) => {
|
|
|
56408
56749
|
],
|
|
56409
56750
|
abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
|
|
56410
56751
|
parse: ([supply, rate]) => {
|
|
56411
|
-
const totalSupply =
|
|
56412
|
-
const exchangeRate =
|
|
56752
|
+
const totalSupply = toBigInt14(supply);
|
|
56753
|
+
const exchangeRate = toBigInt14(rate);
|
|
56413
56754
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56414
56755
|
return void 0;
|
|
56415
56756
|
}
|
|
@@ -56449,12 +56790,12 @@ var readerLairStKaia = (entry) => ({
|
|
|
56449
56790
|
],
|
|
56450
56791
|
abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
|
|
56451
56792
|
parse: ([supply, rate, totalStaking]) => {
|
|
56452
|
-
const totalSupply =
|
|
56453
|
-
const exchangeRate =
|
|
56793
|
+
const totalSupply = toBigInt14(supply);
|
|
56794
|
+
const exchangeRate = toBigInt14(rate);
|
|
56454
56795
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56455
56796
|
return void 0;
|
|
56456
56797
|
}
|
|
56457
|
-
const totalAssets =
|
|
56798
|
+
const totalAssets = toBigInt14(totalStaking) ?? totalSupply * exchangeRate / ONE_E189;
|
|
56458
56799
|
return {
|
|
56459
56800
|
totalAssets,
|
|
56460
56801
|
totalSupply,
|
|
@@ -56482,8 +56823,8 @@ var readerLidoWstEth = (entry) => ({
|
|
|
56482
56823
|
],
|
|
56483
56824
|
abis: [TotalSupplyAbi, LidoWstEthAbi],
|
|
56484
56825
|
parse: ([supply, rate]) => {
|
|
56485
|
-
const totalSupply =
|
|
56486
|
-
const exchangeRate =
|
|
56826
|
+
const totalSupply = toBigInt14(supply);
|
|
56827
|
+
const exchangeRate = toBigInt14(rate);
|
|
56487
56828
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56488
56829
|
return void 0;
|
|
56489
56830
|
}
|
|
@@ -56521,7 +56862,7 @@ var readerListaSlisBnb = (entry) => {
|
|
|
56521
56862
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56522
56863
|
abis: [TotalSupplyAbi],
|
|
56523
56864
|
parse: ([supply]) => {
|
|
56524
|
-
const totalSupply =
|
|
56865
|
+
const totalSupply = toBigInt14(supply);
|
|
56525
56866
|
if (totalSupply === void 0) return void 0;
|
|
56526
56867
|
return {
|
|
56527
56868
|
totalAssets: totalSupply,
|
|
@@ -56539,12 +56880,12 @@ var readerListaSlisBnb = (entry) => {
|
|
|
56539
56880
|
],
|
|
56540
56881
|
abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
|
|
56541
56882
|
parse: ([supply, rate, pooled]) => {
|
|
56542
|
-
const totalSupply =
|
|
56543
|
-
const exchangeRate =
|
|
56883
|
+
const totalSupply = toBigInt14(supply);
|
|
56884
|
+
const exchangeRate = toBigInt14(rate);
|
|
56544
56885
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56545
56886
|
return void 0;
|
|
56546
56887
|
}
|
|
56547
|
-
const pooledBnb =
|
|
56888
|
+
const pooledBnb = toBigInt14(pooled);
|
|
56548
56889
|
const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E189;
|
|
56549
56890
|
return { totalAssets, totalSupply, exchangeRate };
|
|
56550
56891
|
}
|
|
@@ -56570,7 +56911,7 @@ var readerMantleMEth = (entry) => {
|
|
|
56570
56911
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56571
56912
|
abis: [TotalSupplyAbi],
|
|
56572
56913
|
parse: ([supply]) => {
|
|
56573
|
-
const totalSupply =
|
|
56914
|
+
const totalSupply = toBigInt14(supply);
|
|
56574
56915
|
if (totalSupply === void 0) return void 0;
|
|
56575
56916
|
return {
|
|
56576
56917
|
totalAssets: totalSupply,
|
|
@@ -56587,8 +56928,8 @@ var readerMantleMEth = (entry) => {
|
|
|
56587
56928
|
],
|
|
56588
56929
|
abis: [TotalSupplyAbi, MantleStakingAbi],
|
|
56589
56930
|
parse: ([supply, rate]) => {
|
|
56590
|
-
const totalSupply =
|
|
56591
|
-
const exchangeRate =
|
|
56931
|
+
const totalSupply = toBigInt14(supply);
|
|
56932
|
+
const exchangeRate = toBigInt14(rate);
|
|
56592
56933
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56593
56934
|
return void 0;
|
|
56594
56935
|
}
|
|
@@ -56609,7 +56950,7 @@ var readerOffChain = (entry) => {
|
|
|
56609
56950
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56610
56951
|
abis: [TotalSupplyAbi],
|
|
56611
56952
|
parse: ([supply]) => {
|
|
56612
|
-
const totalSupply =
|
|
56953
|
+
const totalSupply = toBigInt14(supply);
|
|
56613
56954
|
if (totalSupply === void 0) return void 0;
|
|
56614
56955
|
return {
|
|
56615
56956
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -56643,7 +56984,7 @@ var readerRenzoEzEth = (entry) => {
|
|
|
56643
56984
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56644
56985
|
abis: [TotalSupplyAbi],
|
|
56645
56986
|
parse: ([supply]) => {
|
|
56646
|
-
const totalSupply =
|
|
56987
|
+
const totalSupply = toBigInt14(supply);
|
|
56647
56988
|
if (totalSupply === void 0) return void 0;
|
|
56648
56989
|
return {
|
|
56649
56990
|
totalAssets: totalSupply,
|
|
@@ -56660,9 +57001,9 @@ var readerRenzoEzEth = (entry) => {
|
|
|
56660
57001
|
],
|
|
56661
57002
|
abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
|
|
56662
57003
|
parse: ([supply, tvls]) => {
|
|
56663
|
-
const totalSupply =
|
|
57004
|
+
const totalSupply = toBigInt14(supply);
|
|
56664
57005
|
if (totalSupply === void 0 || totalSupply === 0n) return void 0;
|
|
56665
|
-
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ?
|
|
57006
|
+
const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt14(tvls[2]) : void 0;
|
|
56666
57007
|
if (totalTvl === void 0) return void 0;
|
|
56667
57008
|
return {
|
|
56668
57009
|
totalAssets: totalTvl,
|
|
@@ -56716,12 +57057,12 @@ var readerRocketReth = (entry) => {
|
|
|
56716
57057
|
calls,
|
|
56717
57058
|
abis,
|
|
56718
57059
|
parse: (slice2) => {
|
|
56719
|
-
const totalSupply =
|
|
56720
|
-
const exchangeRate =
|
|
57060
|
+
const totalSupply = toBigInt14(slice2[0]);
|
|
57061
|
+
const exchangeRate = toBigInt14(slice2[1]);
|
|
56721
57062
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56722
57063
|
return void 0;
|
|
56723
57064
|
}
|
|
56724
|
-
const liquidity = depositPool ?
|
|
57065
|
+
const liquidity = depositPool ? toBigInt14(slice2[2]) : void 0;
|
|
56725
57066
|
return {
|
|
56726
57067
|
totalAssets: totalSupply * exchangeRate / ONE_E189,
|
|
56727
57068
|
totalSupply,
|
|
@@ -56760,7 +57101,7 @@ var readerStaderEthx = (entry) => {
|
|
|
56760
57101
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56761
57102
|
abis: [TotalSupplyAbi],
|
|
56762
57103
|
parse: ([supply]) => {
|
|
56763
|
-
const totalSupply =
|
|
57104
|
+
const totalSupply = toBigInt14(supply);
|
|
56764
57105
|
if (totalSupply === void 0) return void 0;
|
|
56765
57106
|
return {
|
|
56766
57107
|
totalAssets: totalSupply,
|
|
@@ -56777,8 +57118,8 @@ var readerStaderEthx = (entry) => {
|
|
|
56777
57118
|
],
|
|
56778
57119
|
abis: [TotalSupplyAbi, StaderEthxAbi],
|
|
56779
57120
|
parse: ([supply, rate]) => {
|
|
56780
|
-
const totalSupply =
|
|
56781
|
-
const exchangeRate =
|
|
57121
|
+
const totalSupply = toBigInt14(supply);
|
|
57122
|
+
const exchangeRate = toBigInt14(rate);
|
|
56782
57123
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56783
57124
|
return void 0;
|
|
56784
57125
|
}
|
|
@@ -56806,10 +57147,10 @@ var readerStaderMaticX = (entry) => {
|
|
|
56806
57147
|
],
|
|
56807
57148
|
abis: [TotalSupplyAbi, StaderMaticXAbi],
|
|
56808
57149
|
parse: ([supply, tup]) => {
|
|
56809
|
-
const totalSupply =
|
|
57150
|
+
const totalSupply = toBigInt14(supply);
|
|
56810
57151
|
if (!Array.isArray(tup) || tup.length < 3) return void 0;
|
|
56811
|
-
const amountInMatic =
|
|
56812
|
-
const totalPooledMatic =
|
|
57152
|
+
const amountInMatic = toBigInt14(tup[0]);
|
|
57153
|
+
const totalPooledMatic = toBigInt14(tup[2]);
|
|
56813
57154
|
if (totalSupply === void 0 || amountInMatic === void 0) {
|
|
56814
57155
|
return void 0;
|
|
56815
57156
|
}
|
|
@@ -56842,7 +57183,7 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
56842
57183
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56843
57184
|
abis: [TotalSupplyAbi],
|
|
56844
57185
|
parse: ([supply]) => {
|
|
56845
|
-
const totalSupply =
|
|
57186
|
+
const totalSupply = toBigInt14(supply);
|
|
56846
57187
|
if (totalSupply === void 0) return void 0;
|
|
56847
57188
|
return {
|
|
56848
57189
|
totalAssets: totalSupply,
|
|
@@ -56859,8 +57200,8 @@ var readerStakeWiseOsEth = (entry) => {
|
|
|
56859
57200
|
],
|
|
56860
57201
|
abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
|
|
56861
57202
|
parse: ([supply, rate]) => {
|
|
56862
|
-
const totalSupply =
|
|
56863
|
-
const exchangeRate =
|
|
57203
|
+
const totalSupply = toBigInt14(supply);
|
|
57204
|
+
const exchangeRate = toBigInt14(rate);
|
|
56864
57205
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56865
57206
|
return void 0;
|
|
56866
57207
|
}
|
|
@@ -56892,7 +57233,7 @@ var readerStCelo = (entry) => {
|
|
|
56892
57233
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56893
57234
|
abis: [TotalSupplyAbi],
|
|
56894
57235
|
parse: ([supply]) => {
|
|
56895
|
-
const totalSupply =
|
|
57236
|
+
const totalSupply = toBigInt14(supply);
|
|
56896
57237
|
if (totalSupply === void 0) return void 0;
|
|
56897
57238
|
return {
|
|
56898
57239
|
totalAssets: totalSupply,
|
|
@@ -56909,8 +57250,8 @@ var readerStCelo = (entry) => {
|
|
|
56909
57250
|
],
|
|
56910
57251
|
abis: [TotalSupplyAbi, StCeloManagerAbi],
|
|
56911
57252
|
parse: ([supply, rate]) => {
|
|
56912
|
-
const totalSupply =
|
|
56913
|
-
const exchangeRate =
|
|
57253
|
+
const totalSupply = toBigInt14(supply);
|
|
57254
|
+
const exchangeRate = toBigInt14(rate);
|
|
56914
57255
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56915
57256
|
return void 0;
|
|
56916
57257
|
}
|
|
@@ -56942,8 +57283,8 @@ var readerSwellGetRate = (entry) => ({
|
|
|
56942
57283
|
],
|
|
56943
57284
|
abis: [TotalSupplyAbi, SwellGetRateAbi],
|
|
56944
57285
|
parse: ([supply, rate]) => {
|
|
56945
|
-
const totalSupply =
|
|
56946
|
-
const exchangeRate =
|
|
57286
|
+
const totalSupply = toBigInt14(supply);
|
|
57287
|
+
const exchangeRate = toBigInt14(rate);
|
|
56947
57288
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56948
57289
|
return void 0;
|
|
56949
57290
|
}
|
|
@@ -56974,7 +57315,7 @@ var readerValantisWstHype = (entry) => {
|
|
|
56974
57315
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
56975
57316
|
abis: [TotalSupplyAbi],
|
|
56976
57317
|
parse: ([supply]) => {
|
|
56977
|
-
const totalSupply =
|
|
57318
|
+
const totalSupply = toBigInt14(supply);
|
|
56978
57319
|
if (totalSupply === void 0) return void 0;
|
|
56979
57320
|
return {
|
|
56980
57321
|
totalAssets: totalSupply,
|
|
@@ -56991,8 +57332,8 @@ var readerValantisWstHype = (entry) => {
|
|
|
56991
57332
|
],
|
|
56992
57333
|
abis: [TotalSupplyAbi, ValantisStHypeAbi],
|
|
56993
57334
|
parse: ([supply, rate]) => {
|
|
56994
|
-
const totalSupply =
|
|
56995
|
-
const exchangeRate =
|
|
57335
|
+
const totalSupply = toBigInt14(supply);
|
|
57336
|
+
const exchangeRate = toBigInt14(rate);
|
|
56996
57337
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
56997
57338
|
return void 0;
|
|
56998
57339
|
}
|
|
@@ -57026,7 +57367,7 @@ var readerVedaAccountant = (entry) => {
|
|
|
57026
57367
|
calls: [{ address: entry.address, name: "totalSupply", params: [] }],
|
|
57027
57368
|
abis: [TotalSupplyAbi],
|
|
57028
57369
|
parse: ([supply]) => {
|
|
57029
|
-
const totalSupply =
|
|
57370
|
+
const totalSupply = toBigInt14(supply);
|
|
57030
57371
|
if (totalSupply === void 0) return void 0;
|
|
57031
57372
|
return {
|
|
57032
57373
|
totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
|
|
@@ -57044,8 +57385,8 @@ var readerVedaAccountant = (entry) => {
|
|
|
57044
57385
|
],
|
|
57045
57386
|
abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
|
|
57046
57387
|
parse: ([supply, rate]) => {
|
|
57047
|
-
const totalSupply =
|
|
57048
|
-
const rawRate =
|
|
57388
|
+
const totalSupply = toBigInt14(supply);
|
|
57389
|
+
const rawRate = toBigInt14(rate);
|
|
57049
57390
|
if (totalSupply === void 0 || rawRate === void 0) return void 0;
|
|
57050
57391
|
const exchangeRate = rawRate * scale3;
|
|
57051
57392
|
return {
|
|
@@ -57080,8 +57421,8 @@ var readerAnkrRatio = (entry) => ({
|
|
|
57080
57421
|
],
|
|
57081
57422
|
abis: [TotalSupplyAbi, AnkrRatioAbi],
|
|
57082
57423
|
parse: ([supply, ratio]) => {
|
|
57083
|
-
const totalSupply =
|
|
57084
|
-
const r =
|
|
57424
|
+
const totalSupply = toBigInt14(supply);
|
|
57425
|
+
const r = toBigInt14(ratio);
|
|
57085
57426
|
if (totalSupply === void 0 || r === void 0 || r === 0n) {
|
|
57086
57427
|
return void 0;
|
|
57087
57428
|
}
|
|
@@ -57112,8 +57453,8 @@ var readerBinanceWbeth = (entry) => ({
|
|
|
57112
57453
|
],
|
|
57113
57454
|
abis: [TotalSupplyAbi, WbethExchangeRateAbi],
|
|
57114
57455
|
parse: ([supply, rate]) => {
|
|
57115
|
-
const totalSupply =
|
|
57116
|
-
const exchangeRate =
|
|
57456
|
+
const totalSupply = toBigInt14(supply);
|
|
57457
|
+
const exchangeRate = toBigInt14(rate);
|
|
57117
57458
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
57118
57459
|
return void 0;
|
|
57119
57460
|
}
|
|
@@ -57156,8 +57497,8 @@ var readerCoreEarnRate = (entry) => {
|
|
|
57156
57497
|
],
|
|
57157
57498
|
abis: [CoreEarnRateAbi, TotalSupplyAbi],
|
|
57158
57499
|
parse: ([rate, supply]) => {
|
|
57159
|
-
const r =
|
|
57160
|
-
const totalSupply =
|
|
57500
|
+
const r = toBigInt14(rate);
|
|
57501
|
+
const totalSupply = toBigInt14(supply);
|
|
57161
57502
|
if (r === void 0 || r === 0n || totalSupply === void 0) {
|
|
57162
57503
|
return void 0;
|
|
57163
57504
|
}
|
|
@@ -57178,8 +57519,8 @@ var readerCoreStakedRatio = (entry) => {
|
|
|
57178
57519
|
],
|
|
57179
57520
|
abis: [CoreTotalStakedAbi, TotalSupplyAbi],
|
|
57180
57521
|
parse: ([staked, supply]) => {
|
|
57181
|
-
const totalStaked =
|
|
57182
|
-
const totalSupply =
|
|
57522
|
+
const totalStaked = toBigInt14(staked);
|
|
57523
|
+
const totalSupply = toBigInt14(supply);
|
|
57183
57524
|
if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
|
|
57184
57525
|
return void 0;
|
|
57185
57526
|
}
|
|
@@ -57218,8 +57559,8 @@ var readerKintsuSMon = (entry) => ({
|
|
|
57218
57559
|
],
|
|
57219
57560
|
abis: [KintsuSMonAbi, KintsuSMonAbi],
|
|
57220
57561
|
parse: ([pooled, shares]) => {
|
|
57221
|
-
const totalAssets =
|
|
57222
|
-
const totalSupply =
|
|
57562
|
+
const totalAssets = toBigInt14(pooled);
|
|
57563
|
+
const totalSupply = toBigInt14(shares);
|
|
57223
57564
|
if (totalAssets === void 0 || totalSupply === void 0) return void 0;
|
|
57224
57565
|
const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E189 / totalSupply : ONE_E189;
|
|
57225
57566
|
return { totalAssets, totalSupply, exchangeRate };
|
|
@@ -57740,7 +58081,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
57740
58081
|
const validatorsByAddress = new Map(validatorEntries);
|
|
57741
58082
|
const idleByAddress = /* @__PURE__ */ new Map();
|
|
57742
58083
|
idleEntries.forEach((e, i) => {
|
|
57743
|
-
const bal =
|
|
58084
|
+
const bal = toBigInt14(idleResults[i]);
|
|
57744
58085
|
if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
|
|
57745
58086
|
});
|
|
57746
58087
|
const rawResults = new Array(allCalls.length);
|
|
@@ -57870,7 +58211,7 @@ var BeetsStSWithdrawalAbi = [
|
|
|
57870
58211
|
];
|
|
57871
58212
|
|
|
57872
58213
|
// src/vaults/lst/withdrawals/readers/shared.ts
|
|
57873
|
-
var
|
|
58214
|
+
var toBigInt15 = (v) => {
|
|
57874
58215
|
if (v === void 0 || v === null) return void 0;
|
|
57875
58216
|
if (typeof v === "bigint") return v;
|
|
57876
58217
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -57885,7 +58226,7 @@ var toBigInt14 = (v) => {
|
|
|
57885
58226
|
return void 0;
|
|
57886
58227
|
};
|
|
57887
58228
|
var toNumber = (v) => {
|
|
57888
|
-
const b =
|
|
58229
|
+
const b = toBigInt15(v);
|
|
57889
58230
|
if (b === void 0) return void 0;
|
|
57890
58231
|
if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
|
|
57891
58232
|
return Number(b);
|
|
@@ -57922,7 +58263,7 @@ var readerBeets = {
|
|
|
57922
58263
|
const out = [];
|
|
57923
58264
|
for (let i = 0; i < reqs.length; i++) {
|
|
57924
58265
|
const r = reqs[i];
|
|
57925
|
-
const amount3 =
|
|
58266
|
+
const amount3 = toBigInt15(r.assetAmount);
|
|
57926
58267
|
const ts = toNumber(r.requestTimestamp);
|
|
57927
58268
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
57928
58269
|
if (amount3 === void 0 || ts === void 0) continue;
|
|
@@ -58014,13 +58355,13 @@ var readerBeHype = {
|
|
|
58014
58355
|
const q = stage2[i * 2];
|
|
58015
58356
|
const canClaim = Boolean(stage2[i * 2 + 1]);
|
|
58016
58357
|
if (!q) continue;
|
|
58017
|
-
const hypeAmount = Array.isArray(q) ?
|
|
58358
|
+
const hypeAmount = Array.isArray(q) ? toBigInt15(q[2]) : toBigInt15(q.hypeAmount);
|
|
58018
58359
|
if (hypeAmount === void 0) continue;
|
|
58019
58360
|
out.push({
|
|
58020
58361
|
lst: entry.lst,
|
|
58021
58362
|
brand: entry.brand,
|
|
58022
58363
|
symbol: entry.symbol,
|
|
58023
|
-
requestId: String(
|
|
58364
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
58024
58365
|
amountUnderlying: hypeAmount.toString(),
|
|
58025
58366
|
status: canClaim ? "claimable" : "pending"
|
|
58026
58367
|
});
|
|
@@ -58123,7 +58464,7 @@ var readerBenqi = {
|
|
|
58123
58464
|
for (let i = 0; i < reqs.length; i++) {
|
|
58124
58465
|
const r = reqs[i];
|
|
58125
58466
|
const startedAt = toNumber(r.startedAt);
|
|
58126
|
-
const shareAmount =
|
|
58467
|
+
const shareAmount = toBigInt15(r.shareAmount);
|
|
58127
58468
|
if (startedAt === void 0 || shareAmount === void 0) continue;
|
|
58128
58469
|
const readyAt = startedAt + cooldown;
|
|
58129
58470
|
const expiresAt = readyAt + claimWindow;
|
|
@@ -58212,8 +58553,8 @@ var readerBinanceWbeth2 = {
|
|
|
58212
58553
|
for (let i = 0; i < reqs.length; i++) {
|
|
58213
58554
|
const r = reqs[i];
|
|
58214
58555
|
const triggerTime = toNumber(r.triggerTime);
|
|
58215
|
-
const ethAmount =
|
|
58216
|
-
const wbethAmount =
|
|
58556
|
+
const ethAmount = toBigInt15(r.ethAmount);
|
|
58557
|
+
const wbethAmount = toBigInt15(r.wbethAmount);
|
|
58217
58558
|
if (triggerTime === void 0 || ethAmount === void 0) continue;
|
|
58218
58559
|
const readyAt = triggerTime + lockTime;
|
|
58219
58560
|
const claimed = (toNumber(r.claimTime) ?? 0) > 0;
|
|
@@ -58276,8 +58617,8 @@ var readerBeraPaw = {
|
|
|
58276
58617
|
}
|
|
58277
58618
|
const pos = res[0];
|
|
58278
58619
|
if (!pos) return [];
|
|
58279
|
-
const queued = Array.isArray(pos) ?
|
|
58280
|
-
const available = Array.isArray(pos) ?
|
|
58620
|
+
const queued = Array.isArray(pos) ? toBigInt15(pos[0]) : toBigInt15(pos.queued);
|
|
58621
|
+
const available = Array.isArray(pos) ? toBigInt15(pos[1]) : toBigInt15(pos.available);
|
|
58281
58622
|
const out = [];
|
|
58282
58623
|
if (available !== void 0 && available > 0n) {
|
|
58283
58624
|
out.push({
|
|
@@ -58359,7 +58700,7 @@ var readerIbera = {
|
|
|
58359
58700
|
return [];
|
|
58360
58701
|
}
|
|
58361
58702
|
const length = toNumber(stage1[0]) ?? 0;
|
|
58362
|
-
const frontier =
|
|
58703
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
58363
58704
|
if (length === 0) return [];
|
|
58364
58705
|
const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
|
|
58365
58706
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -58383,7 +58724,7 @@ var readerIbera = {
|
|
|
58383
58724
|
const r = stage2[k];
|
|
58384
58725
|
if (!r) continue;
|
|
58385
58726
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
58386
|
-
const amount3 = Array.isArray(r) ?
|
|
58727
|
+
const amount3 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
|
|
58387
58728
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount3 === void 0 || amount3 === 0n) {
|
|
58388
58729
|
continue;
|
|
58389
58730
|
}
|
|
@@ -58456,7 +58797,7 @@ var readerPrimeStaking = {
|
|
|
58456
58797
|
return [];
|
|
58457
58798
|
}
|
|
58458
58799
|
const length = toNumber(stage1[0]) ?? 0;
|
|
58459
|
-
const frontier =
|
|
58800
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
58460
58801
|
if (length === 0) return [];
|
|
58461
58802
|
const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
|
|
58462
58803
|
const ids = Array.from({ length: length - start }, (_3, k) => start + k);
|
|
@@ -58480,7 +58821,7 @@ var readerPrimeStaking = {
|
|
|
58480
58821
|
const r = stage2[k];
|
|
58481
58822
|
if (!r) continue;
|
|
58482
58823
|
const receiver = Array.isArray(r) ? r[1] : r.receiver;
|
|
58483
|
-
const assets = Array.isArray(r) ?
|
|
58824
|
+
const assets = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.assets);
|
|
58484
58825
|
const processed = Array.isArray(r) ? r[4] : r.processed;
|
|
58485
58826
|
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
|
|
58486
58827
|
continue;
|
|
@@ -58551,8 +58892,8 @@ var readerErc7540 = {
|
|
|
58551
58892
|
],
|
|
58552
58893
|
abi: [Erc7540Abi, Erc7540Abi]
|
|
58553
58894
|
});
|
|
58554
|
-
const pending =
|
|
58555
|
-
const claimable =
|
|
58895
|
+
const pending = toBigInt15(stage1[0]) ?? 0n;
|
|
58896
|
+
const claimable = toBigInt15(stage1[1]) ?? 0n;
|
|
58556
58897
|
const out = [];
|
|
58557
58898
|
if (claimable > 0n) {
|
|
58558
58899
|
const stage2 = await multicallRetry({
|
|
@@ -58566,7 +58907,7 @@ var readerErc7540 = {
|
|
|
58566
58907
|
],
|
|
58567
58908
|
abi: [Erc7540Abi]
|
|
58568
58909
|
});
|
|
58569
|
-
const amount3 =
|
|
58910
|
+
const amount3 = toBigInt15(stage2[0]) ?? claimable;
|
|
58570
58911
|
out.push({
|
|
58571
58912
|
lst: entry.lst,
|
|
58572
58913
|
brand: entry.brand,
|
|
@@ -58623,11 +58964,11 @@ var readerEthenaCooldown = {
|
|
|
58623
58964
|
let cooldownEnd;
|
|
58624
58965
|
let amount3;
|
|
58625
58966
|
if (Array.isArray(cell)) {
|
|
58626
|
-
cooldownEnd =
|
|
58627
|
-
amount3 =
|
|
58967
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
58968
|
+
amount3 = toBigInt15(cell[1]);
|
|
58628
58969
|
} else if (cell && typeof cell === "object") {
|
|
58629
|
-
cooldownEnd =
|
|
58630
|
-
amount3 =
|
|
58970
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
58971
|
+
amount3 = toBigInt15(cell.underlyingAmount);
|
|
58631
58972
|
}
|
|
58632
58973
|
if (!amount3 || amount3 === 0n) return [];
|
|
58633
58974
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -58683,13 +59024,13 @@ var readerSusd3Cooldown = {
|
|
|
58683
59024
|
let windowEnd;
|
|
58684
59025
|
let shares;
|
|
58685
59026
|
if (Array.isArray(cell)) {
|
|
58686
|
-
cooldownEnd =
|
|
58687
|
-
windowEnd =
|
|
58688
|
-
shares =
|
|
59027
|
+
cooldownEnd = toBigInt15(cell[0]);
|
|
59028
|
+
windowEnd = toBigInt15(cell[1]);
|
|
59029
|
+
shares = toBigInt15(cell[2]);
|
|
58689
59030
|
} else if (cell && typeof cell === "object") {
|
|
58690
|
-
cooldownEnd =
|
|
58691
|
-
windowEnd =
|
|
58692
|
-
shares =
|
|
59031
|
+
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
59032
|
+
windowEnd = toBigInt15(cell.windowEnd);
|
|
59033
|
+
shares = toBigInt15(cell.shares);
|
|
58693
59034
|
}
|
|
58694
59035
|
if (!shares || shares === 0n) return [];
|
|
58695
59036
|
let amount3 = shares;
|
|
@@ -58701,7 +59042,7 @@ var readerSusd3Cooldown = {
|
|
|
58701
59042
|
],
|
|
58702
59043
|
abi: [Susd3CooldownStatusAbi]
|
|
58703
59044
|
});
|
|
58704
|
-
amount3 =
|
|
59045
|
+
amount3 = toBigInt15(stage2[0]) ?? shares;
|
|
58705
59046
|
} catch {
|
|
58706
59047
|
}
|
|
58707
59048
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -58775,12 +59116,12 @@ var readerStrataCooldown = {
|
|
|
58775
59116
|
let claimable;
|
|
58776
59117
|
let nextUnlockAt;
|
|
58777
59118
|
if (Array.isArray(cell)) {
|
|
58778
|
-
pending =
|
|
58779
|
-
claimable =
|
|
59119
|
+
pending = toBigInt15(cell[0]);
|
|
59120
|
+
claimable = toBigInt15(cell[1]);
|
|
58780
59121
|
nextUnlockAt = toNumber(cell[2]);
|
|
58781
59122
|
} else if (cell && typeof cell === "object") {
|
|
58782
|
-
pending =
|
|
58783
|
-
claimable =
|
|
59123
|
+
pending = toBigInt15(cell.pending);
|
|
59124
|
+
claimable = toBigInt15(cell.claimable);
|
|
58784
59125
|
nextUnlockAt = toNumber(cell.nextUnlockAt);
|
|
58785
59126
|
}
|
|
58786
59127
|
const escrow = { withdrawQueue: contracts[i], claimToken: escrowToken };
|
|
@@ -58888,7 +59229,7 @@ var readerEtherFi = {
|
|
|
58888
59229
|
calls: enumCalls,
|
|
58889
59230
|
abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
|
|
58890
59231
|
});
|
|
58891
|
-
const ids = stage2.map(
|
|
59232
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
58892
59233
|
if (ids.length === 0) return [];
|
|
58893
59234
|
const detailCalls = ids.flatMap((id) => [
|
|
58894
59235
|
{ address: entry.withdrawalContract, name: "getRequest", params: [id] },
|
|
@@ -58908,7 +59249,7 @@ var readerEtherFi = {
|
|
|
58908
59249
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
58909
59250
|
if (!req) continue;
|
|
58910
59251
|
if (!isValid) continue;
|
|
58911
|
-
const amount3 =
|
|
59252
|
+
const amount3 = toBigInt15(req.amountOfEEth);
|
|
58912
59253
|
if (amount3 === void 0) continue;
|
|
58913
59254
|
out.push({
|
|
58914
59255
|
lst: entry.lst,
|
|
@@ -59003,7 +59344,7 @@ var readerKelp = {
|
|
|
59003
59344
|
}
|
|
59004
59345
|
],
|
|
59005
59346
|
abi: [KelpWithdrawalManagerAbi]
|
|
59006
|
-
}).then((res) =>
|
|
59347
|
+
}).then((res) => toBigInt15(res[0]) ?? 0n)
|
|
59007
59348
|
]);
|
|
59008
59349
|
lengths = storageReads;
|
|
59009
59350
|
currentBlock = block;
|
|
@@ -59035,9 +59376,9 @@ var readerKelp = {
|
|
|
59035
59376
|
for (let i = 0; i < detailCalls.length; i++) {
|
|
59036
59377
|
const r = stage2[i];
|
|
59037
59378
|
if (!r) continue;
|
|
59038
|
-
const expected = Array.isArray(r) ?
|
|
59039
|
-
const startBlock = Array.isArray(r) ?
|
|
59040
|
-
const nonce = Array.isArray(r) ?
|
|
59379
|
+
const expected = Array.isArray(r) ? toBigInt15(r[1]) : toBigInt15(r.expectedAssetAmount);
|
|
59380
|
+
const startBlock = Array.isArray(r) ? toBigInt15(r[2]) : toBigInt15(r.withdrawalStartBlock);
|
|
59381
|
+
const nonce = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.userNonce);
|
|
59041
59382
|
if (expected === void 0 || startBlock === void 0) continue;
|
|
59042
59383
|
const claimable = currentBlock >= startBlock + delayBlocks;
|
|
59043
59384
|
out.push({
|
|
@@ -59114,7 +59455,7 @@ var readerLido = {
|
|
|
59114
59455
|
abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
|
|
59115
59456
|
});
|
|
59116
59457
|
const ids = stage1[0];
|
|
59117
|
-
const frontier =
|
|
59458
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
59118
59459
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
59119
59460
|
const stage2 = await multicallRetry({
|
|
59120
59461
|
chain: chainId,
|
|
@@ -59131,10 +59472,10 @@ var readerLido = {
|
|
|
59131
59472
|
if (!Array.isArray(statuses)) return [];
|
|
59132
59473
|
const out = [];
|
|
59133
59474
|
for (let i = 0; i < ids.length; i++) {
|
|
59134
|
-
const id =
|
|
59475
|
+
const id = toBigInt15(ids[i]);
|
|
59135
59476
|
const s = statuses[i];
|
|
59136
59477
|
if (id === void 0 || !s) continue;
|
|
59137
|
-
const amountOfStETH =
|
|
59478
|
+
const amountOfStETH = toBigInt15(s.amountOfStETH);
|
|
59138
59479
|
const isFinalized = Boolean(s.isFinalized);
|
|
59139
59480
|
const isClaimed = Boolean(s.isClaimed);
|
|
59140
59481
|
if (amountOfStETH === void 0) continue;
|
|
@@ -59243,11 +59584,11 @@ var readerLista = {
|
|
|
59243
59584
|
const status = stage2[i];
|
|
59244
59585
|
if (!status) continue;
|
|
59245
59586
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
59246
|
-
const bnbAmount = Array.isArray(status) ?
|
|
59247
|
-
const snbnbAmount = Array.isArray(req) ?
|
|
59587
|
+
const bnbAmount = Array.isArray(status) ? toBigInt15(status[1]) : toBigInt15(status._amount);
|
|
59588
|
+
const snbnbAmount = Array.isArray(req) ? toBigInt15(req[1]) : toBigInt15(req?.amountInSnBnb);
|
|
59248
59589
|
const amount3 = bnbAmount ?? snbnbAmount;
|
|
59249
59590
|
if (amount3 === void 0) continue;
|
|
59250
|
-
const uuid = Array.isArray(req) ?
|
|
59591
|
+
const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
|
|
59251
59592
|
out.push({
|
|
59252
59593
|
lst: entry.lst,
|
|
59253
59594
|
brand: entry.brand,
|
|
@@ -59332,7 +59673,7 @@ var readerRenzo = {
|
|
|
59332
59673
|
for (let i = 0; i < count; i++) {
|
|
59333
59674
|
const tup = stage2[i];
|
|
59334
59675
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
59335
|
-
const amountToRedeem =
|
|
59676
|
+
const amountToRedeem = toBigInt15(tup[2]);
|
|
59336
59677
|
const createdAt = toNumber(tup[4]);
|
|
59337
59678
|
if (amountToRedeem === void 0 || createdAt === void 0) continue;
|
|
59338
59679
|
const readyAt = createdAt + cooldown;
|
|
@@ -59405,9 +59746,9 @@ var readerStaderEthx2 = {
|
|
|
59405
59746
|
]
|
|
59406
59747
|
});
|
|
59407
59748
|
const ids = stage1[0];
|
|
59408
|
-
const frontier =
|
|
59749
|
+
const frontier = toBigInt15(stage1[1]) ?? 0n;
|
|
59409
59750
|
if (!Array.isArray(ids) || ids.length === 0) return [];
|
|
59410
|
-
const idBigInts = ids.map(
|
|
59751
|
+
const idBigInts = ids.map(toBigInt15).filter((v) => v !== void 0);
|
|
59411
59752
|
const detailCalls = idBigInts.map((id) => ({
|
|
59412
59753
|
address: entry.withdrawalContract,
|
|
59413
59754
|
name: "userWithdrawRequests",
|
|
@@ -59423,8 +59764,8 @@ var readerStaderEthx2 = {
|
|
|
59423
59764
|
const id = idBigInts[i];
|
|
59424
59765
|
const tup = stage2[i];
|
|
59425
59766
|
if (!Array.isArray(tup) || tup.length < 5) continue;
|
|
59426
|
-
const ethExpected =
|
|
59427
|
-
const ethFinalized =
|
|
59767
|
+
const ethExpected = toBigInt15(tup[2]) ?? 0n;
|
|
59768
|
+
const ethFinalized = toBigInt15(tup[3]) ?? 0n;
|
|
59428
59769
|
const isFinalized = id < frontier && ethFinalized > 0n;
|
|
59429
59770
|
const queuePosition = isFinalized ? 0 : Number(id - frontier);
|
|
59430
59771
|
out.push({
|
|
@@ -59503,13 +59844,13 @@ var readerStaderMaticX2 = {
|
|
|
59503
59844
|
});
|
|
59504
59845
|
const arr = stage1[0];
|
|
59505
59846
|
if (!Array.isArray(arr)) return [];
|
|
59506
|
-
const currentEpoch = stakeManager ?
|
|
59507
|
-
const delay = stakeManager ?
|
|
59847
|
+
const currentEpoch = stakeManager ? toBigInt15(stage1[1]) ?? 0n : 0n;
|
|
59848
|
+
const delay = stakeManager ? toBigInt15(stage1[2]) ?? 0n : 0n;
|
|
59508
59849
|
const out = [];
|
|
59509
59850
|
for (let i = 0; i < arr.length; i++) {
|
|
59510
59851
|
const r = arr[i];
|
|
59511
|
-
const amount3 =
|
|
59512
|
-
const requestEpoch =
|
|
59852
|
+
const amount3 = toBigInt15(r.amount) ?? 0n;
|
|
59853
|
+
const requestEpoch = toBigInt15(r.requestEpoch);
|
|
59513
59854
|
if (requestEpoch === void 0) continue;
|
|
59514
59855
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
59515
59856
|
out.push({
|
|
@@ -59594,9 +59935,9 @@ var readerMantle = {
|
|
|
59594
59935
|
if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
|
|
59595
59936
|
continue;
|
|
59596
59937
|
}
|
|
59597
|
-
const ethRequested = Array.isArray(detail) ?
|
|
59938
|
+
const ethRequested = Array.isArray(detail) ? toBigInt15(detail[3]) : toBigInt15(detail.ethRequested);
|
|
59598
59939
|
const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
|
|
59599
|
-
const claimable = Array.isArray(info) ?
|
|
59940
|
+
const claimable = Array.isArray(info) ? toBigInt15(info[1]) : toBigInt15(info.claimableAmount);
|
|
59600
59941
|
if (ethRequested === void 0) continue;
|
|
59601
59942
|
out.push({
|
|
59602
59943
|
lst: entry.lst,
|
|
@@ -59675,8 +60016,8 @@ var readerPuffer = {
|
|
|
59675
60016
|
calls,
|
|
59676
60017
|
abi: calls.map(() => PufferWithdrawalManagerAbi)
|
|
59677
60018
|
});
|
|
59678
|
-
const finalizedBatch =
|
|
59679
|
-
const batchSize =
|
|
60019
|
+
const finalizedBatch = toBigInt15(results[detailCalls.length]) ?? 0n;
|
|
60020
|
+
const batchSize = toBigInt15(results[detailCalls.length + 1]) ?? 0n;
|
|
59680
60021
|
const out = [];
|
|
59681
60022
|
const lcUser = user.toLowerCase();
|
|
59682
60023
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -59686,7 +60027,7 @@ var readerPuffer = {
|
|
|
59686
60027
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
59687
60028
|
continue;
|
|
59688
60029
|
}
|
|
59689
|
-
const pufETHAmount = Array.isArray(d) ?
|
|
60030
|
+
const pufETHAmount = Array.isArray(d) ? toBigInt15(d[0]) : toBigInt15(d.pufETHAmount);
|
|
59690
60031
|
if (pufETHAmount === void 0) continue;
|
|
59691
60032
|
const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
|
|
59692
60033
|
const claimable = batchIdx <= finalizedBatch;
|
|
@@ -59784,7 +60125,7 @@ var readerKinetiq = {
|
|
|
59784
60125
|
for (let i = 0; i < count; i++) {
|
|
59785
60126
|
const r = stage2[i];
|
|
59786
60127
|
if (!r) continue;
|
|
59787
|
-
const hypeAmount = Array.isArray(r) ?
|
|
60128
|
+
const hypeAmount = Array.isArray(r) ? toBigInt15(r[0]) : toBigInt15(r.hypeAmount);
|
|
59788
60129
|
const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
|
|
59789
60130
|
if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
|
|
59790
60131
|
continue;
|
|
@@ -59912,7 +60253,7 @@ var readerStakeWise = {
|
|
|
59912
60253
|
const claimedByIdx = /* @__PURE__ */ new Map();
|
|
59913
60254
|
for (let i = 0; i < onChainChecks.length; i++) {
|
|
59914
60255
|
const cell = checkResults[i];
|
|
59915
|
-
const claimed = Array.isArray(cell) ?
|
|
60256
|
+
const claimed = Array.isArray(cell) ? toBigInt15(cell[2]) : toBigInt15(cell?.claimedAssets);
|
|
59916
60257
|
if (claimed !== void 0 && claimed > 0n) {
|
|
59917
60258
|
claimedByIdx.set(onChainChecks[i].idx, claimed);
|
|
59918
60259
|
}
|
|
@@ -59920,7 +60261,7 @@ var readerStakeWise = {
|
|
|
59920
60261
|
const out = [];
|
|
59921
60262
|
for (let i = 0; i < requests.length; i++) {
|
|
59922
60263
|
const r = requests[i];
|
|
59923
|
-
const amount3 =
|
|
60264
|
+
const amount3 = toBigInt15(r.totalAssets) ?? 0n;
|
|
59924
60265
|
const onChainClaimed = claimedByIdx.get(i);
|
|
59925
60266
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
59926
60267
|
out.push({
|
|
@@ -59977,7 +60318,7 @@ var readerStCelo2 = {
|
|
|
59977
60318
|
const timestamps = cell[1] ?? [];
|
|
59978
60319
|
const out = [];
|
|
59979
60320
|
for (let i = 0; i < values.length; i++) {
|
|
59980
|
-
const amount3 =
|
|
60321
|
+
const amount3 = toBigInt15(values[i]);
|
|
59981
60322
|
const readyAt = toNumber(timestamps[i]);
|
|
59982
60323
|
if (amount3 === void 0 || readyAt === void 0) continue;
|
|
59983
60324
|
out.push({
|
|
@@ -60057,7 +60398,7 @@ var readerSwell = {
|
|
|
60057
60398
|
abi: [SwellRswExitAbi, SwellRswExitAbi]
|
|
60058
60399
|
});
|
|
60059
60400
|
const count = toNumber(stage1[0]) ?? 0;
|
|
60060
|
-
const lastProcessed =
|
|
60401
|
+
const lastProcessed = toBigInt15(stage1[1]) ?? 0n;
|
|
60061
60402
|
if (count === 0) return [];
|
|
60062
60403
|
const enumCalls = Array.from({ length: count }, (_3, i) => ({
|
|
60063
60404
|
address: entry.withdrawalContract,
|
|
@@ -60069,7 +60410,7 @@ var readerSwell = {
|
|
|
60069
60410
|
calls: enumCalls,
|
|
60070
60411
|
abi: enumCalls.map(() => SwellRswExitAbi)
|
|
60071
60412
|
});
|
|
60072
|
-
const ids = stage2.map(
|
|
60413
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
60073
60414
|
if (ids.length === 0) return [];
|
|
60074
60415
|
const detailCalls = ids.map((id) => ({
|
|
60075
60416
|
address: entry.withdrawalContract,
|
|
@@ -60086,7 +60427,7 @@ var readerSwell = {
|
|
|
60086
60427
|
const id = ids[i];
|
|
60087
60428
|
const r = stage3[i];
|
|
60088
60429
|
if (!r) continue;
|
|
60089
|
-
const amount3 =
|
|
60430
|
+
const amount3 = toBigInt15(r.amount);
|
|
60090
60431
|
if (amount3 === void 0) continue;
|
|
60091
60432
|
const claimable = id <= lastProcessed;
|
|
60092
60433
|
out.push({
|
|
@@ -60160,14 +60501,14 @@ var readerValantis = {
|
|
|
60160
60501
|
for (let i = 0; i < burns.length; i++) {
|
|
60161
60502
|
const b = burns[i];
|
|
60162
60503
|
if (!b) continue;
|
|
60163
|
-
const amount3 = Array.isArray(b) ?
|
|
60504
|
+
const amount3 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
|
|
60164
60505
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
60165
60506
|
if (amount3 === void 0 || completed) continue;
|
|
60166
60507
|
out.push({
|
|
60167
60508
|
lst: entry.lst,
|
|
60168
60509
|
brand: entry.brand,
|
|
60169
60510
|
symbol: entry.symbol,
|
|
60170
|
-
requestId: String(
|
|
60511
|
+
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
60171
60512
|
amountUnderlying: amount3.toString(),
|
|
60172
60513
|
status: redeemable[i] ? "claimable" : "pending"
|
|
60173
60514
|
});
|
|
@@ -60240,7 +60581,7 @@ var readerTruFin = {
|
|
|
60240
60581
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
60241
60582
|
continue;
|
|
60242
60583
|
}
|
|
60243
|
-
const amount3 = Array.isArray(w) ?
|
|
60584
|
+
const amount3 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
|
|
60244
60585
|
if (amount3 === void 0 || amount3 === 0n) continue;
|
|
60245
60586
|
out.push({
|
|
60246
60587
|
lst: entry.lst,
|
|
@@ -60336,7 +60677,7 @@ var readerYieldNest = {
|
|
|
60336
60677
|
calls: enumCalls,
|
|
60337
60678
|
abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
|
|
60338
60679
|
});
|
|
60339
|
-
const ids = stage2.map(
|
|
60680
|
+
const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
|
|
60340
60681
|
if (ids.length === 0) return [];
|
|
60341
60682
|
const detailCalls = ids.map((id) => ({
|
|
60342
60683
|
address: entry.withdrawalContract,
|
|
@@ -60355,7 +60696,7 @@ var readerYieldNest = {
|
|
|
60355
60696
|
const id = ids[i];
|
|
60356
60697
|
const r = stage3[i];
|
|
60357
60698
|
if (!r) continue;
|
|
60358
|
-
const amount3 =
|
|
60699
|
+
const amount3 = toBigInt15(r.amount);
|
|
60359
60700
|
const created = toNumber(r.creationTimestamp);
|
|
60360
60701
|
const processed = Boolean(r.processed);
|
|
60361
60702
|
if (amount3 === void 0 || created === void 0) continue;
|
|
@@ -61223,7 +61564,7 @@ var NavOracleReadAbi = [
|
|
|
61223
61564
|
|
|
61224
61565
|
// src/vaults/savings/readers/shared.ts
|
|
61225
61566
|
var ONE_E1811 = 10n ** 18n;
|
|
61226
|
-
var
|
|
61567
|
+
var toBigInt16 = (v) => {
|
|
61227
61568
|
if (v === void 0 || v === null) return void 0;
|
|
61228
61569
|
if (typeof v === "bigint") return v;
|
|
61229
61570
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -61254,9 +61595,9 @@ var readerErc46262 = (entry) => {
|
|
|
61254
61595
|
],
|
|
61255
61596
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
61256
61597
|
parse: ([assets, supply, rate]) => {
|
|
61257
|
-
const totalAssets =
|
|
61258
|
-
const totalSupply =
|
|
61259
|
-
const convertToAssetsRaw =
|
|
61598
|
+
const totalAssets = toBigInt16(assets);
|
|
61599
|
+
const totalSupply = toBigInt16(supply);
|
|
61600
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
61260
61601
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
61261
61602
|
return void 0;
|
|
61262
61603
|
}
|
|
@@ -61442,13 +61783,13 @@ var readerErc4626Idle = (entry) => {
|
|
|
61442
61783
|
],
|
|
61443
61784
|
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, BalanceOfAbi],
|
|
61444
61785
|
parse: ([assets, supply, rate, inventoryBalance]) => {
|
|
61445
|
-
const totalAssets =
|
|
61446
|
-
const totalSupply =
|
|
61447
|
-
const convertToAssetsRaw =
|
|
61786
|
+
const totalAssets = toBigInt16(assets);
|
|
61787
|
+
const totalSupply = toBigInt16(supply);
|
|
61788
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
61448
61789
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
61449
61790
|
return void 0;
|
|
61450
61791
|
}
|
|
61451
|
-
const capacity =
|
|
61792
|
+
const capacity = toBigInt16(inventoryBalance);
|
|
61452
61793
|
return {
|
|
61453
61794
|
totalAssets,
|
|
61454
61795
|
totalSupply,
|
|
@@ -61491,13 +61832,13 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
61491
61832
|
AvailableWithdrawLimitAbi
|
|
61492
61833
|
],
|
|
61493
61834
|
parse: ([assets, supply, rate, withdrawLimit]) => {
|
|
61494
|
-
const totalAssets =
|
|
61495
|
-
const totalSupply =
|
|
61496
|
-
const convertToAssetsRaw =
|
|
61835
|
+
const totalAssets = toBigInt16(assets);
|
|
61836
|
+
const totalSupply = toBigInt16(supply);
|
|
61837
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
61497
61838
|
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
61498
61839
|
return void 0;
|
|
61499
61840
|
}
|
|
61500
|
-
const capacity =
|
|
61841
|
+
const capacity = toBigInt16(withdrawLimit);
|
|
61501
61842
|
return {
|
|
61502
61843
|
totalAssets,
|
|
61503
61844
|
totalSupply,
|
|
@@ -61520,9 +61861,9 @@ var readerFrankencoinSavings = (entry) => ({
|
|
|
61520
61861
|
],
|
|
61521
61862
|
abis: [BalanceOfAbi, FrankencoinSavingsReadAbi],
|
|
61522
61863
|
parse: ([balance, ratePPM]) => {
|
|
61523
|
-
const deposits =
|
|
61864
|
+
const deposits = toBigInt16(balance);
|
|
61524
61865
|
if (deposits === void 0) return void 0;
|
|
61525
|
-
if (
|
|
61866
|
+
if (toBigInt16(ratePPM) === void 0) return void 0;
|
|
61526
61867
|
return {
|
|
61527
61868
|
totalAssets: deposits,
|
|
61528
61869
|
// No shares exist; the "supply" IS the deposited principal, and
|
|
@@ -61550,10 +61891,10 @@ var readerNavOracle = (entry) => {
|
|
|
61550
61891
|
],
|
|
61551
61892
|
abis: [TotalSupplyAbi2, NavOracleReadAbi],
|
|
61552
61893
|
parse: ([supply, round]) => {
|
|
61553
|
-
const totalSupply =
|
|
61894
|
+
const totalSupply = toBigInt16(supply);
|
|
61554
61895
|
if (totalSupply === void 0) return void 0;
|
|
61555
61896
|
const raw = Array.isArray(round) ? round[1] : round?.answer;
|
|
61556
|
-
const exchangeRate =
|
|
61897
|
+
const exchangeRate = toBigInt16(raw);
|
|
61557
61898
|
if (exchangeRate === void 0 || exchangeRate <= 0n) return void 0;
|
|
61558
61899
|
return {
|
|
61559
61900
|
totalAssets: totalSupply * exchangeRate * underlyingUnit / (ONE_E1811 * shareUnit),
|
|
@@ -61595,14 +61936,14 @@ var readerNativeWnlp = (entry) => {
|
|
|
61595
61936
|
NativeWithdrawQueueReadAbi
|
|
61596
61937
|
],
|
|
61597
61938
|
parse: ([supply, rate, feeBips, instantEnabled, inventory, window]) => {
|
|
61598
|
-
const totalSupply =
|
|
61599
|
-
const exchangeRate =
|
|
61939
|
+
const totalSupply = toBigInt16(supply);
|
|
61940
|
+
const exchangeRate = toBigInt16(rate);
|
|
61600
61941
|
if (totalSupply === void 0 || exchangeRate === void 0) {
|
|
61601
61942
|
return void 0;
|
|
61602
61943
|
}
|
|
61603
|
-
const capacity =
|
|
61604
|
-
const windowSeconds =
|
|
61605
|
-
const bips =
|
|
61944
|
+
const capacity = toBigInt16(inventory);
|
|
61945
|
+
const windowSeconds = toBigInt16(window);
|
|
61946
|
+
const bips = toBigInt16(feeBips);
|
|
61606
61947
|
return {
|
|
61607
61948
|
totalAssets: totalSupply * exchangeRate / ONE_E1811,
|
|
61608
61949
|
totalSupply,
|
|
@@ -61642,17 +61983,17 @@ var readerYieldBasisLt = (entry) => {
|
|
|
61642
61983
|
YieldBasisAmmReadAbi
|
|
61643
61984
|
],
|
|
61644
61985
|
parse: ([supply, pps, redeemPerShare, maxDebt, valueOracle]) => {
|
|
61645
|
-
const totalSupply =
|
|
61646
|
-
const fundamental =
|
|
61647
|
-
const redeemRaw =
|
|
61986
|
+
const totalSupply = toBigInt16(supply);
|
|
61987
|
+
const fundamental = toBigInt16(pps);
|
|
61988
|
+
const redeemRaw = toBigInt16(redeemPerShare);
|
|
61648
61989
|
if (totalSupply === void 0 || fundamental === void 0 || redeemRaw === void 0) {
|
|
61649
61990
|
return void 0;
|
|
61650
61991
|
}
|
|
61651
61992
|
if (totalSupply === 0n || redeemRaw === 0n) return void 0;
|
|
61652
61993
|
const totalAssets = totalSupply * redeemRaw / ONE_SHARE;
|
|
61653
61994
|
const exchangeRate = redeemRaw * ONE_E1811 / underlyingUnit;
|
|
61654
|
-
const equity = Array.isArray(valueOracle) ?
|
|
61655
|
-
const cap =
|
|
61995
|
+
const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
|
|
61996
|
+
const cap = toBigInt16(maxDebt);
|
|
61656
61997
|
let depositCapacity;
|
|
61657
61998
|
if (cap !== void 0 && equity !== void 0 && equity > 0n) {
|
|
61658
61999
|
const headroom = cap / 2n - equity;
|
|
@@ -62173,7 +62514,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
|
|
|
62173
62514
|
|
|
62174
62515
|
// src/vaults/aave-earn/fetchPublic.ts
|
|
62175
62516
|
var BRAND2 = "Aave";
|
|
62176
|
-
var
|
|
62517
|
+
var toBigInt17 = (v) => {
|
|
62177
62518
|
if (v === void 0 || v === null) return void 0;
|
|
62178
62519
|
if (typeof v === "bigint") return v;
|
|
62179
62520
|
if (typeof v === "number") return BigInt(v);
|
|
@@ -62233,15 +62574,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
62233
62574
|
const token = v.usedReserve.underlyingToken;
|
|
62234
62575
|
const underlyingLc = token.address.toLowerCase();
|
|
62235
62576
|
const assetDecimals = token.decimals;
|
|
62236
|
-
const shareDecOnChain =
|
|
62577
|
+
const shareDecOnChain = toBigInt17(slice2[1]);
|
|
62237
62578
|
const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
|
|
62238
|
-
const totalSupply =
|
|
62579
|
+
const totalSupply = toBigInt17(slice2[2]);
|
|
62239
62580
|
if (totalSupply === void 0) continue;
|
|
62240
62581
|
const shareUnit = 10n ** BigInt(decimals);
|
|
62241
62582
|
const underlyingUnit = 10n ** BigInt(assetDecimals);
|
|
62242
|
-
const convertToAssets =
|
|
62583
|
+
const convertToAssets = toBigInt17(slice2[3]) ?? 0n;
|
|
62243
62584
|
const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
|
|
62244
|
-
const totalAssets =
|
|
62585
|
+
const totalAssets = toBigInt17(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
|
|
62245
62586
|
const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
|
|
62246
62587
|
const asset = tokenList[underlyingLc];
|
|
62247
62588
|
const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num7(v.balance.usdPerToken) : void 0);
|
|
@@ -62288,6 +62629,23 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
62288
62629
|
// src/vaults/upshift/fetchPublic.ts
|
|
62289
62630
|
var num8 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
62290
62631
|
var isEvmAddress = (a) => /^0x[0-9a-fA-F]{40}$/.test(a);
|
|
62632
|
+
var str4 = (v) => {
|
|
62633
|
+
const s = typeof v === "string" ? v.trim() : "";
|
|
62634
|
+
return s ? s : void 0;
|
|
62635
|
+
};
|
|
62636
|
+
var UNCAPPED_SENTINEL = 1e12;
|
|
62637
|
+
var deriveDepositCapacity = (v, totalAssetsRaw) => {
|
|
62638
|
+
const cap = v.depositCap ?? v.maxSupply;
|
|
62639
|
+
const normalized = Number(cap?.normalized);
|
|
62640
|
+
if (!cap?.raw || !Number.isFinite(normalized)) return void 0;
|
|
62641
|
+
if (normalized >= UNCAPPED_SENTINEL) return void 0;
|
|
62642
|
+
try {
|
|
62643
|
+
const remaining = BigInt(cap.raw) - BigInt(totalAssetsRaw);
|
|
62644
|
+
return remaining > 0n ? remaining.toString() : "0";
|
|
62645
|
+
} catch {
|
|
62646
|
+
return void 0;
|
|
62647
|
+
}
|
|
62648
|
+
};
|
|
62291
62649
|
var derivePricePerShare = (totalAssetsRaw, totalSupplyRaw, shareDecimals) => {
|
|
62292
62650
|
try {
|
|
62293
62651
|
const supply = BigInt(totalSupplyRaw);
|
|
@@ -62324,6 +62682,18 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
62324
62682
|
const totalAssetsUsd = apiTvlUsd || totalAssetsFormatted * priceUsd;
|
|
62325
62683
|
const name = (v.name ?? "").trim();
|
|
62326
62684
|
const symbol = (v.receipt?.symbol ?? "").trim();
|
|
62685
|
+
const strategist = (v.strategists ?? []).find((s) => str4(s?.name));
|
|
62686
|
+
const curatorName = str4(strategist?.name);
|
|
62687
|
+
const performanceStanding = num8(v.fees?.performance) ?? 0;
|
|
62688
|
+
const managementStanding = num8(v.fees?.management) ?? 0;
|
|
62689
|
+
const performanceWaived = v.fees?.isPerformanceWaived === true;
|
|
62690
|
+
const managementWaived = v.fees?.isManagementWaived === true;
|
|
62691
|
+
const instant = v.instant_redeem_config;
|
|
62692
|
+
const instantRedeemEnabled = !!instant && instant.isPaused !== true;
|
|
62693
|
+
const spreadBps = instantRedeemEnabled ? Math.max(
|
|
62694
|
+
0,
|
|
62695
|
+
...(instant?.redeemableAssets ?? []).map((a) => num8(a?.spreadBps) ?? 0)
|
|
62696
|
+
) : void 0;
|
|
62327
62697
|
return {
|
|
62328
62698
|
address: receiptAddr,
|
|
62329
62699
|
vaultAddress: vaultAddr,
|
|
@@ -62348,8 +62718,30 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
62348
62718
|
points: num8(v.apy?.pointsApy),
|
|
62349
62719
|
underlying: num8(v.apy?.underlyingApy)
|
|
62350
62720
|
},
|
|
62721
|
+
curatorName,
|
|
62722
|
+
curatorLogoURI: str4(strategist?.logo),
|
|
62723
|
+
description: str4(v.description),
|
|
62724
|
+
version: str4(v.version),
|
|
62725
|
+
fee: performanceWaived ? 0 : performanceStanding,
|
|
62726
|
+
managementFee: managementWaived ? 0 : managementStanding,
|
|
62727
|
+
feeDetail: {
|
|
62728
|
+
performanceStanding,
|
|
62729
|
+
managementStanding,
|
|
62730
|
+
performanceWaived,
|
|
62731
|
+
managementWaived,
|
|
62732
|
+
performanceWaivedUntilDate: str4(v.fees?.performanceFeeWaivedUntilDate),
|
|
62733
|
+
managementWaivedUntilDate: str4(v.fees?.managementFeeWaivedUntilDate)
|
|
62734
|
+
},
|
|
62735
|
+
withdrawalCooldownSeconds: num8(v.lagDuration) ?? 0,
|
|
62736
|
+
...instantRedeemEnabled ? {
|
|
62737
|
+
withdrawalMode: "fee-or-queued",
|
|
62738
|
+
withdrawFeeBps: spreadBps,
|
|
62739
|
+
instantRedeemEnabled: true
|
|
62740
|
+
} : {},
|
|
62351
62741
|
isDepositPaused: v.isDepositPaused ?? false,
|
|
62352
62742
|
isWithdrawalPaused: v.isWithdrawalPaused ?? false,
|
|
62743
|
+
isClosed: v.withdrawalOnly === true,
|
|
62744
|
+
depositCapacity: deriveDepositCapacity(v, totalAssetsRaw),
|
|
62353
62745
|
asset: assetMeta,
|
|
62354
62746
|
priceUsd,
|
|
62355
62747
|
totalAssetsFormatted,
|
|
@@ -63846,7 +64238,7 @@ var fetchGmxVaults = async (chainId, multicallRetry, options) => {
|
|
|
63846
64238
|
// src/vaults/gmx/fetchUser.ts
|
|
63847
64239
|
var DEFAULT_CAP = 50;
|
|
63848
64240
|
var isBig = (v) => typeof v === "bigint";
|
|
63849
|
-
var
|
|
64241
|
+
var str5 = (v) => isBig(v) ? v.toString() : "0";
|
|
63850
64242
|
var getGmxUserPositions = async (chainId, account, multicallRetry, options) => {
|
|
63851
64243
|
const empty = {
|
|
63852
64244
|
chainId,
|
|
@@ -63974,11 +64366,11 @@ var getGmxUserPositions = async (chainId, account, multicallRetry, options) => {
|
|
|
63974
64366
|
market: a.market.toLowerCase(),
|
|
63975
64367
|
initialLongToken: a.initialLongToken.toLowerCase(),
|
|
63976
64368
|
initialShortToken: a.initialShortToken.toLowerCase(),
|
|
63977
|
-
initialLongTokenAmount:
|
|
63978
|
-
initialShortTokenAmount:
|
|
63979
|
-
minOut:
|
|
63980
|
-
executionFee:
|
|
63981
|
-
updatedAtTime:
|
|
64369
|
+
initialLongTokenAmount: str5(n.initialLongTokenAmount),
|
|
64370
|
+
initialShortTokenAmount: str5(n.initialShortTokenAmount),
|
|
64371
|
+
minOut: str5(n.minMarketTokens),
|
|
64372
|
+
executionFee: str5(n.executionFee),
|
|
64373
|
+
updatedAtTime: str5(n.updatedAtTime)
|
|
63982
64374
|
});
|
|
63983
64375
|
});
|
|
63984
64376
|
withdrawalKeys.forEach((key3, i) => {
|
|
@@ -63992,11 +64384,11 @@ var getGmxUserPositions = async (chainId, account, multicallRetry, options) => {
|
|
|
63992
64384
|
account: a.account.toLowerCase(),
|
|
63993
64385
|
receiver: a.receiver.toLowerCase(),
|
|
63994
64386
|
market: a.market.toLowerCase(),
|
|
63995
|
-
tokenAmount:
|
|
63996
|
-
minLongTokenAmount:
|
|
63997
|
-
minShortTokenAmount:
|
|
63998
|
-
executionFee:
|
|
63999
|
-
updatedAtTime:
|
|
64387
|
+
tokenAmount: str5(n.marketTokenAmount),
|
|
64388
|
+
minLongTokenAmount: str5(n.minLongTokenAmount),
|
|
64389
|
+
minShortTokenAmount: str5(n.minShortTokenAmount),
|
|
64390
|
+
executionFee: str5(n.executionFee),
|
|
64391
|
+
updatedAtTime: str5(n.updatedAtTime)
|
|
64000
64392
|
});
|
|
64001
64393
|
});
|
|
64002
64394
|
const glvDeposits = Array.isArray(glvRes[0]) ? glvRes[0] : [];
|
|
@@ -64013,11 +64405,11 @@ var getGmxUserPositions = async (chainId, account, multicallRetry, options) => {
|
|
|
64013
64405
|
glv: a.glv.toLowerCase(),
|
|
64014
64406
|
initialLongToken: a.initialLongToken.toLowerCase(),
|
|
64015
64407
|
initialShortToken: a.initialShortToken.toLowerCase(),
|
|
64016
|
-
initialLongTokenAmount:
|
|
64017
|
-
initialShortTokenAmount:
|
|
64018
|
-
minOut:
|
|
64019
|
-
executionFee:
|
|
64020
|
-
updatedAtTime:
|
|
64408
|
+
initialLongTokenAmount: str5(n.initialLongTokenAmount),
|
|
64409
|
+
initialShortTokenAmount: str5(n.initialShortTokenAmount),
|
|
64410
|
+
minOut: str5(n.minGlvTokens),
|
|
64411
|
+
executionFee: str5(n.executionFee),
|
|
64412
|
+
updatedAtTime: str5(n.updatedAtTime)
|
|
64021
64413
|
});
|
|
64022
64414
|
}
|
|
64023
64415
|
for (const w of glvWithdrawals) {
|
|
@@ -64030,11 +64422,11 @@ var getGmxUserPositions = async (chainId, account, multicallRetry, options) => {
|
|
|
64030
64422
|
receiver: a.receiver.toLowerCase(),
|
|
64031
64423
|
market: a.market.toLowerCase(),
|
|
64032
64424
|
glv: a.glv.toLowerCase(),
|
|
64033
|
-
tokenAmount:
|
|
64034
|
-
minLongTokenAmount:
|
|
64035
|
-
minShortTokenAmount:
|
|
64036
|
-
executionFee:
|
|
64037
|
-
updatedAtTime:
|
|
64425
|
+
tokenAmount: str5(n.glvTokenAmount),
|
|
64426
|
+
minLongTokenAmount: str5(n.minLongTokenAmount),
|
|
64427
|
+
minShortTokenAmount: str5(n.minShortTokenAmount),
|
|
64428
|
+
executionFee: str5(n.executionFee),
|
|
64429
|
+
updatedAtTime: str5(n.updatedAtTime)
|
|
64038
64430
|
});
|
|
64039
64431
|
}
|
|
64040
64432
|
return {
|
|
@@ -64111,7 +64503,7 @@ async function getJson4(url, label) {
|
|
|
64111
64503
|
}
|
|
64112
64504
|
return response.json();
|
|
64113
64505
|
}
|
|
64114
|
-
function
|
|
64506
|
+
function cache3(slot, build, store) {
|
|
64115
64507
|
const now = Date.now();
|
|
64116
64508
|
if (slot && now - slot.at < CACHE_TTL_MS6) return slot.promise;
|
|
64117
64509
|
const promise = build();
|
|
@@ -64121,7 +64513,7 @@ function cache(slot, build, store) {
|
|
|
64121
64513
|
return promise;
|
|
64122
64514
|
}
|
|
64123
64515
|
function fetchPendleApiMarkets() {
|
|
64124
|
-
return
|
|
64516
|
+
return cache3(
|
|
64125
64517
|
marketsCache,
|
|
64126
64518
|
async () => (await getJson4(PENDLE_MARKETS_URL, "markets"))?.markets ?? [],
|
|
64127
64519
|
(c) => {
|
|
@@ -64131,7 +64523,7 @@ function fetchPendleApiMarkets() {
|
|
|
64131
64523
|
}
|
|
64132
64524
|
var assetKey = (chainId, address) => `${chainId}-${address.toLowerCase()}`;
|
|
64133
64525
|
function fetchPendleApiAssets() {
|
|
64134
|
-
return
|
|
64526
|
+
return cache3(
|
|
64135
64527
|
assetsCache,
|
|
64136
64528
|
async () => {
|
|
64137
64529
|
const json = await getJson4(PENDLE_ASSETS_URL, "assets");
|
|
@@ -65545,10 +65937,10 @@ function resolveMinDebt(input) {
|
|
|
65545
65937
|
];
|
|
65546
65938
|
for (const c of candidates) {
|
|
65547
65939
|
if (c == null) continue;
|
|
65548
|
-
const
|
|
65549
|
-
if (
|
|
65550
|
-
if (!/^\d+$/.test(
|
|
65551
|
-
return
|
|
65940
|
+
const str8 = String(c);
|
|
65941
|
+
if (str8 === "0" || str8 === "") continue;
|
|
65942
|
+
if (!/^\d+$/.test(str8)) continue;
|
|
65943
|
+
return str8;
|
|
65552
65944
|
}
|
|
65553
65945
|
return void 0;
|
|
65554
65946
|
}
|
|
@@ -65556,9 +65948,9 @@ function resolveMinCollateral(input) {
|
|
|
65556
65948
|
const m = input.market ?? {};
|
|
65557
65949
|
const raw = m.frankencoin?.minimumCollateral;
|
|
65558
65950
|
if (raw == null) return void 0;
|
|
65559
|
-
const
|
|
65560
|
-
if (
|
|
65561
|
-
return
|
|
65951
|
+
const str8 = String(raw);
|
|
65952
|
+
if (str8 === "0" || str8 === "" || !/^\d+$/.test(str8)) return void 0;
|
|
65953
|
+
return str8;
|
|
65562
65954
|
}
|
|
65563
65955
|
function capUtil(total, cap) {
|
|
65564
65956
|
if (!isNum(cap) || cap <= 0 || !isNum(total)) return void 0;
|
|
@@ -66035,10 +66427,17 @@ var VAULT_PROVIDER_TRAITS = {
|
|
|
66035
66427
|
rateKind: "variable-managed",
|
|
66036
66428
|
rateSource: "api",
|
|
66037
66429
|
rateWindow: { kind: "trailing" },
|
|
66430
|
+
// Every vault requests → settles → claims; the per-vault delay runs 0 to
|
|
66431
|
+
// 30 days and rides on the row as `withdrawalCooldownSeconds`. One vault
|
|
66432
|
+
// (Upshift Clear RWA) declares `fee-or-queued` for its instant leg.
|
|
66038
66433
|
defaultExitMode: "request-based",
|
|
66039
66434
|
priceRisk: "none",
|
|
66040
66435
|
counterpartyKind: "vault-strategy",
|
|
66041
|
-
|
|
66436
|
+
// Upshift publishes a full schedule — performance AND management, per
|
|
66437
|
+
// vault, with waiver flags. Reported `false` while the fetcher dropped
|
|
66438
|
+
// the block, which made every row's empty fee list read as "free" when
|
|
66439
|
+
// one vault charges 20 % + 2 %.
|
|
66440
|
+
reportsPerformanceFee: true,
|
|
66042
66441
|
reportsGovernance: false,
|
|
66043
66442
|
reportsExposures: false,
|
|
66044
66443
|
hasDecomposableBacking: true,
|
|
@@ -66198,6 +66597,19 @@ function buildFees2(input, t) {
|
|
|
66198
66597
|
description: "Taken from the yield the vault earns, not from your principal. The published rate is already net of it."
|
|
66199
66598
|
});
|
|
66200
66599
|
}
|
|
66600
|
+
if (isNum2(input.managementFee) && input.managementFee !== 0) {
|
|
66601
|
+
out.push({
|
|
66602
|
+
id: "management",
|
|
66603
|
+
label: "Management fee",
|
|
66604
|
+
when: "ongoing",
|
|
66605
|
+
unit: "apr-percent",
|
|
66606
|
+
basis: "principal",
|
|
66607
|
+
value: t.feeIsFraction ? input.managementFee * 100 : input.managementFee,
|
|
66608
|
+
payee: "curator",
|
|
66609
|
+
mutable: true,
|
|
66610
|
+
description: "Accrues on your whole balance for as long as you hold, whether or not the vault earns anything. The published rate is already net of it."
|
|
66611
|
+
});
|
|
66612
|
+
}
|
|
66201
66613
|
if (isNum2(input.withdrawFeeBps) && input.withdrawFeeBps !== 0) {
|
|
66202
66614
|
out.push({
|
|
66203
66615
|
id: "instant-exit",
|
|
@@ -66968,13 +67380,13 @@ function num12(v) {
|
|
|
66968
67380
|
const n = typeof v === "number" ? v : Number(v);
|
|
66969
67381
|
return Number.isFinite(n) ? n : void 0;
|
|
66970
67382
|
}
|
|
66971
|
-
function
|
|
67383
|
+
function str6(v) {
|
|
66972
67384
|
if (typeof v === "string") return v.length > 0 ? v : void 0;
|
|
66973
67385
|
if (typeof v === "number" && Number.isFinite(v)) return String(v);
|
|
66974
67386
|
return void 0;
|
|
66975
67387
|
}
|
|
66976
67388
|
function addr2(v) {
|
|
66977
|
-
return
|
|
67389
|
+
return str6(v)?.toLowerCase();
|
|
66978
67390
|
}
|
|
66979
67391
|
function yieldProfile(v) {
|
|
66980
67392
|
return v === "yield-bearing" || v === "volatile" ? v : void 0;
|
|
@@ -67053,7 +67465,7 @@ var RATE_KIND = {
|
|
|
67053
67465
|
gmx: "realized"
|
|
67054
67466
|
};
|
|
67055
67467
|
function resolveExitMode2(provider, meta, tvl, liq) {
|
|
67056
|
-
const declared =
|
|
67468
|
+
const declared = str6(meta.withdrawalMode);
|
|
67057
67469
|
if (declared) return declared;
|
|
67058
67470
|
const fallback = vaultTraits(provider)?.defaultExitMode ?? "instant";
|
|
67059
67471
|
if (fallback !== "instant-capped") return fallback;
|
|
@@ -67064,9 +67476,9 @@ function resolveExitMode2(provider, meta, tvl, liq) {
|
|
|
67064
67476
|
return available >= total ? "instant" : "instant-capped";
|
|
67065
67477
|
}
|
|
67066
67478
|
function earnMarketFromVault(row, chainId, opts = {}) {
|
|
67067
|
-
const provider =
|
|
67068
|
-
const address =
|
|
67069
|
-
const underlying =
|
|
67479
|
+
const provider = str6(row.provider);
|
|
67480
|
+
const address = str6(row.vaultAddress)?.toLowerCase();
|
|
67481
|
+
const underlying = str6(row.underlying)?.toLowerCase();
|
|
67070
67482
|
if (!provider || !address || !underlying) return void 0;
|
|
67071
67483
|
const meta = row.providerMeta ?? {};
|
|
67072
67484
|
const info = row.vaultInfo ?? {};
|
|
@@ -67106,15 +67518,15 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
67106
67518
|
venue: vaultVenue(provider),
|
|
67107
67519
|
venueKind: "vault",
|
|
67108
67520
|
// Curator first (it names the actual operator), then the provider brand.
|
|
67109
|
-
brand:
|
|
67521
|
+
brand: str6(row.curatorName) ?? venueBrand(vaultVenue(provider)),
|
|
67110
67522
|
// What the vault is BUILT ON, kept apart from who runs it — see
|
|
67111
67523
|
// `resolveEarnIdentity` for why this is not simply provider-vs-brand.
|
|
67112
67524
|
...withCuratorEntity(
|
|
67113
67525
|
resolveEarnIdentity(
|
|
67114
67526
|
vaultVenue(provider),
|
|
67115
|
-
|
|
67527
|
+
str6(row.curatorName)
|
|
67116
67528
|
),
|
|
67117
|
-
|
|
67529
|
+
str6(row.curatorEntity)
|
|
67118
67530
|
),
|
|
67119
67531
|
// The maturity is part of a fixed-term row's IDENTITY. Pendle ships names
|
|
67120
67532
|
// with no date, so several PTs on one underlying render identically —
|
|
@@ -67143,26 +67555,26 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
67143
67555
|
withMaturityLabel(
|
|
67144
67556
|
stripLeadingBrand(
|
|
67145
67557
|
vaultDisplayName(row, info) ?? "",
|
|
67146
|
-
|
|
67558
|
+
str6(row.curatorName) ?? venueBrand(vaultVenue(provider))
|
|
67147
67559
|
) || void 0,
|
|
67148
67560
|
maturity
|
|
67149
67561
|
),
|
|
67150
|
-
trancheFromCounterparty(
|
|
67562
|
+
trancheFromCounterparty(str6(meta.solvency))
|
|
67151
67563
|
),
|
|
67152
67564
|
ref: address,
|
|
67153
|
-
logoURI:
|
|
67565
|
+
logoURI: str6(info.logoURI) ?? str6(row.underlyingInfo?.asset?.logoURI),
|
|
67154
67566
|
asset: {
|
|
67155
67567
|
address: underlying,
|
|
67156
|
-
symbol:
|
|
67568
|
+
symbol: str6(row.underlyingInfo?.asset?.symbol) ?? "",
|
|
67157
67569
|
decimals: assetDecimals,
|
|
67158
|
-
assetGroup:
|
|
67570
|
+
assetGroup: str6(info.assetGroup),
|
|
67159
67571
|
priceUsd: num12(row.underlyingInfo?.prices?.priceUsd)
|
|
67160
67572
|
},
|
|
67161
67573
|
// The vault IS a share token by construction; carry it so a withdraw in
|
|
67162
67574
|
// share units can be built without a second lookup.
|
|
67163
67575
|
shareToken: {
|
|
67164
67576
|
address,
|
|
67165
|
-
symbol:
|
|
67577
|
+
symbol: str6(info.symbol) ?? str6(row.symbol) ?? "",
|
|
67166
67578
|
decimals: shareDecimals
|
|
67167
67579
|
},
|
|
67168
67580
|
rate,
|
|
@@ -67181,11 +67593,11 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
67181
67593
|
liq.liquidityUsd,
|
|
67182
67594
|
assetDecimals
|
|
67183
67595
|
) : void 0,
|
|
67184
|
-
depositCapacity:
|
|
67596
|
+
depositCapacity: str6(meta.depositCapacity) ?? str6(meta.maxDeposit),
|
|
67185
67597
|
maturity,
|
|
67186
67598
|
exit: {
|
|
67187
67599
|
mode: exitMode,
|
|
67188
|
-
settlement:
|
|
67600
|
+
settlement: str6(meta.redemptionType),
|
|
67189
67601
|
cooldownSecs: num12(meta.withdrawalCooldownSeconds),
|
|
67190
67602
|
feeBps: num12(meta.withdrawFeeBps)
|
|
67191
67603
|
},
|
|
@@ -67196,9 +67608,9 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
67196
67608
|
// The curated trust classification, where one exists. Typed on `EarnRisk`
|
|
67197
67609
|
// since the surface was written and never populated — a tranche's
|
|
67198
67610
|
// first-loss position is the term most worth surfacing on a rate list.
|
|
67199
|
-
counterparty:
|
|
67611
|
+
counterparty: str6(meta.solvency),
|
|
67200
67612
|
score: num12(row.rating?.score),
|
|
67201
|
-
label:
|
|
67613
|
+
label: str6(row.rating?.level),
|
|
67202
67614
|
illiquid: isIlliquid({
|
|
67203
67615
|
exitMode,
|
|
67204
67616
|
tvlUsd: num12(tvl.totalAssetsUsd),
|
|
@@ -67234,7 +67646,7 @@ function earnVaultTerms(provider, providerMeta, size) {
|
|
|
67234
67646
|
}
|
|
67235
67647
|
function resolveAvailability(meta, maturity) {
|
|
67236
67648
|
const isMintable = meta.isMintable;
|
|
67237
|
-
const capacity =
|
|
67649
|
+
const capacity = str6(meta.depositCapacity) ?? str6(meta.maxDeposit);
|
|
67238
67650
|
const capFull = capacity === "0";
|
|
67239
67651
|
let gating;
|
|
67240
67652
|
let reason;
|
|
@@ -67265,7 +67677,7 @@ function resolveAvailability(meta, maturity) {
|
|
|
67265
67677
|
}
|
|
67266
67678
|
function vaultDisplayName(row, info) {
|
|
67267
67679
|
const share = row.shareAsset;
|
|
67268
|
-
return
|
|
67680
|
+
return str6(row.name) ?? str6(info.name) ?? str6(row.displayName) ?? str6(share?.name) ?? str6(share?.symbol) ?? str6(info.symbol) ?? str6(row.symbol);
|
|
67269
67681
|
}
|
|
67270
67682
|
function resolveMaturity(meta) {
|
|
67271
67683
|
const expiry = num12(meta.expiry) ?? num12(meta.maturity);
|
|
@@ -67274,13 +67686,13 @@ function resolveMaturity(meta) {
|
|
|
67274
67686
|
return {
|
|
67275
67687
|
kind: "fixed-date",
|
|
67276
67688
|
maturity: expiry,
|
|
67277
|
-
maturityIso:
|
|
67689
|
+
maturityIso: str6(meta.expiryIso) ?? new Date(expiry * 1e3).toISOString(),
|
|
67278
67690
|
// A SNAPSHOT — a cached listing ages, so a countdown must be recomputed
|
|
67279
67691
|
// from `maturity` rather than ticked down from this.
|
|
67280
67692
|
secondsToMaturity: Math.max(expiry - nowSecs, 0),
|
|
67281
67693
|
// A PT simply stops earning: it redeems for the underlying at par and
|
|
67282
67694
|
// sits there. No penalty, no liquidation, no auto-roll.
|
|
67283
|
-
atMaturity:
|
|
67695
|
+
atMaturity: str6(meta.atMaturity) ?? "stops-earning"
|
|
67284
67696
|
};
|
|
67285
67697
|
}
|
|
67286
67698
|
function isMatured(maturity) {
|
|
@@ -67313,7 +67725,7 @@ var num13 = (v) => {
|
|
|
67313
67725
|
}
|
|
67314
67726
|
return void 0;
|
|
67315
67727
|
};
|
|
67316
|
-
var
|
|
67728
|
+
var str7 = (v) => typeof v === "string" && v.trim() !== "" ? v : void 0;
|
|
67317
67729
|
var bool2 = (v) => typeof v === "boolean" ? v : void 0;
|
|
67318
67730
|
var fromRaw = (raw, decimals) => {
|
|
67319
67731
|
const s = raw == null ? void 0 : String(raw);
|
|
@@ -67342,7 +67754,7 @@ function sdkRates(row, provider) {
|
|
|
67342
67754
|
}
|
|
67343
67755
|
function toVaultTermInput(vault, provider, chainId) {
|
|
67344
67756
|
const row = vault;
|
|
67345
|
-
const address =
|
|
67757
|
+
const address = str7(row.address)?.toLowerCase();
|
|
67346
67758
|
if (!address) return void 0;
|
|
67347
67759
|
const assetDecimals = num13(row.assetDecimals) ?? num13(row.decimals);
|
|
67348
67760
|
const asset = row.asset;
|
|
@@ -67351,22 +67763,22 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
67351
67763
|
chainId,
|
|
67352
67764
|
address,
|
|
67353
67765
|
vaultUid: `vault.${provider}:${chainId}:${address}`,
|
|
67354
|
-
name:
|
|
67355
|
-
brand:
|
|
67356
|
-
curatorName:
|
|
67357
|
-
description:
|
|
67766
|
+
name: str7(row.displayName) ?? str7(row.name),
|
|
67767
|
+
brand: str7(row.brand),
|
|
67768
|
+
curatorName: str7(row.curatorName),
|
|
67769
|
+
description: str7(row.description),
|
|
67358
67770
|
asset: {
|
|
67359
67771
|
chainId,
|
|
67360
|
-
address:
|
|
67361
|
-
symbol:
|
|
67362
|
-
name:
|
|
67772
|
+
address: str7(row.underlying)?.toLowerCase() ?? "",
|
|
67773
|
+
symbol: str7(asset?.symbol),
|
|
67774
|
+
name: str7(asset?.name),
|
|
67363
67775
|
decimals: assetDecimals,
|
|
67364
|
-
assetGroup:
|
|
67365
|
-
logoURI:
|
|
67776
|
+
assetGroup: str7(asset?.assetGroup),
|
|
67777
|
+
logoURI: str7(asset?.logoURI)
|
|
67366
67778
|
},
|
|
67367
67779
|
...sdkRates(row, provider),
|
|
67368
67780
|
isForwardApr: bool2(row.isForwardApr),
|
|
67369
|
-
aprWindow:
|
|
67781
|
+
aprWindow: str7(row.aprWindow),
|
|
67370
67782
|
// GMX / HyperCore / Pendle report USD only and set the token-denominated
|
|
67371
67783
|
// fields to their USD figure — `totalAssetsFormatted` is the cross-provider
|
|
67372
67784
|
// magnitude either way, so prefer it over re-deriving from raw.
|
|
@@ -67377,19 +67789,20 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
67377
67789
|
instantLiquidityRatio: num13(row.instantLiquidityRatio),
|
|
67378
67790
|
totalBorrowed: fromRaw(row.totalBorrowed, assetDecimals),
|
|
67379
67791
|
expectedLiquidity: fromRaw(row.expectedLiquidity, assetDecimals),
|
|
67380
|
-
withdrawalMode:
|
|
67792
|
+
withdrawalMode: str7(row.withdrawalMode),
|
|
67381
67793
|
withdrawalCooldownSeconds: num13(row.withdrawalCooldownSeconds),
|
|
67382
67794
|
withdrawFeeBps: num13(row.withdrawFeeBps),
|
|
67383
67795
|
fee: num13(row.fee),
|
|
67796
|
+
managementFee: num13(row.managementFee),
|
|
67384
67797
|
swapFeeRate: num13(row.feeRate),
|
|
67385
67798
|
redemptionDiscountBps: num13(row.redemptionDiscountBps),
|
|
67386
67799
|
instantRedeemEnabled: bool2(row.instantRedeemEnabled),
|
|
67387
67800
|
yieldWarmupSeconds: num13(row.yieldWarmupSeconds),
|
|
67388
|
-
accrual:
|
|
67801
|
+
accrual: str7(row.accrual),
|
|
67389
67802
|
needsDepositApproval: bool2(row.needsDepositApproval),
|
|
67390
67803
|
isMintable: bool2(row.isMintable),
|
|
67391
|
-
depositCapacity:
|
|
67392
|
-
supplyCap:
|
|
67804
|
+
depositCapacity: str7(row.depositCapacity),
|
|
67805
|
+
supplyCap: str7(row.supplyCap),
|
|
67393
67806
|
paused: bool2(row.isPaused),
|
|
67394
67807
|
depositsPaused: bool2(row.isDepositPaused),
|
|
67395
67808
|
withdrawalsPaused: bool2(row.isWithdrawalPaused),
|
|
@@ -67397,13 +67810,13 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
67397
67810
|
whitelisted: bool2(row.whitelisted),
|
|
67398
67811
|
expiry: num13(row.expiry),
|
|
67399
67812
|
timelock: num13(row.timelock),
|
|
67400
|
-
owner:
|
|
67401
|
-
curator:
|
|
67402
|
-
guardian:
|
|
67403
|
-
feeRecipient:
|
|
67404
|
-
solvency:
|
|
67405
|
-
navOracle:
|
|
67406
|
-
yieldProfile:
|
|
67813
|
+
owner: str7(row.owner),
|
|
67814
|
+
curator: str7(row.curator),
|
|
67815
|
+
guardian: str7(row.guardian),
|
|
67816
|
+
feeRecipient: str7(row.feeRecipient),
|
|
67817
|
+
solvency: str7(row.solvency),
|
|
67818
|
+
navOracle: str7(row.navOracle),
|
|
67819
|
+
yieldProfile: str7(row.yieldProfile),
|
|
67407
67820
|
exposures: Array.isArray(row.exposures) ? row.exposures : void 0
|
|
67408
67821
|
};
|
|
67409
67822
|
}
|
|
@@ -67420,7 +67833,7 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
67420
67833
|
name: m.name,
|
|
67421
67834
|
brand: m.brand,
|
|
67422
67835
|
curatorName: m.brand,
|
|
67423
|
-
description:
|
|
67836
|
+
description: str7(meta.description),
|
|
67424
67837
|
asset: {
|
|
67425
67838
|
chainId: m.chainId,
|
|
67426
67839
|
address: m.asset.address,
|
|
@@ -67433,7 +67846,7 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
67433
67846
|
rewardsRate: m.rate.rewards,
|
|
67434
67847
|
totalRate: m.rate.total,
|
|
67435
67848
|
isForwardApr: bool2(meta.isForwardApr),
|
|
67436
|
-
aprWindow:
|
|
67849
|
+
aprWindow: str7(meta.aprWindow),
|
|
67437
67850
|
totalAssets: m.tvl.formatted,
|
|
67438
67851
|
totalAssetsUsd: m.tvl.usd,
|
|
67439
67852
|
liquidity: m.liquidity?.formatted,
|
|
@@ -67445,30 +67858,31 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
67445
67858
|
withdrawalCooldownSeconds: m.exit.cooldownSecs,
|
|
67446
67859
|
withdrawFeeBps: m.exit.feeBps,
|
|
67447
67860
|
fee: m.rate.fee,
|
|
67861
|
+
managementFee: num13(meta.managementFee),
|
|
67448
67862
|
swapFeeRate: num13(meta.feeRate),
|
|
67449
67863
|
redemptionDiscountBps: num13(meta.redemptionDiscountBps),
|
|
67450
67864
|
instantRedeemEnabled: bool2(meta.instantRedeemEnabled),
|
|
67451
67865
|
yieldWarmupSeconds: num13(meta.yieldWarmupSeconds),
|
|
67452
|
-
accrual:
|
|
67866
|
+
accrual: str7(meta.accrual),
|
|
67453
67867
|
needsDepositApproval: bool2(meta.needsDepositApproval),
|
|
67454
67868
|
// `canDeposit` already folds in the cap, the pause and the gate, so it is
|
|
67455
67869
|
// the authoritative answer — but the REASON is what a disabled CTA renders,
|
|
67456
67870
|
// and that only survives in the raw fields.
|
|
67457
67871
|
isMintable: m.availability.canDeposit ? void 0 : false,
|
|
67458
67872
|
depositCapacity: m.depositCapacity,
|
|
67459
|
-
supplyCap:
|
|
67873
|
+
supplyCap: str7(meta.supplyCap),
|
|
67460
67874
|
paused: m.availability.gating === "paused" ? true : void 0,
|
|
67461
67875
|
withdrawalsPaused: m.availability.canWithdraw ? void 0 : true,
|
|
67462
67876
|
isClosed: bool2(meta.isClosed),
|
|
67463
67877
|
whitelisted: bool2(meta.whitelisted),
|
|
67464
67878
|
expiry: m.maturity?.maturity,
|
|
67465
67879
|
timelock: num13(meta.timelock),
|
|
67466
|
-
owner:
|
|
67467
|
-
curator:
|
|
67468
|
-
guardian:
|
|
67469
|
-
feeRecipient:
|
|
67880
|
+
owner: str7(meta.owner),
|
|
67881
|
+
curator: str7(meta.curator),
|
|
67882
|
+
guardian: str7(meta.guardian),
|
|
67883
|
+
feeRecipient: str7(meta.feeRecipient),
|
|
67470
67884
|
solvency: m.risk?.counterparty,
|
|
67471
|
-
navOracle:
|
|
67885
|
+
navOracle: str7(meta.navOracle),
|
|
67472
67886
|
yieldProfile: m.risk?.yieldProfile,
|
|
67473
67887
|
exposures: m.refs?.exposures
|
|
67474
67888
|
};
|
|
@@ -67484,8 +67898,8 @@ function originRates(rates) {
|
|
|
67484
67898
|
};
|
|
67485
67899
|
}
|
|
67486
67900
|
function vaultTermInputFromSourceRow(row, chainId) {
|
|
67487
|
-
const provider =
|
|
67488
|
-
const address =
|
|
67901
|
+
const provider = str7(row.provider);
|
|
67902
|
+
const address = str7(row.vaultAddress)?.toLowerCase();
|
|
67489
67903
|
if (!provider || !address) return void 0;
|
|
67490
67904
|
const meta = row.providerMeta ?? {};
|
|
67491
67905
|
const rates = row.rates ?? {};
|
|
@@ -67499,21 +67913,21 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
67499
67913
|
chainId,
|
|
67500
67914
|
address,
|
|
67501
67915
|
vaultUid: `vault.${provider}:${chainId}:${address}`,
|
|
67502
|
-
name:
|
|
67503
|
-
brand:
|
|
67504
|
-
curatorName:
|
|
67505
|
-
description:
|
|
67916
|
+
name: str7(info.name) ?? str7(row.displayName) ?? str7(row.name),
|
|
67917
|
+
brand: str7(row.curatorName) ?? str7(meta.brand),
|
|
67918
|
+
curatorName: str7(row.curatorName),
|
|
67919
|
+
description: str7(meta.description),
|
|
67506
67920
|
asset: {
|
|
67507
67921
|
chainId,
|
|
67508
|
-
address:
|
|
67509
|
-
symbol:
|
|
67922
|
+
address: str7(row.underlying)?.toLowerCase() ?? "",
|
|
67923
|
+
symbol: str7(assetInfo?.symbol),
|
|
67510
67924
|
decimals: assetDecimals,
|
|
67511
|
-
assetGroup:
|
|
67512
|
-
logoURI:
|
|
67925
|
+
assetGroup: str7(info.assetGroup),
|
|
67926
|
+
logoURI: str7(assetInfo?.logoURI)
|
|
67513
67927
|
},
|
|
67514
67928
|
...originRates(rates),
|
|
67515
67929
|
isForwardApr: bool2(meta.isForwardApr),
|
|
67516
|
-
aprWindow:
|
|
67930
|
+
aprWindow: str7(meta.aprWindow),
|
|
67517
67931
|
totalAssets: num13(tvl.totalAssetsFormatted) ?? fromRaw(tvl.totalAssets, assetDecimals),
|
|
67518
67932
|
totalAssetsUsd: num13(tvl.totalAssetsUsd),
|
|
67519
67933
|
liquidity: num13(liq.liquidityFormatted) ?? fromRaw(liq.liquidity, assetDecimals),
|
|
@@ -67521,19 +67935,20 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
67521
67935
|
instantLiquidityRatio: num13(meta.instantLiquidityRatio),
|
|
67522
67936
|
totalBorrowed: fromRaw(meta.totalBorrowed, assetDecimals),
|
|
67523
67937
|
expectedLiquidity: fromRaw(meta.expectedLiquidity, assetDecimals),
|
|
67524
|
-
withdrawalMode:
|
|
67938
|
+
withdrawalMode: str7(meta.withdrawalMode),
|
|
67525
67939
|
withdrawalCooldownSeconds: num13(meta.withdrawalCooldownSeconds),
|
|
67526
67940
|
withdrawFeeBps: num13(meta.withdrawFeeBps),
|
|
67527
67941
|
fee: num13(rates.fee),
|
|
67942
|
+
managementFee: num13(meta.managementFee),
|
|
67528
67943
|
swapFeeRate: num13(meta.feeRate),
|
|
67529
67944
|
redemptionDiscountBps: num13(meta.redemptionDiscountBps),
|
|
67530
67945
|
instantRedeemEnabled: bool2(meta.instantRedeemEnabled),
|
|
67531
67946
|
yieldWarmupSeconds: num13(meta.yieldWarmupSeconds),
|
|
67532
|
-
accrual:
|
|
67947
|
+
accrual: str7(meta.accrual),
|
|
67533
67948
|
needsDepositApproval: bool2(meta.needsDepositApproval),
|
|
67534
67949
|
isMintable: bool2(meta.isMintable),
|
|
67535
|
-
depositCapacity:
|
|
67536
|
-
supplyCap:
|
|
67950
|
+
depositCapacity: str7(meta.depositCapacity) ?? str7(meta.maxDeposit),
|
|
67951
|
+
supplyCap: str7(meta.supplyCap),
|
|
67537
67952
|
paused: bool2(meta.paused) ?? bool2(meta.isPaused),
|
|
67538
67953
|
depositsPaused: bool2(meta.isDepositPaused),
|
|
67539
67954
|
withdrawalsPaused: bool2(meta.isWithdrawalPaused),
|
|
@@ -67541,13 +67956,13 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
67541
67956
|
whitelisted: bool2(meta.whitelisted),
|
|
67542
67957
|
expiry: num13(meta.expiry) ?? num13(meta.maturity),
|
|
67543
67958
|
timelock: num13(meta.timelock),
|
|
67544
|
-
owner:
|
|
67545
|
-
curator:
|
|
67546
|
-
guardian:
|
|
67547
|
-
feeRecipient:
|
|
67548
|
-
solvency:
|
|
67549
|
-
navOracle:
|
|
67550
|
-
yieldProfile:
|
|
67959
|
+
owner: str7(meta.owner),
|
|
67960
|
+
curator: str7(meta.curator),
|
|
67961
|
+
guardian: str7(meta.guardian),
|
|
67962
|
+
feeRecipient: str7(meta.feeRecipient),
|
|
67963
|
+
solvency: str7(meta.solvency),
|
|
67964
|
+
navOracle: str7(meta.navOracle),
|
|
67965
|
+
yieldProfile: str7(info.yieldProfile),
|
|
67551
67966
|
exposures: Array.isArray(row.exposures) ? row.exposures : Array.isArray(meta.exposures) ? meta.exposures : void 0
|
|
67552
67967
|
};
|
|
67553
67968
|
}
|
|
@@ -68498,6 +68913,9 @@ var ROW_DESCRIPTOR_KEYS = [
|
|
|
68498
68913
|
"resupply",
|
|
68499
68914
|
"gearbox",
|
|
68500
68915
|
"curvance",
|
|
68916
|
+
// Fluid: distinguishes a SMART (T2/T3/T4) vault, whose collateral and/or
|
|
68917
|
+
// debt is a two-token DEX LP position, from an ordinary T1 pool row.
|
|
68918
|
+
"fluid",
|
|
68501
68919
|
"broker",
|
|
68502
68920
|
"collateralProvider",
|
|
68503
68921
|
"loanProvider",
|
|
@@ -69436,17 +69854,45 @@ var fluidAdapter = {
|
|
|
69436
69854
|
id: "fluid",
|
|
69437
69855
|
matches: isFluid,
|
|
69438
69856
|
profileId: () => "pool.variable@v1",
|
|
69439
|
-
build: (input) =>
|
|
69440
|
-
|
|
69441
|
-
|
|
69442
|
-
|
|
69443
|
-
|
|
69444
|
-
|
|
69445
|
-
|
|
69446
|
-
|
|
69447
|
-
|
|
69448
|
-
|
|
69449
|
-
|
|
69857
|
+
build: (input) => {
|
|
69858
|
+
const smart = input.market?.fluid ?? {};
|
|
69859
|
+
const isSmartCol = !!smart.isSmartCol;
|
|
69860
|
+
const isSmartDebt = !!smart.isSmartDebt;
|
|
69861
|
+
const isSmart = isSmartCol || isSmartDebt;
|
|
69862
|
+
const pair = (p) => Array.isArray(p) ? p.join(" + ") : void 0;
|
|
69863
|
+
return {
|
|
69864
|
+
// Only claim the liquidity-layer basis when the layer totals are actually
|
|
69865
|
+
// present. The origin does not select `irmTotal*` today, and asserting a
|
|
69866
|
+
// basis we cannot verify is worse than reporting the plain market ratio —
|
|
69867
|
+
// the validator rejects it for exactly that reason.
|
|
69868
|
+
utilization: input.irmTotalDeposits != null && input.irmTotalDebt != null ? { basis: "liquidity-layer", lockupRatio: input.lockupRatio } : { lockupRatio: input.lockupRatio },
|
|
69869
|
+
constraints: {
|
|
69870
|
+
positionModel: "nft",
|
|
69871
|
+
positionIdMeaning: "The Fluid vault position NFT id.",
|
|
69872
|
+
...isSmart ? {
|
|
69873
|
+
/**
|
|
69874
|
+
* A smart vault is NOT a plain pool, and the difference is what a
|
|
69875
|
+
* user is actually agreeing to:
|
|
69876
|
+
*
|
|
69877
|
+
* - the position is a two-token DEX LP share, so its value moves
|
|
69878
|
+
* with the pool's composition, not just with the two prices;
|
|
69879
|
+
* - the row's amount is this leg only — the other leg is a
|
|
69880
|
+
* sibling row of the same vault, and neither can be moved
|
|
69881
|
+
* alone;
|
|
69882
|
+
* - exiting means unwinding LP shares, which is bounded by
|
|
69883
|
+
* share-slippage parameters rather than a plain transfer.
|
|
69884
|
+
*/
|
|
69885
|
+
notes: [
|
|
69886
|
+
isSmartCol ? `Collateral is a Fluid DEX LP position over ${pair(smart.collateralPair) ?? "two tokens"}; this row is one leg of it.` : void 0,
|
|
69887
|
+
isSmartDebt ? `Debt is a Fluid DEX LP position over ${pair(smart.debtPair) ?? "two tokens"}; this row is one leg of it.` : void 0,
|
|
69888
|
+
isSmartDebt ? "The borrow rate is NET of the trading yield the debt LP earns, so it can be negative." : void 0,
|
|
69889
|
+
isSmartCol ? "The supply rate INCLUDES the DEX trading yield on top of the liquidity-layer rate." : void 0,
|
|
69890
|
+
"Both legs of a side move together \u2014 a leg cannot be supplied, borrowed or withdrawn on its own."
|
|
69891
|
+
].filter(Boolean)
|
|
69892
|
+
} : {}
|
|
69893
|
+
}
|
|
69894
|
+
};
|
|
69895
|
+
}
|
|
69450
69896
|
};
|
|
69451
69897
|
var gearboxAdapter = {
|
|
69452
69898
|
id: "gearbox",
|
|
@@ -70363,12 +70809,12 @@ var USER_SET_RATE_PREFIXES = [
|
|
|
70363
70809
|
function collateralSymbolsByVenue(rows, fallbackChainId) {
|
|
70364
70810
|
const byVenue = /* @__PURE__ */ new Map();
|
|
70365
70811
|
for (const row of rows) {
|
|
70366
|
-
const venue =
|
|
70367
|
-
const chainId =
|
|
70812
|
+
const venue = str6(row.lender) ?? str6(row.lenderKey);
|
|
70813
|
+
const chainId = str6(row.chainId) ?? fallbackChainId;
|
|
70368
70814
|
if (!venue || !chainId) continue;
|
|
70369
70815
|
const collateralActive = row.flags?.collateralActive ?? row.collateralActive;
|
|
70370
70816
|
if (collateralActive !== true) continue;
|
|
70371
|
-
const symbol =
|
|
70817
|
+
const symbol = str6(row.underlyingInfo?.asset?.symbol) ?? str6(row.asset?.symbol);
|
|
70372
70818
|
if (!symbol) continue;
|
|
70373
70819
|
const key3 = venueGroupKey(chainId, venue);
|
|
70374
70820
|
let set = byVenue.get(key3);
|
|
@@ -70381,7 +70827,7 @@ function venueGroupKey(chainId, venue) {
|
|
|
70381
70827
|
return `${chainId}::${venue}`;
|
|
70382
70828
|
}
|
|
70383
70829
|
function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
70384
|
-
const marketUid =
|
|
70830
|
+
const marketUid = str6(row.marketUid);
|
|
70385
70831
|
if (!marketUid) return void 0;
|
|
70386
70832
|
let earnUid;
|
|
70387
70833
|
try {
|
|
@@ -70389,8 +70835,8 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70389
70835
|
} catch {
|
|
70390
70836
|
return void 0;
|
|
70391
70837
|
}
|
|
70392
|
-
const chainId =
|
|
70393
|
-
const venue =
|
|
70838
|
+
const chainId = str6(row.chainId) ?? fallbackChainId;
|
|
70839
|
+
const venue = str6(row.lender) ?? str6(row.lenderKey);
|
|
70394
70840
|
if (!chainId || !venue) return void 0;
|
|
70395
70841
|
const flags = row.flags ?? {};
|
|
70396
70842
|
const assetInfo = row.underlyingInfo?.asset ?? row.asset ?? {};
|
|
@@ -70427,32 +70873,32 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70427
70873
|
// Same resolver as the vault half, so `protocol.key` means one thing
|
|
70428
70874
|
// across the listing: the STABLE family key, never the per-market venue.
|
|
70429
70875
|
// No lender publishes a curator today, hence the undefined.
|
|
70430
|
-
...resolveEarnIdentity(venue, void 0,
|
|
70876
|
+
...resolveEarnIdentity(venue, void 0, str6(row.lenderInfo?.protocol)),
|
|
70431
70877
|
// Pair-aware: "USDT · vs wstETH" for an isolated market, plain "USDC" for
|
|
70432
70878
|
// a shared pool. The fetcher's own name is only the fallback — it is the
|
|
70433
70879
|
// leg-local "Loan USDC", which a chain repeats across 300 markets and
|
|
70434
70880
|
// which says nothing about WHICH market this is. Identical to what the
|
|
70435
70881
|
// origin's SQL route builds, so both paths agree.
|
|
70436
70882
|
name: earnMarketLabel({
|
|
70437
|
-
assetSymbol:
|
|
70438
|
-
lenderMarketName:
|
|
70439
|
-
fetcherName:
|
|
70883
|
+
assetSymbol: str6(assetInfo.symbol),
|
|
70884
|
+
lenderMarketName: str6(row.lenderInfo?.name),
|
|
70885
|
+
fetcherName: str6(row.name),
|
|
70440
70886
|
venue,
|
|
70441
70887
|
// The venue's collaterals, UNFILTERED — the label removes this row's own
|
|
70442
70888
|
// leg itself. Filtering here made the collateral row of a 1-collateral
|
|
70443
70889
|
// market look like a 0-collateral one, so the two legs of one market
|
|
70444
70890
|
// disagreed about whether it was isolated.
|
|
70445
70891
|
collateralSymbols: venueCollaterals?.get(venueGroupKey(chainId, venue)),
|
|
70446
|
-
fallbackName:
|
|
70892
|
+
fallbackName: str6(row.name)
|
|
70447
70893
|
}),
|
|
70448
70894
|
// Never re-derived — the uid's third segment as the origin minted it.
|
|
70449
70895
|
ref: marketUid.split(":")[2],
|
|
70450
|
-
logoURI:
|
|
70896
|
+
logoURI: str6(assetInfo.logoURI),
|
|
70451
70897
|
asset: {
|
|
70452
70898
|
address: underlying,
|
|
70453
|
-
symbol:
|
|
70899
|
+
symbol: str6(assetInfo.symbol) ?? "",
|
|
70454
70900
|
decimals,
|
|
70455
|
-
assetGroup:
|
|
70901
|
+
assetGroup: str6(row.underlyingInfo?.assetGroup) ?? str6(row.asset?.assetGroup),
|
|
70456
70902
|
priceUsd
|
|
70457
70903
|
},
|
|
70458
70904
|
// A lending supply position is an aToken/cToken/eToken balance, but the
|
|
@@ -70482,7 +70928,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70482
70928
|
availability,
|
|
70483
70929
|
risk: {
|
|
70484
70930
|
score: num12(row.risk?.score),
|
|
70485
|
-
label:
|
|
70931
|
+
label: str6(row.risk?.label),
|
|
70486
70932
|
illiquid: isIlliquid({
|
|
70487
70933
|
exitMode: "instant-capped",
|
|
70488
70934
|
tvlUsd: num12(row.totalDepositsUSD ?? row.totalDepositsUsd),
|
|
@@ -70497,7 +70943,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70497
70943
|
// nothing else, and one may price its collateral off a feed that ignores
|
|
70498
70944
|
// a depeg in it.
|
|
70499
70945
|
oracle: addr2(row.oracleInfo?.feeds?.find((f) => f?.oracle)?.oracle),
|
|
70500
|
-
oracleDescription:
|
|
70946
|
+
oracleDescription: str6(
|
|
70501
70947
|
row.oracleInfo?.feeds?.find((f) => f?.priceDescription)?.priceDescription
|
|
70502
70948
|
),
|
|
70503
70949
|
borrowable: (flags.borrowingEnabled ?? row.borrowingEnabled) === true
|
|
@@ -70934,6 +71380,6 @@ function earnPositionTotals(items) {
|
|
|
70934
71380
|
};
|
|
70935
71381
|
}
|
|
70936
71382
|
|
|
70937
|
-
export { ApiBookSource, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, EARN_DESCRIPTIONS, EARN_LABELS, EMPTY_BALANCE, EXACTLY_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL, SDK_FRACTION_RATE_PROVIDERS, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, TELLER_CALLS_PER_BID, TERMMAX_CALLS_PER_ACCOUNT, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, disambiguateEarnNames, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchDolomiteAccountNumbers, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidFTokens, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRiverMarkets, fetchSiloVaults, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchYearnApiVaults, fetchYearnVaults, filterActiveLenders, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLendingPosition, isLiveMarket as isLivePendleMarket, isStablecoinSymbol, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, parseBalanceFetcherResult, parseEarnUid, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, pruneFeedStats, rankFindings, ratePercent, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, resolveAdapter, resolveDerivation, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, savingsAddresses, savingsBalanceKind, selectAssetGroupPrices, shortDate, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, supplyDescription, supplyFindings, supplyHeadline, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, tickToAprNumber, tickToPrice, toDigest, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
|
|
71383
|
+
export { ApiBookSource, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, EARN_DESCRIPTIONS, EARN_LABELS, EMPTY_BALANCE, EXACTLY_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL, SDK_FRACTION_RATE_PROVIDERS, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, TELLER_CALLS_PER_BID, TERMMAX_CALLS_PER_ACCOUNT, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchDolomiteAccountNumbers, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidDexState, fetchFluidFTokens, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRiverMarkets, fetchSiloVaults, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchYearnApiVaults, fetchYearnVaults, filterActiveLenders, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLendingPosition, isLiveMarket as isLivePendleMarket, isStablecoinSymbol, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, parseBalanceFetcherResult, parseEarnUid, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, pruneFeedStats, rankFindings, ratePercent, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, resolveAdapter, resolveDerivation, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, savingsAddresses, savingsBalanceKind, selectAssetGroupPrices, shortDate, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, supplyDescription, supplyFindings, supplyHeadline, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, tickToAprNumber, tickToPrice, toDigest, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
|
|
70938
71384
|
//# sourceMappingURL=index.js.map
|
|
70939
71385
|
//# sourceMappingURL=index.js.map
|