@1delta/margin-fetcher 5.0.39 → 5.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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, 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, FluidDexResolverAbi, 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 cache2 = BROKER_CACHE[chainId] ??= {};
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 (cache2[id] === void 0) missing.push(id);
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
- cache2[id] = addr3.toLowerCase();
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 = cache2[id];
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 cache2 = FIXED_TERMS_CACHE[chainId] ??= {};
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
- cache2[id] = terms;
10187
+ cache4[id] = terms;
10188
10188
  });
10189
10189
  } catch {
10190
10190
  }
@@ -10413,6 +10413,22 @@ function getDisplayPrice(meta) {
10413
10413
  return meta?.price?.priceUsd ?? 1;
10414
10414
  }
10415
10415
 
10416
+ // src/lending/user-data/utils/resolveModeConfig.ts
10417
+ function resolveModeConfig(configs, mode) {
10418
+ const direct = configs?.[mode];
10419
+ if (direct) return direct;
10420
+ const base = configs?.["0"];
10421
+ const op = base?.openParameter;
10422
+ if (!base || !op) return void 0;
10423
+ const factor = op.curve?.[mode];
10424
+ if (factor == null || op.dimension !== "collateralFactor") return base;
10425
+ return {
10426
+ ...base,
10427
+ collateralFactor: factor,
10428
+ borrowCollateralFactor: factor
10429
+ };
10430
+ }
10431
+
10416
10432
  // src/lending/user-data/utils/types.ts
10417
10433
  function buildUnderlyingInfo(meta) {
10418
10434
  return {
@@ -10463,7 +10479,7 @@ function createBaseTypeUserState(payload, lenderData, totalDeposits24h = 0, tota
10463
10479
  flags,
10464
10480
  configs
10465
10481
  } = lenderData[marketUid];
10466
- const userConfigForAsset = configs[mode];
10482
+ const userConfigForAsset = resolveModeConfig(configs, mode);
10467
10483
  deposits += depositsUSD;
10468
10484
  debt += debtStableUSD;
10469
10485
  debt += debtUSD;
@@ -10531,7 +10547,7 @@ function createBaseTypeUserState(payload, lenderData, totalDeposits24h = 0, tota
10531
10547
  const marketUid = assetKeys[i];
10532
10548
  if (!lenderData?.[marketUid]) continue;
10533
10549
  const { configs, flags, borrowLiquidity, withdrawLiquidity } = lenderData[marketUid];
10534
- const config = configs?.[mode];
10550
+ const config = resolveModeConfig(configs, mode);
10535
10551
  const price2 = getOraclePrice(lenderData[marketUid]);
10536
10552
  const bcf = config?.borrowCollateralFactor ?? 1;
10537
10553
  const bf = config?.borrowFactor ?? 1;
@@ -11411,7 +11427,7 @@ function createMultiAccountTypeUserState(payload, lenderData, histData) {
11411
11427
  });
11412
11428
  stakingDepositAccrual += (intrinsicYield ?? 0) * depositsUSD;
11413
11429
  stakingBorrowAccrual += (intrinsicYield ?? 0) * debtUSD;
11414
- const config = configs?.[mode];
11430
+ const config = resolveModeConfig(configs, mode);
11415
11431
  collateral += (config?.collateralFactor ?? 1) * depositsUSDOracle;
11416
11432
  borrowDiscountedCollateral += (config?.borrowCollateralFactor ?? 1) * depositsUSDOracle;
11417
11433
  adjustedDebt += (config?.borrowFactor ?? 1) * debtUSDOracle;
@@ -11449,7 +11465,7 @@ function createMultiAccountTypeUserState(payload, lenderData, histData) {
11449
11465
  const marketUid = marketUids[i];
11450
11466
  if (!lenderData?.[marketUid]) continue;
11451
11467
  const { configs, flags, borrowLiquidity, withdrawLiquidity } = lenderData[marketUid];
11452
- const config = configs?.[mode];
11468
+ const config = resolveModeConfig(configs, mode);
11453
11469
  const price2 = getOraclePrice(lenderData[marketUid]);
11454
11470
  const bcf = config?.borrowCollateralFactor ?? 1;
11455
11471
  const bf = config?.borrowFactor ?? 1;
@@ -18711,7 +18727,7 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
18711
18727
  { self: market.silo0, other: market.silo1 },
18712
18728
  { self: market.silo1, other: market.silo0 }
18713
18729
  ];
18714
- const toBigInt17 = (v) => {
18730
+ const toBigInt18 = (v) => {
18715
18731
  if (v === void 0 || v === null || v === "0x") return 0n;
18716
18732
  if (typeof v === "bigint") return v;
18717
18733
  try {
@@ -18723,8 +18739,8 @@ var getSiloV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
18723
18739
  for (let s = 0; s < 2; s++) {
18724
18740
  const { self, other } = sides[s];
18725
18741
  const slot = s * SILO_V2_CALLS_PER_SIDE;
18726
- const totalAssetsRaw = toBigInt17(data[slot]);
18727
- const debtAssetsRaw = toBigInt17(data[slot + 1]);
18742
+ const totalAssetsRaw = toBigInt18(data[slot]);
18743
+ const debtAssetsRaw = toBigInt18(data[slot + 1]);
18728
18744
  const irmConfigRaw = data[slot + 2];
18729
18745
  const decimals = self.decimals;
18730
18746
  const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
@@ -18879,7 +18895,7 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
18879
18895
  { self: market.silo0, other: market.silo1 },
18880
18896
  { self: market.silo1, other: market.silo0 }
18881
18897
  ];
18882
- const toBigInt17 = (v) => {
18898
+ const toBigInt18 = (v) => {
18883
18899
  if (v === void 0 || v === null || v === "0x") return 0n;
18884
18900
  if (typeof v === "bigint") return v;
18885
18901
  try {
@@ -18891,8 +18907,8 @@ var getSiloV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
18891
18907
  for (let s = 0; s < 2; s++) {
18892
18908
  const { self, other } = sides[s];
18893
18909
  const slot = s * SILO_V3_CALLS_PER_SIDE;
18894
- const totalAssetsRaw = toBigInt17(data[slot]);
18895
- const debtAssetsRaw = toBigInt17(data[slot + 1]);
18910
+ const totalAssetsRaw = toBigInt18(data[slot]);
18911
+ const debtAssetsRaw = toBigInt18(data[slot + 1]);
18896
18912
  const irmConfigRaw = data[slot + 2];
18897
18913
  const decimals = self.decimals;
18898
18914
  const totalDeposits = Number(formatUnits(totalAssetsRaw, decimals));
@@ -19015,6 +19031,152 @@ var buildFluidCall = (chainId, _lender) => {
19015
19031
  ];
19016
19032
  };
19017
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
+
19018
19180
  // src/lending/public-data/fluid/publicCallParse.ts
19019
19181
  var FLUID_EEE_LOWER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
19020
19182
  var normalizeUnderlying = (addr3) => addr3 === FLUID_EEE_LOWER ? zeroAddress : addr3;
@@ -19053,6 +19215,8 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
19053
19215
  if (data.length !== expectedNumberOfCalls) return void 0;
19054
19216
  const [vaultEntireData, overallTokensData] = data;
19055
19217
  const liquidityByToken = parseOverallTokensData(overallTokensData);
19218
+ const dexState = getCachedFluidDexState(chainId);
19219
+ const apiData = getCachedFluidApiData(chainId);
19056
19220
  const out = {};
19057
19221
  for (const vault of vaultEntireData ?? []) {
19058
19222
  const parsed = parseVault(
@@ -19061,7 +19225,9 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
19061
19225
  prices,
19062
19226
  additionalYields,
19063
19227
  tokenList,
19064
- liquidityByToken
19228
+ liquidityByToken,
19229
+ apiData?.[Number(vault?.constantVariables?.vaultId ?? -1)],
19230
+ dexState
19065
19231
  );
19066
19232
  if (parsed) {
19067
19233
  out[parsed.lender] = {
@@ -19076,7 +19242,42 @@ var getFluidPublicDataConverter = (_lender, chainId, prices, additionalYields, t
19076
19242
  expectedNumberOfCalls
19077
19243
  ];
19078
19244
  };
19079
- function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidityByToken = {}) {
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) {
19080
19281
  const vaultAddress = (vault.vault ?? "").toLowerCase();
19081
19282
  const constants = vault.constantVariables;
19082
19283
  const configs = vault.configs;
@@ -19086,160 +19287,223 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
19086
19287
  if (!vaultAddress || !constants || !configs || !rates || !totals) {
19087
19288
  return void 0;
19088
19289
  }
19089
- if (vault.isSmartCol || vault.isSmartDebt) return void 0;
19090
- const rawCollateral = (constants.supplyToken?.token0 ?? constants.supplyToken ?? "").toString().toLowerCase();
19091
- const rawLoan = (constants.borrowToken?.token0 ?? constants.borrowToken ?? "").toString().toLowerCase();
19092
- if (!rawCollateral || !rawLoan) return void 0;
19093
- const collateralAddress = normalizeUnderlying(rawCollateral);
19094
- const loanAddress = normalizeUnderlying(rawLoan);
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;
19095
19304
  const vaultId = Number(constants.vaultId ?? 0);
19305
+ const vaultType = Number(constants.vaultType ?? 0);
19096
19306
  const lender = `FLUID_${chainId}_${vaultId}`;
19097
- const collateralMeta = tokenList[collateralAddress];
19098
- const loanMeta = tokenList[loanAddress];
19099
- const colDecimals = Number(
19100
- constants.supplyDecimals ?? collateralMeta?.decimals ?? 18
19101
- );
19102
- const borrowDecimals = Number(
19103
- constants.borrowDecimals ?? loanMeta?.decimals ?? 18
19104
- );
19105
- const totalSupply = Number(
19106
- parseRawAmount(totals.totalSupplyVault?.toString(), colDecimals)
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
19107
19342
  );
19108
- const totalBorrow = Number(
19109
- parseRawAmount(totals.totalBorrowVault?.toString(), borrowDecimals)
19343
+ const debtShares = resolveShares(
19344
+ isSmartDebt,
19345
+ constants.borrow,
19346
+ debtTokens,
19347
+ (s) => [s.token0PerBorrowShare, s.token1PerBorrowShare],
19348
+ api?.borrowShares
19110
19349
  );
19111
- const borrowable = Number(
19112
- parseRawAmount(limits?.borrowable?.toString(), borrowDecimals)
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
+ )
19113
19369
  );
19114
- const withdrawable = Number(
19115
- parseRawAmount(limits?.withdrawable?.toString(), colDecimals)
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
19116
19377
  );
19378
+ if (!colLegs.length || !debtLegs.length) return void 0;
19117
19379
  const totalSupplyRaw = BigInt(totals.totalSupplyVault?.toString() ?? "0");
19118
19380
  const withdrawLimitRaw = BigInt(limits?.withdrawLimit?.toString() ?? "0");
19119
19381
  const lockupRatio = totalSupplyRaw > 0n ? Number(withdrawLimitRaw * 10000n / totalSupplyRaw) / 1e4 : 0;
19120
- const collateralPriceKey = toOracleKey(collateralMeta?.assetGroup) ?? toGenericPriceKey(collateralAddress, chainId);
19121
- const loanPriceKey = toOracleKey(loanMeta?.assetGroup) ?? toGenericPriceKey(loanAddress, chainId);
19122
- const collateralPrice = prices[collateralPriceKey] ?? 0;
19123
- const loanPrice = prices[loanPriceKey] ?? 0;
19124
19382
  const ltv = Number(configs.collateralFactor ?? 0) / BPS;
19125
19383
  const liquidationThreshold = Number(configs.liquidationThreshold ?? 0) / BPS;
19126
19384
  const liquidationPenalty = Number(configs.liquidationPenalty ?? 0) / BPS;
19127
- const supplyRate = scaleFluidRate(rates.supplyRateVault);
19128
- const borrowRate = scaleFluidRate(rates.borrowRateVault);
19129
- const collateralLiquidity = liquidityByToken[collateralAddress];
19130
- const loanLiquidity = liquidityByToken[loanAddress];
19385
+ const priceKeyFor = (token) => {
19386
+ const meta = tokenList[token];
19387
+ return toOracleKey(meta?.assetGroup) ?? toGenericPriceKey(token, chainId);
19388
+ };
19131
19389
  const irmTotals = (state, decimals) => state ? {
19132
19390
  irmTotalDeposits: Number(parseRawAmount(state.totalSupply, decimals)),
19133
19391
  irmTotalDebt: Number(parseRawAmount(state.totalBorrow, decimals))
19134
19392
  } : {};
19135
19393
  const data = {};
19136
- const collateralMarketUid = createMarketUid(
19137
- chainId,
19138
- lender,
19139
- collateralAddress
19140
- );
19141
- data[collateralMarketUid] = {
19142
- marketUid: collateralMarketUid,
19143
- name: "Collateral " + (collateralMeta?.symbol ?? ""),
19144
- poolId: collateralAddress,
19145
- underlying: collateralAddress,
19146
- asset: collateralMeta,
19147
- totalDeposits: totalSupply,
19148
- totalDebtStable: 0,
19149
- totalDebt: 0,
19150
- totalLiquidity: totalSupply,
19151
- borrowLiquidity: 0,
19152
- totalDepositsUSD: totalSupply * collateralPrice,
19153
- totalDebtStableUSD: 0,
19154
- totalDebtUSD: 0,
19155
- totalLiquidityUSD: totalSupply * collateralPrice,
19156
- borrowLiquidityUSD: 0,
19157
- // IRM x-coordinate: the collateral token's Liquidity-layer utilization —
19158
- // it drives the supply rate (borrowRate × utilization × (1 - fee)).
19159
- utilization: collateralLiquidity?.utilization ?? 0,
19160
- ...irmTotals(collateralLiquidity, colDecimals),
19161
- // Share of this vault's collateral currently locked below the LL
19162
- // withdrawal limit (withdrawLimit / totalSupplyVault).
19163
- lockupRatio,
19164
- depositRate: supplyRate,
19165
- // vault collateral earns the supply side rate
19166
- variableBorrowRate: 0,
19167
- stableBorrowRate: 0,
19168
- intrinsicYield: additionalYields?.intrinsicYields?.[collateralPriceKey] ?? 0,
19169
- rewards: [],
19170
- decimals: colDecimals,
19171
- config: {
19172
- "0": {
19173
- category: 0,
19174
- borrowCollateralFactor: ltv,
19175
- collateralFactor: liquidationThreshold,
19176
- borrowFactor: 1,
19177
- liquidationPenalty,
19178
- closeFactor: 1,
19179
- collateralDisabled: false,
19180
- debtDisabled: true
19181
- }
19182
- },
19183
- liquidationBonus: liquidationPenalty,
19184
- closeFactor: 1,
19185
- collateralActive: true,
19186
- borrowingEnabled: false,
19187
- depositsEnabled: true,
19188
- hasStable: false,
19189
- isActive: true,
19190
- isFrozen: false
19191
- };
19192
- const loanMarketUid = createMarketUid(chainId, lender, loanAddress);
19193
- data[loanMarketUid] = {
19194
- marketUid: loanMarketUid,
19195
- name: "Loan " + (loanMeta?.symbol ?? ""),
19196
- poolId: loanAddress,
19197
- underlying: loanAddress,
19198
- asset: loanMeta,
19199
- totalDeposits: 0,
19200
- totalDebtStable: 0,
19201
- totalDebt: totalBorrow,
19202
- totalLiquidity: borrowable,
19203
- borrowLiquidity: borrowable,
19204
- totalDepositsUSD: 0,
19205
- totalDebtStableUSD: 0,
19206
- totalDebtUSD: totalBorrow * loanPrice,
19207
- totalLiquidityUSD: borrowable * loanPrice,
19208
- borrowLiquidityUSD: borrowable * loanPrice,
19209
- // IRM x-coordinate: the loan token's Liquidity-layer utilization — the
19210
- // exact input the current borrow rate was computed from.
19211
- utilization: loanLiquidity?.utilization ?? 0,
19212
- ...irmTotals(loanLiquidity, borrowDecimals),
19213
- depositRate: 0,
19214
- variableBorrowRate: borrowRate,
19215
- stableBorrowRate: 0,
19216
- intrinsicYield: additionalYields?.intrinsicYields?.[loanPriceKey] ?? 0,
19217
- rewards: [],
19218
- decimals: borrowDecimals,
19219
- config: {
19220
- "0": {
19221
- category: 0,
19222
- borrowCollateralFactor: 0,
19223
- collateralFactor: 0,
19224
- borrowFactor: 1,
19225
- liquidationPenalty: 0,
19226
- closeFactor: 1,
19227
- collateralDisabled: true,
19228
- debtDisabled: false
19229
- }
19230
- },
19231
- liquidationBonus: 0,
19232
- closeFactor: 1,
19233
- collateralActive: false,
19234
- borrowingEnabled: true,
19235
- depositsEnabled: false,
19236
- hasStable: false,
19237
- isActive: true,
19238
- 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;
19239
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;
19240
19504
  const llSupply = vault.liquidityUserSupplyData;
19241
19505
  const liquidityUserSupply = llSupply ? {
19242
- withdrawable,
19506
+ withdrawable: colLegs[0]?.available ?? 0,
19243
19507
  withdrawalLimit: llSupply.withdrawalLimit?.toString() ?? "0",
19244
19508
  baseWithdrawalLimit: llSupply.baseWithdrawalLimit?.toString() ?? "0",
19245
19509
  expandPercent: Number(llSupply.expandPercent ?? 0),
@@ -19255,6 +19519,14 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
19255
19519
  borrowRate: state.borrowRate,
19256
19520
  supplyRate: state.supplyRate
19257
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
+ });
19258
19530
  return {
19259
19531
  lender,
19260
19532
  data,
@@ -19263,10 +19535,18 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
19263
19535
  lender,
19264
19536
  vaultAddress,
19265
19537
  vaultId,
19266
- collateralAddress,
19267
- loanAddress,
19268
- collateralDecimals: colDecimals,
19269
- loanDecimals: borrowDecimals,
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),
19270
19550
  oracle: configs.oracle,
19271
19551
  rebalancer: configs.rebalancer,
19272
19552
  liquidationThreshold,
@@ -19274,12 +19554,21 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
19274
19554
  liquidationPenalty,
19275
19555
  oraclePriceOperate: configs.oraclePriceOperate?.toString(),
19276
19556
  oraclePriceLiquidate: configs.oraclePriceLiquidate?.toString(),
19277
- isSmartCol: !!vault.isSmartCol,
19278
- isSmartDebt: !!vault.isSmartDebt,
19557
+ isSmartCol,
19558
+ isSmartDebt,
19559
+ /** DEX trading yield, percent APR. Supply ADDS it, debt NETS it off. */
19560
+ supplyDexTradingRate: supplyDexTrading,
19561
+ borrowDexTradingRate: borrowDexTrading,
19279
19562
  liquidityUserSupply,
19280
19563
  liquidity: {
19281
- supplyToken: formatLiquidity(collateralLiquidity, colDecimals),
19282
- borrowToken: formatLiquidity(loanLiquidity, borrowDecimals)
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
+ )
19283
19572
  }
19284
19573
  }
19285
19574
  }
@@ -19913,11 +20202,13 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
19913
20202
  }) => {
19914
20203
  let calls = [];
19915
20204
  const validLenders = [];
20205
+ const sliceStart = {};
19916
20206
  for (const lender of lenders) {
19917
20207
  const abi = getAbi(lender);
19918
20208
  const callData = buildLenderCall(chainId, lender);
19919
20209
  if (callData.some((c) => !c.address)) continue;
19920
20210
  const mappedCalls = callData.map((call) => ({ call, abi: call.abi ?? abi }));
20211
+ sliceStart[lender] = calls.length;
19921
20212
  calls.push(...mappedCalls);
19922
20213
  validLenders.push(lender);
19923
20214
  }
@@ -19928,8 +20219,31 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
19928
20219
  abi: calls.map((call) => call.abi),
19929
20220
  batchSize: chainId === Chain.ETHEREUM_MAINNET ? 500 : void 0
19930
20221
  }),
19931
- 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)
19932
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
+ }
19933
20247
  const invalidLenders = [];
19934
20248
  let lenderData = {};
19935
20249
  let currentSlice = 0;
@@ -24474,7 +24788,14 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
24474
24788
  dimension: "collateralFactor",
24475
24789
  domain: { min: LLAMALEND_MIN_BANDS, max: LLAMALEND_MAX_BANDS },
24476
24790
  default: market.defaultBands ?? 10,
24477
- immutableAfterOpen: true
24791
+ immutableAfterOpen: true,
24792
+ // The whole curve, so a consumer holding a position's ACTUAL `N` can
24793
+ // resolve the factor it implies instead of the default's — the config
24794
+ // lookup `configs[mode]` cannot work here (the mode slot carries a
24795
+ // parameter VALUE, not a config key), and before this rode along, that
24796
+ // miss fell through to factor 1: undiscounted collateral, health =
24797
+ // deposits/debt, and a max-loop quote the Controller would refuse.
24798
+ curve: m.bandLtv ?? void 0
24478
24799
  };
24479
24800
  const entry = { data: {} };
24480
24801
  const collUid = createMarketUid(chainId, lenderKey, collAddr);
@@ -24562,7 +24883,14 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
24562
24883
  liquidationPenalty: liqPenalty,
24563
24884
  closeFactor,
24564
24885
  collateralDisabled: true,
24565
- debtDisabled: !m.borrowingEnabled
24886
+ debtDisabled: !m.borrowingEnabled,
24887
+ // CURVE-LESS on purpose: this row's factors are constants (the
24888
+ // borrowed side never backs a loan, whatever `N` is), but the row
24889
+ // must still declare the market parameterized — a position's mode
24890
+ // slot carries the band count, and without this marker a
24891
+ // `resolveModeConfig` miss would fall through to the callers'
24892
+ // factor-1 fallback and count the LEND leg as full collateral.
24893
+ openParameter: { ...bandParameter, curve: void 0 }
24566
24894
  }
