@1delta/margin-fetcher 5.0.150 → 5.0.152

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
@@ -9,7 +9,7 @@ import { Chain, isEvmChainId, isRetiredChain, isSvmChainId } from '@1delta/chain
9
9
  import { multicallRetryUniversal, getEvmClient, getEvmClientWithCustomRpcsUniversal, LIST_OVERRIDES, getEvmChain, createMulticallRetryUniversal, getEvmClientUniversal } from '@1delta/providers';
10
10
  import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, CurveTricryptoOracleAbi, Erc20Abi, CoolerMonoAbi, CoolerLtvOracleAbi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, TwyneCollateralVaultAbi, MetaMorphoAbi, FluidDexResolverAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, FlyingTulipLendingLensAbi, LiquityMultiTroveGetterAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, RipeMissionControlAbi, RipeLedgerAbi, RipeVaultBookAbi, RipePriceDeskAbi, RipeVaultAbi, RipeCreditEngineAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, AlchemixAlchemistAbi, FlexTroveManagerAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, RipeHqAbi, TwyneVaultManagerAbi, TwyneCollateralVaultFactoryAbi, AaveV2V3Abi, TwyneATokenWrapperAbi, AlchemixPositionNftAbi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, FlexPriceOracleAbi, TermMaxOracleAggregatorV2Abi, AlchemixTransmuterAbi, FlexSortedTrovesAbi, FlexTokenizedStrategyAbi } from '@1delta/abis';
11
11
  export { MorphoLensAbi } from '@1delta/abis';
12
- import { NEST_SAVINGS_VAULTS, NEST_PREDICATE_PROXY, NEST_USDC, SUPERFORM_SUPERVAULTS, IPOR_FUSION_VAULTS, ROYCO_TRANCHES, STRATA_META_TRANCHES, MIDAS_VAULTS, MORINI_FXARB, EMBER_VAULTS, USDAI_STAKED, MAKINA_MACHINES, YUZU_VAULTS, CONCRETE_VAULTS, MELLOW_VAULTS, AERA_VAULTS, EVA_VAULTS, prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, savingsVerbRequires, savingsSupportsVerb, getCompoundV2Comptroller as getCompoundV2Comptroller$1, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, FLUID_VAULT_FACTORY, getAaveStyleLenderTokenAddress, LendingMode, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses, ignoresReceiver, buildLstWithdrawRequest, savingsReceiverCapability } from '@1delta/calldata-sdk';
12
+ import { NEST_SAVINGS_VAULTS, NEST_PREDICATE_PROXY, NEST_USDC, SUPERFORM_SUPERVAULTS, IPOR_FUSION_VAULTS, MEZZANINE_TRANCHES, ROYCO_TRANCHES, STRATA_META_TRANCHES, MIDAS_VAULTS, MORINI_FXARB, EMBER_VAULTS, USDAI_STAKED, MAKINA_MACHINES, YUZU_VAULTS, CONCRETE_VAULTS, MELLOW_VAULTS, AERA_VAULTS, EVA_VAULTS, prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, savingsVerbRequires, savingsSupportsVerb, getCompoundV2Comptroller as getCompoundV2Comptroller$1, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, FLUID_VAULT_FACTORY, getAaveStyleLenderTokenAddress, LendingMode, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses, ignoresReceiver, buildLstWithdrawRequest, savingsReceiverCapability } from '@1delta/calldata-sdk';
13
13
  import { proxyNativeFetch } from '@1delta/proxy-fetch';
14
14
  import { getNativeDecimals, getWrappedNativeAddressSafe, isNativeWrapOneToOne, WRAPPED_NATIVE_INFO } from '@1delta/wnative';
15
15
  import { BALANCER_V2_FORKS, BALANCER_V3_FORKS, UNISWAP_V4_FORKS, isFlashLoanSourceExcluded, FLASH_LOAN_IDS } from '@1delta/dex-registry';
@@ -24810,34 +24810,15 @@ function buildRateQueue(input) {
24810
24810
  }
24811
24811
  const full = [...merged.entries()].sort((a, b) => a[0] - b[0]).map(([apr, raw]) => ({ apr, raw, assets: Number(raw) / scale3 }));
24812
24812
  const totalDebt = full.reduce((t, l) => t + l.assets, 0);
24813
- const picks = [];
24814
- if (!input.closed) {
24815
- for (const p of USER_SET_RATE_PICKS) {
24816
- let apr = min;
24817
- if (totalDebt > 0) {
24818
- const target = p.share * totalDebt;
24819
- let cum = 0;
24820
- let crossing = full[full.length - 1].apr;
24821
- for (const l of full) {
24822
- cum += l.assets;
24823
- if (cum >= target * (1 - 1e-9)) {
24824
- crossing = l.apr;
24825
- break;
24826
- }
24827
- }
24828
- apr = stepAbove(crossing);
24829
- }
24830
- apr = Math.min(Math.max(apr, min), max);
24831
- const debtAhead = debtAheadOf(full, apr);
24832
- picks.push({
24833
- id: p.id,
24834
- apr,
24835
- debtAhead,
24836
- share: totalDebt > 0 ? debtAhead / totalDebt : 0,
24837
- upfrontFeePct: input.upfrontFeePct(apr)
24838
- });
24839
- }
24840
- }
24813
+ const fill = input.idleRaw != null ? { idle: Number(input.idleRaw) / scale3 } : void 0;
24814
+ const picks = input.closed ? [] : pickRates({
24815
+ levels: full,
24816
+ totalDebt,
24817
+ min,
24818
+ max,
24819
+ fill,
24820
+ upfrontFeePct: input.upfrontFeePct
24821
+ });
24841
24822
  return {
24842
24823
  levels: compressLevels(full, input.maxLevels ?? RATE_QUEUE_MAX_LEVELS),
24843
24824
  totalDebt,
@@ -24846,8 +24827,67 @@ function buildRateQueue(input) {
24846
24827
  picks,
24847
24828
  ...picks.length ? { recommended: pressure.level === "high" ? "protected" : "balanced" } : {},
24848
24829
  pressure,
24849
- complete: input.complete ?? true
24830
+ complete: input.complete ?? true,
24831
+ ...fill ? { fill } : {}
24832
+ };
24833
+ }
24834
+ function fillCapacityAt(levels, idle, apr) {
24835
+ let t = idle;
24836
+ for (const l of levels) if (l.apr < apr - 1e-9) t += l.assets;
24837
+ return t;
24838
+ }
24839
+ function pickRates(q) {
24840
+ const { levels, totalDebt, min, max, fill } = q;
24841
+ const size = Math.max(0, q.size ?? 0);
24842
+ const clamp = (r) => Math.min(Math.max(r, min), max);
24843
+ const floorTaken = levels.some((l) => l.apr <= min + 1e-9);
24844
+ const candidates = [
24845
+ .../* @__PURE__ */ new Set([
24846
+ ...floorTaken ? [] : [min],
24847
+ ...levels.map((l) => clamp(stepAbove(l.apr)))
24848
+ ])
24849
+ ].sort((a, b) => a - b);
24850
+ const at2 = (apr) => {
24851
+ const capacity = fill ? fillCapacityAt(levels, fill.idle, apr) : void 0;
24852
+ const redeemed = fill ? Math.max(0, size - fill.idle) : 0;
24853
+ const debtAhead = Math.max(0, debtAheadOf(levels, apr) - redeemed);
24854
+ const total = totalDebt - redeemed;
24855
+ return {
24856
+ capacity,
24857
+ debtAhead,
24858
+ share: total > 0 ? debtAhead / total : 0,
24859
+ fills: capacity == null || capacity >= size * (1 - 1e-9)
24860
+ };
24850
24861
  };
24862
+ const out = [];
24863
+ for (const p of USER_SET_RATE_PICKS) {
24864
+ const fillable = candidates.filter((c) => at2(c).fills);
24865
+ if (!fillable.length) continue;
24866
+ const apr = totalDebt > 0 ? fillable.find((c) => at2(c).share >= p.share * (1 - 1e-9)) ?? fillable[fillable.length - 1] : fillable[0];
24867
+ const a = at2(apr);
24868
+ out.push({
24869
+ id: p.id,
24870
+ apr,
24871
+ debtAhead: a.debtAhead,
24872
+ share: a.share,
24873
+ upfrontFeePct: q.upfrontFeePct(apr),
24874
+ ...a.capacity != null ? { capacity: a.capacity } : {}
24875
+ });
24876
+ }
24877
+ return out;
24878
+ }
24879
+ function resolveRatePicks(q, size) {
24880
+ const fee = q.picks[0]?.upfrontFeePct ?? 0;
24881
+ if (!q.picks.length) return [];
24882
+ return pickRates({
24883
+ levels: q.levels,
24884
+ totalDebt: q.totalDebt,
24885
+ min: q.min,
24886
+ max: q.max,
24887
+ fill: q.fill,
24888
+ upfrontFeePct: () => fee,
24889
+ size
24890
+ });
24851
24891
  }