24567
24895
  },
24568
24896
  closeFactor,
@@ -26444,7 +26772,7 @@ function bigintToLtv(v) {
26444
26772
  return Number.isFinite(n) ? n / 1e18 : 0;
26445
26773
  }
26446
26774
  }
26447
- var ZERO_ADDRESS4 = "0x0000000000000000000000000000000000000000";
26775
+ var ZERO_ADDRESS6 = "0x0000000000000000000000000000000000000000";
26448
26776
  function convertSiloV3MarketsToPublicResponse(apiItems, chainId, prices, additionalYields = {
26449
26777
  intrinsicYields: {},
26450
26778
  lenderRewards: {},
@@ -26547,8 +26875,8 @@ function convertSiloV3MarketsToPublicResponse(apiItems, chainId, prices, additio
26547
26875
  silo: self.silo.toLowerCase(),
26548
26876
  counterpartySilo: other.silo.toLowerCase(),
26549
26877
  siloConfig: registryEntry.siloConfig.toLowerCase(),
26550
- oracle: (api.solvencyOracleAddress || self.solvencyOracle || ZERO_ADDRESS4).toLowerCase(),
26551
- irm: (api.interestRateModelId || self.interestRateModel || ZERO_ADDRESS4).toLowerCase(),
26878
+ oracle: (api.solvencyOracleAddress || self.solvencyOracle || ZERO_ADDRESS6).toLowerCase(),
26879
+ irm: (api.interestRateModelId || self.interestRateModel || ZERO_ADDRESS6).toLowerCase(),
26552
26880
  shareTokens: {
26553
26881
  collateral: self.collateralShareToken,
26554
26882
  protected: self.protectedShareToken,
@@ -30851,11 +31179,11 @@ var getSiloV2UserDataConverter = (lender, chainId, account, metaMap) => {
30851
31179
  for (let s = 0; s < 2; s++) {
30852
31180
  const { self } = sides[s];
30853
31181
  const slot = s * SILO_V2_USER_CALLS_PER_SIDE;
30854
- const collateralShares = toBigInt6(data[slot]);
30855
- const protectedShares = toBigInt6(data[slot + 1]);
30856
- const collateralRate = toBigInt6(data[slot + 2]);
30857
- const protectedRate = toBigInt6(data[slot + 3]);
30858
- const repayRaw = toBigInt6(data[slot + 4]);
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]);
30859
31187
  const decimals = self.decimals;
30860
31188
  const oneUnit = BigInt(10) ** BigInt(decimals);
30861
31189
  const collateralAssets = oneUnit > 0n ? collateralShares * collateralRate / oneUnit : 0n;
@@ -30936,7 +31264,7 @@ var getSiloV2UserDataConverter = (lender, chainId, account, metaMap) => {
30936
31264
  SILO_V2_USER_CALLS_PER_PAIR
30937
31265
  ];
30938
31266
  };
30939
- function toBigInt6(v) {
31267
+ function toBigInt7(v) {
30940
31268
  if (v === void 0 || v === null || v === "0x") return 0n;
30941
31269
  if (typeof v === "bigint") return v;
30942
31270
  try {
@@ -30963,11 +31291,11 @@ var getSiloV3UserDataConverter = (lender, chainId, account, metaMap) => {
30963
31291
  for (let s = 0; s < 2; s++) {
30964
31292
  const { self } = sides[s];
30965
31293
  const slot = s * SILO_V3_USER_CALLS_PER_SIDE;
30966
- const collateralShares = toBigInt7(data[slot]);
30967
- const protectedShares = toBigInt7(data[slot + 1]);
30968
- const collateralRate = toBigInt7(data[slot + 2]);
30969
- const protectedRate = toBigInt7(data[slot + 3]);
30970
- const repayRaw = toBigInt7(data[slot + 4]);
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]);
30971
31299
  const decimals = self.decimals;
30972
31300
  const oneUnit = BigInt(10) ** BigInt(decimals);
30973
31301
  const collateralAssets = oneUnit > 0n ? collateralShares * collateralRate / oneUnit : 0n;
@@ -31046,7 +31374,7 @@ var getSiloV3UserDataConverter = (lender, chainId, account, metaMap) => {
31046
31374
  SILO_V3_USER_CALLS_PER_PAIR
31047
31375
  ];
31048
31376
  };
31049
- function toBigInt7(v) {
31377
+ function toBigInt8(v) {
31050
31378
  if (v === void 0 || v === null || v === "0x") return 0n;
31051
31379
  if (typeof v === "bigint") return v;
31052
31380
  try {
@@ -31057,7 +31385,7 @@ function toBigInt7(v) {
31057
31385
  }
31058
31386
  var FLUID_EEE_LOWER2 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
31059
31387
  var normalizeUnderlying2 = (addr3) => addr3 === FLUID_EEE_LOWER2 ? zeroAddress : addr3;
31060
- function toBigInt8(v) {
31388
+ function toBigInt9(v) {
31061
31389
  if (v === void 0 || v === null || v === "0x") return 0n;
31062
31390
  if (typeof v === "bigint") return v;
31063
31391
  try {
@@ -31076,12 +31404,12 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
31076
31404
  const vaults = result[1];
31077
31405
  if (!Array.isArray(positions) || !Array.isArray(vaults) || positions.length === 0)
31078
31406
  return void 0;
31407
+ const dexState = getCachedFluidDexState(chainId);
31079
31408
  const perVault = /* @__PURE__ */ new Map();
31080
31409
  for (let i = 0; i < positions.length; i++) {
31081
31410
  const pos = positions[i];
31082
31411
  const vault = vaults[i];
31083
31412
  if (!vault?.constantVariables) continue;
31084
- if (vault.isSmartCol || vault.isSmartDebt) continue;
31085
31413
  if (pos.isLiquidated) continue;
31086
31414
  const vaultId = Number(vault.constantVariables.vaultId ?? 0);
31087
31415
  if (!perVault.has(vaultId)) perVault.set(vaultId, []);
@@ -31093,80 +31421,123 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
31093
31421
  const lenderKey = `${Lender.FLUID}_${chainId}_${vaultId}`;
31094
31422
  const metaMap = meta?.[lenderKey];
31095
31423
  if (!metaMap) continue;
31096
- const constants = nfts[0].vault.constantVariables;
31097
- const rawCol = (constants.supplyToken?.token0 ?? constants.supplyToken ?? "").toString().toLowerCase();
31098
- const rawLoan = (constants.borrowToken?.token0 ?? constants.borrowToken ?? "").toString().toLowerCase();
31099
- if (!rawCol || !rawLoan) continue;
31100
- const collateral = normalizeUnderlying2(rawCol);
31101
- const loan = normalizeUnderlying2(rawLoan);
31102
- const colMarketUid = createMarketUid(chainId, lenderKey, collateral);
31103
- const loanMarketUid = createMarketUid(chainId, lenderKey, loan);
31104
- const colMeta = metaMap[colMarketUid];
31105
- const loanMeta = metaMap[loanMarketUid];
31106
- const colDec = colMeta?.asset?.decimals ?? 18;
31107
- const loanDec = loanMeta?.asset?.decimals ?? 18;
31108
- const colDisplayPrice = colMeta ? getDisplayPrice(colMeta) : 0;
31109
- const colOraclePrice = colMeta ? getOraclePrice(colMeta) : 0;
31110
- const loanDisplayPrice = loanMeta ? getDisplayPrice(loanMeta) : 0;
31111
- const loanOraclePrice = loanMeta ? getOraclePrice(loanMeta) : 0;
31112
- const colPriceHist = colMeta?.price?.priceUsd24h ?? colDisplayPrice;
31113
- const loanPriceHist = loanMeta?.price?.priceUsd24h ?? loanDisplayPrice;
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;
31114
31478
  const lendingPositions = {};
31115
31479
  const modes = {};
31116
31480
  const histData = {};
31117
31481
  for (const { pos } of nfts) {
31118
31482
  const nftId = pos.nftId.toString();
31119
- const supplyRaw = toBigInt8(pos.supply);
31120
- const borrowRaw = toBigInt8(pos.borrow) + toBigInt8(pos.dustBorrow);
31483
+ const supplyRaw = toBigInt9(pos.supply);
31484
+ const borrowRaw = toBigInt9(pos.borrow) + toBigInt9(pos.dustBorrow);
31121
31485
  if (supplyRaw === 0n && borrowRaw === 0n) continue;
31122
- const depositsStr = parseRawAmount(
31123
- supplyRaw.toString(),
31124
- colDec
31125
- );
31126
- const debtStr = parseRawAmount(borrowRaw.toString(), loanDec);
31127
- const depositsNum = Number(depositsStr);
31128
- const debtNum = Number(debtStr);
31129
- const depositsUSD = depositsNum * colDisplayPrice;
31130
- const debtUSD = debtNum * loanDisplayPrice;
31131
- const depositsUSDOracle = depositsNum * colOraclePrice;
31132
- const debtUSDOracle = debtNum * loanOraclePrice;
31133
- histData[nftId] = {
31134
- totalDeposits24h: depositsNum * colPriceHist,
31135
- totalDebt24h: debtNum * loanPriceHist
31136
- };
31137
31486
  modes[nftId] = 0;
31138
31487
  const posData = {};
31139
- posData[colMarketUid] = {
31140
- marketUid: colMarketUid,
31141
- underlying: collateral,
31142
- deposits: depositsStr,
31143
- debt: "0",
31144
- debtStable: "0",
31145
- depositsUSD,
31146
- debtUSD: 0,
31147
- debtStableUSD: 0,
31148
- depositsUSDOracle,
31149
- debtUSDOracle: 0,
31150
- debtStableUSDOracle: 0,
31151
- stableBorrowRate: "0",
31152
- collateralEnabled: supplyRaw > 0n,
31153
- claimableRewards: 0
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;
31154
31511
  };
31155
- posData[loanMarketUid] = {
31156
- marketUid: loanMarketUid,
31157
- underlying: loan,
31158
- deposits: "0",
31159
- debt: debtStr,
31160
- debtStable: "0",
31161
- depositsUSD: 0,
31162
- debtUSD,
31163
- debtStableUSD: 0,
31164
- depositsUSDOracle: 0,
31165
- debtUSDOracle,
31166
- debtStableUSDOracle: 0,
31167
- stableBorrowRate: "0",
31168
- collateralEnabled: false,
31169
- claimableRewards: 0
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
31170
31541
  };
31171
31542
  lendingPositions[nftId] = posData;
31172
31543
  }
@@ -31190,7 +31561,7 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
31190
31561
  FLUID_USER_CALL_COUNT
31191
31562
  ];
31192
31563
  };
31193
- function toBigInt9(v) {
31564
+ function toBigInt10(v) {
31194
31565
  if (v === void 0 || v === null || v === "0x") return 0n;
31195
31566
  if (typeof v === "bigint") return v;
31196
31567
  try {
@@ -31274,7 +31645,7 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
31274
31645
  for (const ca of accounts) {
31275
31646
  const caAddress = (ca.creditAccount ?? ca.addr ?? "").toString().toLowerCase();
31276
31647
  if (!caAddress) continue;
31277
- const debtRaw = toBigInt9(ca.debt);
31648
+ const debtRaw = toBigInt10(ca.debt);
31278
31649
  const tokens = Array.isArray(ca.tokens) ? ca.tokens : Array.isArray(ca.balances) ? ca.balances : [];
31279
31650
  modes[caAddress] = 0;
31280
31651
  const posData = {};
@@ -31283,9 +31654,9 @@ var getGearboxV3UserDataConverter = (_lender, chainId, account, meta) => {
31283
31654
  const rawToken = (bal?.token ?? "").toString().toLowerCase();
31284
31655
  if (!rawToken) continue;
31285
31656
  const token = rawToken;
31286
- const balRaw = toBigInt9(bal.balance);
31657
+ const balRaw = toBigInt10(bal.balance);
31287
31658
  if (balRaw === 0n) continue;
31288
- const quotaRaw = toBigInt9(bal.quota);
31659
+ const quotaRaw = toBigInt10(bal.quota);
31289
31660
  const isQuoted = quotaRaw > 0n || !!bal?.isQuoted;
31290
31661
  const colMarketUid = createMarketUid(chainId, lenderKey, token);
31291
31662
  ensureMetaStub(metaMap, colMarketUid, token);
@@ -31460,7 +31831,7 @@ function normalizeUnderlying3(token) {
31460
31831
  const lower3 = token.toLowerCase();
31461
31832
  return Object.values(WETH_BY_CHAIN).includes(lower3) ? zeroAddress : lower3;
31462
31833
  }
31463
- function toBigInt10(v) {
31834
+ function toBigInt11(v) {
31464
31835
  if (v === void 0 || v === null || v === "0x") return 0n;
31465
31836
  if (typeof v === "bigint") return v;
31466
31837
  try {
@@ -31470,22 +31841,22 @@ function toBigInt10(v) {
31470
31841
  }
31471
31842
  }
31472
31843
  function readDebtUnits(positionResult) {
31473
- if (Array.isArray(positionResult)) return toBigInt10(positionResult[4]);
31844
+ if (Array.isArray(positionResult)) return toBigInt11(positionResult[4]);
31474
31845
  if (positionResult && typeof positionResult === "object")
31475
- return toBigInt10(positionResult.debt);
31846
+ return toBigInt11(positionResult.debt);
31476
31847
  return 0n;
31477
31848
  }
31478
31849
  function readUpdatedLender(updateResult) {
31479
31850
  if (Array.isArray(updateResult)) {
31480
31851
  return {
31481
- credit: toBigInt10(updateResult[0]),
31482
- pendingFee: toBigInt10(updateResult[1])
31852
+ credit: toBigInt11(updateResult[0]),
31853
+ pendingFee: toBigInt11(updateResult[1])
31483
31854
  };
31484
31855
  }
31485
31856
  if (updateResult && typeof updateResult === "object") {
31486
31857
  return {
31487
- credit: toBigInt10(updateResult.newCredit),
31488
- pendingFee: toBigInt10(updateResult.newPendingFee)
31858
+ credit: toBigInt11(updateResult.newCredit),
31859
+ pendingFee: toBigInt11(updateResult.newPendingFee)
31489
31860
  };
31490
31861
  }
31491
31862
  return { credit: 0n, pendingFee: 0n };
@@ -31556,7 +31927,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
31556
31927
  pendingFee: pendingFeeStr
31557
31928
  };
31558
31929
  market.collateralParams.forEach((c, i) => {
31559
- const collAmt = toBigInt10(collateralResults[i]);
31930
+ const collAmt = toBigInt11(collateralResults[i]);
31560
31931
  if (collAmt === 0n) return;
31561
31932
  anyBalance = true;
31562
31933
  const collAddr = c.token.toLowerCase();
@@ -31605,7 +31976,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
31605
31976
  ];
31606
31977
  };
31607
31978
  var WAD11 = 1000000000000000000n;
31608
- function toBigInt11(v) {
31979
+ function toBigInt12(v) {
31609
31980
  if (v === void 0 || v === null || v === "0x") return 0n;
31610
31981
  if (typeof v === "bigint") return v;
31611
31982
  try {
@@ -31642,11 +32013,11 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
31642
32013
  const loanDisplayPrice = loanMeta ? getDisplayPrice(loanMeta) : 0;
31643
32014
  const loanOraclePrice = loanMeta ? getOraclePrice(loanMeta) : 0;
31644
32015
  const loanPriceHist = loanMeta?.price?.priceUsd24h ?? loanDisplayPrice;
31645
- const debtUnits = toBigInt11(obligationResult);
32016
+ const debtUnits = toBigInt12(obligationResult);
31646
32017
  const debtStr = parseRawAmount(debtUnits.toString(), market.loanDecimals);
31647
32018
  const debtNum = Number(debtStr);
31648
- const repoBalance = toBigInt11(balanceResult);
31649
- const redemptionValue = toBigInt11(redemptionResult) || toBigInt11(market.redemptionValue) || WAD11;
32019
+ const repoBalance = toBigInt12(balanceResult);
32020
+ const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD11;
31650
32021
  const lentUnits = repoBalance * redemptionValue / WAD11;
31651
32022
  const depositsStr = parseRawAmount(lentUnits.toString(), market.loanDecimals);
31652
32023
  const depositsNum = Number(depositsStr);
@@ -31670,7 +32041,7 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
31670
32041
  claimableRewards: 0
31671
32042
  };
31672
32043
  market.collateralParams.forEach((c, i) => {
31673
- const collAmt = toBigInt11(collateralResults[i]);
32044
+ const collAmt = toBigInt12(collateralResults[i]);
31674
32045
  if (collAmt === 0n) return;
31675
32046
  anyBalance = true;
31676
32047
  const collAddr = c.token.toLowerCase();
@@ -33331,7 +33702,7 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
33331
33702
  ];
33332
33703
  };
33333
33704
  var nowSec8 = () => Math.floor(Date.now() / 1e3);
33334
- function toBigInt12(v) {
33705
+ function toBigInt13(v) {
33335
33706
  if (v === void 0 || v === null || v === "0x") return 0n;
33336
33707
  if (typeof v === "bigint") return v;
33337
33708
  try {
@@ -33348,18 +33719,18 @@ function field11(res, name, index) {
33348
33719
  return void 0;
33349
33720
  }
33350
33721
  function parsePosition(res) {
33351
- const ftBalance = toBigInt12(field11(res, "ftBalance", 2));
33352
- const xtBalance = toBigInt12(field11(res, "xtBalance", 3));
33722
+ const ftBalance = toBigInt13(field11(res, "ftBalance", 2));
33723
+ const xtBalance = toBigInt13(field11(res, "xtBalance", 3));
33353
33724
  const rawGts = field11(res, "gtInfo", 4);
33354
33725
  const gts = [];
33355
33726
  if (Array.isArray(rawGts)) {
33356
33727
  for (const g of rawGts) {
33357
- const loanId = toBigInt12(field11(g, "loanId", 0));
33728
+ const loanId = toBigInt13(field11(g, "loanId", 0));
33358
33729
  if (loanId === 0n) continue;
33359
33730
  gts.push({
33360
33731
  loanId: loanId.toString(),
33361
- collateralAmt: toBigInt12(field11(g, "collateralAmt", 1)),
33362
- debtAmt: toBigInt12(field11(g, "debtAmt", 2))
33732
+ collateralAmt: toBigInt13(field11(g, "collateralAmt", 1)),
33733
+ debtAmt: toBigInt13(field11(g, "debtAmt", 2))
33363
33734
  });
33364
33735
  }
33365
33736
  }
@@ -38912,7 +39283,7 @@ async function fetchJsonWithProxyFallback(url, body, proxyConfig) {
38912
39283
  if (!proxyConfig) return void 0;
38913
39284
  return attemptFetchJson(url, body, proxyConfig);
38914
39285
  }
38915
- var inflight = /* @__PURE__ */ new Map();
39286
+ var inflight3 = /* @__PURE__ */ new Map();
38916
39287
  var resolved = /* @__PURE__ */ new Map();
38917
39288
  function cacheKey6(chainId, account) {
38918
39289
  return `${chainId}:${account.toLowerCase()}`;
@@ -38924,15 +39295,15 @@ async function dedupedFetch(chainId, account, loader) {
38924
39295
  if (cached && cached.expiresAt > now) {
38925
39296
  return cached.value;
38926
39297
  }
38927
- const existing = inflight.get(key3);
39298
+ const existing = inflight3.get(key3);
38928
39299
  if (existing) return existing;
38929
39300
  const promise = loader().then((value) => {
38930
39301
  resolved.set(key3, { value, expiresAt: Date.now() + CACHE_TTL_MS5 });
38931
39302
  return value;
38932
39303
  }).finally(() => {
38933
- inflight.delete(key3);
39304
+ inflight3.delete(key3);
38934
39305
  });
38935
- inflight.set(key3, promise);
39306
+ inflight3.set(key3, promise);
38936
39307
  return promise;
38937
39308
  }
38938
39309
  function hasMorphoUserSubgraph(chainId) {
@@ -45543,6 +45914,7 @@ var SPARK_V2_WITHDRAW_INTENTS = "0x592b7db9906e6f8924c4d74c2a0ab86ce44fdddf";
45543
45914
  var frankencoinSavingsBase = {
45544
45915
  reader: "frankencoin-savings",
45545
45916
  symbol: "ZCHF",
45917
+ label: "Savings Module",
45546
45918
  brand: "Frankencoin",
45547
45919
  description: "ZCHF is Frankencoin's decentralised Swiss-franc stablecoin, minted against collateral in permissionless, auction-policed positions. The savings module pays a governance-set rate funded by borrower interest: deposits are never lent on (they sit segregated inside the module) and interest is minted by the protocol into your balance, so there are no shares and no share price. Withdrawals are instant and uncapped, but interest only starts accruing after 3 days and a top-up restarts that clock pro-rata, so a short stay can earn nothing.",
45548
45920
  decimals: 18,
@@ -47784,7 +48156,7 @@ var DLEND_POOLS = [
47784
48156
  pool: "0x6598DaD18Bda89A0E58A1F427c8CeBc0dE90F153"
47785
48157
  }
47786
48158
  ];
47787
- var ZERO_ADDRESS5 = "0x0000000000000000000000000000000000000000";
48159
+ var ZERO_ADDRESS7 = "0x0000000000000000000000000000000000000000";
47788
48160
  var SECONDS_PER_YEAR12 = 31536e3;
47789
48161
  var ABI = [
47790
48162
  {
@@ -47901,7 +48273,7 @@ var DTRINITY_SOURCE = {
47901
48273
  link: "https://docs.dtrinity.org/protocol-components/dlend",
47902
48274
  platform: "protocol"
47903
48275
  };
47904
- var isZero = (a) => !a || a.toLowerCase() === ZERO_ADDRESS5;
48276
+ var isZero = (a) => !a || a.toLowerCase() === ZERO_ADDRESS7;
47905
48277
  var scale = (raw, decimals) => Number(raw) / 10 ** decimals;
47906
48278
  function emptyReward2() {
47907
48279
  return {
@@ -50661,7 +51033,7 @@ var SiloOracleAbi = [
50661
51033
  type: "function"
50662
51034
  }
50663
51035
  ];
50664
- var ZERO_ADDRESS6 = "0x0000000000000000000000000000000000000000";
51036
+ var ZERO_ADDRESS8 = "0x0000000000000000000000000000000000000000";
50665
51037
  function lookupUSD(context, asset) {
50666
51038
  const lc = asset.toLowerCase();
50667
51039
  const groupKey = context.tokenList?.[lc]?.assetGroup ?? `${context.chainId}-${lc}`;
@@ -50673,7 +51045,7 @@ function getSiloV2Calls(chainId) {
50673
51045
  const tokensWithRealOracle = /* @__PURE__ */ new Set();
50674
51046
  for (const market of allMarkets) {
50675
51047
  for (const half of [market.silo0, market.silo1]) {
50676
- if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS6) {
51048
+ if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS8) {
50677
51049
  tokensWithRealOracle.add(half.token.toLowerCase());
50678
51050
  }
50679
51051
  }
@@ -50686,7 +51058,7 @@ function getSiloV2Calls(chainId) {
50686
51058
  const lenderKey = siloV2LenderKey(market.siloConfig);
50687
51059
  const halves = [market.silo0, market.silo1];
50688
51060
  const isStatic = halves.map(
50689
- (h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS6
51061
+ (h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS8
50690
51062
  );
50691
51063
  if (isStatic[0] && isStatic[1]) {
50692
51064
  const t0 = halves[0].token.toLowerCase();
@@ -50706,7 +51078,7 @@ function getSiloV2Calls(chainId) {
50706
51078
  decimals: half.decimals,
50707
51079
  silo: half.silo.toLowerCase(),
50708
51080
  lenderKey,
50709
- oracle: ZERO_ADDRESS6,
51081
+ oracle: ZERO_ADDRESS8,
50710
51082
  partnerToken: partnerLc,
50711
51083
  isStatic: true
50712
51084
  });
@@ -50830,7 +51202,7 @@ var SiloOracleAbi2 = [
50830
51202
  type: "function"
50831
51203
  }
50832
51204
  ];
50833
- var ZERO_ADDRESS7 = "0x0000000000000000000000000000000000000000";
51205
+ var ZERO_ADDRESS9 = "0x0000000000000000000000000000000000000000";
50834
51206
  function lookupUSD2(context, asset) {
50835
51207
  const lc = asset.toLowerCase();
50836
51208
  const groupKey = context.tokenList?.[lc]?.assetGroup ?? `${context.chainId}-${lc}`;
@@ -50842,7 +51214,7 @@ function getSiloV3Calls(chainId) {
50842
51214
  const tokensWithRealOracle = /* @__PURE__ */ new Set();
50843
51215
  for (const market of allMarkets) {
50844
51216
  for (const half of [market.silo0, market.silo1]) {
50845
- if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS7) {
51217
+ if (half.solvencyOracle && half.solvencyOracle !== ZERO_ADDRESS9) {
50846
51218
  tokensWithRealOracle.add(half.token.toLowerCase());
50847
51219
  }
50848
51220
  }
@@ -50855,7 +51227,7 @@ function getSiloV3Calls(chainId) {
50855
51227
  const lenderKey = siloV3LenderKey(market.siloConfig);
50856
51228
  const halves = [market.silo0, market.silo1];
50857
51229
  const isStatic = halves.map(
50858
- (h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS7
51230
+ (h) => !h.solvencyOracle || h.solvencyOracle === ZERO_ADDRESS9
50859
51231
  );
50860
51232
  if (isStatic[0] && isStatic[1]) {
50861
51233
  const t0 = halves[0].token.toLowerCase();
@@ -50875,7 +51247,7 @@ function getSiloV3Calls(chainId) {
50875
51247
  decimals: half.decimals,
50876
51248
  silo: half.silo.toLowerCase(),
50877
51249
  lenderKey,
50878
- oracle: ZERO_ADDRESS7,
51250
+ oracle: ZERO_ADDRESS9,
50879
51251
  partnerToken: partnerLc,
50880
51252
  isStatic: true
50881
51253
  });
@@ -51254,7 +51626,7 @@ function lookupUSD3(context, asset) {
51254
51626
  return context.usdPrices[groupKey] ?? context.usdPrices[lc] ?? 0;
51255
51627
  }
51256
51628
  function parseSiloV2GraphQLResults(items, context) {
51257
- const ZERO_ADDRESS9 = "0x0000000000000000000000000000000000000000";
51629
+ const ZERO_ADDRESS11 = "0x0000000000000000000000000000000000000000";
51258
51630
  const out = [];
51259
51631
  const seen = /* @__PURE__ */ new Set();
51260
51632
  for (const item of items) {
@@ -51277,8 +51649,8 @@ function parseSiloV2GraphQLResults(items, context) {
51277
51649
  const partnerTokenLc = other.token.toLowerCase();
51278
51650
  const dedupKey = `${lenderKey}:${tokenLc}`;
51279
51651
  if (seen.has(dedupKey)) continue;
51280
- const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS9).toLowerCase();
51281
- const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS9;
51652
+ const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS11).toLowerCase();
51653
+ const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS11;
51282
51654
  const siloAddrLc = self.silo.toLowerCase();
51283
51655
  try {
51284
51656
  let priceUSD = 0;
@@ -51396,7 +51768,7 @@ function lookupUSD4(context, asset) {
51396
51768
  return context.usdPrices[groupKey] ?? context.usdPrices[lc] ?? 0;
51397
51769
  }
51398
51770
  function parseSiloV3GraphQLResults(items, context) {
51399
- const ZERO_ADDRESS9 = "0x0000000000000000000000000000000000000000";
51771
+ const ZERO_ADDRESS11 = "0x0000000000000000000000000000000000000000";
51400
51772
  const out = [];
51401
51773
  const seen = /* @__PURE__ */ new Set();
51402
51774
  for (const item of items) {
@@ -51419,8 +51791,8 @@ function parseSiloV3GraphQLResults(items, context) {
51419
51791
  const partnerTokenLc = other.token.toLowerCase();
51420
51792
  const dedupKey = `${lenderKey}:${tokenLc}`;
51421
51793
  if (seen.has(dedupKey)) continue;
51422
- const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS9).toLowerCase();
51423
- const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS9;
51794
+ const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS11).toLowerCase();
51795
+ const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS11;
51424
51796
  const siloAddrLc = self.silo.toLowerCase();
51425
51797
  try {
51426
51798
  let priceUSD = 0;
@@ -51542,7 +51914,7 @@ var AGGREGATOR_ABI = [...ChainlinkAggregatorAbi, ...DESCRIPTION_ABI];
51542
51914
  function isFailed(r) {
51543
51915
  return r === "0x" || r === void 0 || r === null;
51544
51916
  }
51545
- var ZERO_ADDRESS8 = "0x0000000000000000000000000000000000000000";
51917
+ var ZERO_ADDRESS10 = "0x0000000000000000000000000000000000000000";
51546
51918
  async function probeAaveFeedTimestamps(chainId, options = {}) {
51547
51919
  const { rpcOverrides, batchSize, retries = 2 } = options;
51548
51920
  const result = {};
@@ -51579,7 +51951,7 @@ async function probeAaveFeedTimestamps(chainId, options = {}) {
51579
51951
  const raw = sourceResults[i];
51580
51952
  if (isFailed(raw)) return;
51581
51953
  const source = String(raw).toLowerCase();
51582
- if (source === ZERO_ADDRESS8) return;
51954
+ if (source === ZERO_ADDRESS10) return;
51583
51955
  sourceOf.set(i, source);
51584
51956
  if (!sourceIndex.has(source)) {
51585
51957
  sourceIndex.set(source, uniqueSources.length);
@@ -55999,7 +56371,7 @@ var Multicall3BalanceAbi = [
55999
56371
  outputs: [{ type: "uint256" }]
56000
56372
  }
56001
56373
  ];
56002
- var toBigInt13 = (v) => {
56374
+ var toBigInt14 = (v) => {
56003
56375
  if (v === void 0 || v === null) return void 0;
56004
56376
  if (typeof v === "bigint") return v;
56005
56377
  if (typeof v === "number") return BigInt(v);
@@ -56023,12 +56395,12 @@ var readerBeetsStS = (entry) => ({
56023
56395
  ],
56024
56396
  abis: [TotalSupplyAbi, BeetsStSAbi, BeetsStSAbi],
56025
56397
  parse: ([supply, rate, pool]) => {
56026
- const totalSupply = toBigInt13(supply);
56027
- const exchangeRate = toBigInt13(rate);
56398
+ const totalSupply = toBigInt14(supply);
56399
+ const exchangeRate = toBigInt14(rate);
56028
56400
  if (totalSupply === void 0 || exchangeRate === void 0) {
56029
56401
  return void 0;
56030
56402
  }
56031
- const liquidity = toBigInt13(pool);
56403
+ const liquidity = toBigInt14(pool);
56032
56404
  return {
56033
56405
  totalAssets: totalSupply * exchangeRate / ONE_E189,
56034
56406
  totalSupply,
@@ -56069,12 +56441,12 @@ var readerBenqiSavax = (entry) => ({
56069
56441
  ],
56070
56442
  abis: [TotalSupplyAbi, BenqiSavaxAbi, BenqiSavaxAbi],
56071
56443
  parse: ([supply, rate, totalPooled]) => {
56072
- const totalSupply = toBigInt13(supply);
56073
- const exchangeRate = toBigInt13(rate);
56444
+ const totalSupply = toBigInt14(supply);
56445
+ const exchangeRate = toBigInt14(rate);
56074
56446
  if (totalSupply === void 0 || exchangeRate === void 0) {
56075
56447
  return void 0;
56076
56448
  }
56077
- const totalAssets = toBigInt13(totalPooled) ?? totalSupply * exchangeRate / ONE_E189;
56449
+ const totalAssets = toBigInt14(totalPooled) ?? totalSupply * exchangeRate / ONE_E189;
56078
56450
  return {
56079
56451
  totalAssets,
56080
56452
  totalSupply,
@@ -56088,7 +56460,7 @@ var readerBgtWrapper1to1 = (entry) => ({
56088
56460
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56089
56461
  abis: [TotalSupplyAbi],
56090
56462
  parse: ([supply]) => {
56091
- const totalSupply = toBigInt13(supply);
56463
+ const totalSupply = toBigInt14(supply);
56092
56464
  if (totalSupply === void 0) return void 0;
56093
56465
  return {
56094
56466
  totalAssets: totalSupply,
@@ -56117,8 +56489,8 @@ var readerDineroBeraEth = (entry) => ({
56117
56489
  ],
56118
56490
  abis: [TotalSupplyAbi, DineroBeraEthAbi],
56119
56491
  parse: ([supply, rate]) => {
56120
- const totalSupply = toBigInt13(supply);
56121
- const exchangeRate = toBigInt13(rate);
56492
+ const totalSupply = toBigInt14(supply);
56493
+ const exchangeRate = toBigInt14(rate);
56122
56494
  if (totalSupply === void 0 || exchangeRate === void 0) {
56123
56495
  return void 0;
56124
56496
  }
@@ -56139,9 +56511,9 @@ var readerErc4626 = (entry) => ({
56139
56511
  ],
56140
56512
  abis: [Erc4626ReadAbi, TotalSupplyAbi, Erc4626ReadAbi],
56141
56513
  parse: ([assets, supply, rate]) => {
56142
- const totalAssets = toBigInt13(assets);
56143
- const totalSupply = toBigInt13(supply);
56144
- const exchangeRate = toBigInt13(rate);
56514
+ const totalAssets = toBigInt14(assets);
56515
+ const totalSupply = toBigInt14(supply);
56516
+ const exchangeRate = toBigInt14(rate);
56145
56517
  if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
56146
56518
  return void 0;
56147
56519
  }
@@ -56156,9 +56528,9 @@ var readerErc4626PreviewRedeem = (entry) => ({
56156
56528
  ],
56157
56529
  abis: [Erc4626PreviewRedeemAbi, TotalSupplyAbi, Erc4626PreviewRedeemAbi],
56158
56530
  parse: ([assets, supply, rate]) => {
56159
- const totalAssets = toBigInt13(assets);
56160
- const totalSupply = toBigInt13(supply);
56161
- const exchangeRate = toBigInt13(rate);
56531
+ const totalAssets = toBigInt14(assets);
56532
+ const totalSupply = toBigInt14(supply);
56533
+ const exchangeRate = toBigInt14(rate);
56162
56534
  if (totalAssets === void 0 || totalSupply === void 0 || exchangeRate === void 0) {
56163
56535
  return void 0;
56164
56536
  }
@@ -56218,15 +56590,15 @@ var readerEtherFiWeEth = (entry) => {
56218
56590
  calls,
56219
56591
  abis,
56220
56592
  parse: (slice2) => {
56221
- const totalSupply = toBigInt13(slice2[0]);
56222
- const exchangeRate = toBigInt13(slice2[1]);
56593
+ const totalSupply = toBigInt14(slice2[0]);
56594
+ const exchangeRate = toBigInt14(slice2[1]);
56223
56595
  if (totalSupply === void 0 || exchangeRate === void 0) {
56224
56596
  return void 0;
56225
56597
  }
56226
56598
  let liquidity;
56227
56599
  if (lp) {
56228
- const lpBalance = toBigInt13(slice2[2]);
56229
- const locked = toBigInt13(slice2[3]);
56600
+ const lpBalance = toBigInt14(slice2[2]);
56601
+ const locked = toBigInt14(slice2[3]);
56230
56602
  if (lpBalance !== void 0 && locked !== void 0) {
56231
56603
  liquidity = lpBalance > locked ? lpBalance - locked : 0n;
56232
56604
  }
@@ -56260,7 +56632,7 @@ var readerHyperbeatBeHype = (entry) => {
56260
56632
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56261
56633
  abis: [TotalSupplyAbi],
56262
56634
  parse: ([supply]) => {
56263
- const totalSupply = toBigInt13(supply);
56635
+ const totalSupply = toBigInt14(supply);
56264
56636
  if (totalSupply === void 0) return void 0;
56265
56637
  return {
56266
56638
  totalAssets: totalSupply,
@@ -56277,8 +56649,8 @@ var readerHyperbeatBeHype = (entry) => {
56277
56649
  ],
56278
56650
  abis: [TotalSupplyAbi, HyperbeatStakingCoreAbi],
56279
56651
  parse: ([supply, rate]) => {
56280
- const totalSupply = toBigInt13(supply);
56281
- const exchangeRate = toBigInt13(rate);
56652
+ const totalSupply = toBigInt14(supply);
56653
+ const exchangeRate = toBigInt14(rate);
56282
56654
  if (totalSupply === void 0 || exchangeRate === void 0) {
56283
56655
  return void 0;
56284
56656
  }
@@ -56310,7 +56682,7 @@ var readerKelpRsEth = (entry) => {
56310
56682
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56311
56683
  abis: [TotalSupplyAbi],
56312
56684
  parse: ([supply]) => {
56313
- const totalSupply = toBigInt13(supply);
56685
+ const totalSupply = toBigInt14(supply);
56314
56686
  if (totalSupply === void 0) return void 0;
56315
56687
  return {
56316
56688
  totalAssets: totalSupply,
@@ -56327,8 +56699,8 @@ var readerKelpRsEth = (entry) => {
56327
56699
  ],
56328
56700
  abis: [TotalSupplyAbi, KelpLrtOracleAbi],
56329
56701
  parse: ([supply, rate]) => {
56330
- const totalSupply = toBigInt13(supply);
56331
- const exchangeRate = toBigInt13(rate);
56702
+ const totalSupply = toBigInt14(supply);
56703
+ const exchangeRate = toBigInt14(rate);
56332
56704
  if (totalSupply === void 0 || exchangeRate === void 0) {
56333
56705
  return void 0;
56334
56706
  }
@@ -56360,7 +56732,7 @@ var readerKinetiqKHype = (entry) => {
56360
56732
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56361
56733
  abis: [TotalSupplyAbi],
56362
56734
  parse: ([supply]) => {
56363
- const totalSupply = toBigInt13(supply);
56735
+ const totalSupply = toBigInt14(supply);
56364
56736
  if (totalSupply === void 0) return void 0;
56365
56737
  return {
56366
56738
  totalAssets: totalSupply,
@@ -56377,8 +56749,8 @@ var readerKinetiqKHype = (entry) => {
56377
56749
  ],
56378
56750
  abis: [TotalSupplyAbi, KinetiqStakingAccountantAbi],
56379
56751
  parse: ([supply, rate]) => {
56380
- const totalSupply = toBigInt13(supply);
56381
- const exchangeRate = toBigInt13(rate);
56752
+ const totalSupply = toBigInt14(supply);
56753
+ const exchangeRate = toBigInt14(rate);
56382
56754
  if (totalSupply === void 0 || exchangeRate === void 0) {
56383
56755
  return void 0;
56384
56756
  }
@@ -56418,12 +56790,12 @@ var readerLairStKaia = (entry) => ({
56418
56790
  ],
56419
56791
  abis: [TotalSupplyAbi, LairStKaiaAbi, LairStKaiaAbi],
56420
56792
  parse: ([supply, rate, totalStaking]) => {
56421
- const totalSupply = toBigInt13(supply);
56422
- const exchangeRate = toBigInt13(rate);
56793
+ const totalSupply = toBigInt14(supply);
56794
+ const exchangeRate = toBigInt14(rate);
56423
56795
  if (totalSupply === void 0 || exchangeRate === void 0) {
56424
56796
  return void 0;
56425
56797
  }
56426
- const totalAssets = toBigInt13(totalStaking) ?? totalSupply * exchangeRate / ONE_E189;
56798
+ const totalAssets = toBigInt14(totalStaking) ?? totalSupply * exchangeRate / ONE_E189;
56427
56799
  return {
56428
56800
  totalAssets,
56429
56801
  totalSupply,
@@ -56451,8 +56823,8 @@ var readerLidoWstEth = (entry) => ({
56451
56823
  ],
56452
56824
  abis: [TotalSupplyAbi, LidoWstEthAbi],
56453
56825
  parse: ([supply, rate]) => {
56454
- const totalSupply = toBigInt13(supply);
56455
- const exchangeRate = toBigInt13(rate);
56826
+ const totalSupply = toBigInt14(supply);
56827
+ const exchangeRate = toBigInt14(rate);
56456
56828
  if (totalSupply === void 0 || exchangeRate === void 0) {
56457
56829
  return void 0;
56458
56830
  }
@@ -56490,7 +56862,7 @@ var readerListaSlisBnb = (entry) => {
56490
56862
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56491
56863
  abis: [TotalSupplyAbi],
56492
56864
  parse: ([supply]) => {
56493
- const totalSupply = toBigInt13(supply);
56865
+ const totalSupply = toBigInt14(supply);
56494
56866
  if (totalSupply === void 0) return void 0;
56495
56867
  return {
56496
56868
  totalAssets: totalSupply,
@@ -56508,12 +56880,12 @@ var readerListaSlisBnb = (entry) => {
56508
56880
  ],
56509
56881
  abis: [TotalSupplyAbi, ListaStakeManagerReadAbi, ListaStakeManagerReadAbi],
56510
56882
  parse: ([supply, rate, pooled]) => {
56511
- const totalSupply = toBigInt13(supply);
56512
- const exchangeRate = toBigInt13(rate);
56883
+ const totalSupply = toBigInt14(supply);
56884
+ const exchangeRate = toBigInt14(rate);
56513
56885
  if (totalSupply === void 0 || exchangeRate === void 0) {
56514
56886
  return void 0;
56515
56887
  }
56516
- const pooledBnb = toBigInt13(pooled);
56888
+ const pooledBnb = toBigInt14(pooled);
56517
56889
  const totalAssets = pooledBnb ?? totalSupply * exchangeRate / ONE_E189;
56518
56890
  return { totalAssets, totalSupply, exchangeRate };
56519
56891
  }
@@ -56539,7 +56911,7 @@ var readerMantleMEth = (entry) => {
56539
56911
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56540
56912
  abis: [TotalSupplyAbi],
56541
56913
  parse: ([supply]) => {
56542
- const totalSupply = toBigInt13(supply);
56914
+ const totalSupply = toBigInt14(supply);
56543
56915
  if (totalSupply === void 0) return void 0;
56544
56916
  return {
56545
56917
  totalAssets: totalSupply,
@@ -56556,8 +56928,8 @@ var readerMantleMEth = (entry) => {
56556
56928
  ],
56557
56929
  abis: [TotalSupplyAbi, MantleStakingAbi],
56558
56930
  parse: ([supply, rate]) => {
56559
- const totalSupply = toBigInt13(supply);
56560
- const exchangeRate = toBigInt13(rate);
56931
+ const totalSupply = toBigInt14(supply);
56932
+ const exchangeRate = toBigInt14(rate);
56561
56933
  if (totalSupply === void 0 || exchangeRate === void 0) {
56562
56934
  return void 0;
56563
56935
  }
@@ -56578,7 +56950,7 @@ var readerOffChain = (entry) => {
56578
56950
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56579
56951
  abis: [TotalSupplyAbi],
56580
56952
  parse: ([supply]) => {
56581
- const totalSupply = toBigInt13(supply);
56953
+ const totalSupply = toBigInt14(supply);
56582
56954
  if (totalSupply === void 0) return void 0;
56583
56955
  return {
56584
56956
  totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
@@ -56612,7 +56984,7 @@ var readerRenzoEzEth = (entry) => {
56612
56984
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56613
56985
  abis: [TotalSupplyAbi],
56614
56986
  parse: ([supply]) => {
56615
- const totalSupply = toBigInt13(supply);
56987
+ const totalSupply = toBigInt14(supply);
56616
56988
  if (totalSupply === void 0) return void 0;
56617
56989
  return {
56618
56990
  totalAssets: totalSupply,
@@ -56629,9 +57001,9 @@ var readerRenzoEzEth = (entry) => {
56629
57001
  ],
56630
57002
  abis: [TotalSupplyAbi, RenzoRestakeManagerAbi],
56631
57003
  parse: ([supply, tvls]) => {
56632
- const totalSupply = toBigInt13(supply);
57004
+ const totalSupply = toBigInt14(supply);
56633
57005
  if (totalSupply === void 0 || totalSupply === 0n) return void 0;
56634
- const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt13(tvls[2]) : void 0;
57006
+ const totalTvl = Array.isArray(tvls) && tvls.length >= 3 ? toBigInt14(tvls[2]) : void 0;
56635
57007
  if (totalTvl === void 0) return void 0;
56636
57008
  return {
56637
57009
  totalAssets: totalTvl,
@@ -56685,12 +57057,12 @@ var readerRocketReth = (entry) => {
56685
57057
  calls,
56686
57058
  abis,
56687
57059
  parse: (slice2) => {
56688
- const totalSupply = toBigInt13(slice2[0]);
56689
- const exchangeRate = toBigInt13(slice2[1]);
57060
+ const totalSupply = toBigInt14(slice2[0]);
57061
+ const exchangeRate = toBigInt14(slice2[1]);
56690
57062
  if (totalSupply === void 0 || exchangeRate === void 0) {
56691
57063
  return void 0;
56692
57064
  }
56693
- const liquidity = depositPool ? toBigInt13(slice2[2]) : void 0;
57065
+ const liquidity = depositPool ? toBigInt14(slice2[2]) : void 0;
56694
57066
  return {
56695
57067
  totalAssets: totalSupply * exchangeRate / ONE_E189,
56696
57068
  totalSupply,
@@ -56729,7 +57101,7 @@ var readerStaderEthx = (entry) => {
56729
57101
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56730
57102
  abis: [TotalSupplyAbi],
56731
57103
  parse: ([supply]) => {
56732
- const totalSupply = toBigInt13(supply);
57104
+ const totalSupply = toBigInt14(supply);
56733
57105
  if (totalSupply === void 0) return void 0;
56734
57106
  return {
56735
57107
  totalAssets: totalSupply,
@@ -56746,8 +57118,8 @@ var readerStaderEthx = (entry) => {
56746
57118
  ],
56747
57119
  abis: [TotalSupplyAbi, StaderEthxAbi],
56748
57120
  parse: ([supply, rate]) => {
56749
- const totalSupply = toBigInt13(supply);
56750
- const exchangeRate = toBigInt13(rate);
57121
+ const totalSupply = toBigInt14(supply);
57122
+ const exchangeRate = toBigInt14(rate);
56751
57123
  if (totalSupply === void 0 || exchangeRate === void 0) {
56752
57124
  return void 0;
56753
57125
  }
@@ -56775,10 +57147,10 @@ var readerStaderMaticX = (entry) => {
56775
57147
  ],
56776
57148
  abis: [TotalSupplyAbi, StaderMaticXAbi],
56777
57149
  parse: ([supply, tup]) => {
56778
- const totalSupply = toBigInt13(supply);
57150
+ const totalSupply = toBigInt14(supply);
56779
57151
  if (!Array.isArray(tup) || tup.length < 3) return void 0;
56780
- const amountInMatic = toBigInt13(tup[0]);
56781
- const totalPooledMatic = toBigInt13(tup[2]);
57152
+ const amountInMatic = toBigInt14(tup[0]);
57153
+ const totalPooledMatic = toBigInt14(tup[2]);
56782
57154
  if (totalSupply === void 0 || amountInMatic === void 0) {
56783
57155
  return void 0;
56784
57156
  }
@@ -56811,7 +57183,7 @@ var readerStakeWiseOsEth = (entry) => {
56811
57183
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56812
57184
  abis: [TotalSupplyAbi],
56813
57185
  parse: ([supply]) => {
56814
- const totalSupply = toBigInt13(supply);
57186
+ const totalSupply = toBigInt14(supply);
56815
57187
  if (totalSupply === void 0) return void 0;
56816
57188
  return {
56817
57189
  totalAssets: totalSupply,
@@ -56828,8 +57200,8 @@ var readerStakeWiseOsEth = (entry) => {
56828
57200
  ],
56829
57201
  abis: [TotalSupplyAbi, StakeWiseOsTokenAbi],
56830
57202
  parse: ([supply, rate]) => {
56831
- const totalSupply = toBigInt13(supply);
56832
- const exchangeRate = toBigInt13(rate);
57203
+ const totalSupply = toBigInt14(supply);
57204
+ const exchangeRate = toBigInt14(rate);
56833
57205
  if (totalSupply === void 0 || exchangeRate === void 0) {
56834
57206
  return void 0;
56835
57207
  }
@@ -56861,7 +57233,7 @@ var readerStCelo = (entry) => {
56861
57233
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56862
57234
  abis: [TotalSupplyAbi],
56863
57235
  parse: ([supply]) => {
56864
- const totalSupply = toBigInt13(supply);
57236
+ const totalSupply = toBigInt14(supply);
56865
57237
  if (totalSupply === void 0) return void 0;
56866
57238
  return {
56867
57239
  totalAssets: totalSupply,
@@ -56878,8 +57250,8 @@ var readerStCelo = (entry) => {
56878
57250
  ],
56879
57251
  abis: [TotalSupplyAbi, StCeloManagerAbi],
56880
57252
  parse: ([supply, rate]) => {
56881
- const totalSupply = toBigInt13(supply);
56882
- const exchangeRate = toBigInt13(rate);
57253
+ const totalSupply = toBigInt14(supply);
57254
+ const exchangeRate = toBigInt14(rate);
56883
57255
  if (totalSupply === void 0 || exchangeRate === void 0) {
56884
57256
  return void 0;
56885
57257
  }
@@ -56911,8 +57283,8 @@ var readerSwellGetRate = (entry) => ({
56911
57283
  ],
56912
57284
  abis: [TotalSupplyAbi, SwellGetRateAbi],
56913
57285
  parse: ([supply, rate]) => {
56914
- const totalSupply = toBigInt13(supply);
56915
- const exchangeRate = toBigInt13(rate);
57286
+ const totalSupply = toBigInt14(supply);
57287
+ const exchangeRate = toBigInt14(rate);
56916
57288
  if (totalSupply === void 0 || exchangeRate === void 0) {
56917
57289
  return void 0;
56918
57290
  }
@@ -56943,7 +57315,7 @@ var readerValantisWstHype = (entry) => {
56943
57315
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56944
57316
  abis: [TotalSupplyAbi],
56945
57317
  parse: ([supply]) => {
56946
- const totalSupply = toBigInt13(supply);
57318
+ const totalSupply = toBigInt14(supply);
56947
57319
  if (totalSupply === void 0) return void 0;
56948
57320
  return {
56949
57321
  totalAssets: totalSupply,
@@ -56960,8 +57332,8 @@ var readerValantisWstHype = (entry) => {
56960
57332
  ],
56961
57333
  abis: [TotalSupplyAbi, ValantisStHypeAbi],
56962
57334
  parse: ([supply, rate]) => {
56963
- const totalSupply = toBigInt13(supply);
56964
- const exchangeRate = toBigInt13(rate);
57335
+ const totalSupply = toBigInt14(supply);
57336
+ const exchangeRate = toBigInt14(rate);
56965
57337
  if (totalSupply === void 0 || exchangeRate === void 0) {
56966
57338
  return void 0;
56967
57339
  }
@@ -56995,7 +57367,7 @@ var readerVedaAccountant = (entry) => {
56995
57367
  calls: [{ address: entry.address, name: "totalSupply", params: [] }],
56996
57368
  abis: [TotalSupplyAbi],
56997
57369
  parse: ([supply]) => {
56998
- const totalSupply = toBigInt13(supply);
57370
+ const totalSupply = toBigInt14(supply);
56999
57371
  if (totalSupply === void 0) return void 0;
57000
57372
  return {
57001
57373
  totalAssets: rescaleDecimals(totalSupply, shareDec, underlyingDec),
@@ -57013,8 +57385,8 @@ var readerVedaAccountant = (entry) => {
57013
57385
  ],
57014
57386
  abis: [TotalSupplyAbi, VedaAccountantGetRateAbi],
57015
57387
  parse: ([supply, rate]) => {
57016
- const totalSupply = toBigInt13(supply);
57017
- const rawRate = toBigInt13(rate);
57388
+ const totalSupply = toBigInt14(supply);
57389
+ const rawRate = toBigInt14(rate);
57018
57390
  if (totalSupply === void 0 || rawRate === void 0) return void 0;
57019
57391
  const exchangeRate = rawRate * scale3;
57020
57392
  return {
@@ -57049,8 +57421,8 @@ var readerAnkrRatio = (entry) => ({
57049
57421
  ],
57050
57422
  abis: [TotalSupplyAbi, AnkrRatioAbi],
57051
57423
  parse: ([supply, ratio]) => {
57052
- const totalSupply = toBigInt13(supply);
57053
- const r = toBigInt13(ratio);
57424
+ const totalSupply = toBigInt14(supply);
57425
+ const r = toBigInt14(ratio);
57054
57426
  if (totalSupply === void 0 || r === void 0 || r === 0n) {
57055
57427
  return void 0;
57056
57428
  }
@@ -57081,8 +57453,8 @@ var readerBinanceWbeth = (entry) => ({
57081
57453
  ],
57082
57454
  abis: [TotalSupplyAbi, WbethExchangeRateAbi],
57083
57455
  parse: ([supply, rate]) => {
57084
- const totalSupply = toBigInt13(supply);
57085
- const exchangeRate = toBigInt13(rate);
57456
+ const totalSupply = toBigInt14(supply);
57457
+ const exchangeRate = toBigInt14(rate);
57086
57458
  if (totalSupply === void 0 || exchangeRate === void 0) {
57087
57459
  return void 0;
57088
57460
  }
@@ -57125,8 +57497,8 @@ var readerCoreEarnRate = (entry) => {
57125
57497
  ],
57126
57498
  abis: [CoreEarnRateAbi, TotalSupplyAbi],
57127
57499
  parse: ([rate, supply]) => {
57128
- const r = toBigInt13(rate);
57129
- const totalSupply = toBigInt13(supply);
57500
+ const r = toBigInt14(rate);
57501
+ const totalSupply = toBigInt14(supply);
57130
57502
  if (r === void 0 || r === 0n || totalSupply === void 0) {
57131
57503
  return void 0;
57132
57504
  }
@@ -57147,8 +57519,8 @@ var readerCoreStakedRatio = (entry) => {
57147
57519
  ],
57148
57520
  abis: [CoreTotalStakedAbi, TotalSupplyAbi],
57149
57521
  parse: ([staked, supply]) => {
57150
- const totalStaked = toBigInt13(staked);
57151
- const totalSupply = toBigInt13(supply);
57522
+ const totalStaked = toBigInt14(staked);
57523
+ const totalSupply = toBigInt14(supply);
57152
57524
  if (totalStaked === void 0 || totalSupply === void 0 || totalSupply === 0n) {
57153
57525
  return void 0;
57154
57526
  }
@@ -57187,8 +57559,8 @@ var readerKintsuSMon = (entry) => ({
57187
57559
  ],
57188
57560
  abis: [KintsuSMonAbi, KintsuSMonAbi],
57189
57561
  parse: ([pooled, shares]) => {
57190
- const totalAssets = toBigInt13(pooled);
57191
- const totalSupply = toBigInt13(shares);
57562
+ const totalAssets = toBigInt14(pooled);
57563
+ const totalSupply = toBigInt14(shares);
57192
57564
  if (totalAssets === void 0 || totalSupply === void 0) return void 0;
57193
57565
  const exchangeRate = totalSupply > 0n ? totalAssets * ONE_E189 / totalSupply : ONE_E189;
57194
57566
  return { totalAssets, totalSupply, exchangeRate };
@@ -57709,7 +58081,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
57709
58081
  const validatorsByAddress = new Map(validatorEntries);
57710
58082
  const idleByAddress = /* @__PURE__ */ new Map();
57711
58083
  idleEntries.forEach((e, i) => {
57712
- const bal = toBigInt13(idleResults[i]);
58084
+ const bal = toBigInt14(idleResults[i]);
57713
58085
  if (bal !== void 0) idleByAddress.set(e.address.toLowerCase(), bal);
57714
58086
  });
57715
58087
  const rawResults = new Array(allCalls.length);
@@ -57839,7 +58211,7 @@ var BeetsStSWithdrawalAbi = [
57839
58211
  ];
57840
58212
 
57841
58213
  // src/vaults/lst/withdrawals/readers/shared.ts
57842
- var toBigInt14 = (v) => {
58214
+ var toBigInt15 = (v) => {
57843
58215
  if (v === void 0 || v === null) return void 0;
57844
58216
  if (typeof v === "bigint") return v;
57845
58217
  if (typeof v === "number") return BigInt(v);
@@ -57854,7 +58226,7 @@ var toBigInt14 = (v) => {
57854
58226
  return void 0;
57855
58227
  };
57856
58228
  var toNumber = (v) => {
57857
- const b = toBigInt14(v);
58229
+ const b = toBigInt15(v);
57858
58230
  if (b === void 0) return void 0;
57859
58231
  if (b > BigInt(Number.MAX_SAFE_INTEGER)) return void 0;
57860
58232
  return Number(b);
@@ -57891,7 +58263,7 @@ var readerBeets = {
57891
58263
  const out = [];
57892
58264
  for (let i = 0; i < reqs.length; i++) {
57893
58265
  const r = reqs[i];
57894
- const amount3 = toBigInt14(r.assetAmount);
58266
+ const amount3 = toBigInt15(r.assetAmount);
57895
58267
  const ts = toNumber(r.requestTimestamp);
57896
58268
  const isWithdrawn = Boolean(r.isWithdrawn);
57897
58269
  if (amount3 === void 0 || ts === void 0) continue;
@@ -57983,13 +58355,13 @@ var readerBeHype = {
57983
58355
  const q = stage2[i * 2];
57984
58356
  const canClaim = Boolean(stage2[i * 2 + 1]);
57985
58357
  if (!q) continue;
57986
- const hypeAmount = Array.isArray(q) ? toBigInt14(q[2]) : toBigInt14(q.hypeAmount);
58358
+ const hypeAmount = Array.isArray(q) ? toBigInt15(q[2]) : toBigInt15(q.hypeAmount);
57987
58359
  if (hypeAmount === void 0) continue;
57988
58360
  out.push({
57989
58361
  lst: entry.lst,
57990
58362
  brand: entry.brand,
57991
58363
  symbol: entry.symbol,
57992
- requestId: String(toBigInt14(ids[i]) ?? i),
58364
+ requestId: String(toBigInt15(ids[i]) ?? i),
57993
58365
  amountUnderlying: hypeAmount.toString(),
57994
58366
  status: canClaim ? "claimable" : "pending"
57995
58367
  });
@@ -58092,7 +58464,7 @@ var readerBenqi = {
58092
58464
  for (let i = 0; i < reqs.length; i++) {
58093
58465
  const r = reqs[i];
58094
58466
  const startedAt = toNumber(r.startedAt);
58095
- const shareAmount = toBigInt14(r.shareAmount);
58467
+ const shareAmount = toBigInt15(r.shareAmount);
58096
58468
  if (startedAt === void 0 || shareAmount === void 0) continue;
58097
58469
  const readyAt = startedAt + cooldown;
58098
58470
  const expiresAt = readyAt + claimWindow;
@@ -58181,8 +58553,8 @@ var readerBinanceWbeth2 = {
58181
58553
  for (let i = 0; i < reqs.length; i++) {
58182
58554
  const r = reqs[i];
58183
58555
  const triggerTime = toNumber(r.triggerTime);
58184
- const ethAmount = toBigInt14(r.ethAmount);
58185
- const wbethAmount = toBigInt14(r.wbethAmount);
58556
+ const ethAmount = toBigInt15(r.ethAmount);
58557
+ const wbethAmount = toBigInt15(r.wbethAmount);
58186
58558
  if (triggerTime === void 0 || ethAmount === void 0) continue;
58187
58559
  const readyAt = triggerTime + lockTime;
58188
58560
  const claimed = (toNumber(r.claimTime) ?? 0) > 0;
@@ -58245,8 +58617,8 @@ var readerBeraPaw = {
58245
58617
  }
58246
58618
  const pos = res[0];
58247
58619
  if (!pos) return [];
58248
- const queued = Array.isArray(pos) ? toBigInt14(pos[0]) : toBigInt14(pos.queued);
58249
- const available = Array.isArray(pos) ? toBigInt14(pos[1]) : toBigInt14(pos.available);
58620
+ const queued = Array.isArray(pos) ? toBigInt15(pos[0]) : toBigInt15(pos.queued);
58621
+ const available = Array.isArray(pos) ? toBigInt15(pos[1]) : toBigInt15(pos.available);
58250
58622
  const out = [];
58251
58623
  if (available !== void 0 && available > 0n) {
58252
58624
  out.push({
@@ -58328,7 +58700,7 @@ var readerIbera = {
58328
58700
  return [];
58329
58701
  }
58330
58702
  const length = toNumber(stage1[0]) ?? 0;
58331
- const frontier = toBigInt14(stage1[1]) ?? 0n;
58703
+ const frontier = toBigInt15(stage1[1]) ?? 0n;
58332
58704
  if (length === 0) return [];
58333
58705
  const start = length > MAX_SCAN ? length - MAX_SCAN : 0;
58334
58706
  const ids = Array.from({ length: length - start }, (_3, k) => start + k);
@@ -58352,7 +58724,7 @@ var readerIbera = {
58352
58724
  const r = stage2[k];
58353
58725
  if (!r) continue;
58354
58726
  const receiver = Array.isArray(r) ? r[2] : r.receiver;
58355
- const amount3 = Array.isArray(r) ? toBigInt14(r[3]) : toBigInt14(r.amount);
58727
+ const amount3 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
58356
58728
  if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount3 === void 0 || amount3 === 0n) {
58357
58729
  continue;
58358
58730
  }
@@ -58425,7 +58797,7 @@ var readerPrimeStaking = {
58425
58797
  return [];
58426
58798
  }
58427
58799
  const length = toNumber(stage1[0]) ?? 0;
58428
- const frontier = toBigInt14(stage1[1]) ?? 0n;
58800
+ const frontier = toBigInt15(stage1[1]) ?? 0n;
58429
58801
  if (length === 0) return [];
58430
58802
  const start = length > MAX_SCAN2 ? length - MAX_SCAN2 : 0;
58431
58803
  const ids = Array.from({ length: length - start }, (_3, k) => start + k);
@@ -58449,7 +58821,7 @@ var readerPrimeStaking = {
58449
58821
  const r = stage2[k];
58450
58822
  if (!r) continue;
58451
58823
  const receiver = Array.isArray(r) ? r[1] : r.receiver;
58452
- const assets = Array.isArray(r) ? toBigInt14(r[3]) : toBigInt14(r.assets);
58824
+ const assets = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.assets);
58453
58825
  const processed = Array.isArray(r) ? r[4] : r.processed;
58454
58826
  if (typeof receiver !== "string" || receiver.toLowerCase() !== target || assets === void 0 || assets === 0n) {
58455
58827
  continue;
@@ -58520,8 +58892,8 @@ var readerErc7540 = {
58520
58892
  ],
58521
58893
  abi: [Erc7540Abi, Erc7540Abi]
58522
58894
  });
58523
- const pending = toBigInt14(stage1[0]) ?? 0n;
58524
- const claimable = toBigInt14(stage1[1]) ?? 0n;
58895
+ const pending = toBigInt15(stage1[0]) ?? 0n;
58896
+ const claimable = toBigInt15(stage1[1]) ?? 0n;
58525
58897
  const out = [];
58526
58898
  if (claimable > 0n) {
58527
58899
  const stage2 = await multicallRetry({
@@ -58535,7 +58907,7 @@ var readerErc7540 = {
58535
58907
  ],
58536
58908
  abi: [Erc7540Abi]
58537
58909
  });
58538
- const amount3 = toBigInt14(stage2[0]) ?? claimable;
58910
+ const amount3 = toBigInt15(stage2[0]) ?? claimable;
58539
58911
  out.push({
58540
58912
  lst: entry.lst,
58541
58913
  brand: entry.brand,
@@ -58592,11 +58964,11 @@ var readerEthenaCooldown = {
58592
58964
  let cooldownEnd;
58593
58965
  let amount3;
58594
58966
  if (Array.isArray(cell)) {
58595
- cooldownEnd = toBigInt14(cell[0]);
58596
- amount3 = toBigInt14(cell[1]);
58967
+ cooldownEnd = toBigInt15(cell[0]);
58968
+ amount3 = toBigInt15(cell[1]);
58597
58969
  } else if (cell && typeof cell === "object") {
58598
- cooldownEnd = toBigInt14(cell.cooldownEnd);
58599
- amount3 = toBigInt14(cell.underlyingAmount);
58970
+ cooldownEnd = toBigInt15(cell.cooldownEnd);
58971
+ amount3 = toBigInt15(cell.underlyingAmount);
58600
58972
  }
58601
58973
  if (!amount3 || amount3 === 0n) return [];
58602
58974
  const readyAt = Number(cooldownEnd ?? 0n);
@@ -58652,13 +59024,13 @@ var readerSusd3Cooldown = {
58652
59024
  let windowEnd;
58653
59025
  let shares;
58654
59026
  if (Array.isArray(cell)) {
58655
- cooldownEnd = toBigInt14(cell[0]);
58656
- windowEnd = toBigInt14(cell[1]);
58657
- shares = toBigInt14(cell[2]);
59027
+ cooldownEnd = toBigInt15(cell[0]);
59028
+ windowEnd = toBigInt15(cell[1]);
59029
+ shares = toBigInt15(cell[2]);
58658
59030
  } else if (cell && typeof cell === "object") {
58659
- cooldownEnd = toBigInt14(cell.cooldownEnd);
58660
- windowEnd = toBigInt14(cell.windowEnd);
58661
- shares = toBigInt14(cell.shares);
59031
+ cooldownEnd = toBigInt15(cell.cooldownEnd);
59032
+ windowEnd = toBigInt15(cell.windowEnd);
59033
+ shares = toBigInt15(cell.shares);
58662
59034
  }
58663
59035
  if (!shares || shares === 0n) return [];
58664
59036
  let amount3 = shares;
@@ -58670,7 +59042,7 @@ var readerSusd3Cooldown = {
58670
59042
  ],
58671
59043
  abi: [Susd3CooldownStatusAbi]
58672
59044
  });
58673
- amount3 = toBigInt14(stage2[0]) ?? shares;
59045
+ amount3 = toBigInt15(stage2[0]) ?? shares;
58674
59046
  } catch {
58675
59047
  }
58676
59048
  const readyAt = Number(cooldownEnd ?? 0n);
@@ -58744,12 +59116,12 @@ var readerStrataCooldown = {
58744
59116
  let claimable;
58745
59117
  let nextUnlockAt;
58746
59118
  if (Array.isArray(cell)) {
58747
- pending = toBigInt14(cell[0]);
58748
- claimable = toBigInt14(cell[1]);
59119
+ pending = toBigInt15(cell[0]);
59120
+ claimable = toBigInt15(cell[1]);
58749
59121
  nextUnlockAt = toNumber(cell[2]);
58750
59122
  } else if (cell && typeof cell === "object") {
58751
- pending = toBigInt14(cell.pending);
58752
- claimable = toBigInt14(cell.claimable);
59123
+ pending = toBigInt15(cell.pending);
59124
+ claimable = toBigInt15(cell.claimable);
58753
59125
  nextUnlockAt = toNumber(cell.nextUnlockAt);
58754
59126
  }
58755
59127
  const escrow = { withdrawQueue: contracts[i], claimToken: escrowToken };
@@ -58857,7 +59229,7 @@ var readerEtherFi = {
58857
59229
  calls: enumCalls,
58858
59230
  abi: enumCalls.map(() => EtherFiWithdrawRequestAbi)
58859
59231
  });
58860
- const ids = stage2.map(toBigInt14).filter((v) => v !== void 0);
59232
+ const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
58861
59233
  if (ids.length === 0) return [];
58862
59234
  const detailCalls = ids.flatMap((id) => [
58863
59235
  { address: entry.withdrawalContract, name: "getRequest", params: [id] },
@@ -58877,7 +59249,7 @@ var readerEtherFi = {
58877
59249
  const isValid = Boolean(stage3[i * 3 + 2]);
58878
59250
  if (!req) continue;
58879
59251
  if (!isValid) continue;
58880
- const amount3 = toBigInt14(req.amountOfEEth);
59252
+ const amount3 = toBigInt15(req.amountOfEEth);
58881
59253
  if (amount3 === void 0) continue;
58882
59254
  out.push({
58883
59255
  lst: entry.lst,
@@ -58972,7 +59344,7 @@ var readerKelp = {
58972
59344
  }
58973
59345
  ],
58974
59346
  abi: [KelpWithdrawalManagerAbi]
58975
- }).then((res) => toBigInt14(res[0]) ?? 0n)
59347
+ }).then((res) => toBigInt15(res[0]) ?? 0n)
58976
59348
  ]);
58977
59349
  lengths = storageReads;
58978
59350
  currentBlock = block;
@@ -59004,9 +59376,9 @@ var readerKelp = {
59004
59376
  for (let i = 0; i < detailCalls.length; i++) {
59005
59377
  const r = stage2[i];
59006
59378
  if (!r) continue;
59007
- const expected = Array.isArray(r) ? toBigInt14(r[1]) : toBigInt14(r.expectedAssetAmount);
59008
- const startBlock = Array.isArray(r) ? toBigInt14(r[2]) : toBigInt14(r.withdrawalStartBlock);
59009
- const nonce = Array.isArray(r) ? toBigInt14(r[3]) : toBigInt14(r.userNonce);
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);
59010
59382
  if (expected === void 0 || startBlock === void 0) continue;
59011
59383
  const claimable = currentBlock >= startBlock + delayBlocks;
59012
59384
  out.push({
@@ -59083,7 +59455,7 @@ var readerLido = {
59083
59455
  abi: [LidoWithdrawalQueueAbi, LidoWithdrawalQueueAbi]
59084
59456
  });
59085
59457
  const ids = stage1[0];
59086
- const frontier = toBigInt14(stage1[1]) ?? 0n;
59458
+ const frontier = toBigInt15(stage1[1]) ?? 0n;
59087
59459
  if (!Array.isArray(ids) || ids.length === 0) return [];
59088
59460
  const stage2 = await multicallRetry({
59089
59461
  chain: chainId,
@@ -59100,10 +59472,10 @@ var readerLido = {
59100
59472
  if (!Array.isArray(statuses)) return [];
59101
59473
  const out = [];
59102
59474
  for (let i = 0; i < ids.length; i++) {
59103
- const id = toBigInt14(ids[i]);
59475
+ const id = toBigInt15(ids[i]);
59104
59476
  const s = statuses[i];
59105
59477
  if (id === void 0 || !s) continue;
59106
- const amountOfStETH = toBigInt14(s.amountOfStETH);
59478
+ const amountOfStETH = toBigInt15(s.amountOfStETH);
59107
59479
  const isFinalized = Boolean(s.isFinalized);
59108
59480
  const isClaimed = Boolean(s.isClaimed);
59109
59481
  if (amountOfStETH === void 0) continue;
@@ -59212,11 +59584,11 @@ var readerLista = {
59212
59584
  const status = stage2[i];
59213
59585
  if (!status) continue;
59214
59586
  const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
59215
- const bnbAmount = Array.isArray(status) ? toBigInt14(status[1]) : toBigInt14(status._amount);
59216
- const snbnbAmount = Array.isArray(req) ? toBigInt14(req[1]) : toBigInt14(req?.amountInSnBnb);
59587
+ const bnbAmount = Array.isArray(status) ? toBigInt15(status[1]) : toBigInt15(status._amount);
59588
+ const snbnbAmount = Array.isArray(req) ? toBigInt15(req[1]) : toBigInt15(req?.amountInSnBnb);
59217
59589
  const amount3 = bnbAmount ?? snbnbAmount;
59218
59590
  if (amount3 === void 0) continue;
59219
- const uuid = Array.isArray(req) ? toBigInt14(req[0]) : toBigInt14(req?.uuid);
59591
+ const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
59220
59592
  out.push({
59221
59593
  lst: entry.lst,
59222
59594
  brand: entry.brand,
@@ -59301,7 +59673,7 @@ var readerRenzo = {
59301
59673
  for (let i = 0; i < count; i++) {
59302
59674
  const tup = stage2[i];
59303
59675
  if (!Array.isArray(tup) || tup.length < 5) continue;
59304
- const amountToRedeem = toBigInt14(tup[2]);
59676
+ const amountToRedeem = toBigInt15(tup[2]);
59305
59677
  const createdAt = toNumber(tup[4]);
59306
59678
  if (amountToRedeem === void 0 || createdAt === void 0) continue;
59307
59679
  const readyAt = createdAt + cooldown;
@@ -59374,9 +59746,9 @@ var readerStaderEthx2 = {
59374
59746
  ]
59375
59747
  });
59376
59748
  const ids = stage1[0];
59377
- const frontier = toBigInt14(stage1[1]) ?? 0n;
59749
+ const frontier = toBigInt15(stage1[1]) ?? 0n;
59378
59750
  if (!Array.isArray(ids) || ids.length === 0) return [];
59379
- const idBigInts = ids.map(toBigInt14).filter((v) => v !== void 0);
59751
+ const idBigInts = ids.map(toBigInt15).filter((v) => v !== void 0);
59380
59752
  const detailCalls = idBigInts.map((id) => ({
59381
59753
  address: entry.withdrawalContract,
59382
59754
  name: "userWithdrawRequests",
@@ -59392,8 +59764,8 @@ var readerStaderEthx2 = {
59392
59764
  const id = idBigInts[i];
59393
59765
  const tup = stage2[i];
59394
59766
  if (!Array.isArray(tup) || tup.length < 5) continue;
59395
- const ethExpected = toBigInt14(tup[2]) ?? 0n;
59396
- const ethFinalized = toBigInt14(tup[3]) ?? 0n;
59767
+ const ethExpected = toBigInt15(tup[2]) ?? 0n;
59768
+ const ethFinalized = toBigInt15(tup[3]) ?? 0n;
59397
59769
  const isFinalized = id < frontier && ethFinalized > 0n;
59398
59770
  const queuePosition = isFinalized ? 0 : Number(id - frontier);
59399
59771
  out.push({
@@ -59472,13 +59844,13 @@ var readerStaderMaticX2 = {
59472
59844
  });
59473
59845
  const arr = stage1[0];
59474
59846
  if (!Array.isArray(arr)) return [];
59475
- const currentEpoch = stakeManager ? toBigInt14(stage1[1]) ?? 0n : 0n;
59476
- const delay = stakeManager ? toBigInt14(stage1[2]) ?? 0n : 0n;
59847
+ const currentEpoch = stakeManager ? toBigInt15(stage1[1]) ?? 0n : 0n;
59848
+ const delay = stakeManager ? toBigInt15(stage1[2]) ?? 0n : 0n;
59477
59849
  const out = [];
59478
59850
  for (let i = 0; i < arr.length; i++) {
59479
59851
  const r = arr[i];
59480
- const amount3 = toBigInt14(r.amount) ?? 0n;
59481
- const requestEpoch = toBigInt14(r.requestEpoch);
59852
+ const amount3 = toBigInt15(r.amount) ?? 0n;
59853
+ const requestEpoch = toBigInt15(r.requestEpoch);
59482
59854
  if (requestEpoch === void 0) continue;
59483
59855
  const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
59484
59856
  out.push({
@@ -59563,9 +59935,9 @@ var readerMantle = {
59563
59935
  if (typeof requester === "string" && requester.toLowerCase() !== lcUser) {
59564
59936
  continue;
59565
59937
  }
59566
- const ethRequested = Array.isArray(detail) ? toBigInt14(detail[3]) : toBigInt14(detail.ethRequested);
59938
+ const ethRequested = Array.isArray(detail) ? toBigInt15(detail[3]) : toBigInt15(detail.ethRequested);
59567
59939
  const isFinalized = Array.isArray(info) ? Boolean(info[0]) : Boolean(info.isFinalized);
59568
- const claimable = Array.isArray(info) ? toBigInt14(info[1]) : toBigInt14(info.claimableAmount);
59940
+ const claimable = Array.isArray(info) ? toBigInt15(info[1]) : toBigInt15(info.claimableAmount);
59569
59941
  if (ethRequested === void 0) continue;
59570
59942
  out.push({
59571
59943
  lst: entry.lst,
@@ -59644,8 +60016,8 @@ var readerPuffer = {
59644
60016
  calls,
59645
60017
  abi: calls.map(() => PufferWithdrawalManagerAbi)
59646
60018
  });
59647
- const finalizedBatch = toBigInt14(results[detailCalls.length]) ?? 0n;
59648
- const batchSize = toBigInt14(results[detailCalls.length + 1]) ?? 0n;
60019
+ const finalizedBatch = toBigInt15(results[detailCalls.length]) ?? 0n;
60020
+ const batchSize = toBigInt15(results[detailCalls.length + 1]) ?? 0n;
59649
60021
  const out = [];
59650
60022
  const lcUser = user.toLowerCase();
59651
60023
  for (let i = 0; i < ids.length; i++) {
@@ -59655,7 +60027,7 @@ var readerPuffer = {
59655
60027
  if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
59656
60028
  continue;
59657
60029
  }
59658
- const pufETHAmount = Array.isArray(d) ? toBigInt14(d[0]) : toBigInt14(d.pufETHAmount);
60030
+ const pufETHAmount = Array.isArray(d) ? toBigInt15(d[0]) : toBigInt15(d.pufETHAmount);
59659
60031
  if (pufETHAmount === void 0) continue;
59660
60032
  const batchIdx = batchSize > 0n ? ids[i] / batchSize : 0n;
59661
60033
  const claimable = batchIdx <= finalizedBatch;
@@ -59753,7 +60125,7 @@ var readerKinetiq = {
59753
60125
  for (let i = 0; i < count; i++) {
59754
60126
  const r = stage2[i];
59755
60127
  if (!r) continue;
59756
- const hypeAmount = Array.isArray(r) ? toBigInt14(r[0]) : toBigInt14(r.hypeAmount);
60128
+ const hypeAmount = Array.isArray(r) ? toBigInt15(r[0]) : toBigInt15(r.hypeAmount);
59757
60129
  const timestamp = Array.isArray(r) ? toNumber(r[4]) : toNumber(r.timestamp);
59758
60130
  if (hypeAmount === void 0 || hypeAmount === 0n || timestamp === void 0) {
59759
60131
  continue;
@@ -59881,7 +60253,7 @@ var readerStakeWise = {
59881
60253
  const claimedByIdx = /* @__PURE__ */ new Map();
59882
60254
  for (let i = 0; i < onChainChecks.length; i++) {
59883
60255
  const cell = checkResults[i];
59884
- const claimed = Array.isArray(cell) ? toBigInt14(cell[2]) : toBigInt14(cell?.claimedAssets);
60256
+ const claimed = Array.isArray(cell) ? toBigInt15(cell[2]) : toBigInt15(cell?.claimedAssets);
59885
60257
  if (claimed !== void 0 && claimed > 0n) {
59886
60258
  claimedByIdx.set(onChainChecks[i].idx, claimed);
59887
60259
  }
@@ -59889,7 +60261,7 @@ var readerStakeWise = {
59889
60261
  const out = [];
59890
60262
  for (let i = 0; i < requests.length; i++) {
59891
60263
  const r = requests[i];
59892
- const amount3 = toBigInt14(r.totalAssets) ?? 0n;
60264
+ const amount3 = toBigInt15(r.totalAssets) ?? 0n;
59893
60265
  const onChainClaimed = claimedByIdx.get(i);
59894
60266
  const claimable = onChainClaimed !== void 0 || r.isClaimable;
59895
60267
  out.push({
@@ -59946,7 +60318,7 @@ var readerStCelo2 = {
59946
60318
  const timestamps = cell[1] ?? [];
59947
60319
  const out = [];
59948
60320
  for (let i = 0; i < values.length; i++) {
59949
- const amount3 = toBigInt14(values[i]);
60321
+ const amount3 = toBigInt15(values[i]);
59950
60322
  const readyAt = toNumber(timestamps[i]);
59951
60323
  if (amount3 === void 0 || readyAt === void 0) continue;
59952
60324
  out.push({
@@ -60026,7 +60398,7 @@ var readerSwell = {
60026
60398
  abi: [SwellRswExitAbi, SwellRswExitAbi]
60027
60399
  });
60028
60400
  const count = toNumber(stage1[0]) ?? 0;
60029
- const lastProcessed = toBigInt14(stage1[1]) ?? 0n;
60401
+ const lastProcessed = toBigInt15(stage1[1]) ?? 0n;
60030
60402
  if (count === 0) return [];
60031
60403
  const enumCalls = Array.from({ length: count }, (_3, i) => ({
60032
60404
  address: entry.withdrawalContract,
@@ -60038,7 +60410,7 @@ var readerSwell = {
60038
60410
  calls: enumCalls,
60039
60411
  abi: enumCalls.map(() => SwellRswExitAbi)
60040
60412
  });
60041
- const ids = stage2.map(toBigInt14).filter((v) => v !== void 0);
60413
+ const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
60042
60414
  if (ids.length === 0) return [];
60043
60415
  const detailCalls = ids.map((id) => ({
60044
60416
  address: entry.withdrawalContract,
@@ -60055,7 +60427,7 @@ var readerSwell = {
60055
60427
  const id = ids[i];
60056
60428
  const r = stage3[i];
60057
60429
  if (!r) continue;
60058
- const amount3 = toBigInt14(r.amount);
60430
+ const amount3 = toBigInt15(r.amount);
60059
60431
  if (amount3 === void 0) continue;
60060
60432
  const claimable = id <= lastProcessed;
60061
60433
  out.push({
@@ -60129,14 +60501,14 @@ var readerValantis = {
60129
60501
  for (let i = 0; i < burns.length; i++) {
60130
60502
  const b = burns[i];
60131
60503
  if (!b) continue;
60132
- const amount3 = Array.isArray(b) ? toBigInt14(b[0]) : toBigInt14(b.amount);
60504
+ const amount3 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
60133
60505
  const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
60134
60506
  if (amount3 === void 0 || completed) continue;
60135
60507
  out.push({
60136
60508
  lst: entry.lst,
60137
60509
  brand: entry.brand,
60138
60510
  symbol: entry.symbol,
60139
- requestId: String(toBigInt14(ids[i]) ?? i),
60511
+ requestId: String(toBigInt15(ids[i]) ?? i),
60140
60512
  amountUnderlying: amount3.toString(),
60141
60513
  status: redeemable[i] ? "claimable" : "pending"
60142
60514
  });
@@ -60209,7 +60581,7 @@ var readerTruFin = {
60209
60581
  if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
60210
60582
  continue;
60211
60583
  }
60212
- const amount3 = Array.isArray(w) ? toBigInt14(w[1]) : toBigInt14(w.amount);
60584
+ const amount3 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
60213
60585
  if (amount3 === void 0 || amount3 === 0n) continue;
60214
60586
  out.push({
60215
60587
  lst: entry.lst,
@@ -60305,7 +60677,7 @@ var readerYieldNest = {
60305
60677
  calls: enumCalls,
60306
60678
  abi: enumCalls.map(() => YieldNestWithdrawalQueueAbi)
60307
60679
  });
60308
- const ids = stage2.map(toBigInt14).filter((v) => v !== void 0);
60680
+ const ids = stage2.map(toBigInt15).filter((v) => v !== void 0);
60309
60681
  if (ids.length === 0) return [];
60310
60682
  const detailCalls = ids.map((id) => ({
60311
60683
  address: entry.withdrawalContract,
@@ -60324,7 +60696,7 @@ var readerYieldNest = {
60324
60696
  const id = ids[i];
60325
60697
  const r = stage3[i];
60326
60698
  if (!r) continue;
60327
- const amount3 = toBigInt14(r.amount);
60699
+ const amount3 = toBigInt15(r.amount);
60328
60700
  const created = toNumber(r.creationTimestamp);
60329
60701
  const processed = Boolean(r.processed);
60330
60702
  if (amount3 === void 0 || created === void 0) continue;
@@ -61192,7 +61564,7 @@ var NavOracleReadAbi = [
61192
61564
 
61193
61565
  // src/vaults/savings/readers/shared.ts
61194
61566
  var ONE_E1811 = 10n ** 18n;
61195
- var toBigInt15 = (v) => {
61567
+ var toBigInt16 = (v) => {
61196
61568
  if (v === void 0 || v === null) return void 0;
61197
61569
  if (typeof v === "bigint") return v;
61198
61570
  if (typeof v === "number") return BigInt(v);
@@ -61223,9 +61595,9 @@ var readerErc46262 = (entry) => {
61223
61595
  ],
61224
61596
  abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
61225
61597
  parse: ([assets, supply, rate]) => {
61226
- const totalAssets = toBigInt15(assets);
61227
- const totalSupply = toBigInt15(supply);
61228
- const convertToAssetsRaw = toBigInt15(rate);
61598
+ const totalAssets = toBigInt16(assets);
61599
+ const totalSupply = toBigInt16(supply);
61600
+ const convertToAssetsRaw = toBigInt16(rate);
61229
61601
  if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
61230
61602
  return void 0;
61231
61603
  }
@@ -61411,13 +61783,13 @@ var readerErc4626Idle = (entry) => {
61411
61783
  ],
61412
61784
  abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, BalanceOfAbi],
61413
61785
  parse: ([assets, supply, rate, inventoryBalance]) => {
61414
- const totalAssets = toBigInt15(assets);
61415
- const totalSupply = toBigInt15(supply);
61416
- const convertToAssetsRaw = toBigInt15(rate);
61786
+ const totalAssets = toBigInt16(assets);
61787
+ const totalSupply = toBigInt16(supply);
61788
+ const convertToAssetsRaw = toBigInt16(rate);
61417
61789
  if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
61418
61790
  return void 0;
61419
61791
  }
61420
- const capacity = toBigInt15(inventoryBalance);
61792
+ const capacity = toBigInt16(inventoryBalance);
61421
61793
  return {
61422
61794
  totalAssets,
61423
61795
  totalSupply,
@@ -61460,13 +61832,13 @@ var readerErc4626WithdrawLimit = (entry) => {
61460
61832
  AvailableWithdrawLimitAbi
61461
61833
  ],
61462
61834
  parse: ([assets, supply, rate, withdrawLimit]) => {
61463
- const totalAssets = toBigInt15(assets);
61464
- const totalSupply = toBigInt15(supply);
61465
- const convertToAssetsRaw = toBigInt15(rate);
61835
+ const totalAssets = toBigInt16(assets);
61836
+ const totalSupply = toBigInt16(supply);
61837
+ const convertToAssetsRaw = toBigInt16(rate);
61466
61838
  if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
61467
61839
  return void 0;
61468
61840
  }
61469
- const capacity = toBigInt15(withdrawLimit);
61841
+ const capacity = toBigInt16(withdrawLimit);
61470
61842
  return {
61471
61843
  totalAssets,
61472
61844
  totalSupply,
@@ -61489,9 +61861,9 @@ var readerFrankencoinSavings = (entry) => ({
61489
61861
  ],
61490
61862
  abis: [BalanceOfAbi, FrankencoinSavingsReadAbi],
61491
61863
  parse: ([balance, ratePPM]) => {
61492
- const deposits = toBigInt15(balance);
61864
+ const deposits = toBigInt16(balance);
61493
61865
  if (deposits === void 0) return void 0;
61494
- if (toBigInt15(ratePPM) === void 0) return void 0;
61866
+ if (toBigInt16(ratePPM) === void 0) return void 0;
61495
61867
  return {
61496
61868
  totalAssets: deposits,
61497
61869
  // No shares exist; the "supply" IS the deposited principal, and
@@ -61519,10 +61891,10 @@ var readerNavOracle = (entry) => {
61519
61891
  ],
61520
61892
  abis: [TotalSupplyAbi2, NavOracleReadAbi],
61521
61893
  parse: ([supply, round]) => {
61522
- const totalSupply = toBigInt15(supply);
61894
+ const totalSupply = toBigInt16(supply);
61523
61895
  if (totalSupply === void 0) return void 0;
61524
61896
  const raw = Array.isArray(round) ? round[1] : round?.answer;
61525
- const exchangeRate = toBigInt15(raw);
61897
+ const exchangeRate = toBigInt16(raw);
61526
61898
  if (exchangeRate === void 0 || exchangeRate <= 0n) return void 0;
61527
61899
  return {
61528
61900
  totalAssets: totalSupply * exchangeRate * underlyingUnit / (ONE_E1811 * shareUnit),
@@ -61564,14 +61936,14 @@ var readerNativeWnlp = (entry) => {
61564
61936
  NativeWithdrawQueueReadAbi
61565
61937
  ],
61566
61938
  parse: ([supply, rate, feeBips, instantEnabled, inventory, window]) => {
61567
- const totalSupply = toBigInt15(supply);
61568
- const exchangeRate = toBigInt15(rate);
61939
+ const totalSupply = toBigInt16(supply);
61940
+ const exchangeRate = toBigInt16(rate);
61569
61941
  if (totalSupply === void 0 || exchangeRate === void 0) {
61570
61942
  return void 0;
61571
61943
  }
61572
- const capacity = toBigInt15(inventory);
61573
- const windowSeconds = toBigInt15(window);
61574
- const bips = toBigInt15(feeBips);
61944
+ const capacity = toBigInt16(inventory);
61945
+ const windowSeconds = toBigInt16(window);
61946
+ const bips = toBigInt16(feeBips);
61575
61947
  return {
61576
61948
  totalAssets: totalSupply * exchangeRate / ONE_E1811,
61577
61949
  totalSupply,
@@ -61611,17 +61983,17 @@ var readerYieldBasisLt = (entry) => {
61611
61983
  YieldBasisAmmReadAbi
61612
61984
  ],
61613
61985
  parse: ([supply, pps, redeemPerShare, maxDebt, valueOracle]) => {
61614
- const totalSupply = toBigInt15(supply);
61615
- const fundamental = toBigInt15(pps);
61616
- const redeemRaw = toBigInt15(redeemPerShare);
61986
+ const totalSupply = toBigInt16(supply);
61987
+ const fundamental = toBigInt16(pps);
61988
+ const redeemRaw = toBigInt16(redeemPerShare);
61617
61989
  if (totalSupply === void 0 || fundamental === void 0 || redeemRaw === void 0) {
61618
61990
  return void 0;
61619
61991
  }
61620
61992
  if (totalSupply === 0n || redeemRaw === 0n) return void 0;
61621
61993
  const totalAssets = totalSupply * redeemRaw / ONE_SHARE;
61622
61994
  const exchangeRate = redeemRaw * ONE_E1811 / underlyingUnit;
61623
- const equity = Array.isArray(valueOracle) ? toBigInt15(valueOracle[1]) : toBigInt15(valueOracle?.value);
61624
- const cap = toBigInt15(maxDebt);
61995
+ const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
61996
+ const cap = toBigInt16(maxDebt);
61625
61997
  let depositCapacity;
61626
61998
  if (cap !== void 0 && equity !== void 0 && equity > 0n) {
61627
61999
  const headroom = cap / 2n - equity;
@@ -61720,20 +62092,21 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
61720
62092
  const redemptionDiscountBps = state.fundamentalExchangeRate !== void 0 && state.fundamentalExchangeRate > 0n ? Number(
61721
62093
  state.exchangeRate * 100000000n / state.fundamentalExchangeRate - 100000000n
61722
62094
  ) / 1e4 : void 0;
61723
- const displayName = composeVaultDisplayName(
62095
+ const productName = entry.label ?? entry.symbol;
62096
+ const displayName = entry.label ? `${entry.brand} ${entry.label}` : composeVaultDisplayName(
61724
62097
  entry.brand,
61725
62098
  entry.brand,
61726
62099
  asset ?? {
61727
62100
  symbol: entry.symbol,
61728
62101
  decimals: entry.decimals
61729
62102
  },
61730
- `${entry.brand} ${entry.symbol}`
62103
+ `${entry.brand} ${productName}`
61731
62104
  );
61732
62105
  const vault = {
61733
62106
  address: addressLc,
61734
62107
  underlying: underlyingLc,
61735
62108
  symbol: entry.symbol,
61736
- name: `${entry.brand} ${entry.symbol}`,
62109
+ name: `${entry.brand} ${productName}`,
61737
62110
  displayName,
61738
62111
  brand: entry.brand,
61739
62112
  curatorName: entry.brand,
@@ -62141,7 +62514,7 @@ var resolveAaveEarnCuratorName = (chainId, owner) => {
62141
62514
 
62142
62515
  // src/vaults/aave-earn/fetchPublic.ts
62143
62516
  var BRAND2 = "Aave";
62144
- var toBigInt16 = (v) => {
62517
+ var toBigInt17 = (v) => {
62145
62518
  if (v === void 0 || v === null) return void 0;
62146
62519
  if (typeof v === "bigint") return v;
62147
62520
  if (typeof v === "number") return BigInt(v);
@@ -62201,15 +62574,15 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
62201
62574
  const token = v.usedReserve.underlyingToken;
62202
62575
  const underlyingLc = token.address.toLowerCase();
62203
62576
  const assetDecimals = token.decimals;
62204
- const shareDecOnChain = toBigInt16(slice2[1]);
62577
+ const shareDecOnChain = toBigInt17(slice2[1]);
62205
62578
  const decimals = shareDecOnChain !== void 0 ? Number(shareDecOnChain) : assetDecimals;
62206
- const totalSupply = toBigInt16(slice2[2]);
62579
+ const totalSupply = toBigInt17(slice2[2]);
62207
62580
  if (totalSupply === void 0) continue;
62208
62581
  const shareUnit = 10n ** BigInt(decimals);
62209
62582
  const underlyingUnit = 10n ** BigInt(assetDecimals);
62210
- const convertToAssets = toBigInt16(slice2[3]) ?? 0n;
62583
+ const convertToAssets = toBigInt17(slice2[3]) ?? 0n;
62211
62584
  const convertToShares = convertToAssets > 0n ? shareUnit * underlyingUnit / convertToAssets : 0n;
62212
- const totalAssets = toBigInt16(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
62585
+ const totalAssets = toBigInt17(slice2[0]) ?? totalSupply * convertToAssets / shareUnit;
62213
62586
  const totalAssetsFormatted = Number(totalAssets) / 10 ** assetDecimals;
62214
62587
  const asset = tokenList[underlyingLc];
62215
62588
  const priceUsd = prices[underlyingLc] ?? (v.balance?.usdPerToken != null ? num7(v.balance.usdPerToken) : void 0);
@@ -64079,7 +64452,7 @@ async function getJson4(url, label) {
64079
64452
  }
64080
64453
  return response.json();
64081
64454
  }
64082
- function cache(slot, build, store) {
64455
+ function cache3(slot, build, store) {
64083
64456
  const now = Date.now();
64084
64457
  if (slot && now - slot.at < CACHE_TTL_MS6) return slot.promise;
64085
64458
  const promise = build();
@@ -64089,7 +64462,7 @@ function cache(slot, build, store) {
64089
64462
  return promise;
64090
64463
  }
64091
64464
  function fetchPendleApiMarkets() {
64092
- return cache(
64465
+ return cache3(
64093
64466
  marketsCache,
64094
64467
  async () => (await getJson4(PENDLE_MARKETS_URL, "markets"))?.markets ?? [],
64095
64468
  (c) => {
@@ -64099,7 +64472,7 @@ function fetchPendleApiMarkets() {
64099
64472
  }
64100
64473
  var assetKey = (chainId, address) => `${chainId}-${address.toLowerCase()}`;
64101
64474
  function fetchPendleApiAssets() {
64102
- return cache(
64475
+ return cache3(
64103
64476
  assetsCache,
64104
64477
  async () => {
64105
64478
  const json = await getJson4(PENDLE_ASSETS_URL, "assets");
@@ -66767,14 +67140,24 @@ function isLegName(name, asset) {
66767
67140
  return !!m && m[1].trim().toLowerCase() === asset.toLowerCase();
66768
67141
  }
66769
67142
  function stripBrandWords(name, venue) {
67143
+ return dropLeadingBrandWords(
67144
+ name,
67145
+ venue ? `${venueBrand(venue)} ${venueBrandKey(venue)}` : ""
67146
+ );
67147
+ }
67148
+ function dropLeadingBrandWords(name, brand) {
66770
67149
  const brandWords = new Set(
66771
- (venue ? `${venueBrand(venue)} ${venueBrandKey(venue)}` : "").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)
67150
+ brand.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)
66772
67151
  );
66773
67152
  const words = name.trim().split(/\s+/);
66774
67153
  let i = 0;
66775
67154
  while (i < words.length && brandWords.has(words[i].toLowerCase())) i++;
66776
67155
  return words.slice(i).join(" ").trim();
66777
67156
  }
67157
+ function stripLeadingBrand(name, brand) {
67158
+ if (!brand) return name.trim();
67159
+ return dropLeadingBrandWords(name, brand) || name.trim();
67160
+ }
66778
67161
  function namesToken(text, token) {
66779
67162
  const wanted = token.toLowerCase();
66780
67163
  const unwrapped = wanted.startsWith("w") && wanted.length >= 4 ? wanted.slice(1) : void 0;
@@ -67095,8 +67478,16 @@ function earnMarketFromVault(row, chainId, opts = {}) {
67095
67478
  // "USDe · Strata srUSDe" here (a vault's share symbol is not its asset
67096
67479
  // symbol, so the "does the name state the asset?" test always fails).
67097
67480
  // Only the two suffixes that carry identity are applied.
67481
+ // The brand renders in the subtitle beside this, so a name that repeats it
67482
+ // says it twice ("Lido wstETH" under "Lido · Vaults").
67098
67483
  name: withTrancheLabel(
67099
- withMaturityLabel(vaultDisplayName(row, info), maturity),
67484
+ withMaturityLabel(
67485
+ stripLeadingBrand(
67486
+ vaultDisplayName(row, info) ?? "",
67487
+ str5(row.curatorName) ?? venueBrand(vaultVenue(provider))
67488
+ ) || void 0,
67489
+ maturity
67490
+ ),
67100
67491
  trancheFromCounterparty(str5(meta.solvency))
67101
67492
  ),
67102
67493
  ref: address,
@@ -68448,6 +68839,9 @@ var ROW_DESCRIPTOR_KEYS = [
68448
68839
  "resupply",
68449
68840
  "gearbox",
68450
68841
  "curvance",
68842
+ // Fluid: distinguishes a SMART (T2/T3/T4) vault, whose collateral and/or
68843
+ // debt is a two-token DEX LP position, from an ordinary T1 pool row.
68844
+ "fluid",
68451
68845
  "broker",
68452
68846
  "collateralProvider",
68453
68847
  "loanProvider",
@@ -69386,17 +69780,45 @@ var fluidAdapter = {
69386
69780
  id: "fluid",
69387
69781
  matches: isFluid,
69388
69782
  profileId: () => "pool.variable@v1",
69389
- build: (input) => ({
69390
- // Only claim the liquidity-layer basis when the layer totals are actually
69391
- // present. The origin does not select `irmTotal*` today, and asserting a
69392
- // basis we cannot verify is worse than reporting the plain market ratio —
69393
- // the validator rejects it for exactly that reason.
69394
- utilization: input.irmTotalDeposits != null && input.irmTotalDebt != null ? { basis: "liquidity-layer", lockupRatio: input.lockupRatio } : { lockupRatio: input.lockupRatio },
69395
- constraints: {
69396
- positionModel: "nft",
69397
- positionIdMeaning: "The Fluid vault position NFT id."
69398
- }
69399
- })
69783
+ build: (input) => {
69784
+ const smart = input.market?.fluid ?? {};
69785
+ const isSmartCol = !!smart.isSmartCol;
69786
+ const isSmartDebt = !!smart.isSmartDebt;
69787
+ const isSmart = isSmartCol || isSmartDebt;
69788
+ const pair = (p) => Array.isArray(p) ? p.join(" + ") : void 0;
69789
+ return {
69790
+ // Only claim the liquidity-layer basis when the layer totals are actually
69791
+ // present. The origin does not select `irmTotal*` today, and asserting a
69792
+ // basis we cannot verify is worse than reporting the plain market ratio —
69793
+ // the validator rejects it for exactly that reason.
69794
+ utilization: input.irmTotalDeposits != null && input.irmTotalDebt != null ? { basis: "liquidity-layer", lockupRatio: input.lockupRatio } : { lockupRatio: input.lockupRatio },
69795
+ constraints: {
69796
+ positionModel: "nft",
69797
+ positionIdMeaning: "The Fluid vault position NFT id.",
69798
+ ...isSmart ? {
69799
+ /**
69800
+ * A smart vault is NOT a plain pool, and the difference is what a
69801
+ * user is actually agreeing to:
69802
+ *
69803
+ * - the position is a two-token DEX LP share, so its value moves
69804
+ * with the pool's composition, not just with the two prices;
69805
+ * - the row's amount is this leg only — the other leg is a
69806
+ * sibling row of the same vault, and neither can be moved
69807
+ * alone;
69808
+ * - exiting means unwinding LP shares, which is bounded by
69809
+ * share-slippage parameters rather than a plain transfer.
69810
+ */
69811
+ notes: [
69812
+ isSmartCol ? `Collateral is a Fluid DEX LP position over ${pair(smart.collateralPair) ?? "two tokens"}; this row is one leg of it.` : void 0,
69813
+ isSmartDebt ? `Debt is a Fluid DEX LP position over ${pair(smart.debtPair) ?? "two tokens"}; this row is one leg of it.` : void 0,
69814
+ isSmartDebt ? "The borrow rate is NET of the trading yield the debt LP earns, so it can be negative." : void 0,
69815
+ isSmartCol ? "The supply rate INCLUDES the DEX trading yield on top of the liquidity-layer rate." : void 0,
69816
+ "Both legs of a side move together \u2014 a leg cannot be supplied, borrowed or withdrawn on its own."
69817
+ ].filter(Boolean)
69818
+ } : {}
69819
+ }
69820
+ };
69821
+ }
69400
69822
  };
69401
69823
  var gearboxAdapter = {
69402
69824
  id: "gearbox",
@@ -70884,6 +71306,6 @@ function earnPositionTotals(items) {
70884
71306
  };
70885
71307
  }
70886
71308
 
70887
- 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, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, savingsAddresses, savingsBalanceKind, selectAssetGroupPrices, shortDate, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, 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 };
71309
+ 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 };
70888
71310
  //# sourceMappingURL=index.js.map
70889
71311
  //# sourceMappingURL=index.js.map