24852
24892
  function compressLevels(full, cap) {
24853
24893
  const toLevel = (apr2, raw2, assets2) => ({
@@ -25483,7 +25523,7 @@ async function fetchTellerMarkets(chainId, multicallRetry = multicallRetryUniver
25483
25523
  }
25484
25524
  return null;
25485
25525
  };
25486
- const num23 = (i) => {
25526
+ const num24 = (i) => {
25487
25527
  const b = big32(i);
25488
25528
  return b === null ? null : Number(b);
25489
25529
  };
@@ -25493,9 +25533,9 @@ async function fetchTellerMarkets(chainId, multicallRetry = multicallRetryUniver
25493
25533
  config,
25494
25534
  available: big32(base),
25495
25535
  committed: big32(base + 1),
25496
- minRateBps: num23(base + 2),
25536
+ minRateBps: num24(base + 2),
25497
25537
  collateralPerPrincipal: big32(base + 3),
25498
- maxLoanDuration: num23(base + 4),
25538
+ maxLoanDuration: num24(base + 4),
25499
25539
  marketId: big32(base + 5),
25500
25540
  totalAssets: big32(base + 6)
25501
25541
  };
@@ -26693,20 +26733,20 @@ async function fetchInverseMarkets(lender, chainId, multicallRetry = multicallRe
26693
26733
  if (Object.keys(byAddr).length > 0) {
26694
26734
  const rows = markets.map((market) => {
26695
26735
  const m = byAddr[market.address.toLowerCase()];
26696
- const num23 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
26736
+ const num24 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
26697
26737
  return {
26698
26738
  market,
26699
- totalDebt: num23(m?.totalDebt),
26700
- dolaLiquidity: num23(m?.dolaLiquidity),
26701
- leftToBorrow: num23(m?.leftToBorrow),
26702
- price: num23(m?.price),
26739
+ totalDebt: num24(m?.totalDebt),
26740
+ dolaLiquidity: num24(m?.dolaLiquidity),
26741
+ leftToBorrow: num24(m?.leftToBorrow),
26742
+ price: num24(m?.price),
26703
26743
  borrowPaused: typeof m?.borrowPaused === "boolean" ? m.borrowPaused : null,
26704
- dailyBorrows: num23(m?.dailyBorrows),
26744
+ dailyBorrows: num24(m?.dailyBorrows),
26705
26745
  // The API serves it as a DECIMAL (`replenishmentIncentive: 0.1`),
26706
26746
  // unlike the on-chain bps — normalize here, and fall back to the
26707
26747
  // curated metadata value when the field is missing.
26708
26748
  replenishmentIncentiveBps: (() => {
26709
- const dec2 = num23(m?.replenishmentIncentive);
26749
+ const dec2 = num24(m?.replenishmentIncentive);
26710
26750
  if (dec2 !== null) return Math.round(dec2 * 1e4);
26711
26751
  const meta = Number(market.replenishmentIncentiveBps);
26712
26752
  return Number.isFinite(meta) ? meta : null;
@@ -26715,7 +26755,7 @@ async function fetchInverseMarkets(lender, chainId, multicallRetry = multicallRe
26715
26755
  escrowYieldApy: (() => {
26716
26756
  const escrow = String(m?.escrowImplementation ?? "").toLowerCase();
26717
26757
  if (!escrow || escrow === SIMPLE_ESCROW) return null;
26718
- const apy = (num23(m?.supplyApy) ?? 0) + (num23(m?.extraApy) ?? 0);
26758
+ const apy = (num24(m?.supplyApy) ?? 0) + (num24(m?.extraApy) ?? 0);
26719
26759
  return apy > 0 ? apy : null;
26720
26760
  })()
26721
26761
  };
@@ -30189,7 +30229,9 @@ function convertFlexMarketsToResponse(raw, chainId, prices = {}, additionalYield
30189
30229
  pressure: lenderLiquidityPressure(
30190
30230
  lenderAssets > 0 ? 1 - idle / lenderAssets : null
30191
30231
  ),
30192
- upfrontFeePct: (apr) => (avgRate > 0 ? avgRate * 100 : apr) * upfrontYears
30232
+ upfrontFeePct: (apr) => (avgRate > 0 ? avgRate * 100 : apr) * upfrontYears,
30233
+ // a Flex borrow fills from idle, then from troves below its rate
30234
+ idleRaw: m.lenderIdle
30193
30235
  }) : void 0;
30194
30236
  const recommendedPick = queue?.picks.find((p) => p.id === queue.recommended);
30195
30237
  const rateParameter = {
@@ -33599,12 +33641,18 @@ function organizeUserQueries(queries) {
33599
33641
  // key discovers every Alchemist on the chain in ONE balanceOf round (and
33600
33642
  // one tokenOfOwnerByIndex round), where per-market queries paid both
33601
33643
  // rounds once per Alchemist.
33602
- byFamily(isAlchemix, Lender.ALCHEMIX)
33644
+ byFamily(isAlchemix, Lender.ALCHEMIX),
33645
+ // Fluid: per-vault keys `FLUID_<chainId>_<vaultId>` all build the SAME
33646
+ // `VaultResolver.positionsByUser(account)`, which walks every vault on the
33647
+ // chain — so N vault keys issued N copies of the heaviest call in the
33648
+ // batch (176 extra on Ethereum, 94 on Arbitrum, 2026-11-04). The converter
33649
+ // already reads the whole meta map and emits one entry per vault.
33650
+ byFamily(isFluid, Lender.FLUID)
33603
33651
  ];
33604
33652
  if (morphos.length === 0 && gearbox.length === 0 && midnight.length === 0 && term.length === 0 && exactly.length === 0 && liquity.length === 0 && river.length === 0 && teller.length === 0 && termMax.length === 0 && usdd.length === 0 && sky.length === 0 && frankencoin.length === 0 && llamaLend.length === 0 && siloV2.length === 0 && siloV3.length === 0 && familyGroups.every(([g]) => g.length === 0))
33605
33653
  return queries;
33606
33654
  const others = queries.filter(
33607
- (q) => !isMorphoType(q.lender) && !isGearboxV3(q.lender) && !isMidnight(q.lender) && !isTerm(q.lender) && !isExactly(q.lender) && !isLiquityFamily(q.lender) && !isRiver(q.lender) && !isTeller(q.lender) && !isTermMax(q.lender) && !isDssType(q.lender) && !isFrankencoin(q.lender) && !isLlamaLend(q.lender) && !isSiloV2Type(q.lender) && !isSiloV3Type(q.lender) && !isResupply(q.lender) && !isInverse(q.lender) && !isFraxlend(q.lender) && !isCurvance(q.lender) && !isFlex(q.lender) && !isAlchemix(q.lender)
33655
+ (q) => !isMorphoType(q.lender) && !isGearboxV3(q.lender) && !isMidnight(q.lender) && !isTerm(q.lender) && !isExactly(q.lender) && !isLiquityFamily(q.lender) && !isRiver(q.lender) && !isTeller(q.lender) && !isTermMax(q.lender) && !isDssType(q.lender) && !isFrankencoin(q.lender) && !isLlamaLend(q.lender) && !isSiloV2Type(q.lender) && !isSiloV3Type(q.lender) && !isResupply(q.lender) && !isInverse(q.lender) && !isFraxlend(q.lender) && !isCurvance(q.lender) && !isFlex(q.lender) && !isAlchemix(q.lender) && !isFluid(q.lender)
33608
33656
  );
33609
33657
  const morphoBlue = morphos.filter((q) => q.lender.startsWith("MORPHO_BLUE"));
33610
33658
  const moolah = morphos.filter((q) => q.lender.startsWith("LISTA_DAO"));
@@ -34665,6 +34713,76 @@ var buildEulerUserCall = async (chainId, lender, account, subAccountIndexes) =>
34665
34713
  params: [evcAddress, getSubAccountAddress(account, i)]
34666
34714
  }));
34667
34715
  };
34716
+ var AAVE_V4_LENS_WORDS = 4;
34717
+ var AAVE_V4_LENS_CHAINS = /* @__PURE__ */ new Set([
34718
+ Chain.ETHEREUM_MAINNET
34719
+ ]);
34720
+ var spokeEntryOf = (chainId, lender) => {
34721
+ const parsed = parseAaveV4SpokeLenderKey(lender);
34722
+ if (!parsed) return void 0;
34723
+ return aaveV4Spokes()?.[chainId]?.[parsed.spokeAddrLower];
34724
+ };
34725
+ var isAddress2 = (a) => typeof a === "string" && /^0x[0-9a-fA-F]{40}$/.test(a);
34726
+ var usesAaveV4Lens = (chainId, lender) => {
34727
+ if (!AAVE_V4_LENS_CHAINS.has(chainId)) return false;
34728
+ if (getPositionLensFor(chainId, LENS_FAMILY.AAVE_V4) === void 0)
34729
+ return false;
34730
+ const entry2 = spokeEntryOf(chainId, lender);
34731
+ if (!entry2 || !isAddress2(entry2.spoke)) return false;
34732
+ const reserves = entry2.reserves ?? [];
34733
+ if (reserves.length === 0) return false;
34734
+ return reserves.every((r) => {
34735
+ try {
34736
+ return BigInt(r.reserveId) >= 0n;
34737
+ } catch {
34738
+ return false;
34739
+ }
34740
+ });
34741
+ };
34742
+ var buildAaveV4LensCall = (chainId, lender, account) => {
34743
+ const lens = getPositionLensFor(chainId, LENS_FAMILY.AAVE_V4);
34744
+ const entry2 = spokeEntryOf(chainId, lender);
34745
+ if (!lens || !entry2 || !isAddress2(entry2.spoke)) return [];
34746
+ const ids = (entry2.reserves ?? []).map((r) => BigInt(r.reserveId));
34747
+ const payload = encodeAbiParameters(
34748
+ parseAbiParameters("address, uint256[]"),
34749
+ [entry2.spoke, ids]
34750
+ );
34751
+ return [
34752
+ {
34753
+ address: lens,
34754
+ name: "getUserData",
34755
+ params: [[{ family: LENS_FAMILY.AAVE_V4, payload }], account],
34756
+ abi: PositionLensAbi
34757
+ }
34758
+ ];
34759
+ };
34760
+ var rebuildAaveV4Data = (blobs, reserveCount) => {
34761
+ if (isFailedCall(blobs) || !Array.isArray(blobs) || blobs.length !== 1) {
34762
+ return void 0;
34763
+ }
34764
+ let rows;
34765
+ try {
34766
+ rows = decodeLensRows(blobs[0], AAVE_V4_LENS_WORDS, 0, 1).rows;
34767
+ } catch {
34768
+ return void 0;
34769
+ }
34770
+ const out = [];
34771
+ for (let i = 0; i < reserveCount; i++)
34772
+ out.push(0n, [0n, 0n], [false, false], { dynamicConfigKey: 0 });
34773
+ for (const r of rows) {
34774
+ if (r.index >= reserveCount) return void 0;
34775
+ const [supplied, drawn, premium, configKey] = r.words;
34776
+ const base = r.index * USER_CALLS_PER_RESERVE;
34777
+ out[base] = supplied;
34778
+ out[base + 1] = [drawn, premium];
34779
+ out[base + 2] = [(r.flags & 1) === 1, drawn + premium > 0n];
34780
+ out[base + 3] = { dynamicConfigKey: Number(configKey) };
34781
+ }
34782
+ return out;
34783
+ };
34784
+
34785
+ // src/lending/user-data/aave-v4-type/userCallBuild.ts
34668
34786
  var USER_CALLS_PER_RESERVE = 4;
34669
34787
  function resolveSpokeEntry2(chainId, lender) {
34670
34788
  const parsed = parseAaveV4SpokeLenderKey(lender);
@@ -34672,6 +34790,8 @@ function resolveSpokeEntry2(chainId, lender) {
34672
34790
  return aaveV4Spokes()?.[chainId]?.[parsed.spokeAddrLower];
34673
34791
  }
34674
34792
  var buildAaveV4UserCall = (chainId, lender, account) => {
34793
+ if (usesAaveV4Lens(chainId, lender))
34794
+ return buildAaveV4LensCall(chainId, lender, account);
34675
34795
  const spokeEntry = resolveSpokeEntry2(chainId, lender);
34676
34796
  if (!spokeEntry) return [];
34677
34797
  const spokeAddr = spokeEntry.spoke;
@@ -35473,11 +35593,11 @@ function buildDataPhaseCalls(branches, perBranch, account) {
35473
35593
 
35474
35594
  // src/lending/user-data/river/lens.ts
35475
35595
  var usesRiverLens = (chainId) => getPositionLensFor(chainId, LENS_FAMILY.RIVER) !== void 0;
35476
- var isAddress2 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
35596
+ var isAddress3 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
35477
35597
  var buildRiverLensCall = (chainId, cfg, markets, account) => {
35478
35598
  const lens = getPositionLensFor(chainId, LENS_FAMILY.RIVER);
35479
35599
  if (!lens) return [];
35480
- if (!isAddress2(cfg.xapp) || markets.some((m) => !isAddress2(m.troveManager))) {
35600
+ if (!isAddress3(cfg.xapp) || markets.some((m) => !isAddress3(m.troveManager))) {
35481
35601
  return [];
35482
35602
  }
35483
35603
  const payload = encodeAbiParameters(
@@ -36351,11 +36471,11 @@ function __resetResupplyUserCaches() {
36351
36471
 
36352
36472
  // src/lending/user-data/fraxlend/lens.ts
36353
36473
  var usesFraxlendLens = (chainId) => getPositionLensFor(chainId, LENS_FAMILY.FRAXLEND) !== void 0;
36354
- var isAddress3 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
36474
+ var isAddress4 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
36355
36475
  var buildFraxlendLensCall = (chainId, pairs, account) => {
36356
36476
  const lens = getPositionLensFor(chainId, LENS_FAMILY.FRAXLEND);
36357
36477
  if (!lens) return [];
36358
- if (pairs.some((p) => !isAddress3(p.address))) return [];
36478
+ if (pairs.some((p) => !isAddress4(p.address))) return [];
36359
36479
  const payload = encodeAbiParameters(parseAbiParameters("address[]"), [
36360
36480
  pairs.map((p) => p.address)
36361
36481
  ]);
@@ -36606,7 +36726,7 @@ function getCachedTwyneDiscovery(chainId, lender, account, opts) {
36606
36726
  );
36607
36727
  }
36608
36728
  var lower2 = (a) => String(a).toLowerCase();
36609
- var isAddress4 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
36729
+ var isAddress5 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v);
36610
36730
  async function discover3(chainId, lender, account, opts) {
36611
36731
  const key5 = discoveryKey4(chainId, lender, account, blockKey(opts));
36612
36732
  const cached2 = discoveryCache6.get(key5);
@@ -36629,7 +36749,7 @@ async function discover3(chainId, lender, account, opts) {
36629
36749
  },
36630
36750
  opts
36631
36751
  );
36632
- const created = Array.isArray(listRaw) ? listRaw.filter(isAddress4).map(lower2) : [];
36752
+ const created = Array.isArray(listRaw) ? listRaw.filter(isAddress5).map(lower2) : [];
36633
36753
  if (created.length === 0) {
36634
36754
  discoveryCache6.set(key5, empty2);
36635
36755
  return empty2;
@@ -36663,8 +36783,8 @@ async function discover3(chainId, lender, account, opts) {
36663
36783
  const iv = refs[i * 3];
36664
36784
  const target = refs[i * 3 + 1];
36665
36785
  const owner = refs[i * 3 + 2];
36666
- if (!isAddress4(iv) || !isAddress4(target)) return;
36667
- if (isAddress4(owner) && lower2(owner) !== lower2(account)) return;
36786
+ if (!isAddress5(iv) || !isAddress5(target)) return;
36787
+ if (isAddress5(owner) && lower2(owner) !== lower2(account)) return;
36668
36788
  const marketKey2 = `${lower2(iv)}|${lower2(target)}`;
36669
36789
  if (!known.has(marketKey2)) return;
36670
36790
  vaults.push({
@@ -38775,12 +38895,15 @@ var getAaveV4UserDataConverter = (lender, chainId, account, meta) => {
38775
38895
  const spokeAddrLc = spokeAddr.toLowerCase();
38776
38896
  const reserves = spokeEntry.reserves ?? [];
38777
38897
  const flatMeta = meta ?? {};
38778
- const expectedNumberOfCalls = reserves.length * USER_CALLS_PER_RESERVE;
38898
+ const viaLens = usesAaveV4Lens(chainId, lender);
38899
+ const expectedNumberOfCalls = viaLens ? 1 : reserves.length * USER_CALLS_PER_RESERVE;
38779
38900
  return [
38780
- (data) => {
38781
- if (data.length !== expectedNumberOfCalls) {
38901
+ (raw) => {
38902
+ if (raw.length !== expectedNumberOfCalls) {
38782
38903
  return void 0;
38783
38904
  }
38905
+ const data = viaLens ? rebuildAaveV4Data(raw[0], reserves.length) : raw;
38906
+ if (!data) throw new Error(`${lender}: PositionLens blob unusable`);
38784
38907
  const lendingPositions = {};
38785
38908
  let totalDeposits24h = 0;
38786
38909
  let totalDebt24h = 0;
@@ -57069,8 +57192,8 @@ var NEST_VAULT_PROSE = {
57069
57192
  var NEST_ENTRIES = (() => {
57070
57193
  const out = {};
57071
57194
  for (const v of NEST_SAVINGS_VAULTS) {
57072
- const prose = NEST_VAULT_PROSE[v.symbol];
57073
- if (!prose) continue;
57195
+ const prose2 = NEST_VAULT_PROSE[v.symbol];
57196
+ if (!prose2) continue;
57074
57197
  for (const chainId of v.chains) {
57075
57198
  (out[chainId] ??= []).push({
57076
57199
  reader: "nest-vault",
@@ -57078,7 +57201,7 @@ var NEST_ENTRIES = (() => {
57078
57201
  underlying: NEST_USDC[chainId],
57079
57202
  symbol: v.symbol,
57080
57203
  brand: "Nest",
57081
- description: `${prose.description} ${EXIT}`,
57204
+ description: `${prose2.description} ${EXIT}`,
57082
57205
  decimals: 6,
57083
57206
  underlyingDecimals: 6,
57084
57207
  isRebasing: false,
@@ -57088,7 +57211,7 @@ var NEST_ENTRIES = (() => {
57088
57211
  withdrawalMode: "fee-or-queued",
57089
57212
  solvency: "nav-attested",
57090
57213
  yieldFetcher: nestFetcher,
57091
- yieldKey: prose.yieldKey
57214
+ yieldKey: prose2.yieldKey
57092
57215
  });
57093
57216
  }
57094
57217
  }
@@ -57537,6 +57660,54 @@ var IPOR_FUSION_ENTRIES = (() => {
57537
57660
  }
57538
57661
  return out;
57539
57662
  })();
57663
+ var COMMON = "Mezzanine's Hastra Optimizer, which loops Hastra PRIME and AUTO through Morpho and Kamino. The curator reports its NAV through RedStone each weekly epoch, so the rate is one epoch's result and can swing, or turn negative, from week to week. MZUSD not staked in a tranche earns nothing and its yield goes to the tranches: about half of all MZUSD sat unstaked in one Safe at listing, roughly doubling both rates, which fall if it is staked or redeemed.";
57664
+ var HASTRA_PROSE = {
57665
+ senior: `The SENIOR tranche of ${COMMON} It takes losses only after the junior tranche is gone.`,
57666
+ junior: `The JUNIOR, FIRST-LOSS tranche of ${COMMON} It takes every loss first, for a yield premium that grows as this tranche shrinks against the senior.`
57667
+ };
57668
+ var PRIME = "Mezzanine's undocumented PRIME vault, seeded by the operator's Safe, which holds nearly all of it. Its USDC is swept into the same strategy as the Hastra Optimizer. No NAV report has ever been applied, so it has earned nothing and a withdrawal request cannot settle. Deposits are refused while its epochs stay stalled.";
57669
+ var PRIME_PROSE = {
57670
+ senior: `The SENIOR tranche of ${PRIME} It takes losses only after the junior tranche is gone.`,
57671
+ junior: `The JUNIOR, FIRST-LOSS tranche of ${PRIME} It takes every loss first.`
57672
+ };
57673
+ var prose = (t) => (t.vaultName === "PRIME" ? PRIME_PROSE : HASTRA_PROSE)[t.tranche];
57674
+ var toEntry3 = (t) => ({
57675
+ reader: "mezzanine-tranche",
57676
+ address: t.address,
57677
+ // The deposit asset, not `asset()`: see the reader.
57678
+ underlying: t.depositAsset,
57679
+ symbol: t.symbol,
57680
+ brand: "Mezzanine",
57681
+ description: prose(t),
57682
+ decimals: 21,
57683
+ underlyingDecimals: 6,
57684
+ isRebasing: false,
57685
+ isMintable: true,
57686
+ withdrawalMode: "request-based",
57687
+ withdrawQueue: t.address,
57688
+ solvency: t.tranche === "senior" ? "tranched-senior" : "tranched-junior",
57689
+ // Not read by the reader: it publishes the row's NAV attestation, so the
57690
+ // sheet says the price is reported and the senior's principal is not safe.
57691
+ priceOracle: t.navOracle,
57692
+ feeScheduleCheckedAt: "2026-11-05",
57693
+ mezzanine: {
57694
+ issuanceVault: t.issuanceVault,
57695
+ mzusd: t.mzusd,
57696
+ reservoir: t.reservoir,
57697
+ allowlist: t.allowlist,
57698
+ pauseManager: t.pauseManager,
57699
+ depositSymbol: t.depositSymbol,
57700
+ funded: t.fundingAsset !== void 0
57701
+ }
57702
+ });
57703
+ var MEZZANINE_ENTRIES = (() => {
57704
+ const out = {};
57705
+ for (const t of MEZZANINE_TRANCHES) {
57706
+ if (!out[t.chainId]) out[t.chainId] = [];
57707
+ out[t.chainId].push(toEntry3(t));
57708
+ }
57709
+ return out;
57710
+ })();
57540
57711
  var L2SD_YIELD_KEYS = {
57541
57712
  limUSD: "limUSD::LIMUSD",
57542
57713
  haHYPE: "haHYPE::haHYPE",
@@ -59534,7 +59705,7 @@ var ROWS = [
59534
59705
  )
59535
59706
  }
59536
59707
  ];
59537
- var toEntry3 = (r) => ({
59708
+ var toEntry4 = (r) => ({
59538
59709
  reader: "alchemix-transmuter",
59539
59710
  address: r.transmuter,
59540
59711
  underlying: r.alAsset,
@@ -59564,7 +59735,7 @@ var toEntry3 = (r) => ({
59564
59735
  alchemixTransmuter: r.cfg
59565
59736
  });
59566
59737
  var ALCHEMIX_TRANSMUTER_ENTRIES = ROWS.reduce((out, r) => {
59567
- (out[r.chainId] ??= []).push(toEntry3(r));
59738
+ (out[r.chainId] ??= []).push(toEntry4(r));
59568
59739
  return out;
59569
59740
  }, {});
59570
59741
  var CHAIN_ID19 = "1";
@@ -63697,6 +63868,10 @@ var SAVINGS_REGISTRY = (() => {
63697
63868
  if (!out[chainId]) out[chainId] = [];
63698
63869
  out[chainId].push(...entries);
63699
63870
  }
63871
+ for (const [chainId, entries] of Object.entries(MEZZANINE_ENTRIES)) {
63872
+ if (!out[chainId]) out[chainId] = [];
63873
+ out[chainId].push(...entries);
63874
+ }
63700
63875
  for (const [chainId, entries] of Object.entries(LLAMA_GAP_ENTRIES)) {
63701
63876
  if (!out[chainId]) out[chainId] = [];
63702
63877
  out[chainId].push(...entries);
@@ -72965,7 +73140,8 @@ function getEulerV2Calls(chainId) {
72965
73140
  meta.push({
72966
73141
  vault: entry2.vault.toLowerCase(),
72967
73142
  lender,
72968
- usePriceLens
73143
+ usePriceLens,
73144
+ ...entry2.fixedRate ? { fixedRate: true } : {}
72969
73145
  });
72970
73146
  }
72971
73147
  if (calls.length > 0) {
@@ -73030,7 +73206,12 @@ function parseEulerV2Results(data, meta, context) {
73030
73206
  queryMeta.lender,
73031
73207
  queryMeta.vault
73032
73208
  ),
73033
- derivation
73209
+ derivation,
73210
+ // A `FixedRateOracle` is the vault creator's assumption, not a reading:
73211
+ // the row keeps it, a group takes it only with no live source. Reading
73212
+ // as `direct`, these held USDf and lvlUSD at 1.00 (0.9943, 0.9968) and
73213
+ // bUSD0 at 1.00 (0.9768).
73214
+ ...queryMeta.fixedRate ? { fallbackOnly: true } : {}
73034
73215
  });
73035
73216
  } catch {
73036
73217
  }
@@ -74320,6 +74501,176 @@ var YEARN_V3_SHARE_RATE_PRICE_SPECS = [
74320
74501
  ),
74321
74502
  yearnV3("yvWETH-2", "0xac37729b76db6438ce62042ae1270ee574ca7571", WETH_1, 18)
74322
74503
  ];
74504
+ var erc46263 = (tag, share, shareDecimals, underlying, underlyingDecimals, groups) => ({
74505
+ tag,
74506
+ chainId: "1",
74507
+ share,
74508
+ shareDecimals,
74509
+ underlying,
74510
+ underlyingDecimals,
74511
+ read: {
74512
+ kind: "assets",
74513
+ address: share,
74514
+ fn: "convertToAssets",
74515
+ arg: 10n ** BigInt(shareDecimals)
74516
+ },
74517
+ ...groups
74518
+ });
74519
+ var USD3_1 = "0x056b269eb1f75477a8666ae8c7fe01b64dd55ecc";
74520
+ var SAVINGS_SHARE_RATE_PRICE_SPECS = [
74521
+ erc46263(
74522
+ "slvlUSD",
74523
+ "0x4737d9b4592b40d51e110b94c9c043c6654067ae",
74524
+ 18,
74525
+ "0x7c1156e515aa1a2e851674120074968c905aaf37",
74526
+ // lvlUSD
74527
+ 18
74528
+ ),
74529
+ // the Tempo, Katana and MegaETH mirrors have no vault of their own
74530
+ erc46263(
74531
+ "stcUSD",
74532
+ "0x88887be419578051ff9f4eb6c858a951921d8888",
74533
+ 18,
74534
+ "0xcccc62962d17b8914c62d74ffb843d73b2a3cccc",
74535
+ // cUSD
74536
+ 18,
74537
+ {
74538
+ assetGroup: "Staked cap USD::stcUSD",
74539
+ underlyingGroup: "Cap USD::CUSD"
74540
+ }
74541
+ ),
74542
+ erc46263(
74543
+ "sDOLA",
74544
+ "0xb45ad160634c528cc3d2926d9807104fa3157305",
74545
+ 18,
74546
+ "0x865377367054516e17014ccded1e7d814edc9ce4",
74547
+ // DOLA
74548
+ 18
74549
+ ),
74550
+ erc46263(
74551
+ "sUSDf",
74552
+ "0xc8cf6d7991f15525488b2a83df53468d682ba4b0",
74553
+ 18,
74554
+ "0xfa2b947eec368f42195f24f36d2af29f7c24cec2",
74555
+ // USDf
74556
+ 18
74557
+ ),
74558
+ erc46263(
74559
+ "sreUSD",
74560
+ "0x557ab1e003951a73c12d16f0fea8490e39c33c35",
74561
+ 18,
74562
+ "0x57ab1e0003f623289cd798b1824be09a793e4bec",
74563
+ // reUSD
74564
+ 18
74565
+ ),
74566
+ erc46263(
74567
+ "ssftUSD",
74568
+ "0x232128844e5af56fd4b3f8bf97e08ab477282ab5",
74569
+ 18,
74570
+ "0xf7d85ec4e7710f71992752eac2111312e73e9c9c",
74571
+ // ftUSD
74572
+ 6
74573
+ ),
74574
+ // the BNB and Monad mirrors have no vault of their own
74575
+ erc46263(
74576
+ "sUSDat",
74577
+ "0xd166337499e176bbc38a1fbd113ab144e5bd2df7",
74578
+ 18,
74579
+ "0x23238f20b894f29041f48d88ee91131c395aaa71",
74580
+ // USDat
74581
+ 6,
74582
+ {
74583
+ assetGroup: "Saturn sUSDat::SUSDAT",
74584
+ underlyingGroup: "Saturn Dollar::USDAT"
74585
+ }
74586
+ ),
74587
+ erc46263("sUSD3", "0xf689555121e529ff0463e191f9bd9d1e496164a7", 6, USD3_1, 6),
74588
+ erc46263("USD3", USD3_1, 6, USDC_1, 6),
74589
+ // wstUSR priced as if USR were $1: lenders kept 1.1330 while USR fell to 0.04
74590
+ // (read 2026-11-06; DefiLlama 0.0453). The rate × USR's market price is the
74591
+ // value of the share, on every chain's mirror.
74592
+ erc46263(
74593
+ "wstUSR",
74594
+ "0x1202f5c7b4b9e47a1a484e8b270be34dbbc75055",
74595
+ 18,
74596
+ "0x66a1e37c9b0eaddca17d3662d6c05f4decf3e110",
74597
+ // USR
74598
+ 18,
74599
+ {
74600
+ assetGroup: "Resolv wstUSR::WSTUSR",
74601
+ underlyingGroup: "Resolv USD::USR"
74602
+ }
74603
+ ),
74604
+ // Angle stEUR: 1.098481 EURA; the group sat 5 % under it, at 1.1670. The L2
74605
+ // copies are bridged and lag this vault.
74606
+ erc46263(
74607
+ "stEUR",
74608
+ "0x004626a008b1acdc4c74ab51644093b155e59a23",
74609
+ 18,
74610
+ "0x1a7e4e63778b4f12a199c062f3efdd288afcbce8",
74611
+ // EURA
74612
+ 18,
74613
+ { assetGroup: "STEUR", underlyingGroup: "EURA" }
74614
+ ),
74615
+ // The funded svZCHF (836k ZCHF). A dust vault `0x637f00ca…` (1.14 ZCHF, rate
74616
+ // 1.0438) shares its group; this rate keeps the group off that one.
74617
+ erc46263(
74618
+ "svZCHF",
74619
+ "0xe5f130253ff137f9917c0107659a4c5262abf6b0",
74620
+ 18,
74621
+ "0xb58e61c3098d85632df34eecfb899a1ed80921cb",
74622
+ // ZCHF
74623
+ 18
74624
+ ),
74625
+ // Pareto USP: the Inverter oracle's redemption price, 6 decimals of USDC
74626
+ {
74627
+ tag: "USP",
74628
+ chainId: "1",
74629
+ share: "0x098697ba3fee4ea76294c5d6a466a4e3b3e95fe6",
74630
+ shareDecimals: 18,
74631
+ underlying: USDC_1,
74632
+ underlyingDecimals: 6,
74633
+ read: {
74634
+ kind: "assets",
74635
+ address: "0x433471901ba1a8bde764e8421790c7d9bab33552",
74636
+ fn: "getPriceForRedemption",
74637
+ arg: null
74638
+ }
74639
+ },
74640
+ // Hyperbeat: `getRate()` on the vault's Pricer, 8 decimals of USDT0
74641
+ {
74642
+ tag: "hbUSDT",
74643
+ chainId: "999",
74644
+ share: "0x5e105266db42f78fa814322bce7f388b4c2e61eb",
74645
+ shareDecimals: 18,
74646
+ underlying: "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
74647
+ // USDT0
74648
+ underlyingDecimals: 8,
74649
+ read: {
74650
+ kind: "assets",
74651
+ address: "0x3636a26ec1d512c5ecff42f7adaa5ce7964c6579",
74652
+ fn: "getRate",
74653
+ arg: null
74654
+ }
74655
+ }
74656
+ ];
74657
+ var USD_ISSUER_PRICE_SPECS = [
74658
+ {
74659
+ tag: "USDY",
74660
+ chainId: "1",
74661
+ share: "0x96f6ef951840721adbf46ac996b59e0235cb985c",
74662
+ shareDecimals: 18,
74663
+ underlying: "",
74664
+ underlyingDecimals: 18,
74665
+ assetGroup: "USDY",
74666
+ read: {
74667
+ kind: "usd-price",
74668
+ address: "0xa0219aa5b31e65bc920b5b6dfb8edf0988121de0",
74669
+ fn: "getPrice",
74670
+ decimals: 18
74671
+ }
74672
+ }
74673
+ ];
74323
74674
  var SHARE_RATE_PRICE_SPECS = [
74324
74675
  // Makina machines moved to `gapSweep.ts` with their savings rows — still
74325
74676
  // priced here off the same machine read.
@@ -74332,14 +74683,20 @@ var SHARE_RATE_PRICE_SPECS = [
74332
74683
  ].filter((s) => !(s.tag in NOT_PRICED)).map(priceSpecFromRateSpec),
74333
74684
  ...MELLOW_SHARE_RATE_PRICE_SPECS,
74334
74685
  ...ERC4626_SHARE_RATE_PRICE_SPECS,
74335
- ...YEARN_V3_SHARE_RATE_PRICE_SPECS
74686
+ ...YEARN_V3_SHARE_RATE_PRICE_SPECS,
74687
+ ...SAVINGS_SHARE_RATE_PRICE_SPECS,
74688
+ ...USD_ISSUER_PRICE_SPECS
74336
74689
  ];
74337
74690
  var ABI6 = parseAbi([
74338
74691
  "function getReport(address asset) view returns (uint224 priceD18, uint32 timestamp, bool isSuspicious)"
74339
74692
  ]);
74340
- var abiItemFor = (read) => read.kind === "mellow-report" ? ABI6 : parseAbi([
74341
- read.arg === null ? `function ${read.fn}() view returns (uint256)` : `function ${read.fn}(uint256) view returns (uint256)`
74342
- ]);
74693
+ var abiItemFor = (read) => {
74694
+ if (read.kind === "mellow-report") return ABI6;
74695
+ const noArg = read.kind === "usd-price" || read.arg === null;
74696
+ return parseAbi([
74697
+ noArg ? `function ${read.fn}() view returns (uint256)` : `function ${read.fn}(uint256) view returns (uint256)`
74698
+ ]);
74699
+ };
74343
74700
  function shareRateCalls(chainId, specs = SHARE_RATE_PRICE_SPECS) {
74344
74701
  const mine = specs.filter((s) => s.chainId === chainId);
74345
74702
  const abi = [];
@@ -74352,10 +74709,16 @@ function shareRateCalls(chainId, specs = SHARE_RATE_PRICE_SPECS) {
74352
74709
  abi.push(item);
74353
74710
  }
74354
74711
  }
74355
- return s.read.kind === "mellow-report" ? { address: s.read.oracle, name: "getReport", params: [s.read.asset] } : {
74712
+ if (s.read.kind === "mellow-report")
74713
+ return {
74714
+ address: s.read.oracle,
74715
+ name: "getReport",
74716
+ params: [s.read.asset]
74717
+ };
74718
+ return {
74356
74719
  address: s.read.address,
74357
74720
  name: s.read.fn,
74358
- params: s.read.arg === null ? [] : [s.read.arg]
74721
+ params: s.read.kind === "usd-price" || s.read.arg === null ? [] : [s.read.arg]
74359
74722
  };
74360
74723
  });
74361
74724
  return { specs: mine, calls, abi };
@@ -74382,7 +74745,7 @@ function decodeShareRate(spec, raw) {
74382
74745
  } else {
74383
74746
  const v = toBig9(raw);
74384
74747
  if (v === void 0 || v <= 0n) return void 0;
74385
- rate = Number(v) / 10 ** spec.underlyingDecimals;
74748
+ rate = Number(v) / 10 ** (spec.read.kind === "usd-price" ? spec.read.decimals : spec.underlyingDecimals);
74386
74749
  }
74387
74750
  return Number.isFinite(rate) && rate >= SHARE_RATE_MIN && rate <= SHARE_RATE_MAX ? rate : void 0;
74388
74751
  }
@@ -74410,26 +74773,43 @@ async function fetchShareRatesRaw(chainId, rpcOverrides, retries = 3, specs = SH
74410
74773
  return [];
74411
74774
  }
74412
74775
  }
74776
+ var sourceOf = (read) => read.kind === "mellow-report" ? "mellow:getReport" : read.fn;
74777
+ function rateEntryFields(spec, rate) {
74778
+ if (spec.read.kind === "usd-price")
74779
+ return {
74780
+ price: rate,
74781
+ priceUSD: rate,
74782
+ derivation: "direct",
74783
+ shareRate: {
74784
+ rate,
74785
+ underlying: "",
74786
+ usd: true,
74787
+ source: sourceOf(spec.read)
74788
+ }
74789
+ };
74790
+ return {
74791
+ price: rate,
74792
+ priceUSD: 0,
74793
+ baseAsset: spec.underlying,
74794
+ derivation: "quoted",
74795
+ shareRate: {
74796
+ rate,
74797
+ underlying: spec.underlying,
74798
+ ...spec.underlyingGroup ? { underlyingGroup: spec.underlyingGroup } : {},
74799
+ source: sourceOf(spec.read)
74800
+ }
74801
+ };
74802
+ }
74413
74803
  function shareRateEntries(chainId, tokenList, rates) {
74414
74804
  const out = [];
74415
74805
  for (const { spec, rate } of rates) {
74416
74806
  if (!tokenList[spec.share]) continue;
74417
- const entry2 = {
74807
+ out.push({
74418
74808
  asset: spec.share,
74419
- price: rate,
74420
- priceUSD: 0,
74421
74809
  marketUid: `${SHARE_RATE_PRICE_KEY}:${chainId}:${spec.share}`,
74422
74810
  description: `Issuer share rate (${spec.tag}): ${rate.toPrecision(10)} underlying per share`,
74423
- baseAsset: spec.underlying,
74424
- derivation: "quoted",
74425
- shareRate: {
74426
- rate,
74427
- underlying: spec.underlying,
74428
- ...spec.underlyingGroup ? { underlyingGroup: spec.underlyingGroup } : {},
74429
- source: spec.read.kind === "mellow-report" ? "mellow:getReport" : `${spec.read.fn}`
74430
- }
74431
- };
74432
- out.push(entry2);
74811
+ ...rateEntryFields(spec, rate)
74812
+ });
74433
74813
  }
74434
74814
  return out;
74435
74815
  }
@@ -74455,25 +74835,17 @@ async function fetchGroupShareRatesRaw(rpcOverrides, retries = 3, specs = GROUP_
74455
74835
  function crossChainShareRateEntries(chainId, tokenList, rates) {
74456
74836
  const out = [];
74457
74837
  for (const { spec, rate } of rates) {
74458
- if (!spec.assetGroup || !spec.underlyingGroup) continue;
74838
+ const dollars = spec.read.kind === "usd-price";
74839
+ if (!spec.assetGroup || !spec.underlyingGroup && !dollars) continue;
74459
74840
  for (const [address, t] of Object.entries(tokenList)) {
74460
74841
  if (t?.assetGroup !== spec.assetGroup) continue;
74461
74842
  const asset = address.toLowerCase();
74462
74843
  if (spec.chainId === chainId && asset === spec.share) continue;
74463
74844
  out.push({
74464
74845
  asset,
74465
- price: rate,
74466
- priceUSD: 0,
74467
74846
  marketUid: `${SHARE_RATE_PRICE_KEY}:${spec.chainId}:${spec.share}`,
74468
74847
  description: `Issuer share rate (${spec.tag}, read on chain ${spec.chainId}): ${rate.toPrecision(10)} underlying per share`,
74469
- baseAsset: spec.underlying,
74470
- derivation: "quoted",
74471
- shareRate: {
74472
- rate,
74473
- underlying: spec.underlying,
74474
- underlyingGroup: spec.underlyingGroup,
74475
- source: spec.read.kind === "mellow-report" ? "mellow:getReport" : spec.read.fn
74476
- }
74848
+ ...rateEntryFields(spec, rate)
74477
74849
  });
74478
74850
  }
74479
74851
  }
@@ -74606,7 +74978,7 @@ async function probeAaveFeedTimestamps(chainId, options = {}) {
74606
74978
  overrdies: rpcOverrides,
74607
74979
  logErrors: false
74608
74980
  });
74609
- const sourceOf = /* @__PURE__ */ new Map();
74981
+ const sourceOf2 = /* @__PURE__ */ new Map();
74610
74982
  const uniqueSources = [];
74611
74983
  const sourceIndex = /* @__PURE__ */ new Map();
74612
74984
  jobs.forEach((_3, i) => {
@@ -74614,7 +74986,7 @@ async function probeAaveFeedTimestamps(chainId, options = {}) {
74614
74986
  if (isFailed2(raw)) return;
74615
74987
  const source = String(raw).toLowerCase();
74616
74988
  if (source === ZERO_ADDRESS11) return;
74617
- sourceOf.set(i, source);
74989
+ sourceOf2.set(i, source);
74618
74990
  if (!sourceIndex.has(source)) {
74619
74991
  sourceIndex.set(source, uniqueSources.length);
74620
74992
  uniqueSources.push(source);
@@ -74648,7 +75020,7 @@ async function probeAaveFeedTimestamps(chainId, options = {}) {
74648
75020
  description: isFailed2(description) ? void 0 : String(description)
74649
75021
  });
74650
75022
  });
74651
- for (const [i, source] of sourceOf) {
75023
+ for (const [i, source] of sourceOf2) {
74652
75024
  const info = infoOfSource.get(source);
74653
75025
  if (!info) continue;
74654
75026
  const { lender, asset } = jobs[i];
@@ -76133,6 +76505,31 @@ function disagreesWith(priceUSD, reference, cfg = DEFAULT_CONSENSUS_DEMOTION) {
76133
76505
  return Math.abs(priceUSD / reference - 1) > cfg.demoteDeviation;
76134
76506
  }
76135
76507
 
76508
+ // src/prices/oracle-prices/placeholderFeeds.ts
76509
+ var PLACEHOLDER_FEEDS = {
76510
+ // LayerBank V3 answers its USDC feed for the legacy Nest vaults, whose
76511
+ // `hook()` is 0 (read 2026-11-06: 0.99979849 for all four, against Morpho's
76512
+ // 1.0092 / 1.0188 / 1.0464 for the first three). Its other Nest rows are right.
76513
+ "98866": [
76514
+ ["LAYERBANK_V3", "0xdea736937d464d288ec80138bcd1a2e109a200e3"],
76515
+ // nETF
76516
+ ["LAYERBANK_V3", "0xbfc5770631641719cd1cf809d8325b146aed19de"],
76517
+ // nINSTO
76518
+ ["LAYERBANK_V3", "0x9fbc367b9bb966a2a537989817a088afcaffdc4c"],
76519
+ // nELIXIR
76520
+ ["LAYERBANK_V3", "0xb52b090837a035f93a84487e5a7d3719c32aa8a9"]
76521
+ // nPAYFI
76522
+ ],
76523
+ // YEI's USDY source does not track Ondo's accrual (`USDY_GROUP_PRICE.md`).
76524
+ "1329": [["YEI", "0x54cd901491aef397084453f4372b93c33260e2a6"]]
76525
+ };
76526
+ function isPlaceholderFeed(chainId, lender, asset) {
76527
+ const lc2 = asset.toLowerCase();
76528
+ return (PLACEHOLDER_FEEDS[chainId] ?? []).some(
76529
+ ([prefix, a]) => a === lc2 && lender.startsWith(prefix)
76530
+ );
76531
+ }
76532
+
76136
76533
  // src/prices/oracle-prices/feedStats.ts
76137
76534
  var EWMA_ALPHA = 0.1;
76138
76535
  var MIN_DEVIATION_SAMPLES = 5;
@@ -76442,7 +76839,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
76442
76839
  // `fallbackOnly` wins over `shareRate`: a share rate can be a
76443
76840
  // last resort too (a registry-wide sweep of vault rates), and is
76444
76841
  // then resolved the same way but ranked as a fallback
76445
- sourceRank: entry2.fallbackOnly ? SOURCE_RANK.fallback : shareRate ? SOURCE_RANK.shareRate : SOURCE_RANK.oracle,
76842
+ sourceRank: entry2.fallbackOnly || isPlaceholderFeed(chainId, lender, entry2.asset) ? SOURCE_RANK.fallback : shareRate ? SOURCE_RANK.shareRate : SOURCE_RANK.oracle,
76446
76843
  consensusRank: 0,
76447
76844
  oracleKey,
76448
76845
  priceUSD: entry2.priceUSD,
@@ -76458,7 +76855,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
76458
76855
  depth: depthOf(entry2.marketUid, lender, depth),
76459
76856
  chainRank
76460
76857
  };
76461
- if (shareRate) {
76858
+ if (shareRate && !shareRate.usd) {
76462
76859
  const u = shareRate.underlying;
76463
76860
  const uGroup = shareRate.underlyingGroup ?? tokenList[u]?.assetGroup ?? tokenList[u.toLowerCase()]?.assetGroup;
76464
76861
  pendingShareRates.push({
@@ -76523,7 +76920,10 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
76523
76920
  chainId: best.chainId,
76524
76921
  lender: best.lender,
76525
76922
  feedKey: best.feedKey,
76526
- derivation: derivationOfRank(best.derivationRank),
76923
+ // The arbiter between writer boxes ranks by this and does not know
76924
+ // `fallbackOnly`: a box left with only a last resort (a fixed-rate
76925
+ // oracle) must not look like a live feed against another box's reading.
76926
+ derivation: best.sourceRank === SOURCE_RANK.fallback ? "derived" : derivationOfRank(best.derivationRank),
76527
76927
  candidates,
76528
76928
  rejected,
76529
76929
  ...demoted ? { demoted, consensusUSD } : {}
@@ -83842,6 +84242,132 @@ var readerStrataCooldown = {
83842
84242
  }
83843
84243
  };
83844
84244
 
84245
+ // src/vaults/lst/withdrawals/abis/mezzanine.ts
84246
+ var MezzanineQueueReadAbi = [
84247
+ {
84248
+ name: "getUserEpochInfo",
84249
+ type: "function",
84250
+ stateMutability: "view",
84251
+ inputs: [
84252
+ { name: "user", type: "address" },
84253
+ { name: "epochId", type: "uint256" }
84254
+ ],
84255
+ outputs: [
84256
+ { name: "pendingShares", type: "uint256" },
84257
+ { name: "claimableAssets", type: "uint256" }
84258
+ ]
84259
+ },
84260
+ {
84261
+ name: "convertToAssets",
84262
+ type: "function",
84263
+ stateMutability: "view",
84264
+ inputs: [{ name: "shares", type: "uint256" }],
84265
+ outputs: [{ name: "", type: "uint256" }]
84266
+ }
84267
+ ];
84268
+ var MezzanineEpochReadAbi = [
84269
+ {
84270
+ name: "currentEpochId",
84271
+ type: "function",
84272
+ stateMutability: "view",
84273
+ inputs: [],
84274
+ outputs: [{ name: "", type: "uint256" }]
84275
+ },
84276
+ {
84277
+ name: "epochStart",
84278
+ type: "function",
84279
+ stateMutability: "view",
84280
+ inputs: [],
84281
+ outputs: [{ name: "", type: "uint256" }]
84282
+ },
84283
+ {
84284
+ name: "epochDuration",
84285
+ type: "function",
84286
+ stateMutability: "view",
84287
+ inputs: [],
84288
+ outputs: [{ name: "", type: "uint256" }]
84289
+ }
84290
+ ];
84291
+
84292
+ // src/vaults/lst/withdrawals/readers/mezzanine.ts
84293
+ var MAX_DELAY_EPOCHS = 30n;
84294
+ var LOOKBACK_EPOCHS = 104n;
84295
+ var ONE_SHARE3 = 10n ** 21n;
84296
+ var readerMezzanineEpoch = {
84297
+ fetch: async (user, multicallRetry, chainId, entry2) => {
84298
+ const tranche = entry2.withdrawalContract;
84299
+ const vault = entry2.secondaryWithdrawalContract;
84300
+ const mzusd = entry2.escrowToken;
84301
+ if (!tranche || !vault) return [];
84302
+ const clock = await multicallRetry({
84303
+ chain: chainId,
84304
+ calls: [
84305
+ { address: vault, name: "currentEpochId", params: [] },
84306
+ { address: vault, name: "epochStart", params: [] },
84307
+ { address: vault, name: "epochDuration", params: [] },
84308
+ { address: tranche, name: "convertToAssets", params: [ONE_SHARE3] }
84309
+ ],
84310
+ abi: [
84311
+ MezzanineEpochReadAbi,
84312
+ MezzanineEpochReadAbi,
84313
+ MezzanineEpochReadAbi,
84314
+ MezzanineQueueReadAbi
84315
+ ]
84316
+ });
84317
+ const current = toBigInt15(clock[0]);
84318
+ const epochStart = toBigInt15(clock[1]);
84319
+ const epochDuration = toBigInt15(clock[2]);
84320
+ const perShare = toBigInt15(clock[3]);
84321
+ if (current === void 0) return [];
84322
+ const first = current > LOOKBACK_EPOCHS ? current - LOOKBACK_EPOCHS : 1n;
84323
+ const epochs = [];
84324
+ for (let e = first; e <= current + MAX_DELAY_EPOCHS; e++) epochs.push(e);
84325
+ const res = await multicallRetry({
84326
+ chain: chainId,
84327
+ calls: epochs.map((e) => ({
84328
+ address: tranche,
84329
+ name: "getUserEpochInfo",
84330
+ params: [user, e]
84331
+ })),
84332
+ abi: epochs.map(() => MezzanineQueueReadAbi)
84333
+ });
84334
+ const out = [];
84335
+ epochs.forEach((epoch, i) => {
84336
+ const cell = res[i];
84337
+ if (!Array.isArray(cell)) return;
84338
+ const pendingShares = toBigInt15(cell[0]);
84339
+ const claimable = toBigInt15(cell[1]);
84340
+ if (!pendingShares) return;
84341
+ const finalized = claimable !== void 0 && claimable > 0n;
84342
+ const base = {
84343
+ lst: entry2.lst,
84344
+ brand: entry2.brand,
84345
+ symbol: entry2.symbol,
84346
+ requestId: epoch.toString(),
84347
+ shares: pendingShares.toString(),
84348
+ withdrawQueue: tranche,
84349
+ ...mzusd ? { claimToken: mzusd } : {}
84350
+ };
84351
+ if (finalized) {
84352
+ out.push({
84353
+ ...base,
84354
+ amountUnderlying: claimable.toString(),
84355
+ status: "claimable"
84356
+ });
84357
+ return;
84358
+ }
84359
+ const readyAt = epochStart !== void 0 && epochDuration !== void 0 && epoch >= current ? Number(epochStart + (epoch - current + 1n) * epochDuration) : void 0;
84360
+ out.push({
84361
+ ...base,
84362
+ amountUnderlying: (pendingShares * (perShare ?? 0n) / ONE_SHARE3).toString(),
84363
+ status: "pending",
84364
+ ...readyAt !== void 0 ? { readyAt } : {}
84365
+ });
84366
+ });
84367
+ return out;
84368
+ }
84369
+ };
84370
+
83845
84371
  // src/vaults/lst/withdrawals/abis/etherfi.ts
83846
84372
  var EtherFiWithdrawRequestAbi = [
83847
84373
  {
@@ -85520,6 +86046,8 @@ var buildWithdrawalReader = (entry2) => {
85520
86046
  return readerSusd3Cooldown;
85521
86047
  case "strataCooldown":
85522
86048
  return readerStrataCooldown;
86049
+ case "mezzanineEpoch":
86050
+ return readerMezzanineEpoch;
85523
86051
  case "swellNft":
85524
86052
  return readerSwell;
85525
86053
  case "stakeWiseSubgraph":
@@ -85733,6 +86261,18 @@ var LST_WITHDRAWAL_REGISTRY = {
85733
86261
  symbol: "apyUSD",
85734
86262
  reader: "unverified"
85735
86263
  },
86264
+ // Mezzanine tranches — ONE entry per TRANCHE: requests are tranche-local.
86265
+ // `withdrawalContract` is the tranche, `secondaryWithdrawalContract` the
86266
+ // IssuanceVault holding the epoch clock, `escrowToken` the MZUSD a claim pays.
86267
+ ...MEZZANINE_TRANCHES.filter((t) => t.chainId === "1").map((t) => ({
86268
+ lst: t.address,
86269
+ brand: "Mezzanine",
86270
+ symbol: t.symbol,
86271
+ reader: "mezzanineEpoch",
86272
+ withdrawalContract: t.address,
86273
+ secondaryWithdrawalContract: t.issuanceVault,
86274
+ escrowToken: t.mzusd
86275
+ })),
85736
86276
  // Strata tranche markets — ONE entry per market (not per tranche):
85737
86277
  // both tranches escrow into the same two per-market ICooldown
85738
86278
  // contracts keyed by (escrowToken, user) with no tranche
@@ -87619,6 +88159,163 @@ var FusionBalanceOfAbi = [
87619
88159
  }
87620
88160
  ];
87621
88161
 
88162
+ // src/vaults/savings/abis/mezzanine.ts
88163
+ var MezzanineTrancheReadAbi = [
88164
+ {
88165
+ name: "totalAssets",
88166
+ type: "function",
88167
+ stateMutability: "view",
88168
+ inputs: [],
88169
+ outputs: [{ name: "", type: "uint256" }]
88170
+ },
88171
+ {
88172
+ name: "totalSupply",
88173
+ type: "function",
88174
+ stateMutability: "view",
88175
+ inputs: [],
88176
+ outputs: [{ name: "", type: "uint256" }]
88177
+ },
88178
+ {
88179
+ name: "convertToAssets",
88180
+ type: "function",
88181
+ stateMutability: "view",
88182
+ inputs: [{ name: "shares", type: "uint256" }],
88183
+ outputs: [{ name: "", type: "uint256" }]
88184
+ },
88185
+ {
88186
+ name: "maxDeposit",
88187
+ type: "function",
88188
+ stateMutability: "view",
88189
+ inputs: [{ name: "receiver", type: "address" }],
88190
+ outputs: [{ name: "", type: "uint256" }]
88191
+ },
88192
+ {
88193
+ name: "yieldStreamingAmount",
88194
+ type: "function",
88195
+ stateMutability: "view",
88196
+ inputs: [],
88197
+ outputs: [{ name: "", type: "uint256" }]
88198
+ },
88199
+ {
88200
+ name: "yieldStreamStart",
88201
+ type: "function",
88202
+ stateMutability: "view",
88203
+ inputs: [],
88204
+ outputs: [{ name: "", type: "uint48" }]
88205
+ },
88206
+ {
88207
+ name: "yieldStreamEnd",
88208
+ type: "function",
88209
+ stateMutability: "view",
88210
+ inputs: [],
88211
+ outputs: [{ name: "", type: "uint48" }]
88212
+ },
88213
+ {
88214
+ name: "unstakeDelayEpochs",
88215
+ type: "function",
88216
+ stateMutability: "view",
88217
+ inputs: [],
88218
+ outputs: [{ name: "", type: "uint256" }]
88219
+ },
88220
+ {
88221
+ name: "unstakeYieldReductionBps",
88222
+ type: "function",
88223
+ stateMutability: "view",
88224
+ inputs: [],
88225
+ outputs: [{ name: "", type: "uint256" }]
88226
+ },
88227
+ {
88228
+ name: "directWithdrawEnabled",
88229
+ type: "function",
88230
+ stateMutability: "view",
88231
+ inputs: [],
88232
+ outputs: [{ name: "", type: "bool" }]
88233
+ }
88234
+ ];
88235
+ var MezzanineVaultReadAbi = [
88236
+ {
88237
+ name: "epochStart",
88238
+ type: "function",
88239
+ stateMutability: "view",
88240
+ inputs: [],
88241
+ outputs: [{ name: "", type: "uint256" }]
88242
+ },
88243
+ {
88244
+ name: "epochDuration",
88245
+ type: "function",
88246
+ stateMutability: "view",
88247
+ inputs: [],
88248
+ outputs: [{ name: "", type: "uint256" }]
88249
+ },
88250
+ {
88251
+ name: "currentEpochId",
88252
+ type: "function",
88253
+ stateMutability: "view",
88254
+ inputs: [],
88255
+ outputs: [{ name: "", type: "uint256" }]
88256
+ },
88257
+ {
88258
+ name: "performanceFeeBps",
88259
+ type: "function",
88260
+ stateMutability: "view",
88261
+ inputs: [],
88262
+ outputs: [{ name: "", type: "uint16" }]
88263
+ },
88264
+ {
88265
+ name: "protocolFeeBps",
88266
+ type: "function",
88267
+ stateMutability: "view",
88268
+ inputs: [],
88269
+ outputs: [{ name: "", type: "uint16" }]
88270
+ }
88271
+ ];
88272
+ var MezzanineBaseReadAbi = [
88273
+ {
88274
+ name: "withdrawalFeeBps",
88275
+ type: "function",
88276
+ stateMutability: "view",
88277
+ inputs: [],
88278
+ outputs: [{ name: "", type: "uint256" }]
88279
+ },
88280
+ {
88281
+ name: "getRemainingRedemptionCap",
88282
+ type: "function",
88283
+ stateMutability: "view",
88284
+ inputs: [],
88285
+ outputs: [{ name: "", type: "uint256" }]
88286
+ }
88287
+ ];
88288
+ var MezzanineAllowlistReadAbi = [
88289
+ {
88290
+ name: "verifyAccount",
88291
+ type: "function",
88292
+ stateMutability: "view",
88293
+ inputs: [{ name: "account", type: "address" }],
88294
+ outputs: [{ name: "", type: "bool" }]
88295
+ }
88296
+ ];
88297
+ var MezzaninePauseReadAbi = [
88298
+ {
88299
+ name: "isPaused",
88300
+ type: "function",
88301
+ stateMutability: "view",
88302
+ inputs: [
88303
+ { name: "target", type: "address" },
88304
+ { name: "category", type: "uint8" }
88305
+ ],
88306
+ outputs: [{ name: "", type: "bool" }]
88307
+ }
88308
+ ];
88309
+ var MezzanineTokenReadAbi = [
88310
+ {
88311
+ name: "balanceOf",
88312
+ type: "function",
88313
+ stateMutability: "view",
88314
+ inputs: [{ name: "account", type: "address" }],
88315
+ outputs: [{ name: "", type: "uint256" }]
88316
+ }
88317
+ ];
88318
+
87622
88319
  // src/vaults/savings/abis/ember.ts
87623
88320
  var EmberMaxDepositAbi = [
87624
88321
  {
@@ -88490,10 +89187,10 @@ var readerZerobaseVault = (entry2) => {
88490
89187
  const wait = toBigInt16(waitingTime);
88491
89188
  let supplyRate;
88492
89189
  if (Array.isArray(rewardRate) && rewardRate.length === 2) {
88493
- const num23 = toBigInt16(rewardRate[0]);
89190
+ const num24 = toBigInt16(rewardRate[0]);
88494
89191
  const base = toBigInt16(rewardRate[1]);
88495
- if (num23 !== void 0 && base !== void 0 && base > 0n && num23 < base)
88496
- supplyRate = Number(num23) * 100 / Number(base);
89192
+ if (num24 !== void 0 && base !== void 0 && base > 0n && num24 < base)
89193
+ supplyRate = Number(num24) * 100 / Number(base);
88497
89194
  }
88498
89195
  return {
88499
89196
  // Share and underlying decimals match on every deployment (6/6, or
@@ -89284,7 +89981,7 @@ var readerWrenNav = (entry2) => {
89284
89981
  };
89285
89982
 
89286
89983
  // src/vaults/savings/readers/yieldBasisLt.ts
89287
- var ONE_SHARE3 = ONE_E1823;
89984
+ var ONE_SHARE4 = ONE_E1823;
89288
89985
  var readerYieldBasisLt = (entry2) => {
89289
89986
  const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
89290
89987
  const amm = entry2.capacityContract ?? entry2.address;
@@ -89292,7 +89989,7 @@ var readerYieldBasisLt = (entry2) => {
89292
89989
  calls: [
89293
89990
  { address: entry2.address, name: "totalSupply", params: [] },
89294
89991
  { address: entry2.address, name: "pricePerShare", params: [] },
89295
- { address: entry2.address, name: "preview_withdraw", params: [ONE_SHARE3] },
89992
+ { address: entry2.address, name: "preview_withdraw", params: [ONE_SHARE4] },
89296
89993
  { address: amm, name: "max_debt", params: [] },
89297
89994
  { address: amm, name: "value_oracle", params: [] }
89298
89995
  ],
@@ -89311,7 +90008,7 @@ var readerYieldBasisLt = (entry2) => {
89311
90008
  return void 0;
89312
90009
  }
89313
90010
  if (totalSupply === 0n || redeemRaw === 0n) return void 0;
89314
- const totalAssets = totalSupply * redeemRaw / ONE_SHARE3;
90011
+ const totalAssets = totalSupply * redeemRaw / ONE_SHARE4;
89315
90012
  const exchangeRate = redeemRaw * ONE_E1823 / underlyingUnit;
89316
90013
  const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
89317
90014
  const cap = toBigInt16(maxDebt);
@@ -89487,8 +90184,207 @@ var readerIporFusion = (entry2) => {
89487
90184
  };
89488
90185
  };
89489
90186
 
89490
- // src/vaults/savings/readers/emberVault.ts
90187
+ // src/vaults/savings/readers/mezzanine.ts
89491
90188
  var NEUTRAL_PROBE5 = "0x000000000000000000000000000000000000dead";
90189
+ var PAUSE_DEPOSITS = 0;
90190
+ var PAUSE_WITHDRAWALS = 1;
90191
+ var BASE_SCALE = 10n ** 12n;
90192
+ var SECONDS_PER_YEAR23 = 31536e3;
90193
+ var mezzanineStreamRate = (args) => {
90194
+ const { amount: amount5, start, end, totalAssets, epochDuration, now } = args;
90195
+ const period = end - start;
90196
+ if (period <= 0 || totalAssets <= 0n) return void 0;
90197
+ if (now >= end + epochDuration) return void 0;
90198
+ const perAsset = Number(amount5 * 1000000000000n / totalAssets) / 1e12;
90199
+ return perAsset / period * SECONDS_PER_YEAR23 * 100;
90200
+ };
90201
+ var mezzanineEpochStalled = (args) => args.now >= args.epochStart + 2 * args.epochDuration;
90202
+ var mezzanineExitWait = (args) => {
90203
+ const { epochStart, epochDuration, delayEpochs, now } = args;
90204
+ const remainder = Math.max(0, epochStart + epochDuration - now);
90205
+ return remainder + delayEpochs * epochDuration;
90206
+ };
90207
+ var exitDescription = (args) => {
90208
+ const { delayEpochs, yieldCutBps, capacity, depositSymbol, funded, stalled } = args;
90209
+ const epochs = `${delayEpochs} weekly epoch${delayEpochs === 1 ? "" : "s"}`;
90210
+ const cut = yieldCutBps / 100;
90211
+ return (stalled ? `This vault has missed its epoch reports, so a request made now does not settle until they resume. ` : "") + `Settles after ${epochs}, once Mezzanine's automation applies the NAV report and finalizes the epoch; a late report delays it. Queued shares stay in the loss waterfall, and ${cut} % of the yield they earn while queued is forfeited. The claim pays MZUSD, which redeems 1:1 for ${depositSymbol} only while the vault holds idle ${depositSymbol}` + (capacity !== void 0 ? ` (${(Number(capacity) / 1e6).toLocaleString("en-US", { maximumFractionDigits: 0 })} right now)` : "") + `; the curator has to move it there.` + (funded ? ` ${depositSymbol} turns into USDC through Hastra's own redemption.` : "");
90212
+ };
90213
+ var readerMezzanine = (entry2) => {
90214
+ const cfg = entry2.mezzanine;
90215
+ const t = entry2.address;
90216
+ const shareUnit = 10n ** BigInt(entry2.decimals);
90217
+ const vault = cfg?.issuanceVault ?? "";
90218
+ const mzusd = cfg?.mzusd ?? "";
90219
+ const tranche = (name, params = []) => ({
90220
+ address: t,
90221
+ name,
90222
+ params
90223
+ });
90224
+ const onVault = (name) => ({ address: vault, name, params: [] });
90225
+ const onBase = (name) => ({ address: mzusd, name, params: [] });
90226
+ return {
90227
+ calls: [
90228
+ tranche("totalAssets"),
90229
+ tranche("totalSupply"),
90230
+ tranche("convertToAssets", [shareUnit]),
90231
+ tranche("maxDeposit", [NEUTRAL_PROBE5]),
90232
+ tranche("yieldStreamingAmount"),
90233
+ tranche("yieldStreamStart"),
90234
+ tranche("yieldStreamEnd"),
90235
+ tranche("unstakeDelayEpochs"),
90236
+ tranche("unstakeYieldReductionBps"),
90237
+ tranche("directWithdrawEnabled"),
90238
+ onVault("epochStart"),
90239
+ onVault("epochDuration"),
90240
+ onVault("performanceFeeBps"),
90241
+ onVault("protocolFeeBps"),
90242
+ onBase("withdrawalFeeBps"),
90243
+ onBase("getRemainingRedemptionCap"),
90244
+ { address: entry2.underlying, name: "balanceOf", params: [vault] },
90245
+ {
90246
+ address: entry2.underlying,
90247
+ name: "balanceOf",
90248
+ params: [cfg?.reservoir ?? ""]
90249
+ },
90250
+ {
90251
+ address: cfg?.allowlist ?? "",
90252
+ name: "verifyAccount",
90253
+ params: [NEUTRAL_PROBE5]
90254
+ },
90255
+ {
90256
+ address: cfg?.pauseManager ?? "",
90257
+ name: "isPaused",
90258
+ params: [mzusd, PAUSE_DEPOSITS]
90259
+ },
90260
+ {
90261
+ address: cfg?.pauseManager ?? "",
90262
+ name: "isPaused",
90263
+ params: [t, PAUSE_WITHDRAWALS]
90264
+ }
90265
+ ],
90266
+ abis: [
90267
+ ...Array(10).fill(MezzanineTrancheReadAbi),
90268
+ ...Array(4).fill(MezzanineVaultReadAbi),
90269
+ ...Array(2).fill(MezzanineBaseReadAbi),
90270
+ MezzanineTokenReadAbi,
90271
+ MezzanineTokenReadAbi,
90272
+ MezzanineAllowlistReadAbi,
90273
+ MezzaninePauseReadAbi,
90274
+ MezzaninePauseReadAbi
90275
+ ],
90276
+ parse: (slice2) => {
90277
+ const [
90278
+ assets,
90279
+ supply,
90280
+ perShare,
90281
+ maxDep,
90282
+ streamAmount,
90283
+ streamStart,
90284
+ streamEnd,
90285
+ delay,
90286
+ yieldCut,
90287
+ direct,
90288
+ epochStartRaw,
90289
+ epochDurationRaw,
90290
+ perfFee,
90291
+ protocolFee,
90292
+ baseFee,
90293
+ redemptionCap,
90294
+ vaultIdle,
90295
+ reservoirIdle,
90296
+ allowed,
90297
+ depositsPaused,
90298
+ withdrawalsPaused
90299
+ ] = slice2;
90300
+ const trancheAssets = toBigInt16(assets);
90301
+ const totalSupply = toBigInt16(supply);
90302
+ const assetsPerShare = toBigInt16(perShare);
90303
+ if (trancheAssets === void 0 || totalSupply === void 0 || assetsPerShare === void 0 || direct === true)
90304
+ return void 0;
90305
+ const now = Math.floor(Date.now() / 1e3);
90306
+ const epochStart = toBigInt16(epochStartRaw);
90307
+ const epochDuration = toBigInt16(epochDurationRaw);
90308
+ const delayEpochs = toBigInt16(delay);
90309
+ const yieldCutBps = toBigInt16(yieldCut);
90310
+ const amount5 = toBigInt16(streamAmount);
90311
+ const start = toBigInt16(streamStart);
90312
+ const end = toBigInt16(streamEnd);
90313
+ const supplyRate = amount5 !== void 0 && start !== void 0 && end !== void 0 && epochDuration !== void 0 ? mezzanineStreamRate({
90314
+ amount: amount5,
90315
+ start: Number(start),
90316
+ end: Number(end),
90317
+ totalAssets: trancheAssets,
90318
+ epochDuration: Number(epochDuration),
90319
+ now
90320
+ }) : void 0;
90321
+ const wait = epochStart !== void 0 && epochDuration !== void 0 && delayEpochs !== void 0 ? mezzanineExitWait({
90322
+ epochStart: Number(epochStart),
90323
+ epochDuration: Number(epochDuration),
90324
+ delayEpochs: Number(delayEpochs),
90325
+ now
90326
+ }) : void 0;
90327
+ const stalled = epochStart !== void 0 && epochDuration !== void 0 && mezzanineEpochStalled({
90328
+ epochStart: Number(epochStart),
90329
+ epochDuration: Number(epochDuration),
90330
+ now
90331
+ });
90332
+ const vaultBalance = toBigInt16(vaultIdle);
90333
+ const reservoirBalance = toBigInt16(reservoirIdle);
90334
+ const cap = toBigInt16(redemptionCap);
90335
+ const held = vaultBalance !== void 0 && reservoirBalance !== void 0 ? vaultBalance + reservoirBalance : void 0;
90336
+ const capacity = held !== void 0 && cap !== void 0 ? held < cap ? held : cap : held;
90337
+ const exitFeeBps = toBigInt16(baseFee);
90338
+ const route = {
90339
+ id: "queued",
90340
+ kind: "queued",
90341
+ label: delayEpochs !== void 0 ? `${delayEpochs}-epoch queue` : "Epoch queue",
90342
+ settlement: "async",
90343
+ ...exitFeeBps !== void 0 ? { feeBps: Number(exitFeeBps) } : {},
90344
+ ...wait !== void 0 && !stalled ? { waitSeconds: wait } : {},
90345
+ ...capacity !== void 0 ? {
90346
+ capacity: capacity.toString(),
90347
+ capacityFormatted: Number(capacity) / 1e6
90348
+ } : {},
90349
+ selfOnly: true,
90350
+ description: exitDescription({
90351
+ delayEpochs: Number(delayEpochs ?? 1n),
90352
+ yieldCutBps: Number(yieldCutBps ?? 0n),
90353
+ capacity,
90354
+ depositSymbol: cfg?.depositSymbol ?? "wYLDS",
90355
+ funded: cfg?.funded ?? true,
90356
+ stalled
90357
+ })
90358
+ };
90359
+ const perf = toBigInt16(perfFee);
90360
+ const protocol = toBigInt16(protocolFee);
90361
+ const maxDeposit = toBigInt16(maxDep);
90362
+ const closed = allowed === false || depositsPaused === true || stalled;
90363
+ const depositCapacity = closed ? 0n : maxDeposit !== void 0 && maxDeposit < 2n ** 255n ? maxDeposit / BASE_SCALE : void 0;
90364
+ return {
90365
+ // The virtual NAV: balance less the unstreamed yield and the assets
90366
+ // reserved for finalized requests, the base of `pricePerShare`.
90367
+ totalAssets: trancheAssets / BASE_SCALE,
90368
+ totalSupply,
90369
+ // MZUSD wei per share IS the 1e18-scaled deposit-asset rate, because
90370
+ // one MZUSD is one deposit-asset unit of notional. No further scaling.
90371
+ exchangeRate: assetsPerShare,
90372
+ ...supplyRate !== void 0 ? { supplyRate } : {},
90373
+ exitRoutes: [route],
90374
+ ...wait !== void 0 && !stalled ? { withdrawalCooldownSeconds: wait } : {},
90375
+ ...perf !== void 0 && protocol !== void 0 ? { performanceFeeBps: Number(perf + protocol) } : {},
90376
+ ...exitFeeBps !== void 0 ? { queuedFeeBps: Number(exitFeeBps) } : {},
90377
+ depositFeeBps: 0,
90378
+ managementFeeBps: 0,
90379
+ ...depositCapacity !== void 0 ? { depositCapacity } : {},
90380
+ ...withdrawalsPaused === true ? { exitPaused: true } : {}
90381
+ };
90382
+ }
90383
+ };
90384
+ };
90385
+
90386
+ // src/vaults/savings/readers/emberVault.ts
90387
+ var NEUTRAL_PROBE6 = "0x000000000000000000000000000000000000dead";
89492
90388
  var readerEmberVault = (entry2) => {
89493
90389
  const shareUnit = 10n ** BigInt(entry2.decimals);
89494
90390
  const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
@@ -89497,7 +90393,7 @@ var readerEmberVault = (entry2) => {
89497
90393
  { address: entry2.address, name: "totalAssets", params: [] },
89498
90394
  { address: entry2.address, name: "totalSupply", params: [] },
89499
90395
  { address: entry2.address, name: "convertToAssets", params: [shareUnit] },
89500
- { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE5] },
90396
+ { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE6] },
89501
90397
  { address: entry2.address, name: "pauseStatus", params: [] }
89502
90398
  ],
89503
90399
  abis: [
@@ -90124,7 +91020,7 @@ var readerUnitasXgld = (entry2) => {
90124
91020
  };
90125
91021
 
90126
91022
  // src/vaults/savings/readers/roycoTranche.ts
90127
- var NEUTRAL_PROBE6 = "0x000000000000000000000000000000000000dead";
91023
+ var NEUTRAL_PROBE7 = "0x000000000000000000000000000000000000dead";
90128
91024
  var ASSET_CLAIMS = {
90129
91025
  name: "claims",
90130
91026
  type: "tuple",
@@ -90227,7 +91123,7 @@ var readerRoycoTranche = (entry2) => {
90227
91123
  { address: entry2.address, name: "totalAssets", params: [] },
90228
91124
  { address: entry2.address, name: "totalSupply", params: [] },
90229
91125
  { address: entry2.address, name: "convertToAssets", params: [shareUnit] },
90230
- { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE6] },
91126
+ { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE7] },
90231
91127
  { address: entry2.address, name: "paused", params: [] },
90232
91128
  ...entryPoint ? [
90233
91129
  {
@@ -90666,7 +91562,7 @@ var readerAccountableVault = (entry2) => {
90666
91562
  };
90667
91563
 
90668
91564
  // src/vaults/savings/readers/alchemixTransmuter.ts
90669
- var SECONDS_PER_YEAR23 = 31536e3;
91565
+ var SECONDS_PER_YEAR24 = 31536e3;
90670
91566
  var UNCAPPED_FLOOR = 2n ** 200n;
90671
91567
  var pow10 = (n) => 10n ** BigInt(n);
90672
91568
  var readerAlchemixTransmuter = (entry2) => {
@@ -90742,7 +91638,7 @@ var readerAlchemixTransmuter = (entry2) => {
90742
91638
  const price1e18 = out !== void 0 && out > 0n ? out * ONE_E1823 * pow10(18 - cfg.underlyingDecimals) / q.unit : void 0;
90743
91639
  const marketDiscountBps = price1e18 !== void 0 ? Number((price1e18 - ONE_E1823) * 100000n / ONE_E1823) / 10 : void 0;
90744
91640
  const tf = transmutationFee !== void 0 ? Number(transmutationFee) / 1e4 : 0;
90745
- const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR23 / termSeconds) * 100 : void 0;
91641
+ const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR24 / termSeconds) * 100 : void 0;
90746
91642
  const exitFeeBps = exitFee !== void 0 ? Number(exitFee) : void 0;
90747
91643
  const exitRoutes = [
90748
91644
  {
@@ -90787,7 +91683,7 @@ var readerAlchemixTransmuter = (entry2) => {
90787
91683
  };
90788
91684
 
90789
91685
  // src/vaults/savings/readers/gapSweep.ts
90790
- var NEUTRAL_PROBE7 = "0x000000000000000000000000000000000000dead";
91686
+ var NEUTRAL_PROBE8 = "0x000000000000000000000000000000000000dead";
90791
91687
  var MAX_UINT256 = 2n ** 256n - 1n;
90792
91688
  var readerUsdaiStaked = (entry2) => {
90793
91689
  const a = entry2.address;
@@ -90837,7 +91733,7 @@ var readerYuzuIlp = (entry2) => {
90837
91733
  { address: entry2.address, name: "totalAssets", params: [] },
90838
91734
  { address: entry2.address, name: "totalSupply", params: [] },
90839
91735
  { address: entry2.address, name: "convertToAssets", params: [shareUnit] },
90840
- { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE7] },
91736
+ { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE8] },
90841
91737
  { address: entry2.address, name: "paused", params: [] }
90842
91738
  ],
90843
91739
  abis: [
@@ -90952,6 +91848,8 @@ var buildReader2 = (entry2) => {
90952
91848
  return readerSuperformVault(entry2);
90953
91849
  case "ipor-fusion":
90954
91850
  return readerIporFusion(entry2);
91851
+ case "mezzanine-tranche":
91852
+ return readerMezzanine(entry2);
90955
91853
  case "ember-vault":
90956
91854
  return readerEmberVault(entry2);
90957
91855
  case "mellow-core":
@@ -91349,7 +92247,7 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
91349
92247
  // Only the NAV-oracle reader's entries publish their share price from a
91350
92248
  // feed; on every other entry `priceOracle` is unset, so this stays absent
91351
92249
  // rather than pointing at an unrelated contract.
91352
- navOracle: entry2.reader === "nav-oracle" || entry2.reader === "inverter-oracle" ? entry2.priceOracle?.toLowerCase() : void 0,
92250
+ navOracle: entry2.reader === "nav-oracle" || entry2.reader === "inverter-oracle" || entry2.reader === "mezzanine-tranche" ? entry2.priceOracle?.toLowerCase() : void 0,
91353
92251
  asset,
91354
92252
  priceUsd,
91355
92253
  totalAssetsFormatted,
@@ -93202,6 +94100,12 @@ var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
93202
94100
  // StockMarketTRBasisTrade
93203
94101
  "1-0x99351baed3d8ab544ccb08af96a105910fda71e7",
93204
94102
  // aFXArbUSDTRY
94103
+ // Mezzanine's junior tranche: first loss on a levered loop, and paid a rate
94104
+ // that one NAV report can triple. Pinned in `mezzanine.test.ts`.
94105
+ "1-0x6f5d94dc0c8bbf052abf024259d087da45ad96a1",
94106
+ // mjHastra
94107
+ "1-0x95a3956dd49bd5efe7bf3edb199ddecc68057695",
94108
+ // mjPRIME
93205
94109
  // IPOR Fusion loops and carries — the share price is collateral at an
93206
94110
  // oracle mark minus debt, levered 5–9× on the loops, and on the carries the
93207
94111
  // debt sits in a different currency than the vault (dollars against ETH or
@@ -95240,6 +96144,281 @@ function buildVaultLookup(data) {
95240
96144
  return map;
95241
96145
  }
95242
96146
 
96147
+ // src/terms/choices.ts
96148
+ function buildPositionChoices(b) {
96149
+ const out = [
96150
+ modeChoice(b),
96151
+ termChoice(b),
96152
+ parameterChoice(b),
96153
+ rateChoice(b)
96154
+ ].filter((c) => c != null);
96155
+ return out.length ? out : void 0;
96156
+ }
96157
+ var STANCES = ["cheapest", "balanced", "protected"];
96158
+ var num15 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
96159
+ function rateChoice(b) {
96160
+ const us = b.rate.userSet;
96161
+ if (!us?.required || us.min == null || us.max == null) return void 0;
96162
+ const presets = (us.picks ?? []).map((p) => ({
96163
+ id: p.id,
96164
+ value: p.apr,
96165
+ effects: rateEffectsAfterFill(p)
96166
+ }));
96167
+ const fills = presets.some((p) => p.effects.capacity != null);
96168
+ return {
96169
+ id: "rate",
96170
+ kind: "interest-rate",
96171
+ param: { name: "interestRate", encoding: "wad-fraction" },
96172
+ unit: "percent-apr",
96173
+ domain: { min: us.min, max: us.max, step: 0.01 },
96174
+ ...us.default != null ? { default: us.default } : {},
96175
+ moves: fills ? ["cost", "capacity", "protection"] : ["cost", "protection"],
96176
+ ...presets.length ? { presets } : {},
96177
+ ...us.recommended ? { recommended: us.recommended } : {},
96178
+ ladder: { pricing: "queue" },
96179
+ lock: {
96180
+ adjustable: us.adjustable,
96181
+ ...us.adjustmentCooldownSecs ? { cooldownSecs: us.adjustmentCooldownSecs } : {},
96182
+ cost: us.adjustable ? "upfront-fee-again" : "close-and-reopen"
96183
+ },
96184
+ ...us.pressure ? { pressure: us.pressure } : {},
96185
+ // where the rate decides the fill, the picks move with the size
96186
+ ...fills ? { dependsOn: ["size"] } : {}
96187
+ };
96188
+ }
96189
+ function parameterChoice(b) {
96190
+ const liq = b.liquidation;
96191
+ const op = liq.openParameter;
96192
+ if (!op || op.dimension !== "collateralFactor") return void 0;
96193
+ const range2 = "min" in op.domain ? op.domain : void 0;
96194
+ const lock = {
96195
+ adjustable: !op.immutableAfterOpen,
96196
+ ...op.adjustCooldownSeconds ? { cooldownSecs: op.adjustCooldownSeconds } : {},
96197
+ cost: op.immutableAfterOpen ? "close-and-reopen" : "none"
96198
+ };
96199
+ if (op.kind === "llamalend-bands") {
96200
+ const curve = liq.bandLtv ?? {};
96201
+ const lo = range2?.min ?? 4;
96202
+ const hi = range2?.max ?? 50;
96203
+ return {
96204
+ id: "bands",
96205
+ kind: "llamalend-bands",
96206
+ param: { name: "bands", encoding: "integer" },
96207
+ unit: "count",
96208
+ domain: { min: lo, max: hi, step: 1 },
96209
+ default: op.default,
96210
+ moves: ["capacity", "protection"],
96211
+ presets: bandPresets(liq, op.default, lo, hi),
96212
+ recommended: "balanced",
96213
+ // without the curve there is nothing to draw a ladder from
96214
+ ...Object.keys(curve).length ? { ladder: { pricing: "parameter" } } : {},
96215
+ lock
96216
+ };
96217
+ }
96218
+ if (!range2) return void 0;
96219
+ const mid = Math.round((range2.min + range2.max) / 2 * 1e4) / 1e4;
96220
+ const values = {
96221
+ cheapest: range2.max,
96222
+ balanced: mid,
96223
+ protected: range2.min
96224
+ };
96225
+ return {
96226
+ id: "liqLtv",
96227
+ kind: op.kind,
96228
+ param: { name: "liqLtv", encoding: "fraction" },
96229
+ unit: "percent-ltv",
96230
+ domain: { min: range2.min * 100, max: range2.max * 100, step: 0.01 },
96231
+ default: op.default * 100,
96232
+ moves: ["capacity", "protection"],
96233
+ presets: STANCES.map((id) => ({
96234
+ id,
96235
+ value: values[id] * 100,
96236
+ effects: { maxLtv: values[id] }
96237
+ })),
96238
+ lock
96239
+ };
96240
+ }
96241
+ function termChoice(b) {
96242
+ const menu = b.rate.menu;
96243
+ if (!menu || menu.length < 2) return void 0;
96244
+ const options = menu.map((m) => ({
96245
+ value: m.termId,
96246
+ label: `${Math.round(m.durationDays)} d`,
96247
+ effects: {
96248
+ aprPct: m.apr,
96249
+ ...m.available != null ? { capacity: m.available } : {}
96250
+ }
96251
+ }));
96252
+ return {
96253
+ id: "term",
96254
+ kind: "term",
96255
+ param: { name: "termId", encoding: "id" },
96256
+ unit: "id",
96257
+ domain: { values: options.map((o) => o.value) },
96258
+ moves: options.some((o) => o.effects.capacity != null) ? ["cost", "capacity"] : ["cost"],
96259
+ options,
96260
+ lock: { adjustable: false, cost: "close-and-reopen" }
96261
+ };
96262
+ }
96263
+ function modeChoice(b) {
96264
+ const modes = (b.modes ?? []).filter(
96265
+ (m) => m.entry == null || m.entry === "user-selected"
96266
+ );
96267
+ if (modes.length < 2) return void 0;
96268
+ const options = modes.map((m) => {
96269
+ const maxLtv = num15(m.liquidation?.ltv);
96270
+ return {
96271
+ value: m.modeId,
96272
+ ...m.label ? { label: m.label } : {},
96273
+ effects: maxLtv != null ? { maxLtv } : {}
96274
+ };
96275
+ });
96276
+ const def = modes.find((m) => m.isDefault)?.modeId;
96277
+ return {
96278
+ id: "mode",
96279
+ kind: "e-mode",
96280
+ param: { name: "modeId", encoding: "id" },
96281
+ unit: "id",
96282
+ domain: { values: options.map((o) => o.value) },
96283
+ ...def != null ? { default: def } : {},
96284
+ moves: ["capacity"],
96285
+ options,
96286
+ lock: { adjustable: true, cost: "none" }
96287
+ };
96288
+ }
96289
+ var bandEffects = (liq, n) => {
96290
+ const maxLtv = num15(liq.bandLtv?.[String(n)]);
96291
+ const a = num15(liq.ammA);
96292
+ return {
96293
+ ...maxLtv != null ? { maxLtv } : {},
96294
+ ...a != null && a > 1 ? { rangeWidth: 1 - ((a - 1) / a) ** n } : {}
96295
+ };
96296
+ };
96297
+ function bandsForStance(curve, def, stance, ltv, lo = 4, hi = 50) {
96298
+ const fits = (n) => {
96299
+ if (ltv == null || !curve || !Object.keys(curve).length) return true;
96300
+ const max = num15(curve[String(n)]);
96301
+ return max != null && max >= ltv;
96302
+ };
96303
+ const domain = [];
96304
+ for (let n = lo; n <= hi; n++) if (fits(n)) domain.push(n);
96305
+ if (!domain.length) return lo;
96306
+ if (stance === "cheapest") return domain[0];
96307
+ if (stance === "protected") return domain[domain.length - 1];
96308
+ return domain.includes(def) ? def : domain[domain.length - 1];
96309
+ }
96310
+ function bandPresets(liq, def, lo, hi, ltv) {
96311
+ return STANCES.map((id) => {
96312
+ const n = bandsForStance(liq.bandLtv, def, id, ltv, lo, hi);
96313
+ return { id, value: n, effects: bandEffects(liq, n) };
96314
+ });
96315
+ }
96316
+ function parameterLadder(b) {
96317
+ const liq = b.liquidation;
96318
+ return Object.entries(liq.bandLtv ?? {}).map(([k, maxLtv]) => {
96319
+ const value = Number(k);
96320
+ return { value, maxLtv, ...bandEffects(liq, value) };
96321
+ }).sort((x, y) => x.value - y.value);
96322
+ }
96323
+ var rateEffects = (q, apr) => {
96324
+ const total = q.totalDebt;
96325
+ const assets = debtAheadOf(q.levels, apr);
96326
+ return {
96327
+ aprPct: apr,
96328
+ ...q.picks[0] ? { upfrontFeePct: q.picks[0].upfrontFeePct } : {},
96329
+ ahead: { assets, share: total > 0 ? assets / total : 0 },
96330
+ ...q.fill ? { capacity: fillCapacityAt(q.levels, q.fill.idle, apr) } : {}
96331
+ };
96332
+ };
96333
+ function resolveChoices(b, req, queue) {
96334
+ const size = Math.max(0, req.size ?? 0);
96335
+ const choices = (buildPositionChoices(b) ?? []).map((c) => ({ ...c }));
96336
+ const selected = {};
96337
+ const warnings = [];
96338
+ const outcome = {};
96339
+ for (const c of choices) {
96340
+ if (c.id === "rate" && queue) {
96341
+ const picks = resolveRatePicks(queue, size);
96342
+ const presets = picks.map((p) => ({
96343
+ id: p.id,
96344
+ value: p.apr,
96345
+ effects: rateEffectsAfterFill(p)
96346
+ }));
96347
+ c.presets = presets.length ? presets : void 0;
96348
+ if (queue.recommended) c.recommended = queue.recommended;
96349
+ c.pressure = queue.pressure;
96350
+ }
96351
+ if (c.id === "bands" && req.ltv != null && "min" in c.domain)
96352
+ c.presets = bandPresets(
96353
+ b.liquidation,
96354
+ Number(c.default),
96355
+ c.domain.min,
96356
+ c.domain.max,
96357
+ req.ltv
96358
+ );
96359
+ const value = req.selected?.[c.id] ?? (req.stance ? resolveStance(c, req.stance) : void 0) ?? c.presets?.find((p) => p.id === c.recommended)?.value ?? c.default;
96360
+ if (value == null) continue;
96361
+ selected[c.id] = value;
96362
+ const effects = c.id === "rate" && queue ? rateEffects(queue, Number(value)) : c.id === "bands" ? bandEffects(b.liquidation, Number(value)) : [...c.presets ?? [], ...c.options ?? []].find(
96363
+ (o) => o.value === value
96364
+ )?.effects ?? {};
96365
+ if (effects.aprPct != null) outcome.aprPct = effects.aprPct;
96366
+ if (effects.upfrontFeePct != null)
96367
+ outcome.upfrontFeePct = effects.upfrontFeePct;
96368
+ if (effects.ahead) outcome.ahead = effects.ahead;
96369
+ if (effects.rangeWidth != null) outcome.rangeWidth = effects.rangeWidth;
96370
+ if (effects.maxLtv != null)
96371
+ outcome.maxLtv = Math.min(outcome.maxLtv ?? 1, effects.maxLtv);
96372
+ if (effects.capacity != null)
96373
+ outcome.capacity = Math.min(
96374
+ outcome.capacity ?? Infinity,
96375
+ effects.capacity
96376
+ );
96377
+ if (effects.capacity != null && size > effects.capacity * (1 + 1e-9))
96378
+ warnings.push({ code: "EXCEEDS_CAPACITY", blocking: true, choice: c.id });
96379
+ if (req.ltv != null && effects.maxLtv != null && req.ltv > effects.maxLtv + 1e-9)
96380
+ warnings.push({ code: "LTV_ABOVE_MAX", blocking: true, choice: c.id });
96381
+ if (c.id === "rate" && effects.ahead?.assets === 0 && queue?.totalDebt)
96382
+ warnings.push({ code: "NOTHING_AHEAD", blocking: false, choice: c.id });
96383
+ }
96384
+ return { choices, selected, outcome, warnings };
96385
+ }
96386
+ var rateEffectsAfterFill = (p) => ({
96387
+ aprPct: p.apr,
96388
+ upfrontFeePct: p.upfrontFeePct,
96389
+ ahead: { assets: p.debtAhead, share: p.share },
96390
+ ...p.capacity != null ? { capacity: p.capacity } : {}
96391
+ });
96392
+ function resolveStance(c, stance) {
96393
+ const want = STANCES.indexOf(stance);
96394
+ for (let i = want; i >= 0; i--) {
96395
+ const p = c.presets?.find((x) => x.id === STANCES[i]);
96396
+ if (p) return p.value;
96397
+ }
96398
+ return c.presets?.[0]?.value ?? c.default;
96399
+ }
96400
+ function encodeChoiceValue(c, value) {
96401
+ switch (c.param.encoding) {
96402
+ case "wad-fraction":
96403
+ return (BigInt(Math.round(Number(value) * 1e6)) * 10n ** 10n).toString();
96404
+ case "fraction":
96405
+ return String(Number(value) / 100);
96406
+ default:
96407
+ return String(value);
96408
+ }
96409
+ }
96410
+ function digestChoices(choices) {
96411
+ if (!choices?.length) return void 0;
96412
+ return choices.map((c) => ({
96413
+ id: c.id,
96414
+ param: c.param,
96415
+ unit: c.unit,
96416
+ ...c.default != null ? { default: c.default } : {},
96417
+ ...c.recommended ? { recommended: c.recommended } : {},
96418
+ ...c.presets?.length ? { presets: c.presets.map((p) => ({ id: p.id, value: p.value })) } : {}
96419
+ }));
96420
+ }
96421
+
95243
96422
  // src/terms/tags.ts
95244
96423
  var push = (set, ...tags) => {
95245
96424
  for (const t of tags) set.add(t);
@@ -96871,7 +98050,8 @@ function rewardTerms(input, side2) {
96871
98050
  return out.length ? out : void 0;
96872
98051
  }
96873
98052
  function buildRate(input, side2) {
96874
- const kind = rateKindOf(input);
98053
+ const rowKind = rateKindOf(input);
98054
+ const kind = side2 === "supply" && rowKind === "user-set" ? "variable-curve" : rowKind;
96875
98055
  const rewards = rewardTerms(input, side2);
96876
98056
  const priceableRewards = (rewards ?? []).filter((r) => !r.indicative).reduce((s, r) => s + r.apr, 0);
96877
98057
  const menuBest = input.terms?.length ? Math.min(...input.terms.map((t) => t.apr)) : void 0;
@@ -97048,7 +98228,8 @@ function buildAvailability(input, side2) {
97048
98228
  const total = side2 === "supply" ? input.totalDeposits : input.totalDebt;
97049
98229
  const capUtilization = capUtil(total, cap);
97050
98230
  const capFull = capUtilization != null && capUtilization >= 1;
97051
- const noLiquidity = side2 === "borrow" && isNum(input.borrowLiquidity) && input.borrowLiquidity <= 0;
98231
+ const queuePicks = input.market?.flex?.queue?.picks;
98232
+ const noLiquidity = side2 === "borrow" && isNum(input.borrowLiquidity) && input.borrowLiquidity <= 0 && !queuePicks?.some((p) => (p.capacity ?? 0) > 0);
97052
98233
  const canOpen = enabled && !frozen && !inactive && !capFull && !noLiquidity;
97053
98234
  let blockedBy;
97054
98235
  if (!canOpen) {
@@ -97328,6 +98509,9 @@ function finalizeInfo(sheet) {
97328
98509
  implications: sheet.borrow.info.implications,
97329
98510
  tags: deriveBorrowTags(sheet.borrow, market)
97330
98511
  };
98512
+ const choices = buildPositionChoices(sheet.borrow);
98513
+ if (choices) sheet.borrow.choices = choices;
98514
+ else delete sheet.borrow.choices;
97331
98515
  }
97332
98516
  return sheet;
97333
98517
  }
@@ -98811,7 +99995,7 @@ function resolveEarnIdentity(venue, brand, publishedProtocol) {
98811
99995
  }
98812
99996
  return { protocol: { key: key5, name: protocolName }, curator: { name } };
98813
99997
  }
98814
- function num15(v) {
99998
+ function num16(v) {
98815
99999
  if (v == null || v === "") return void 0;
98816
100000
  const n = typeof v === "number" ? v : Number(v);
98817
100001
  return Number.isFinite(n) ? n : void 0;
@@ -98911,8 +100095,8 @@ function resolveExitMode2(provider, meta, tvl, liq) {
98911
100095
  if (declared) return declared;
98912
100096
  const fallback = vaultTraits(provider)?.defaultExitMode ?? "instant";
98913
100097
  if (fallback !== "instant-capped") return fallback;
98914
- const total = num15(tvl?.totalAssetsFormatted) ?? num15(tvl?.totalAssetsUsd);
98915
- const available = num15(liq?.liquidityFormatted) ?? num15(liq?.liquidityUsd);
100098
+ const total = num16(tvl?.totalAssetsFormatted) ?? num16(tvl?.totalAssetsUsd);
100099
+ const available = num16(liq?.liquidityFormatted) ?? num16(liq?.liquidityUsd);
98916
100100
  if (total === void 0 || available === void 0) return "instant-capped";
98917
100101
  if (total <= 0) return "instant";
98918
100102
  return available >= total ? "instant" : "instant-capped";
@@ -98950,8 +100134,8 @@ function earnMarketFromVault(row, chainId, opts = {}) {
98950
100134
  const rates = row.rates ?? {};
98951
100135
  const tvl = row.tvl ?? {};
98952
100136
  const liq = row.liquidity ?? {};
98953
- const shareDecimals = num15(row.decimals) ?? 18;
98954
- const assetDecimals = num15(row.assetDecimals) ?? num15(row.underlyingInfo?.asset?.decimals) ?? shareDecimals;
100137
+ const shareDecimals = num16(row.decimals) ?? 18;
100138
+ const assetDecimals = num16(row.assetDecimals) ?? num16(row.underlyingInfo?.asset?.decimals) ?? shareDecimals;
98955
100139
  const rateUnavailable = isRateSourceUnavailable(str6(meta.rateSource));
98956
100140
  const toPercent2 = (v) => rateUnavailable ? void 0 : ratePercent(v, provider, opts.fractionRateProviders);
98957
100141
  const rewards = toPercent2(rates.rewardsRate);
@@ -99041,7 +100225,7 @@ function earnMarketFromVault(row, chainId, opts = {}) {
99041
100225
  symbol: str6(row.underlyingInfo?.asset?.symbol) ?? "",
99042
100226
  decimals: assetDecimals,
99043
100227
  assetGroup: str6(info.assetGroup),
99044
- priceUsd: num15(row.underlyingInfo?.prices?.priceUsd)
100228
+ priceUsd: num16(row.underlyingInfo?.prices?.priceUsd)
99045
100229
  },
99046
100230
  // The vault IS a share token by construction; carry it so a withdraw in
99047
100231
  // share units can be built without a second lookup.
@@ -99071,8 +100255,8 @@ function earnMarketFromVault(row, chainId, opts = {}) {
99071
100255
  exit: {
99072
100256
  mode: exitMode,
99073
100257
  settlement: str6(meta.redemptionType),
99074
- cooldownSecs: num15(meta.withdrawalCooldownSeconds),
99075
- feeBps: num15(meta.withdrawFeeBps),
100258
+ cooldownSecs: num16(meta.withdrawalCooldownSeconds),
100259
+ feeBps: num16(meta.withdrawFeeBps),
99076
100260
  // Passed through, never re-derived: the earn row and the vault row must
99077
100261
  // not disagree about what the legs out are.
99078
100262
  routes: Array.isArray(meta.exitRoutes) ? meta.exitRoutes : void 0
@@ -99085,12 +100269,12 @@ function earnMarketFromVault(row, chainId, opts = {}) {
99085
100269
  // since the surface was written and never populated — a tranche's
99086
100270
  // first-loss position is the term most worth surfacing on a rate list.
99087
100271
  counterparty: str6(meta.solvency),
99088
- score: num15(row.rating?.score),
100272
+ score: num16(row.rating?.score),
99089
100273
  label: str6(row.rating?.level),
99090
100274
  illiquid: isIlliquid({
99091
100275
  exitMode,
99092
- tvlUsd: num15(tvl.totalAssetsUsd),
99093
- liquidityUsd: num15(liq.liquidityUsd)
100276
+ tvlUsd: num16(tvl.totalAssetsUsd),
100277
+ liquidityUsd: num16(liq.liquidityUsd)
99094
100278
  })
99095
100279
  },
99096
100280
  // Filled by `capabilities.ts` — kept required on the type so a normalizer
@@ -99102,7 +100286,7 @@ function earnMarketFromVault(row, chainId, opts = {}) {
99102
100286
  return market;
99103
100287
  }
99104
100288
  function ratePercent(value, provider, fractionProviders = FRACTION_RATE_PROVIDERS) {
99105
- const n = num15(value);
100289
+ const n = num16(value);
99106
100290
  if (n === void 0) return void 0;
99107
100291
  return fractionProviders.has(provider) ? n * 100 : n;
99108
100292
  }
@@ -99111,7 +100295,7 @@ function implausibleRatePercent(percent) {
99111
100295
  }
99112
100296
  function resolveRateKind(provider, meta) {
99113
100297
  if (meta.navOracle || meta.solvency === "nav-attested") return "nav-accrual";
99114
- if (meta.rateBasis === "entry-discount" && ((num15(meta.termSeconds) ?? 0) > 0 || (num15(meta.expiry) ?? 0) > 0))
100298
+ if (meta.rateBasis === "entry-discount" && ((num16(meta.termSeconds) ?? 0) > 0 || (num16(meta.expiry) ?? 0) > 0))
99115
100299
  return "fixed-term";
99116
100300
  return RATE_KIND[provider] ?? "variable-managed";
99117
100301
  }
@@ -99164,9 +100348,9 @@ function vaultDisplayName(row, info) {
99164
100348
  return str6(row.name) ?? str6(info.name) ?? str6(row.displayName) ?? str6(share?.name) ?? str6(share?.symbol) ?? str6(info.symbol) ?? str6(row.symbol);
99165
100349
  }
99166
100350
  function resolveMaturity(meta) {
99167
- const expiry = num15(meta.expiry) ?? num15(meta.maturity);
100351
+ const expiry = num16(meta.expiry) ?? num16(meta.maturity);
99168
100352
  if (expiry === void 0 || expiry <= 0) {
99169
- const term = num15(meta.termSeconds);
100353
+ const term = num16(meta.termSeconds);
99170
100354
  if (term !== void 0 && term > 0)
99171
100355
  return {
99172
100356
  kind: "rolling-duration",
@@ -99214,8 +100398,8 @@ function amount3(raw, formatted, usd, decimals) {
99214
100398
  const rawStr = raw != null ? String(raw) : void 0;
99215
100399
  return {
99216
100400
  raw: rawStr,
99217
- formatted: num15(formatted) ?? formatRaw(rawStr, decimals),
99218
- usd: num15(usd)
100401
+ formatted: num16(formatted) ?? formatRaw(rawStr, decimals),
100402
+ usd: num16(usd)
99219
100403
  };
99220
100404
  }
99221
100405
  function withCuratorEntity(id, entity) {
@@ -99262,7 +100446,7 @@ function managedVaultCuration(provider, chainId, address) {
99262
100446
  }
99263
100447
 
99264
100448
  // src/terms/vault/input.ts
99265
- var num16 = (v) => {
100449
+ var num17 = (v) => {
99266
100450
  if (typeof v === "number") return Number.isFinite(v) ? v : void 0;
99267
100451
  if (typeof v === "string" && v.trim() !== "") {
99268
100452
  const n = Number(v);
@@ -99293,13 +100477,13 @@ var fromRaw = (raw, decimals) => {
99293
100477
  function sdkRates(row, provider) {
99294
100478
  if (!SDK_FRACTION_RATE_PROVIDERS.has(provider)) {
99295
100479
  return {
99296
- supplyRate: num16(row.supplyRate),
99297
- rewardsRate: num16(row.rewardsRate),
99298
- totalRate: num16(row.depositRate)
100480
+ supplyRate: num17(row.supplyRate),
100481
+ rewardsRate: num17(row.rewardsRate),
100482
+ totalRate: num17(row.depositRate)
99299
100483
  };
99300
100484
  }
99301
100485
  const pct5 = (v) => {
99302
- const n = num16(v);
100486
+ const n = num17(v);
99303
100487
  return n === void 0 ? void 0 : n * 100;
99304
100488
  };
99305
100489
  return {
@@ -99313,7 +100497,7 @@ function toVaultTermInput(vault, provider, chainId) {
99313
100497
  const row = vault;
99314
100498
  const address = str7(row.address)?.toLowerCase();
99315
100499
  if (!address) return void 0;
99316
- const assetDecimals = num16(row.assetDecimals) ?? num16(row.decimals);
100500
+ const assetDecimals = num17(row.assetDecimals) ?? num17(row.decimals);
99317
100501
  const asset = row.asset;
99318
100502
  return {
99319
100503
  provider,
@@ -99339,25 +100523,25 @@ function toVaultTermInput(vault, provider, chainId) {
99339
100523
  // GMX / HyperCore / Pendle report USD only and set the token-denominated
99340
100524
  // fields to their USD figure — `totalAssetsFormatted` is the cross-provider
99341
100525
  // magnitude either way, so prefer it over re-deriving from raw.
99342
- totalAssets: num16(row.totalAssetsFormatted) ?? fromRaw(row.totalAssets, assetDecimals),
99343
- totalAssetsUsd: num16(row.totalAssetsUsd) ?? num16(row.tvlUsd),
99344
- liquidity: num16(row.liquidityFormatted) ?? fromRaw(row.liquidity, assetDecimals),
99345
- liquidityUsd: num16(row.liquidityUsd),
99346
- instantLiquidityRatio: num16(row.instantLiquidityRatio),
100526
+ totalAssets: num17(row.totalAssetsFormatted) ?? fromRaw(row.totalAssets, assetDecimals),
100527
+ totalAssetsUsd: num17(row.totalAssetsUsd) ?? num17(row.tvlUsd),
100528
+ liquidity: num17(row.liquidityFormatted) ?? fromRaw(row.liquidity, assetDecimals),
100529
+ liquidityUsd: num17(row.liquidityUsd),
100530
+ instantLiquidityRatio: num17(row.instantLiquidityRatio),
99347
100531
  totalBorrowed: fromRaw(row.totalBorrowed, assetDecimals),
99348
100532
  expectedLiquidity: fromRaw(row.expectedLiquidity, assetDecimals),
99349
100533
  withdrawalMode: str7(row.withdrawalMode),
99350
- withdrawalCooldownSeconds: num16(row.withdrawalCooldownSeconds),
99351
- withdrawFeeBps: num16(row.withdrawFeeBps),
99352
- depositFeeBps: num16(row.depositFeeBps),
100534
+ withdrawalCooldownSeconds: num17(row.withdrawalCooldownSeconds),
100535
+ withdrawFeeBps: num17(row.withdrawFeeBps),
100536
+ depositFeeBps: num17(row.depositFeeBps),
99353
100537
  feeScheduleComplete: bool5(row.feeScheduleComplete),
99354
100538
  exitRoutes: routes(row.exitRoutes),
99355
- fee: num16(row.fee),
99356
- managementFee: num16(row.managementFee),
99357
- swapFeeRate: num16(row.feeRate),
99358
- redemptionDiscountBps: num16(row.redemptionDiscountBps),
100539
+ fee: num17(row.fee),
100540
+ managementFee: num17(row.managementFee),
100541
+ swapFeeRate: num17(row.feeRate),
100542
+ redemptionDiscountBps: num17(row.redemptionDiscountBps),
99359
100543
  instantRedeemEnabled: bool5(row.instantRedeemEnabled),
99360
- yieldWarmupSeconds: num16(row.yieldWarmupSeconds),
100544
+ yieldWarmupSeconds: num17(row.yieldWarmupSeconds),
99361
100545
  accrual: str7(row.accrual),
99362
100546
  needsDepositApproval: bool5(row.needsDepositApproval),
99363
100547
  isMintable: bool5(row.isMintable),
@@ -99368,10 +100552,10 @@ function toVaultTermInput(vault, provider, chainId) {
99368
100552
  withdrawalsPaused: bool5(row.isWithdrawalPaused),
99369
100553
  isClosed: bool5(row.isClosed),
99370
100554
  whitelisted: bool5(row.whitelisted),
99371
- expiry: num16(row.expiry),
99372
- termSeconds: num16(row.termSeconds),
100555
+ expiry: num17(row.expiry),
100556
+ termSeconds: num17(row.termSeconds),
99373
100557
  rateBasis: str7(row.rateBasis),
99374
- timelock: num16(row.timelock),
100558
+ timelock: num17(row.timelock),
99375
100559
  allocators: strArray(row.allocators),
99376
100560
  owner: str7(row.owner),
99377
100561
  curator: str7(row.curator),
@@ -99448,19 +100632,19 @@ function vaultTermInputFromEarnMarket(m) {
99448
100632
  totalAssetsUsd: m.tvl.usd,
99449
100633
  liquidity: m.liquidity?.formatted,
99450
100634
  liquidityUsd: m.liquidity?.usd,
99451
- instantLiquidityRatio: num16(meta.instantLiquidityRatio),
99452
- totalBorrowed: num16(meta.totalBorrowed),
99453
- expectedLiquidity: num16(meta.expectedLiquidity),
100635
+ instantLiquidityRatio: num17(meta.instantLiquidityRatio),
100636
+ totalBorrowed: num17(meta.totalBorrowed),
100637
+ expectedLiquidity: num17(meta.expectedLiquidity),
99454
100638
  withdrawalMode: m.exit.mode,
99455
100639
  withdrawalCooldownSeconds: m.exit.cooldownSecs,
99456
100640
  withdrawFeeBps: m.exit.feeBps,
99457
100641
  exitRoutes: routes(m.exit.routes),
99458
100642
  fee: m.rate.fee,
99459
- managementFee: num16(meta.managementFee),
99460
- swapFeeRate: num16(meta.feeRate),
99461
- redemptionDiscountBps: num16(meta.redemptionDiscountBps),
100643
+ managementFee: num17(meta.managementFee),
100644
+ swapFeeRate: num17(meta.feeRate),
100645
+ redemptionDiscountBps: num17(meta.redemptionDiscountBps),
99462
100646
  instantRedeemEnabled: bool5(meta.instantRedeemEnabled),
99463
- yieldWarmupSeconds: num16(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
100647
+ yieldWarmupSeconds: num17(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
99464
100648
  accrual: str7(meta.accrual) ?? curated.accrual,
99465
100649
  needsDepositApproval: bool5(meta.needsDepositApproval) ?? curated.needsDepositApproval,
99466
100650
  // `canDeposit` already folds in the cap, the pause and the gate, so it is
@@ -99474,9 +100658,9 @@ function vaultTermInputFromEarnMarket(m) {
99474
100658
  isClosed: bool5(meta.isClosed),
99475
100659
  whitelisted: bool5(meta.whitelisted),
99476
100660
  expiry: m.maturity?.maturity ?? curated.expiry,
99477
- termSeconds: (m.maturity?.kind === "rolling-duration" ? m.maturity.maxDurationSecs : void 0) ?? num16(meta.termSeconds) ?? curated.termSeconds,
100661
+ termSeconds: (m.maturity?.kind === "rolling-duration" ? m.maturity.maxDurationSecs : void 0) ?? num17(meta.termSeconds) ?? curated.termSeconds,
99478
100662
  rateBasis: str7(meta.rateBasis) ?? curated.rateBasis,
99479
- timelock: num16(meta.timelock),
100663
+ timelock: num17(meta.timelock),
99480
100664
  allocators: strArray(meta.allocators),
99481
100665
  owner: str7(meta.owner),
99482
100666
  curator: str7(meta.curator),
@@ -99489,13 +100673,13 @@ function vaultTermInputFromEarnMarket(m) {
99489
100673
  };
99490
100674
  }
99491
100675
  function originRates(rates) {
99492
- const supply = num16(rates.supplyRate);
99493
- const rewards = num16(rates.rewardsRate);
99494
- const deposit = num16(rates.depositRate);
100676
+ const supply = num17(rates.supplyRate);
100677
+ const rewards = num17(rates.rewardsRate);
100678
+ const deposit = num17(rates.depositRate);
99495
100679
  return {
99496
100680
  supplyRate: supply ?? (deposit !== void 0 && rewards !== void 0 ? deposit - rewards : deposit),
99497
100681
  rewardsRate: rewards,
99498
- totalRate: num16(rates.totalRate) ?? deposit
100682
+ totalRate: num17(rates.totalRate) ?? deposit
99499
100683
  };
99500
100684
  }
99501
100685
  function vaultTermInputFromSourceRow(row, chainId) {
@@ -99508,7 +100692,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
99508
100692
  const liq = row.liquidity ?? {};
99509
100693
  const info = row.vaultInfo ?? {};
99510
100694
  const assetInfo = row.underlyingInfo?.asset;
99511
- const assetDecimals = num16(row.assetDecimals) ?? num16(assetInfo?.decimals) ?? num16(row.decimals);
100695
+ const assetDecimals = num17(row.assetDecimals) ?? num17(assetInfo?.decimals) ?? num17(row.decimals);
99512
100696
  const curated = savingsCuration(provider, chainId, address, {
99513
100697
  brand: str7(row.curatorName) ?? str7(meta.brand),
99514
100698
  name: str7(info.name) ?? str7(row.displayName) ?? str7(row.name)
@@ -99533,23 +100717,23 @@ function vaultTermInputFromSourceRow(row, chainId) {
99533
100717
  ...originRates(rates),
99534
100718
  isForwardApr: bool5(meta.isForwardApr),
99535
100719
  aprWindow: str7(meta.aprWindow),
99536
- totalAssets: num16(tvl.totalAssetsFormatted) ?? fromRaw(tvl.totalAssets, assetDecimals),
99537
- totalAssetsUsd: num16(tvl.totalAssetsUsd),
99538
- liquidity: num16(liq.liquidityFormatted) ?? fromRaw(liq.liquidity, assetDecimals),
99539
- liquidityUsd: num16(liq.liquidityUsd),
99540
- instantLiquidityRatio: num16(meta.instantLiquidityRatio),
100720
+ totalAssets: num17(tvl.totalAssetsFormatted) ?? fromRaw(tvl.totalAssets, assetDecimals),
100721
+ totalAssetsUsd: num17(tvl.totalAssetsUsd),
100722
+ liquidity: num17(liq.liquidityFormatted) ?? fromRaw(liq.liquidity, assetDecimals),
100723
+ liquidityUsd: num17(liq.liquidityUsd),
100724
+ instantLiquidityRatio: num17(meta.instantLiquidityRatio),
99541
100725
  totalBorrowed: fromRaw(meta.totalBorrowed, assetDecimals),
99542
100726
  expectedLiquidity: fromRaw(meta.expectedLiquidity, assetDecimals),
99543
100727
  withdrawalMode: str7(meta.withdrawalMode),
99544
- withdrawalCooldownSeconds: num16(meta.withdrawalCooldownSeconds),
99545
- withdrawFeeBps: num16(meta.withdrawFeeBps),
100728
+ withdrawalCooldownSeconds: num17(meta.withdrawalCooldownSeconds),
100729
+ withdrawFeeBps: num17(meta.withdrawFeeBps),
99546
100730
  exitRoutes: routes(meta.exitRoutes),
99547
- fee: num16(rates.fee),
99548
- managementFee: num16(meta.managementFee),
99549
- swapFeeRate: num16(meta.feeRate),
99550
- redemptionDiscountBps: num16(meta.redemptionDiscountBps),
100731
+ fee: num17(rates.fee),
100732
+ managementFee: num17(meta.managementFee),
100733
+ swapFeeRate: num17(meta.feeRate),
100734
+ redemptionDiscountBps: num17(meta.redemptionDiscountBps),
99551
100735
  instantRedeemEnabled: bool5(meta.instantRedeemEnabled),
99552
- yieldWarmupSeconds: num16(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
100736
+ yieldWarmupSeconds: num17(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
99553
100737
  accrual: str7(meta.accrual) ?? curated.accrual,
99554
100738
  needsDepositApproval: bool5(meta.needsDepositApproval) ?? curated.needsDepositApproval,
99555
100739
  isMintable: bool5(meta.isMintable),
@@ -99560,10 +100744,10 @@ function vaultTermInputFromSourceRow(row, chainId) {
99560
100744
  withdrawalsPaused: bool5(meta.isWithdrawalPaused),
99561
100745
  isClosed: bool5(meta.isClosed),
99562
100746
  whitelisted: bool5(meta.whitelisted),
99563
- expiry: num16(meta.expiry) ?? num16(meta.maturity) ?? curated.expiry,
99564
- termSeconds: num16(meta.termSeconds) ?? curated.termSeconds,
100747
+ expiry: num17(meta.expiry) ?? num17(meta.maturity) ?? curated.expiry,
100748
+ termSeconds: num17(meta.termSeconds) ?? curated.termSeconds,
99565
100749
  rateBasis: str7(meta.rateBasis) ?? curated.rateBasis,
99566
- timelock: num16(meta.timelock),
100750
+ timelock: num17(meta.timelock),
99567
100751
  allocators: strArray(meta.allocators),
99568
100752
  owner: str7(meta.owner),
99569
100753
  curator: str7(meta.curator),
@@ -100390,7 +101574,7 @@ async function fetchTokenBalances(chainId, account, tokens, options = {}) {
100390
101574
  }
100391
101575
 
100392
101576
  // src/terms/input.ts
100393
- var num17 = (v) => {
101577
+ var num18 = (v) => {
100394
101578
  if (v == null) return void 0;
100395
101579
  const n = typeof v === "string" ? Number(v) : v;
100396
101580
  return Number.isFinite(n) ? n : void 0;
@@ -100421,20 +101605,20 @@ function toTermSheetInput(row, ctx = {}) {
100421
101605
  {
100422
101606
  category: v?.category ?? k,
100423
101607
  label: v?.label,
100424
- borrowCollateralFactor: num17(v?.borrowCollateralFactor),
100425
- collateralFactor: num17(v?.collateralFactor),
100426
- borrowFactor: num17(v?.borrowFactor),
100427
- liquidationPenalty: num17(v?.liquidationPenalty),
100428
- closeFactor: num17(v?.closeFactor),
100429
- targetHealthFactor: num17(v?.targetHealthFactor),
101608
+ borrowCollateralFactor: num18(v?.borrowCollateralFactor),
101609
+ collateralFactor: num18(v?.collateralFactor),
101610
+ borrowFactor: num18(v?.borrowFactor),
101611
+ liquidationPenalty: num18(v?.liquidationPenalty),
101612
+ closeFactor: num18(v?.closeFactor),
101613
+ targetHealthFactor: num18(v?.targetHealthFactor),
100430
101614
  collateralDisabled: v?.collateralDisabled === true,
100431
101615
  debtDisabled: v?.debtDisabled === true,
100432
101616
  // the mode-level position fields (UNIFIED_API_AUDIT §11) — set
100433
101617
  // only where the row carries them, so EVM inputs are unchanged
100434
- ...v?.liquidationBorrowFactor != null ? { liquidationBorrowFactor: num17(v.liquidationBorrowFactor) } : {},
100435
- ...v?.debtCapacity != null ? { debtCapacity: num17(v.debtCapacity) } : {},
100436
- ...v?.collateralDebtCapacity != null ? { collateralDebtCapacity: num17(v.collateralDebtCapacity) } : {},
100437
- ...v?.maxCollateralAssets != null ? { maxCollateralAssets: num17(v.maxCollateralAssets) } : {},
101618
+ ...v?.liquidationBorrowFactor != null ? { liquidationBorrowFactor: num18(v.liquidationBorrowFactor) } : {},
101619
+ ...v?.debtCapacity != null ? { debtCapacity: num18(v.debtCapacity) } : {},
101620
+ ...v?.collateralDebtCapacity != null ? { collateralDebtCapacity: num18(v.collateralDebtCapacity) } : {},
101621
+ ...v?.maxCollateralAssets != null ? { maxCollateralAssets: num18(v.maxCollateralAssets) } : {},
100438
101622
  ...v?.exclusiveCollateral != null ? { exclusiveCollateral: v.exclusiveCollateral === true } : {},
100439
101623
  ...v?.openParameter ? { openParameter: v.openParameter } : {}
100440
101624
  }
@@ -100442,11 +101626,11 @@ function toTermSheetInput(row, ctx = {}) {
100442
101626
  ) : void 0;
100443
101627
  const rewards = pick2(row, "rewards")?.map((r) => ({
100444
101628
  asset: r?.asset,
100445
- depositRate: num17(r?.depositRate),
100446
- variableBorrowRate: num17(r?.variableBorrowRate),
100447
- stableBorrowRate: num17(r?.stableBorrowRate),
101629
+ depositRate: num18(r?.depositRate),
101630
+ variableBorrowRate: num18(r?.variableBorrowRate),
101631
+ stableBorrowRate: num18(r?.stableBorrowRate),
100448
101632
  kind: r?.kind,
100449
- endsAt: num17(r?.endsAt),
101633
+ endsAt: num18(r?.endsAt),
100450
101634
  claim: r?.claim
100451
101635
  }));
100452
101636
  return {
@@ -100460,29 +101644,29 @@ function toTermSheetInput(row, ctx = {}) {
100460
101644
  (v) => !!v && typeof v === "object"
100461
101645
  ),
100462
101646
  underlying: pick2(row, "underlying"),
100463
- decimals: num17(pick2(row, "decimals")),
100464
- depositRate: num17(pick2(row, "depositRate")),
100465
- variableBorrowRate: num17(pick2(row, "variableBorrowRate")),
100466
- stableBorrowRate: num17(pick2(row, "stableBorrowRate")),
100467
- intrinsicYield: num17(pick2(row, "intrinsicYield")),
101647
+ decimals: num18(pick2(row, "decimals")),
101648
+ depositRate: num18(pick2(row, "depositRate")),
101649
+ variableBorrowRate: num18(pick2(row, "variableBorrowRate")),
101650
+ stableBorrowRate: num18(pick2(row, "stableBorrowRate")),
101651
+ intrinsicYield: num18(pick2(row, "intrinsicYield")),
100468
101652
  rewards,
100469
101653
  rateModel: pick2(row, "rateModel"),
100470
- originationFee: num17(pick2(row, "originationFee")),
100471
- totalDeposits: num17(pick2(row, "totalDeposits")),
100472
- totalDebt: num17(pick2(row, "totalDebt")),
100473
- totalDebtStable: num17(pick2(row, "totalDebtStable")),
100474
- totalLiquidity: num17(pick2(row, "totalLiquidity")),
100475
- borrowLiquidity: num17(pick2(row, "borrowLiquidity")),
100476
- totalDepositsUsd: num17(pick2(row, "totalDepositsUSD", "totalDepositsUsd")),
100477
- totalDebtUsd: num17(pick2(row, "totalDebtUSD", "totalDebtUsd")),
100478
- totalLiquidityUsd: num17(pick2(row, "totalLiquidityUSD", "totalLiquidityUsd")),
100479
- utilization: num17(pick2(row, "utilization")),
100480
- irmTotalDeposits: num17(pick2(row, "irmTotalDeposits")),
100481
- irmTotalDebt: num17(pick2(row, "irmTotalDebt")),
100482
- lockupRatio: num17(pick2(row, "lockupRatio")),
101654
+ originationFee: num18(pick2(row, "originationFee")),
101655
+ totalDeposits: num18(pick2(row, "totalDeposits")),
101656
+ totalDebt: num18(pick2(row, "totalDebt")),
101657
+ totalDebtStable: num18(pick2(row, "totalDebtStable")),
101658
+ totalLiquidity: num18(pick2(row, "totalLiquidity")),
101659
+ borrowLiquidity: num18(pick2(row, "borrowLiquidity")),
101660
+ totalDepositsUsd: num18(pick2(row, "totalDepositsUSD", "totalDepositsUsd")),
101661
+ totalDebtUsd: num18(pick2(row, "totalDebtUSD", "totalDebtUsd")),
101662
+ totalLiquidityUsd: num18(pick2(row, "totalLiquidityUSD", "totalLiquidityUsd")),
101663
+ utilization: num18(pick2(row, "utilization")),
101664
+ irmTotalDeposits: num18(pick2(row, "irmTotalDeposits")),
101665
+ irmTotalDebt: num18(pick2(row, "irmTotalDebt")),
101666
+ lockupRatio: num18(pick2(row, "lockupRatio")),
100483
101667
  minBorrow: pick2(row, "minBorrow", "caps.minBorrow") ?? void 0,
100484
- supplyCap: num17(pick2(row, "supplyCap", "caps.supplyCap")),
100485
- borrowCap: num17(pick2(row, "borrowCap", "caps.borrowCap")),
101668
+ supplyCap: num18(pick2(row, "supplyCap", "caps.supplyCap")),
101669
+ borrowCap: num18(pick2(row, "borrowCap", "caps.borrowCap")),
100486
101670
  debtCeiling: pick2(row, "debtCeiling", "caps.debtCeiling"),
100487
101671
  isActive: pick2(row, "isActive", "flags.isActive"),
100488
101672
  isFrozen: pick2(row, "isFrozen", "flags.isFrozen"),
@@ -100519,8 +101703,8 @@ function toTermSheetInput(row, ctx = {}) {
100519
101703
  // builder's `?? 1`, so Aave and Compound V2 published "the whole debt can
100520
101704
  // be repaid in one liquidation" against a real close factor of 0.5, and
100521
101705
  // Aave V4's `targetHealthFactor` vanished entirely.
100522
- closeFactor: num17(pick2(row, "closeFactor", "caps.closeFactor")),
100523
- targetHealthFactor: num17(
101706
+ closeFactor: num18(pick2(row, "closeFactor", "caps.closeFactor")),
101707
+ targetHealthFactor: num18(
100524
101708
  pick2(row, "targetHealthFactor", "caps.targetHealthFactor")
100525
101709
  ),
100526
101710
  fixedTerm: pick2(row, "fixedTerm") ?? ctx.fixedTerm,
@@ -101681,7 +102865,7 @@ var ripeAdapter = {
101681
102865
  };
101682
102866
  }
101683
102867
  };
101684
- var num18 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
102868
+ var num19 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
101685
102869
  var alchemixAdapter = {
101686
102870
  id: "alchemix",
101687
102871
  matches: isAlchemix,
@@ -101689,8 +102873,8 @@ var alchemixAdapter = {
101689
102873
  build: (input) => {
101690
102874
  const a = input.market?.alchemix ?? {};
101691
102875
  const isCollateralRow = input.collateralActive !== false;
101692
- const protocolFeeBps = num18(a.protocolFeeBps);
101693
- const liquidatorFeeBps = num18(a.liquidatorFeeBps);
102876
+ const protocolFeeBps = num19(a.protocolFeeBps);
102877
+ const liquidatorFeeBps = num19(a.liquidatorFeeBps);
101694
102878
  const fees2 = [];
101695
102879
  if (protocolFeeBps != null)
101696
102880
  fees2.push({
@@ -101730,7 +102914,7 @@ var alchemixAdapter = {
101730
102914
  if (cap > 0) capUtilization = Math.min(1, Number(a.totalDeposited) / cap);
101731
102915
  }
101732
102916
  const capFull = capUtilization != null && capUtilization >= 1;
101733
- const termSecs = num18(a.transmuterQueue?.termSeconds);
102917
+ const termSecs = num19(a.transmuterQueue?.termSeconds);
101734
102918
  return {
101735
102919
  oracle: {
101736
102920
  // Not a market price feed: collateral is valued at the MYT's OWN share
@@ -101823,9 +103007,9 @@ var alchemixAdapter = {
101823
103007
  alchemix: {
101824
103008
  debtValuation: "face",
101825
103009
  redemptionFeeBps: protocolFeeBps,
101826
- redemptionRatePerYear: num18(a.redemptionRatePerYear),
103010
+ redemptionRatePerYear: num19(a.redemptionRatePerYear),
101827
103011
  transmuterTermSecs: termSecs,
101828
- transmuterTermBlocks: num18(a.transmuterQueue?.termBlocks)
103012
+ transmuterTermBlocks: num19(a.transmuterQueue?.termBlocks)
101829
103013
  }
101830
103014
  }
101831
103015
  },
@@ -101842,7 +103026,7 @@ var alchemixAdapter = {
101842
103026
  };
101843
103027
  }
101844
103028
  };
101845
- var num19 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
103029
+ var num20 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
101846
103030
  var flexAdapter = {
101847
103031
  id: "flex",
101848
103032
  matches: isFlex,
@@ -101850,18 +103034,18 @@ var flexAdapter = {
101850
103034
  build: (input) => {
101851
103035
  const f = input.market?.flex ?? {};
101852
103036
  const isCollateralRow = input.collateralActive !== false;
101853
- const minApr = num19(f.minAnnualInterestRate) != null ? f.minAnnualInterestRate * 100 : void 0;
101854
- const maxApr = num19(f.maxAnnualInterestRate) != null ? f.maxAnnualInterestRate * 100 : void 0;
101855
- const minFee = num19(f.minLiquidationFee);
101856
- const maxFee = num19(f.maxLiquidationFee);
101857
- const repayCooldown = num19(f.repayCooldown);
103037
+ const minApr = num20(f.minAnnualInterestRate) != null ? f.minAnnualInterestRate * 100 : void 0;
103038
+ const maxApr = num20(f.maxAnnualInterestRate) != null ? f.maxAnnualInterestRate * 100 : void 0;
103039
+ const minFee = num20(f.minLiquidationFee);
103040
+ const maxFee = num20(f.maxLiquidationFee);
103041
+ const repayCooldown = num20(f.repayCooldown);
101858
103042
  const decimals = input.asset?.decimals ?? input.decimals;
101859
- const minDebt = num19(f.minDebt) != null && decimals != null ? parseUnits(String(f.minDebt), decimals).toString() : void 0;
101860
- const perfFeeBps = num19(f.performanceFeeBps);
101861
- const idle = num19(f.idleLiquidity);
103043
+ const minDebt = num20(f.minDebt) != null && decimals != null ? parseUnits(String(f.minDebt), decimals).toString() : void 0;
103044
+ const perfFeeBps = num20(f.performanceFeeBps);
103045
+ const idle = num20(f.idleLiquidity);
101862
103046
  const borrowFees = [];
101863
- const upfrontPct = num19(input.originationFee) ?? (num19(f.averageInterestRate) != null && num19(f.upfrontInterestPeriod) ? f.averageInterestRate * (f.upfrontInterestPeriod / 31536e3) * 100 : void 0);
101864
- if (upfrontPct != null && num19(f.upfrontInterestPeriod))
103047
+ const upfrontPct = num20(input.originationFee) ?? (num20(f.averageInterestRate) != null && num20(f.upfrontInterestPeriod) ? f.averageInterestRate * (f.upfrontInterestPeriod / 31536e3) * 100 : void 0);
103048
+ if (upfrontPct != null && num20(f.upfrontInterestPeriod))
101865
103049
  borrowFees.push({
101866
103050
  id: "origination",
101867
103051
  label: "Upfront fee",
@@ -101924,7 +103108,7 @@ var flexAdapter = {
101924
103108
  default: input.variableBorrowRate,
101925
103109
  adjustable: true,
101926
103110
  adjustmentCostNote: "Changing the rate again within the adjustment cooldown re-charges the upfront fee.",
101927
- adjustmentCooldownSecs: num19(f.interestRateAdjCooldown),
103111
+ adjustmentCooldownSecs: num20(f.interestRateAdjCooldown),
101928
103112
  ...queueUserSetFields(f.queue)
101929
103113
  }
101930
103114
  },
@@ -102123,6 +103307,7 @@ var llamaLendAdapter = {
102123
103307
  ] : void 0,
102124
103308
  bandLtv,
102125
103309
  defaultBands: typeof ll.defaultBands === "number" ? ll.defaultBands : void 0,
103310
+ ammA: Number(ll.ammA) > 1 ? Number(ll.ammA) : void 0,
102126
103311
  /**
102127
103312
  * The band count as an editable TERM, not just a curve to read.
102128
103313
  *
@@ -102506,7 +103691,7 @@ var flyingTulipAdapter = {
102506
103691
  };
102507
103692
  }
102508
103693
  };
102509
- var num20 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
103694
+ var num21 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
102510
103695
  var pct2 = (v) => `${(v * 100).toFixed(2)} %`;
102511
103696
  var twyneAdapter = {
102512
103697
  id: "twyne",
@@ -102514,13 +103699,13 @@ var twyneAdapter = {
102514
103699
  profileId: () => "twyne.credit-delegation@v1",
102515
103700
  build: (input) => {
102516
103701
  const tw = input.market?.twyne ?? {};
102517
- const floorLtv = num20(tw.floorLtv);
102518
- const maxLtv = num20(tw.maxLtv);
102519
- const externalLiqLtv = num20(tw.externalLiqLtv);
102520
- const creditApr = num20(tw.creditApr);
102521
- const maturity = num20(tw.collateralMaturity);
103702
+ const floorLtv = num21(tw.floorLtv);
103703
+ const maxLtv = num21(tw.maxLtv);
103704
+ const externalLiqLtv = num21(tw.externalLiqLtv);
103705
+ const creditApr = num21(tw.creditApr);
103706
+ const maturity = num21(tw.collateralMaturity);
102522
103707
  const matured = tw.collateralMatured === true;
102523
- const creditAvailable = num20(tw.creditAvailable);
103708
+ const creditAvailable = num21(tw.creditAvailable);
102524
103709
  const vaultType = typeof tw.vaultType === "string" ? tw.vaultType : void 0;
102525
103710
  const externalName = vaultType === "AAVE_V3" ? "Aave V3" : vaultType === "EULER_V2" ? "Euler V2" : "the external market";
102526
103711
  const creditExhausted = creditAvailable != null && creditAvailable <= 0;
@@ -102695,7 +103880,7 @@ var aaveV4Adapter = {
102695
103880
  build: (input) => {
102696
103881
  const target = input.targetHealthFactor;
102697
103882
  const desc = input.market?.aaveV4 ?? {};
102698
- const maxBonusHf = num21(desc.healthFactorForMaxBonus);
103883
+ const maxBonusHf = num22(desc.healthFactorForMaxBonus);
102699
103884
  return {
102700
103885
  borrow: {
102701
103886
  liquidation: {
@@ -102709,7 +103894,7 @@ var aaveV4Adapter = {
102709
103894
  };
102710
103895
  }
102711
103896
  };
102712
- function num21(v) {
103897
+ function num22(v) {
102713
103898
  if (v == null) return void 0;
102714
103899
  const n = typeof v === "string" ? Number(v) : v;
102715
103900
  return Number.isFinite(n) && n > 0 ? n : void 0;
@@ -103972,7 +105157,8 @@ function toDigest(sheet) {
103972
105157
  (p) => p.id === sheet.borrow.rate.userSet.recommended
103973
105158
  )?.apr
103974
105159
  }
103975
- } : {}
105160
+ } : {},
105161
+ ...sheet.borrow.choices ? { choices: digestChoices(sheet.borrow.choices) } : {}
103976
105162
  } : void 0,
103977
105163
  swap: sheet.swap ? {
103978
105164
  kind: sheet.swap.kind,
@@ -104578,17 +105764,17 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
104578
105764
  const assetInfo = row.underlyingInfo?.asset ?? row.asset ?? {};
104579
105765
  const underlying = addr5(assetInfo.address, chainId) ?? addr5(row.underlying, chainId) ?? addr5(row.poolId, chainId);
104580
105766
  if (!underlying) return void 0;
104581
- const decimals = num15(assetInfo.decimals) ?? num15(row.decimals) ?? 18;
104582
- const priceUsd = num15(row.underlyingInfo?.prices?.priceUsd) ?? num15(row.price);
104583
- const base = num15(row.depositRate);
104584
- const intrinsic = num15(row.intrinsicYield);
105767
+ const decimals = num16(assetInfo.decimals) ?? num16(row.decimals) ?? 18;
105768
+ const priceUsd = num16(row.underlyingInfo?.prices?.priceUsd) ?? num16(row.price);
105769
+ const base = num16(row.depositRate);
105770
+ const intrinsic = num16(row.intrinsicYield);
104585
105771
  const rewards = sumRewardAprs(row.rewards);
104586
105772
  const marketOwn = sum2(base, rewards);
104587
105773
  const rate = {
104588
105774
  // Prefer our own sum over the origin's `apr`, because `apr` is documented
104589
105775
  // as `depositRate + intrinsicYield` and therefore EXCLUDES incentives —
104590
105776
  // using it as the headline would under-report every incentivized market.
104591
- total: sum2(base, intrinsic, rewards) ?? num15(row.apr) ?? 0,
105777
+ total: sum2(base, intrinsic, rewards) ?? num16(row.apr) ?? 0,
104592
105778
  base,
104593
105779
  rewards,
104594
105780
  intrinsic,
@@ -104656,7 +105842,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
104656
105842
  row.totalLiquidityUSD ?? row.totalLiquidityUsd
104657
105843
  ),
104658
105844
  depositCapacity: void 0,
104659
- utilization: num15(row.utilization),
105845
+ utilization: num16(row.utilization),
104660
105846
  // Lending withdrawals are same-block, bounded by available liquidity —
104661
105847
  // which is exactly `instant-capped`, not `instant`. A pool at 100 %
104662
105848
  // utilization cannot be exited, and calling that `instant` is the kind of
@@ -104664,12 +105850,12 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
104664
105850
  exit: { mode: "instant-capped", settlement: "sync" },
104665
105851
  availability: availability2,
104666
105852
  risk: {
104667
- score: num15(row.risk?.score),
105853
+ score: num16(row.risk?.score),
104668
105854
  label: str6(row.risk?.label),
104669
105855
  illiquid: isIlliquid({
104670
105856
  exitMode: "instant-capped",
104671
- tvlUsd: num15(row.totalDepositsUSD ?? row.totalDepositsUsd),
104672
- liquidityUsd: num15(row.totalLiquidityUSD ?? row.totalLiquidityUsd)
105857
+ tvlUsd: num16(row.totalDepositsUSD ?? row.totalDepositsUsd),
105858
+ liquidityUsd: num16(row.totalLiquidityUSD ?? row.totalLiquidityUsd)
104673
105859
  })
104674
105860
  },
104675
105861
  ...basket ? { basket } : {},
@@ -104735,9 +105921,9 @@ function resolveAvailability2(row, flags, totalRate) {
104735
105921
  };
104736
105922
  }
104737
105923
  function isSupplyCapFull(row) {
104738
- const cap = num15(row.caps?.supplyCap) ?? num15(row.supplyCap);
105924
+ const cap = num16(row.caps?.supplyCap) ?? num16(row.supplyCap);
104739
105925
  if (cap === void 0 || cap <= 0) return false;
104740
- const deposits = num15(row.totalDeposits);
105926
+ const deposits = num16(row.totalDeposits);
104741
105927
  if (deposits === void 0) return false;
104742
105928
  return deposits >= cap;
104743
105929
  }
@@ -104746,7 +105932,7 @@ function sumRewardAprs(rewards) {
104746
105932
  let total = 0;
104747
105933
  let seen = false;
104748
105934
  for (const r of rewards) {
104749
- const apr = num15(r?.depositRate);
105935
+ const apr = num16(r?.depositRate);
104750
105936
  if (apr === void 0) continue;
104751
105937
  total += apr;
104752
105938
  seen = true;
@@ -104754,7 +105940,7 @@ function sumRewardAprs(rewards) {
104754
105940
  return seen ? total : void 0;
104755
105941
  }
104756
105942
  function amount4(formatted, usd) {
104757
- return { formatted: num15(formatted), usd: num15(usd) };
105943
+ return { formatted: num16(formatted), usd: num16(usd) };
104758
105944
  }
104759
105945
  function sum2(...parts) {
104760
105946
  const present = parts.filter((p) => p !== void 0);
@@ -105444,7 +106630,7 @@ function vaultCapabilities(row) {
105444
106630
  caps.push({
105445
106631
  action: "withdraw",
105446
106632
  requires: withdrawRequires(provider),
105447
- feeBps: num15(meta.withdrawFeeBps) ?? row.exit.feeBps,
106633
+ feeBps: num16(meta.withdrawFeeBps) ?? row.exit.feeBps,
105448
106634
  // a fee-paying single-token exit: pays the vault's token only
105449
106635
  acceptsNative: false
105450
106636
  });
@@ -105588,7 +106774,7 @@ function legEarnUid(marketUid) {
105588
106774
  if (isVaultVenue(parts[0])) return void 0;
105589
106775
  return marketUid;
105590
106776
  }
105591
- function num22(v) {
106777
+ function num23(v) {
105592
106778
  const n = typeof v === "number" ? v : Number(v);
105593
106779
  return Number.isFinite(n) ? n : 0;
105594
106780
  }
@@ -105615,10 +106801,10 @@ function legAsset(pos) {
105615
106801
  };
105616
106802
  }
105617
106803
  function toLeg(pos) {
105618
- const depositsUsd = num22(pos.depositsUSD);
105619
- const debtUsd = num22(pos.debtUSD) + num22(pos.debtStableUSD);
105620
- const hasSupply = depositsUsd !== 0 || num22(pos.deposits) !== 0;
105621
- const hasDebt = debtUsd !== 0 || num22(pos.debt) !== 0 || num22(pos.debtStable) !== 0;
106804
+ const depositsUsd = num23(pos.depositsUSD);
106805
+ const debtUsd = num23(pos.debtUSD) + num23(pos.debtStableUSD);
106806
+ const hasSupply = depositsUsd !== 0 || num23(pos.deposits) !== 0;
106807
+ const hasDebt = debtUsd !== 0 || num23(pos.debt) !== 0 || num23(pos.debtStable) !== 0;
105622
106808
  return {
105623
106809
  earnUid: legEarnUid(pos.marketUid),
105624
106810
  marketUid: pos.marketUid,
@@ -105663,12 +106849,12 @@ function earnPositionFromLenderEntry(entry2) {
105663
106849
  (s) => s.legs.some((l) => l.side !== "none") || s.netUsd !== 0
105664
106850
  );
105665
106851
  const crossMargin = active.length <= 1;
105666
- const suppliedUsd = num22(entry2.balanceData?.deposits);
105667
- const borrowedUsd = num22(entry2.balanceData?.debt);
106852
+ const suppliedUsd = num23(entry2.balanceData?.deposits);
106853
+ const borrowedUsd = num23(entry2.balanceData?.debt);
105668
106854
  const aprBreakdown = {
105669
- market: num22(entry2.aprData?.apr),
105670
- rewards: num22(entry2.aprData?.rewardApr),
105671
- intrinsic: num22(entry2.aprData?.intrinsicApr)
106855
+ market: num23(entry2.aprData?.apr),
106856
+ rewards: num23(entry2.aprData?.rewardApr),
106857
+ intrinsic: num23(entry2.aprData?.intrinsicApr)
105672
106858
  };
105673
106859
  return {
105674
106860
  positionUid: buildLendingPositionUid(entry2.lender, entry2.chainId),
@@ -105682,15 +106868,15 @@ function earnPositionFromLenderEntry(entry2) {
105682
106868
  ...entry2.lenderInfo?.logoUri ? { logoURI: entry2.lenderInfo.logoUri } : {},
105683
106869
  suppliedUsd,
105684
106870
  borrowedUsd,
105685
- netUsd: num22(entry2.balanceData?.nav),
106871
+ netUsd: num23(entry2.balanceData?.nav),
105686
106872
  apr: aprBreakdown.market + aprBreakdown.rewards + aprBreakdown.intrinsic,
105687
106873
  aprBreakdown,
105688
- depositApr: num22(entry2.aprData?.depositApr),
105689
- borrowApr: num22(entry2.aprData?.borrowApr),
106874
+ depositApr: num23(entry2.aprData?.depositApr),
106875
+ borrowApr: num23(entry2.aprData?.borrowApr),
105690
106876
  // Only a cross-margin account HAS one health factor. Publishing the first
105691
106877
  // sub-account's as the row's would be a number about a different position.
105692
106878
  health: crossMargin ? active[0]?.health ?? null : null,
105693
- leverage: num22(entry2.leverage),
106879
+ leverage: num23(entry2.leverage),
105694
106880
  crossMargin,
105695
106881
  legs: subAccounts.flatMap((s) => s.legs),
105696
106882
  subAccounts: active,
@@ -106328,8 +107514,8 @@ async function fetchBorosAccount(account, fetchImpl) {
106328
107514
  }
106329
107515
 
106330
107516
  // src/boros/margin.ts
106331
- var SECONDS_PER_YEAR24 = 365 * 24 * 3600;
106332
- var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) / SECONDS_PER_YEAR24;
107517
+ var SECONDS_PER_YEAR25 = 365 * 24 * 3600;
107518
+ var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) / SECONDS_PER_YEAR25;
106333
107519
  function borosInitialMargin(m, size, ratePct, ttmSec) {
106334
107520
  const r = Math.max(Math.abs(ratePct) / 100, m.margin.rateFloor);
106335
107521
  return Math.abs(size) * r * m.margin.kIM * ttmYears(m, ttmSec);
@@ -106339,7 +107525,7 @@ function borosMaintenanceMargin(m, size, markPct, ttmSec) {
106339
107525
  return Math.abs(size) * r * m.margin.kMM * ttmYears(m, ttmSec);
106340
107526
  }
106341
107527
  function borosTakerFee(m, size) {
106342
- return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec / SECONDS_PER_YEAR24;
107528
+ return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec / SECONDS_PER_YEAR25;
106343
107529
  }
106344
107530
  function walkBorosBook(levels, size) {
106345
107531
  let left = size;
@@ -106361,7 +107547,7 @@ function walkBorosBook(levels, size) {
106361
107547
  };
106362
107548
  }
106363
107549
  function borosRateMoveToLiquidation(m, size, equity, markPct) {
106364
- const ttm = m.timeToMaturitySec / SECONDS_PER_YEAR24;
107550
+ const ttm = m.timeToMaturitySec / SECONDS_PER_YEAR25;
106365
107551
  if (!(Math.abs(size) > 0) || !(ttm > 0)) return null;
106366
107552
  const mm = borosMaintenanceMargin(m, size, markPct);
106367
107553
  const slack = equity - mm;
@@ -106453,7 +107639,7 @@ function quoteBorosHedgeLeg(p) {
106453
107639
  const fixed = fill.avgAprPct;
106454
107640
  const floating = m.rates.floatingApr;
106455
107641
  const takerFee = borosTakerFee(m, size);
106456
- const ttmYears2 = m.timeToMaturitySec / SECONDS_PER_YEAR24;
107642
+ const ttmYears2 = m.timeToMaturitySec / SECONDS_PER_YEAR25;
106457
107643
  const settleAprPct = m.fees.settleFee != null ? m.fees.settleFee * 100 : null;
106458
107644
  const allIn = ttmYears2 > 0 ? takerFee / size / ttmYears2 * 100 + (settleAprPct ?? 0) : null;
106459
107645
  const rateForMargin = fixed ?? m.rates.markApr ?? 0;
@@ -106606,11 +107792,11 @@ function buildFundingHedgeTerms(i) {
106606
107792
  };
106607
107793
  }
106608
107794
  function basisBlock(b) {
106609
- const num23 = (x) => x != null && Number.isFinite(x) ? x : void 0;
106610
- const meanGapApr = num23(b.meanGap);
106611
- const trackingErrorApr = num23(b.trackingError);
106612
- const correlation = num23(b.correlation);
106613
- const beta = num23(b.beta);
107795
+ const num24 = (x) => x != null && Number.isFinite(x) ? x : void 0;
107796
+ const meanGapApr = num24(b.meanGap);
107797
+ const trackingErrorApr = num24(b.trackingError);
107798
+ const correlation = num24(b.correlation);
107799
+ const beta = num24(b.beta);
106614
107800
  const parts = [];
106615
107801
  if (meanGapApr != null)
106616
107802
  parts.push(
@@ -106675,6 +107861,6 @@ function hedgeImplications(h, p) {
106675
107861
  return out;
106676
107862
  }
106677
107863
 
106678
- export { ALCHEMIX_BLOCK_SECONDS, ApiBookSource, BOROS_API_BASE, BOROS_GOVERNANCE, BOROS_MIN_CASH_USD, BOROS_PROFILE_ID, BorosApiError, DEFAULT_CONSENSUS_DEMOTION, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, DEFAULT_TERM_ORDER_STORE, DOLOMITE_ISO_ID_PREFIX, EARN_DESCRIPTIONS, EARN_LABELS, EARN_RATE_SOURCE_BY_PROVIDER, EMPTY_BALANCE, EXACTLY_LENDER_KEY, EXPONENT_MATURED_REASON, FIXED_YIELD_EARN_VENUE_PREFIXES, FLYING_TULIP_LENDER_KEY, FRACTION_RATE_PROVIDERS, FUNDING_EXPOSURE_PROFILES, FUNDING_HEDGE_REFERENCE_USD, 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, NON_EVM_VAULT_PROVIDERS, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL2 as PENDLE_MARKETS_URL, PREFIX_LENDERS, RATE_QUEUE_MAX_LEVELS, RATE_QUEUE_STEP, REFLECT_TRANCHE_SIDES, RIPE_LENDER_KEY, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, SVM_EARN_MINT_BUILDERS, SVM_EARN_VAULT_BUILDERS, SVM_SAVINGS_CURATION, SVM_VAULT_PROVIDERS, TELLER_CALLS_PER_BID, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_MARKETS_PER_CALL, 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, USER_REWARD_SOURCES, USER_SET_RATE_PICKS, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VENUS_CORE_POOL_ID, VOLATILE_VAULT_OVERRIDES, VenusEModeAbi, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, alchemixLenderKey, alchemixMytRate, alchemixRedemptionPace, appendSnapshot, applyEarnSanity, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, blockNumberFromTag, borosApi, borosInitialMargin, borosMaintenanceMargin, borosRateMoveToLiquidation, borosSideTerms, borosTakerFee, borrowDescription, borrowFindings, borrowHeadline, buildBorosTermSheet, buildExposures2 as buildExposures, buildFluidFTokensCall, buildFundingHedgeTerms, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildQueriesFromMeta, buildRateQueue, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, 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, convertAlchemixMarketsToResponse, convertBorosCandle, convertBorosMarket, convertCoolerMarketsToResponse, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFlexMarketsToResponse, convertFlyingTulipMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRipeMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMultiAccountTypeUserState, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, debtAheadOf, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, deriveSwapTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, disambiguateOrderBookNames, discoverFlexTroves, dolomiteVaultAddress, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRateAtMaturity, earnRowFundingProfile, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, emitterCoverage, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, enumerateEmitters, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, exponentTrancheDescription, feePhrase, feedKeyOf, feedStatKey, fetchAaveIncentivesUserRewards, fetchAlchemixMarkets, fetchBorosAccount, fetchBorosCollaterals, fetchBorosMarket, fetchBorosMarketById, fetchBorosMarkets, fetchBorosOrderBook, fetchBorosRateHistory, fetchCoolerMarkets, fetchDolomiteAccountNumbers, fetchDolomiteSubAccounts, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFlexMarkets, fetchFluidDexState, fetchFluidFTokens, fetchFlyingTulipMarkets, fetchFlyingTulipUserRewards, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLenderRewards, fetchLenderRewardsByMarketUid, fetchLiquityMarkets, fetchListaMarketEmissions, fetchListaUserRewards, fetchListaVaultEmissions, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMerklUserRewards, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRipeMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTermStoreOrders, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchUserRewards, fetchUsualRewardsClaimData, fetchYearnApiVaults, fetchYearnVaults, fillableRemaining, filterActiveLenders, filterLenderMeta, filterLendersByProtocol, finalizeInfo, findingsFor, flexAverageRate, flexLenderApr, flexLenderKey, flexMarketIndex, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fundingExposureOf, fundingSymbolBase, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMidnightChainBooks, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getResolvedDolomiteSubAccounts, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, getVenusEModeSetup, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, injectLenderInfoIntoEntries, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isFixedYieldEarnRow, isIlliquid, isLenderVenueKey, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isMaturedTerm, isOrderBookCollateralLeg, isOrderBookLendRow, isPrincipalTokenSymbol, isRollingBookLendRow, isSecondaryMarketOnly, isStablecoinSymbol, isSyntheticQuoteUnit, isUnearnableEarnRate, isUnrealizableEarnRate, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, lenderLiquidityPressure, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, listaEmissionRewardFetcher, listaLoginMessage, llamaLendKeyParts, llamaLendLenderKey, marketKeysOf, meetsLiquidityFloor, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, organizeUserQueries, parseBalanceFetcherResult, parseDolomiteSubAccountId, parseEarnUid, parseLenderKey, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, pegPressure, assetKey as pendleAssetKey, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, protocolConsensus, protocolOf, pruneFeedStats, quoteBorosHedgeLeg, rankBorosHedgeMarkets, rankFindings, ratePercent, readLstPauseState, readTransmuterLots, readUserPositions, readVaultSharePrices, reflectTrancheDescription, rejectOutliers as rejectPriceOutliers, repairImpossibleTvl, resolveAdapter, resolveDerivation, resolveDolomiteRowIdentity, resolveEarnIdentity, resolveMerklOpportunityMarkets, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, selectUsualRewardEntry, setMysticApiKey, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampOrderBookLendRow, stampRollingBookLendRow, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, subAccountsOf, supplyDescription, supplyFindings, supplyHeadline, svmEarnBuildability, svmEarnBuilderKey, svmSavingsCuration, swapRoutedProvidersArePriceConsistent, swapSideDescription, swapSideHeadline, swapSideImplications, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termApiBaseUrl, 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, termOfferRateToAprPct, termOrderStoreBaseUrl, tickToAprNumber, tickToPrice, toDigest, toDolomiteSubAccountId, toTermFillNow, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, walkBorosBook, withMaturityLabel, withTrancheLabel };
107864
+ export { ALCHEMIX_BLOCK_SECONDS, ApiBookSource, BOROS_API_BASE, BOROS_GOVERNANCE, BOROS_MIN_CASH_USD, BOROS_PROFILE_ID, BorosApiError, DEFAULT_CONSENSUS_DEMOTION, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, DEFAULT_TERM_ORDER_STORE, DOLOMITE_ISO_ID_PREFIX, EARN_DESCRIPTIONS, EARN_LABELS, EARN_RATE_SOURCE_BY_PROVIDER, EMPTY_BALANCE, EXACTLY_LENDER_KEY, EXPONENT_MATURED_REASON, FIXED_YIELD_EARN_VENUE_PREFIXES, FLYING_TULIP_LENDER_KEY, FRACTION_RATE_PROVIDERS, FUNDING_EXPOSURE_PROFILES, FUNDING_HEDGE_REFERENCE_USD, 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, NON_EVM_VAULT_PROVIDERS, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL2 as PENDLE_MARKETS_URL, PREFIX_LENDERS, RATE_QUEUE_MAX_LEVELS, RATE_QUEUE_STEP, REFLECT_TRANCHE_SIDES, RIPE_LENDER_KEY, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, SVM_EARN_MINT_BUILDERS, SVM_EARN_VAULT_BUILDERS, SVM_SAVINGS_CURATION, SVM_VAULT_PROVIDERS, TELLER_CALLS_PER_BID, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_MARKETS_PER_CALL, 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, USER_REWARD_SOURCES, USER_SET_RATE_PICKS, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VENUS_CORE_POOL_ID, VOLATILE_VAULT_OVERRIDES, VenusEModeAbi, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, alchemixLenderKey, alchemixMytRate, alchemixRedemptionPace, appendSnapshot, applyEarnSanity, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, bandsForStance, blockNumberFromTag, borosApi, borosInitialMargin, borosMaintenanceMargin, borosRateMoveToLiquidation, borosSideTerms, borosTakerFee, borrowDescription, borrowFindings, borrowHeadline, buildBorosTermSheet, buildExposures2 as buildExposures, buildFluidFTokensCall, buildFundingHedgeTerms, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildPositionChoices, buildQueriesFromMeta, buildRateQueue, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, 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, convertAlchemixMarketsToResponse, convertBorosCandle, convertBorosMarket, convertCoolerMarketsToResponse, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFlexMarketsToResponse, convertFlyingTulipMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRipeMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMultiAccountTypeUserState, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, debtAheadOf, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, deriveSwapTags, detectInterfaceKinds, dexResolverFor, digestChoices, disambiguateEarnNames, disambiguateOrderBookNames, discoverFlexTroves, dolomiteVaultAddress, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRateAtMaturity, earnRowFundingProfile, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, emitterCoverage, encodeBalanceFetcherCalldata, encodeChoiceValue, enrichTermSheet, enrichmentIndexFromRows, enumerateEmitters, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, exponentTrancheDescription, feePhrase, feedKeyOf, feedStatKey, fetchAaveIncentivesUserRewards, fetchAlchemixMarkets, fetchBorosAccount, fetchBorosCollaterals, fetchBorosMarket, fetchBorosMarketById, fetchBorosMarkets, fetchBorosOrderBook, fetchBorosRateHistory, fetchCoolerMarkets, fetchDolomiteAccountNumbers, fetchDolomiteSubAccounts, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFlexMarkets, fetchFluidDexState, fetchFluidFTokens, fetchFlyingTulipMarkets, fetchFlyingTulipUserRewards, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLenderRewards, fetchLenderRewardsByMarketUid, fetchLiquityMarkets, fetchListaMarketEmissions, fetchListaUserRewards, fetchListaVaultEmissions, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMerklUserRewards, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRipeMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTermStoreOrders, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchUserRewards, fetchUsualRewardsClaimData, fetchYearnApiVaults, fetchYearnVaults, fillCapacityAt, fillableRemaining, filterActiveLenders, filterLenderMeta, filterLendersByProtocol, finalizeInfo, findingsFor, flexAverageRate, flexLenderApr, flexLenderKey, flexMarketIndex, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fundingExposureOf, fundingSymbolBase, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMidnightChainBooks, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getResolvedDolomiteSubAccounts, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, getVenusEModeSetup, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, injectLenderInfoIntoEntries, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isFixedYieldEarnRow, isIlliquid, isLenderVenueKey, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isMaturedTerm, isOrderBookCollateralLeg, isOrderBookLendRow, isPrincipalTokenSymbol, isRollingBookLendRow, isSecondaryMarketOnly, isStablecoinSymbol, isSyntheticQuoteUnit, isUnearnableEarnRate, isUnrealizableEarnRate, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, lenderLiquidityPressure, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, listaEmissionRewardFetcher, listaLoginMessage, llamaLendKeyParts, llamaLendLenderKey, marketKeysOf, meetsLiquidityFloor, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, organizeUserQueries, parameterLadder, parseBalanceFetcherResult, parseDolomiteSubAccountId, parseEarnUid, parseLenderKey, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, pegPressure, assetKey as pendleAssetKey, pickRates, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, protocolConsensus, protocolOf, pruneFeedStats, quoteBorosHedgeLeg, rankBorosHedgeMarkets, rankFindings, ratePercent, readLstPauseState, readTransmuterLots, readUserPositions, readVaultSharePrices, reflectTrancheDescription, rejectOutliers as rejectPriceOutliers, repairImpossibleTvl, resolveAdapter, resolveChoices, resolveDerivation, resolveDolomiteRowIdentity, resolveEarnIdentity, resolveMerklOpportunityMarkets, resolveModeConfig, resolveRatePicks, resolveStCeloDepositGroup, resolveStance, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, selectUsualRewardEntry, setMysticApiKey, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampOrderBookLendRow, stampRollingBookLendRow, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, subAccountsOf, supplyDescription, supplyFindings, supplyHeadline, svmEarnBuildability, svmEarnBuilderKey, svmSavingsCuration, swapRoutedProvidersArePriceConsistent, swapSideDescription, swapSideHeadline, swapSideImplications, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termApiBaseUrl, 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, termOfferRateToAprPct, termOrderStoreBaseUrl, tickToAprNumber, tickToPrice, toDigest, toDolomiteSubAccountId, toTermFillNow, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, walkBorosBook, withMaturityLabel, withTrancheLabel };
106679
107865
  //# sourceMappingURL=index.js.map
106680
107866
  //# sourceMappingURL=index.js.map