@1delta/margin-fetcher 5.0.150 → 5.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +242 -2
- package/dist/index.js +1188 -246
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
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
|
|
24814
|
-
|
|
24815
|
-
|
|
24816
|
-
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
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
|
|
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:
|
|
25536
|
+
minRateBps: num24(base + 2),
|
|
25497
25537
|
collateralPerPrincipal: big32(base + 3),
|
|
25498
|
-
maxLoanDuration:
|
|
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
|
|
26736
|
+
const num24 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
26697
26737
|
return {
|
|
26698
26738
|
market,
|
|
26699
|
-
totalDebt:
|
|
26700
|
-
dolaLiquidity:
|
|
26701
|
-
leftToBorrow:
|
|
26702
|
-
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:
|
|
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 =
|
|
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 = (
|
|
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
|
|
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 (!
|
|
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
|
|
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) => !
|
|
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
|
|
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(
|
|
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 (!
|
|
36667
|
-
if (
|
|
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
|
|
38898
|
+
const viaLens = usesAaveV4Lens(chainId, lender);
|
|
38899
|
+
const expectedNumberOfCalls = viaLens ? 1 : reserves.length * USER_CALLS_PER_RESERVE;
|
|
38779
38900
|
return [
|
|
38780
|
-
(
|
|
38781
|
-
if (
|
|
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;
|
|
@@ -57537,6 +57660,46 @@ 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 MEZZANINE_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 toEntry3 = (t) => ({
|
|
57669
|
+
reader: "mezzanine-tranche",
|
|
57670
|
+
address: t.address,
|
|
57671
|
+
// The deposit asset, not `asset()`: see the reader.
|
|
57672
|
+
underlying: t.depositAsset,
|
|
57673
|
+
symbol: t.symbol,
|
|
57674
|
+
brand: "Mezzanine",
|
|
57675
|
+
description: MEZZANINE_PROSE[t.tranche],
|
|
57676
|
+
decimals: 21,
|
|
57677
|
+
underlyingDecimals: 6,
|
|
57678
|
+
isRebasing: false,
|
|
57679
|
+
isMintable: true,
|
|
57680
|
+
withdrawalMode: "request-based",
|
|
57681
|
+
withdrawQueue: t.address,
|
|
57682
|
+
solvency: t.tranche === "senior" ? "tranched-senior" : "tranched-junior",
|
|
57683
|
+
// Not read by the reader: it publishes the row's NAV attestation, so the
|
|
57684
|
+
// sheet says the price is reported and the senior's principal is not safe.
|
|
57685
|
+
priceOracle: t.navOracle,
|
|
57686
|
+
feeScheduleCheckedAt: "2026-11-05",
|
|
57687
|
+
mezzanine: {
|
|
57688
|
+
issuanceVault: t.issuanceVault,
|
|
57689
|
+
mzusd: t.mzusd,
|
|
57690
|
+
reservoir: t.reservoir,
|
|
57691
|
+
allowlist: t.allowlist,
|
|
57692
|
+
pauseManager: t.pauseManager
|
|
57693
|
+
}
|
|
57694
|
+
});
|
|
57695
|
+
var MEZZANINE_ENTRIES = (() => {
|
|
57696
|
+
const out = {};
|
|
57697
|
+
for (const t of MEZZANINE_TRANCHES) {
|
|
57698
|
+
if (!out[t.chainId]) out[t.chainId] = [];
|
|
57699
|
+
out[t.chainId].push(toEntry3(t));
|
|
57700
|
+
}
|
|
57701
|
+
return out;
|
|
57702
|
+
})();
|
|
57540
57703
|
var L2SD_YIELD_KEYS = {
|
|
57541
57704
|
limUSD: "limUSD::LIMUSD",
|
|
57542
57705
|
haHYPE: "haHYPE::haHYPE",
|
|
@@ -59534,7 +59697,7 @@ var ROWS = [
|
|
|
59534
59697
|
)
|
|
59535
59698
|
}
|
|
59536
59699
|
];
|
|
59537
|
-
var
|
|
59700
|
+
var toEntry4 = (r) => ({
|
|
59538
59701
|
reader: "alchemix-transmuter",
|
|
59539
59702
|
address: r.transmuter,
|
|
59540
59703
|
underlying: r.alAsset,
|
|
@@ -59564,7 +59727,7 @@ var toEntry3 = (r) => ({
|
|
|
59564
59727
|
alchemixTransmuter: r.cfg
|
|
59565
59728
|
});
|
|
59566
59729
|
var ALCHEMIX_TRANSMUTER_ENTRIES = ROWS.reduce((out, r) => {
|
|
59567
|
-
(out[r.chainId] ??= []).push(
|
|
59730
|
+
(out[r.chainId] ??= []).push(toEntry4(r));
|
|
59568
59731
|
return out;
|
|
59569
59732
|
}, {});
|
|
59570
59733
|
var CHAIN_ID19 = "1";
|
|
@@ -63697,6 +63860,10 @@ var SAVINGS_REGISTRY = (() => {
|
|
|
63697
63860
|
if (!out[chainId]) out[chainId] = [];
|
|
63698
63861
|
out[chainId].push(...entries);
|
|
63699
63862
|
}
|
|
63863
|
+
for (const [chainId, entries] of Object.entries(MEZZANINE_ENTRIES)) {
|
|
63864
|
+
if (!out[chainId]) out[chainId] = [];
|
|
63865
|
+
out[chainId].push(...entries);
|
|
63866
|
+
}
|
|
63700
63867
|
for (const [chainId, entries] of Object.entries(LLAMA_GAP_ENTRIES)) {
|
|
63701
63868
|
if (!out[chainId]) out[chainId] = [];
|
|
63702
63869
|
out[chainId].push(...entries);
|
|
@@ -83842,6 +84009,132 @@ var readerStrataCooldown = {
|
|
|
83842
84009
|
}
|
|
83843
84010
|
};
|
|
83844
84011
|
|
|
84012
|
+
// src/vaults/lst/withdrawals/abis/mezzanine.ts
|
|
84013
|
+
var MezzanineQueueReadAbi = [
|
|
84014
|
+
{
|
|
84015
|
+
name: "getUserEpochInfo",
|
|
84016
|
+
type: "function",
|
|
84017
|
+
stateMutability: "view",
|
|
84018
|
+
inputs: [
|
|
84019
|
+
{ name: "user", type: "address" },
|
|
84020
|
+
{ name: "epochId", type: "uint256" }
|
|
84021
|
+
],
|
|
84022
|
+
outputs: [
|
|
84023
|
+
{ name: "pendingShares", type: "uint256" },
|
|
84024
|
+
{ name: "claimableAssets", type: "uint256" }
|
|
84025
|
+
]
|
|
84026
|
+
},
|
|
84027
|
+
{
|
|
84028
|
+
name: "convertToAssets",
|
|
84029
|
+
type: "function",
|
|
84030
|
+
stateMutability: "view",
|
|
84031
|
+
inputs: [{ name: "shares", type: "uint256" }],
|
|
84032
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
84033
|
+
}
|
|
84034
|
+
];
|
|
84035
|
+
var MezzanineEpochReadAbi = [
|
|
84036
|
+
{
|
|
84037
|
+
name: "currentEpochId",
|
|
84038
|
+
type: "function",
|
|
84039
|
+
stateMutability: "view",
|
|
84040
|
+
inputs: [],
|
|
84041
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
84042
|
+
},
|
|
84043
|
+
{
|
|
84044
|
+
name: "epochStart",
|
|
84045
|
+
type: "function",
|
|
84046
|
+
stateMutability: "view",
|
|
84047
|
+
inputs: [],
|
|
84048
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
84049
|
+
},
|
|
84050
|
+
{
|
|
84051
|
+
name: "epochDuration",
|
|
84052
|
+
type: "function",
|
|
84053
|
+
stateMutability: "view",
|
|
84054
|
+
inputs: [],
|
|
84055
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
84056
|
+
}
|
|
84057
|
+
];
|
|
84058
|
+
|
|
84059
|
+
// src/vaults/lst/withdrawals/readers/mezzanine.ts
|
|
84060
|
+
var MAX_DELAY_EPOCHS = 30n;
|
|
84061
|
+
var LOOKBACK_EPOCHS = 104n;
|
|
84062
|
+
var ONE_SHARE3 = 10n ** 21n;
|
|
84063
|
+
var readerMezzanineEpoch = {
|
|
84064
|
+
fetch: async (user, multicallRetry, chainId, entry2) => {
|
|
84065
|
+
const tranche = entry2.withdrawalContract;
|
|
84066
|
+
const vault = entry2.secondaryWithdrawalContract;
|
|
84067
|
+
const mzusd = entry2.escrowToken;
|
|
84068
|
+
if (!tranche || !vault) return [];
|
|
84069
|
+
const clock = await multicallRetry({
|
|
84070
|
+
chain: chainId,
|
|
84071
|
+
calls: [
|
|
84072
|
+
{ address: vault, name: "currentEpochId", params: [] },
|
|
84073
|
+
{ address: vault, name: "epochStart", params: [] },
|
|
84074
|
+
{ address: vault, name: "epochDuration", params: [] },
|
|
84075
|
+
{ address: tranche, name: "convertToAssets", params: [ONE_SHARE3] }
|
|
84076
|
+
],
|
|
84077
|
+
abi: [
|
|
84078
|
+
MezzanineEpochReadAbi,
|
|
84079
|
+
MezzanineEpochReadAbi,
|
|
84080
|
+
MezzanineEpochReadAbi,
|
|
84081
|
+
MezzanineQueueReadAbi
|
|
84082
|
+
]
|
|
84083
|
+
});
|
|
84084
|
+
const current = toBigInt15(clock[0]);
|
|
84085
|
+
const epochStart = toBigInt15(clock[1]);
|
|
84086
|
+
const epochDuration = toBigInt15(clock[2]);
|
|
84087
|
+
const perShare = toBigInt15(clock[3]);
|
|
84088
|
+
if (current === void 0) return [];
|
|
84089
|
+
const first = current > LOOKBACK_EPOCHS ? current - LOOKBACK_EPOCHS : 1n;
|
|
84090
|
+
const epochs = [];
|
|
84091
|
+
for (let e = first; e <= current + MAX_DELAY_EPOCHS; e++) epochs.push(e);
|
|
84092
|
+
const res = await multicallRetry({
|
|
84093
|
+
chain: chainId,
|
|
84094
|
+
calls: epochs.map((e) => ({
|
|
84095
|
+
address: tranche,
|
|
84096
|
+
name: "getUserEpochInfo",
|
|
84097
|
+
params: [user, e]
|
|
84098
|
+
})),
|
|
84099
|
+
abi: epochs.map(() => MezzanineQueueReadAbi)
|
|
84100
|
+
});
|
|
84101
|
+
const out = [];
|
|
84102
|
+
epochs.forEach((epoch, i) => {
|
|
84103
|
+
const cell = res[i];
|
|
84104
|
+
if (!Array.isArray(cell)) return;
|
|
84105
|
+
const pendingShares = toBigInt15(cell[0]);
|
|
84106
|
+
const claimable = toBigInt15(cell[1]);
|
|
84107
|
+
if (!pendingShares) return;
|
|
84108
|
+
const finalized = claimable !== void 0 && claimable > 0n;
|
|
84109
|
+
const base = {
|
|
84110
|
+
lst: entry2.lst,
|
|
84111
|
+
brand: entry2.brand,
|
|
84112
|
+
symbol: entry2.symbol,
|
|
84113
|
+
requestId: epoch.toString(),
|
|
84114
|
+
shares: pendingShares.toString(),
|
|
84115
|
+
withdrawQueue: tranche,
|
|
84116
|
+
...mzusd ? { claimToken: mzusd } : {}
|
|
84117
|
+
};
|
|
84118
|
+
if (finalized) {
|
|
84119
|
+
out.push({
|
|
84120
|
+
...base,
|
|
84121
|
+
amountUnderlying: claimable.toString(),
|
|
84122
|
+
status: "claimable"
|
|
84123
|
+
});
|
|
84124
|
+
return;
|
|
84125
|
+
}
|
|
84126
|
+
const readyAt = epochStart !== void 0 && epochDuration !== void 0 && epoch >= current ? Number(epochStart + (epoch - current + 1n) * epochDuration) : void 0;
|
|
84127
|
+
out.push({
|
|
84128
|
+
...base,
|
|
84129
|
+
amountUnderlying: (pendingShares * (perShare ?? 0n) / ONE_SHARE3).toString(),
|
|
84130
|
+
status: "pending",
|
|
84131
|
+
...readyAt !== void 0 ? { readyAt } : {}
|
|
84132
|
+
});
|
|
84133
|
+
});
|
|
84134
|
+
return out;
|
|
84135
|
+
}
|
|
84136
|
+
};
|
|
84137
|
+
|
|
83845
84138
|
// src/vaults/lst/withdrawals/abis/etherfi.ts
|
|
83846
84139
|
var EtherFiWithdrawRequestAbi = [
|
|
83847
84140
|
{
|
|
@@ -85520,6 +85813,8 @@ var buildWithdrawalReader = (entry2) => {
|
|
|
85520
85813
|
return readerSusd3Cooldown;
|
|
85521
85814
|
case "strataCooldown":
|
|
85522
85815
|
return readerStrataCooldown;
|
|
85816
|
+
case "mezzanineEpoch":
|
|
85817
|
+
return readerMezzanineEpoch;
|
|
85523
85818
|
case "swellNft":
|
|
85524
85819
|
return readerSwell;
|
|
85525
85820
|
case "stakeWiseSubgraph":
|
|
@@ -85733,6 +86028,18 @@ var LST_WITHDRAWAL_REGISTRY = {
|
|
|
85733
86028
|
symbol: "apyUSD",
|
|
85734
86029
|
reader: "unverified"
|
|
85735
86030
|
},
|
|
86031
|
+
// Mezzanine tranches — ONE entry per TRANCHE: requests are tranche-local.
|
|
86032
|
+
// `withdrawalContract` is the tranche, `secondaryWithdrawalContract` the
|
|
86033
|
+
// IssuanceVault holding the epoch clock, `escrowToken` the MZUSD a claim pays.
|
|
86034
|
+
...MEZZANINE_TRANCHES.filter((t) => t.chainId === "1").map((t) => ({
|
|
86035
|
+
lst: t.address,
|
|
86036
|
+
brand: "Mezzanine",
|
|
86037
|
+
symbol: t.symbol,
|
|
86038
|
+
reader: "mezzanineEpoch",
|
|
86039
|
+
withdrawalContract: t.address,
|
|
86040
|
+
secondaryWithdrawalContract: t.issuanceVault,
|
|
86041
|
+
escrowToken: t.mzusd
|
|
86042
|
+
})),
|
|
85736
86043
|
// Strata tranche markets — ONE entry per market (not per tranche):
|
|
85737
86044
|
// both tranches escrow into the same two per-market ICooldown
|
|
85738
86045
|
// contracts keyed by (escrowToken, user) with no tranche
|
|
@@ -87619,6 +87926,163 @@ var FusionBalanceOfAbi = [
|
|
|
87619
87926
|
}
|
|
87620
87927
|
];
|
|
87621
87928
|
|
|
87929
|
+
// src/vaults/savings/abis/mezzanine.ts
|
|
87930
|
+
var MezzanineTrancheReadAbi = [
|
|
87931
|
+
{
|
|
87932
|
+
name: "totalAssets",
|
|
87933
|
+
type: "function",
|
|
87934
|
+
stateMutability: "view",
|
|
87935
|
+
inputs: [],
|
|
87936
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87937
|
+
},
|
|
87938
|
+
{
|
|
87939
|
+
name: "totalSupply",
|
|
87940
|
+
type: "function",
|
|
87941
|
+
stateMutability: "view",
|
|
87942
|
+
inputs: [],
|
|
87943
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87944
|
+
},
|
|
87945
|
+
{
|
|
87946
|
+
name: "convertToAssets",
|
|
87947
|
+
type: "function",
|
|
87948
|
+
stateMutability: "view",
|
|
87949
|
+
inputs: [{ name: "shares", type: "uint256" }],
|
|
87950
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87951
|
+
},
|
|
87952
|
+
{
|
|
87953
|
+
name: "maxDeposit",
|
|
87954
|
+
type: "function",
|
|
87955
|
+
stateMutability: "view",
|
|
87956
|
+
inputs: [{ name: "receiver", type: "address" }],
|
|
87957
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87958
|
+
},
|
|
87959
|
+
{
|
|
87960
|
+
name: "yieldStreamingAmount",
|
|
87961
|
+
type: "function",
|
|
87962
|
+
stateMutability: "view",
|
|
87963
|
+
inputs: [],
|
|
87964
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87965
|
+
},
|
|
87966
|
+
{
|
|
87967
|
+
name: "yieldStreamStart",
|
|
87968
|
+
type: "function",
|
|
87969
|
+
stateMutability: "view",
|
|
87970
|
+
inputs: [],
|
|
87971
|
+
outputs: [{ name: "", type: "uint48" }]
|
|
87972
|
+
},
|
|
87973
|
+
{
|
|
87974
|
+
name: "yieldStreamEnd",
|
|
87975
|
+
type: "function",
|
|
87976
|
+
stateMutability: "view",
|
|
87977
|
+
inputs: [],
|
|
87978
|
+
outputs: [{ name: "", type: "uint48" }]
|
|
87979
|
+
},
|
|
87980
|
+
{
|
|
87981
|
+
name: "unstakeDelayEpochs",
|
|
87982
|
+
type: "function",
|
|
87983
|
+
stateMutability: "view",
|
|
87984
|
+
inputs: [],
|
|
87985
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87986
|
+
},
|
|
87987
|
+
{
|
|
87988
|
+
name: "unstakeYieldReductionBps",
|
|
87989
|
+
type: "function",
|
|
87990
|
+
stateMutability: "view",
|
|
87991
|
+
inputs: [],
|
|
87992
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
87993
|
+
},
|
|
87994
|
+
{
|
|
87995
|
+
name: "directWithdrawEnabled",
|
|
87996
|
+
type: "function",
|
|
87997
|
+
stateMutability: "view",
|
|
87998
|
+
inputs: [],
|
|
87999
|
+
outputs: [{ name: "", type: "bool" }]
|
|
88000
|
+
}
|
|
88001
|
+
];
|
|
88002
|
+
var MezzanineVaultReadAbi = [
|
|
88003
|
+
{
|
|
88004
|
+
name: "epochStart",
|
|
88005
|
+
type: "function",
|
|
88006
|
+
stateMutability: "view",
|
|
88007
|
+
inputs: [],
|
|
88008
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88009
|
+
},
|
|
88010
|
+
{
|
|
88011
|
+
name: "epochDuration",
|
|
88012
|
+
type: "function",
|
|
88013
|
+
stateMutability: "view",
|
|
88014
|
+
inputs: [],
|
|
88015
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88016
|
+
},
|
|
88017
|
+
{
|
|
88018
|
+
name: "currentEpochId",
|
|
88019
|
+
type: "function",
|
|
88020
|
+
stateMutability: "view",
|
|
88021
|
+
inputs: [],
|
|
88022
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88023
|
+
},
|
|
88024
|
+
{
|
|
88025
|
+
name: "performanceFeeBps",
|
|
88026
|
+
type: "function",
|
|
88027
|
+
stateMutability: "view",
|
|
88028
|
+
inputs: [],
|
|
88029
|
+
outputs: [{ name: "", type: "uint16" }]
|
|
88030
|
+
},
|
|
88031
|
+
{
|
|
88032
|
+
name: "protocolFeeBps",
|
|
88033
|
+
type: "function",
|
|
88034
|
+
stateMutability: "view",
|
|
88035
|
+
inputs: [],
|
|
88036
|
+
outputs: [{ name: "", type: "uint16" }]
|
|
88037
|
+
}
|
|
88038
|
+
];
|
|
88039
|
+
var MezzanineBaseReadAbi = [
|
|
88040
|
+
{
|
|
88041
|
+
name: "withdrawalFeeBps",
|
|
88042
|
+
type: "function",
|
|
88043
|
+
stateMutability: "view",
|
|
88044
|
+
inputs: [],
|
|
88045
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88046
|
+
},
|
|
88047
|
+
{
|
|
88048
|
+
name: "getRemainingRedemptionCap",
|
|
88049
|
+
type: "function",
|
|
88050
|
+
stateMutability: "view",
|
|
88051
|
+
inputs: [],
|
|
88052
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88053
|
+
}
|
|
88054
|
+
];
|
|
88055
|
+
var MezzanineAllowlistReadAbi = [
|
|
88056
|
+
{
|
|
88057
|
+
name: "verifyAccount",
|
|
88058
|
+
type: "function",
|
|
88059
|
+
stateMutability: "view",
|
|
88060
|
+
inputs: [{ name: "account", type: "address" }],
|
|
88061
|
+
outputs: [{ name: "", type: "bool" }]
|
|
88062
|
+
}
|
|
88063
|
+
];
|
|
88064
|
+
var MezzaninePauseReadAbi = [
|
|
88065
|
+
{
|
|
88066
|
+
name: "isPaused",
|
|
88067
|
+
type: "function",
|
|
88068
|
+
stateMutability: "view",
|
|
88069
|
+
inputs: [
|
|
88070
|
+
{ name: "target", type: "address" },
|
|
88071
|
+
{ name: "category", type: "uint8" }
|
|
88072
|
+
],
|
|
88073
|
+
outputs: [{ name: "", type: "bool" }]
|
|
88074
|
+
}
|
|
88075
|
+
];
|
|
88076
|
+
var MezzanineTokenReadAbi = [
|
|
88077
|
+
{
|
|
88078
|
+
name: "balanceOf",
|
|
88079
|
+
type: "function",
|
|
88080
|
+
stateMutability: "view",
|
|
88081
|
+
inputs: [{ name: "account", type: "address" }],
|
|
88082
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
88083
|
+
}
|
|
88084
|
+
];
|
|
88085
|
+
|
|
87622
88086
|
// src/vaults/savings/abis/ember.ts
|
|
87623
88087
|
var EmberMaxDepositAbi = [
|
|
87624
88088
|
{
|
|
@@ -88490,10 +88954,10 @@ var readerZerobaseVault = (entry2) => {
|
|
|
88490
88954
|
const wait = toBigInt16(waitingTime);
|
|
88491
88955
|
let supplyRate;
|
|
88492
88956
|
if (Array.isArray(rewardRate) && rewardRate.length === 2) {
|
|
88493
|
-
const
|
|
88957
|
+
const num24 = toBigInt16(rewardRate[0]);
|
|
88494
88958
|
const base = toBigInt16(rewardRate[1]);
|
|
88495
|
-
if (
|
|
88496
|
-
supplyRate = Number(
|
|
88959
|
+
if (num24 !== void 0 && base !== void 0 && base > 0n && num24 < base)
|
|
88960
|
+
supplyRate = Number(num24) * 100 / Number(base);
|
|
88497
88961
|
}
|
|
88498
88962
|
return {
|
|
88499
88963
|
// Share and underlying decimals match on every deployment (6/6, or
|
|
@@ -89284,7 +89748,7 @@ var readerWrenNav = (entry2) => {
|
|
|
89284
89748
|
};
|
|
89285
89749
|
|
|
89286
89750
|
// src/vaults/savings/readers/yieldBasisLt.ts
|
|
89287
|
-
var
|
|
89751
|
+
var ONE_SHARE4 = ONE_E1823;
|
|
89288
89752
|
var readerYieldBasisLt = (entry2) => {
|
|
89289
89753
|
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
89290
89754
|
const amm = entry2.capacityContract ?? entry2.address;
|
|
@@ -89292,7 +89756,7 @@ var readerYieldBasisLt = (entry2) => {
|
|
|
89292
89756
|
calls: [
|
|
89293
89757
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
89294
89758
|
{ address: entry2.address, name: "pricePerShare", params: [] },
|
|
89295
|
-
{ address: entry2.address, name: "preview_withdraw", params: [
|
|
89759
|
+
{ address: entry2.address, name: "preview_withdraw", params: [ONE_SHARE4] },
|
|
89296
89760
|
{ address: amm, name: "max_debt", params: [] },
|
|
89297
89761
|
{ address: amm, name: "value_oracle", params: [] }
|
|
89298
89762
|
],
|
|
@@ -89311,7 +89775,7 @@ var readerYieldBasisLt = (entry2) => {
|
|
|
89311
89775
|
return void 0;
|
|
89312
89776
|
}
|
|
89313
89777
|
if (totalSupply === 0n || redeemRaw === 0n) return void 0;
|
|
89314
|
-
const totalAssets = totalSupply * redeemRaw /
|
|
89778
|
+
const totalAssets = totalSupply * redeemRaw / ONE_SHARE4;
|
|
89315
89779
|
const exchangeRate = redeemRaw * ONE_E1823 / underlyingUnit;
|
|
89316
89780
|
const equity = Array.isArray(valueOracle) ? toBigInt16(valueOracle[1]) : toBigInt16(valueOracle?.value);
|
|
89317
89781
|
const cap = toBigInt16(maxDebt);
|
|
@@ -89487,8 +89951,198 @@ var readerIporFusion = (entry2) => {
|
|
|
89487
89951
|
};
|
|
89488
89952
|
};
|
|
89489
89953
|
|
|
89490
|
-
// src/vaults/savings/readers/
|
|
89954
|
+
// src/vaults/savings/readers/mezzanine.ts
|
|
89491
89955
|
var NEUTRAL_PROBE5 = "0x000000000000000000000000000000000000dead";
|
|
89956
|
+
var PAUSE_DEPOSITS = 0;
|
|
89957
|
+
var PAUSE_WITHDRAWALS = 1;
|
|
89958
|
+
var BASE_SCALE = 10n ** 12n;
|
|
89959
|
+
var SECONDS_PER_YEAR23 = 31536e3;
|
|
89960
|
+
var mezzanineStreamRate = (args) => {
|
|
89961
|
+
const { amount: amount5, start, end, totalAssets, epochDuration, now } = args;
|
|
89962
|
+
const period = end - start;
|
|
89963
|
+
if (period <= 0 || totalAssets <= 0n) return void 0;
|
|
89964
|
+
if (now >= end + epochDuration) return void 0;
|
|
89965
|
+
const perAsset = Number(amount5 * 1000000000000n / totalAssets) / 1e12;
|
|
89966
|
+
return perAsset / period * SECONDS_PER_YEAR23 * 100;
|
|
89967
|
+
};
|
|
89968
|
+
var mezzanineExitWait = (args) => {
|
|
89969
|
+
const { epochStart, epochDuration, delayEpochs, now } = args;
|
|
89970
|
+
const remainder = Math.max(0, epochStart + epochDuration - now);
|
|
89971
|
+
return remainder + delayEpochs * epochDuration;
|
|
89972
|
+
};
|
|
89973
|
+
var exitDescription = (args) => {
|
|
89974
|
+
const { delayEpochs, yieldCutBps, capacity } = args;
|
|
89975
|
+
const epochs = `${delayEpochs} weekly epoch${delayEpochs === 1 ? "" : "s"}`;
|
|
89976
|
+
const cut = yieldCutBps / 100;
|
|
89977
|
+
return `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 wYLDS only while the vault holds idle wYLDS` + (capacity !== void 0 ? ` (${(Number(capacity) / 1e6).toLocaleString("en-US", { maximumFractionDigits: 0 })} right now)` : "") + `; the curator has to move it there. wYLDS turns into USDC through Hastra's own redemption.`;
|
|
89978
|
+
};
|
|
89979
|
+
var readerMezzanine = (entry2) => {
|
|
89980
|
+
const cfg = entry2.mezzanine;
|
|
89981
|
+
const t = entry2.address;
|
|
89982
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
89983
|
+
const vault = cfg?.issuanceVault ?? "";
|
|
89984
|
+
const mzusd = cfg?.mzusd ?? "";
|
|
89985
|
+
const tranche = (name, params = []) => ({
|
|
89986
|
+
address: t,
|
|
89987
|
+
name,
|
|
89988
|
+
params
|
|
89989
|
+
});
|
|
89990
|
+
const onVault = (name) => ({ address: vault, name, params: [] });
|
|
89991
|
+
const onBase = (name) => ({ address: mzusd, name, params: [] });
|
|
89992
|
+
return {
|
|
89993
|
+
calls: [
|
|
89994
|
+
tranche("totalAssets"),
|
|
89995
|
+
tranche("totalSupply"),
|
|
89996
|
+
tranche("convertToAssets", [shareUnit]),
|
|
89997
|
+
tranche("maxDeposit", [NEUTRAL_PROBE5]),
|
|
89998
|
+
tranche("yieldStreamingAmount"),
|
|
89999
|
+
tranche("yieldStreamStart"),
|
|
90000
|
+
tranche("yieldStreamEnd"),
|
|
90001
|
+
tranche("unstakeDelayEpochs"),
|
|
90002
|
+
tranche("unstakeYieldReductionBps"),
|
|
90003
|
+
tranche("directWithdrawEnabled"),
|
|
90004
|
+
onVault("epochStart"),
|
|
90005
|
+
onVault("epochDuration"),
|
|
90006
|
+
onVault("performanceFeeBps"),
|
|
90007
|
+
onVault("protocolFeeBps"),
|
|
90008
|
+
onBase("withdrawalFeeBps"),
|
|
90009
|
+
onBase("getRemainingRedemptionCap"),
|
|
90010
|
+
{ address: entry2.underlying, name: "balanceOf", params: [vault] },
|
|
90011
|
+
{
|
|
90012
|
+
address: entry2.underlying,
|
|
90013
|
+
name: "balanceOf",
|
|
90014
|
+
params: [cfg?.reservoir ?? ""]
|
|
90015
|
+
},
|
|
90016
|
+
{
|
|
90017
|
+
address: cfg?.allowlist ?? "",
|
|
90018
|
+
name: "verifyAccount",
|
|
90019
|
+
params: [NEUTRAL_PROBE5]
|
|
90020
|
+
},
|
|
90021
|
+
{
|
|
90022
|
+
address: cfg?.pauseManager ?? "",
|
|
90023
|
+
name: "isPaused",
|
|
90024
|
+
params: [mzusd, PAUSE_DEPOSITS]
|
|
90025
|
+
},
|
|
90026
|
+
{
|
|
90027
|
+
address: cfg?.pauseManager ?? "",
|
|
90028
|
+
name: "isPaused",
|
|
90029
|
+
params: [t, PAUSE_WITHDRAWALS]
|
|
90030
|
+
}
|
|
90031
|
+
],
|
|
90032
|
+
abis: [
|
|
90033
|
+
...Array(10).fill(MezzanineTrancheReadAbi),
|
|
90034
|
+
...Array(4).fill(MezzanineVaultReadAbi),
|
|
90035
|
+
...Array(2).fill(MezzanineBaseReadAbi),
|
|
90036
|
+
MezzanineTokenReadAbi,
|
|
90037
|
+
MezzanineTokenReadAbi,
|
|
90038
|
+
MezzanineAllowlistReadAbi,
|
|
90039
|
+
MezzaninePauseReadAbi,
|
|
90040
|
+
MezzaninePauseReadAbi
|
|
90041
|
+
],
|
|
90042
|
+
parse: (slice2) => {
|
|
90043
|
+
const [
|
|
90044
|
+
assets,
|
|
90045
|
+
supply,
|
|
90046
|
+
perShare,
|
|
90047
|
+
maxDep,
|
|
90048
|
+
streamAmount,
|
|
90049
|
+
streamStart,
|
|
90050
|
+
streamEnd,
|
|
90051
|
+
delay,
|
|
90052
|
+
yieldCut,
|
|
90053
|
+
direct,
|
|
90054
|
+
epochStartRaw,
|
|
90055
|
+
epochDurationRaw,
|
|
90056
|
+
perfFee,
|
|
90057
|
+
protocolFee,
|
|
90058
|
+
baseFee,
|
|
90059
|
+
redemptionCap,
|
|
90060
|
+
vaultIdle,
|
|
90061
|
+
reservoirIdle,
|
|
90062
|
+
allowed,
|
|
90063
|
+
depositsPaused,
|
|
90064
|
+
withdrawalsPaused
|
|
90065
|
+
] = slice2;
|
|
90066
|
+
const trancheAssets = toBigInt16(assets);
|
|
90067
|
+
const totalSupply = toBigInt16(supply);
|
|
90068
|
+
const assetsPerShare = toBigInt16(perShare);
|
|
90069
|
+
if (trancheAssets === void 0 || totalSupply === void 0 || assetsPerShare === void 0 || direct === true)
|
|
90070
|
+
return void 0;
|
|
90071
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
90072
|
+
const epochStart = toBigInt16(epochStartRaw);
|
|
90073
|
+
const epochDuration = toBigInt16(epochDurationRaw);
|
|
90074
|
+
const delayEpochs = toBigInt16(delay);
|
|
90075
|
+
const yieldCutBps = toBigInt16(yieldCut);
|
|
90076
|
+
const amount5 = toBigInt16(streamAmount);
|
|
90077
|
+
const start = toBigInt16(streamStart);
|
|
90078
|
+
const end = toBigInt16(streamEnd);
|
|
90079
|
+
const supplyRate = amount5 !== void 0 && start !== void 0 && end !== void 0 && epochDuration !== void 0 ? mezzanineStreamRate({
|
|
90080
|
+
amount: amount5,
|
|
90081
|
+
start: Number(start),
|
|
90082
|
+
end: Number(end),
|
|
90083
|
+
totalAssets: trancheAssets,
|
|
90084
|
+
epochDuration: Number(epochDuration),
|
|
90085
|
+
now
|
|
90086
|
+
}) : void 0;
|
|
90087
|
+
const wait = epochStart !== void 0 && epochDuration !== void 0 && delayEpochs !== void 0 ? mezzanineExitWait({
|
|
90088
|
+
epochStart: Number(epochStart),
|
|
90089
|
+
epochDuration: Number(epochDuration),
|
|
90090
|
+
delayEpochs: Number(delayEpochs),
|
|
90091
|
+
now
|
|
90092
|
+
}) : void 0;
|
|
90093
|
+
const vaultBalance = toBigInt16(vaultIdle);
|
|
90094
|
+
const reservoirBalance = toBigInt16(reservoirIdle);
|
|
90095
|
+
const cap = toBigInt16(redemptionCap);
|
|
90096
|
+
const held = vaultBalance !== void 0 && reservoirBalance !== void 0 ? vaultBalance + reservoirBalance : void 0;
|
|
90097
|
+
const capacity = held !== void 0 && cap !== void 0 ? held < cap ? held : cap : held;
|
|
90098
|
+
const exitFeeBps = toBigInt16(baseFee);
|
|
90099
|
+
const route = {
|
|
90100
|
+
id: "queued",
|
|
90101
|
+
kind: "queued",
|
|
90102
|
+
label: delayEpochs !== void 0 ? `${delayEpochs}-epoch queue` : "Epoch queue",
|
|
90103
|
+
settlement: "async",
|
|
90104
|
+
...exitFeeBps !== void 0 ? { feeBps: Number(exitFeeBps) } : {},
|
|
90105
|
+
...wait !== void 0 ? { waitSeconds: wait } : {},
|
|
90106
|
+
...capacity !== void 0 ? {
|
|
90107
|
+
capacity: capacity.toString(),
|
|
90108
|
+
capacityFormatted: Number(capacity) / 1e6
|
|
90109
|
+
} : {},
|
|
90110
|
+
selfOnly: true,
|
|
90111
|
+
description: exitDescription({
|
|
90112
|
+
delayEpochs: Number(delayEpochs ?? 1n),
|
|
90113
|
+
yieldCutBps: Number(yieldCutBps ?? 0n),
|
|
90114
|
+
capacity
|
|
90115
|
+
})
|
|
90116
|
+
};
|
|
90117
|
+
const perf = toBigInt16(perfFee);
|
|
90118
|
+
const protocol = toBigInt16(protocolFee);
|
|
90119
|
+
const maxDeposit = toBigInt16(maxDep);
|
|
90120
|
+
const closed = allowed === false || depositsPaused === true;
|
|
90121
|
+
const depositCapacity = closed ? 0n : maxDeposit !== void 0 && maxDeposit < 2n ** 255n ? maxDeposit / BASE_SCALE : void 0;
|
|
90122
|
+
return {
|
|
90123
|
+
// The virtual NAV: balance less the unstreamed yield and the assets
|
|
90124
|
+
// reserved for finalized requests, the base of `pricePerShare`.
|
|
90125
|
+
totalAssets: trancheAssets / BASE_SCALE,
|
|
90126
|
+
totalSupply,
|
|
90127
|
+
// MZUSD wei per share IS the 1e18-scaled deposit-asset rate, because
|
|
90128
|
+
// one MZUSD is one deposit-asset unit of notional. No further scaling.
|
|
90129
|
+
exchangeRate: assetsPerShare,
|
|
90130
|
+
...supplyRate !== void 0 ? { supplyRate } : {},
|
|
90131
|
+
exitRoutes: [route],
|
|
90132
|
+
...wait !== void 0 ? { withdrawalCooldownSeconds: wait } : {},
|
|
90133
|
+
...perf !== void 0 && protocol !== void 0 ? { performanceFeeBps: Number(perf + protocol) } : {},
|
|
90134
|
+
...exitFeeBps !== void 0 ? { queuedFeeBps: Number(exitFeeBps) } : {},
|
|
90135
|
+
depositFeeBps: 0,
|
|
90136
|
+
managementFeeBps: 0,
|
|
90137
|
+
...depositCapacity !== void 0 ? { depositCapacity } : {},
|
|
90138
|
+
...withdrawalsPaused === true ? { exitPaused: true } : {}
|
|
90139
|
+
};
|
|
90140
|
+
}
|
|
90141
|
+
};
|
|
90142
|
+
};
|
|
90143
|
+
|
|
90144
|
+
// src/vaults/savings/readers/emberVault.ts
|
|
90145
|
+
var NEUTRAL_PROBE6 = "0x000000000000000000000000000000000000dead";
|
|
89492
90146
|
var readerEmberVault = (entry2) => {
|
|
89493
90147
|
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
89494
90148
|
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
@@ -89497,7 +90151,7 @@ var readerEmberVault = (entry2) => {
|
|
|
89497
90151
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
89498
90152
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
89499
90153
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
89500
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
90154
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE6] },
|
|
89501
90155
|
{ address: entry2.address, name: "pauseStatus", params: [] }
|
|
89502
90156
|
],
|
|
89503
90157
|
abis: [
|
|
@@ -90124,7 +90778,7 @@ var readerUnitasXgld = (entry2) => {
|
|
|
90124
90778
|
};
|
|
90125
90779
|
|
|
90126
90780
|
// src/vaults/savings/readers/roycoTranche.ts
|
|
90127
|
-
var
|
|
90781
|
+
var NEUTRAL_PROBE7 = "0x000000000000000000000000000000000000dead";
|
|
90128
90782
|
var ASSET_CLAIMS = {
|
|
90129
90783
|
name: "claims",
|
|
90130
90784
|
type: "tuple",
|
|
@@ -90227,7 +90881,7 @@ var readerRoycoTranche = (entry2) => {
|
|
|
90227
90881
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
90228
90882
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
90229
90883
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
90230
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
90884
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE7] },
|
|
90231
90885
|
{ address: entry2.address, name: "paused", params: [] },
|
|
90232
90886
|
...entryPoint ? [
|
|
90233
90887
|
{
|
|
@@ -90666,7 +91320,7 @@ var readerAccountableVault = (entry2) => {
|
|
|
90666
91320
|
};
|
|
90667
91321
|
|
|
90668
91322
|
// src/vaults/savings/readers/alchemixTransmuter.ts
|
|
90669
|
-
var
|
|
91323
|
+
var SECONDS_PER_YEAR24 = 31536e3;
|
|
90670
91324
|
var UNCAPPED_FLOOR = 2n ** 200n;
|
|
90671
91325
|
var pow10 = (n) => 10n ** BigInt(n);
|
|
90672
91326
|
var readerAlchemixTransmuter = (entry2) => {
|
|
@@ -90742,7 +91396,7 @@ var readerAlchemixTransmuter = (entry2) => {
|
|
|
90742
91396
|
const price1e18 = out !== void 0 && out > 0n ? out * ONE_E1823 * pow10(18 - cfg.underlyingDecimals) / q.unit : void 0;
|
|
90743
91397
|
const marketDiscountBps = price1e18 !== void 0 ? Number((price1e18 - ONE_E1823) * 100000n / ONE_E1823) / 10 : void 0;
|
|
90744
91398
|
const tf = transmutationFee !== void 0 ? Number(transmutationFee) / 1e4 : 0;
|
|
90745
|
-
const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (
|
|
91399
|
+
const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR24 / termSeconds) * 100 : void 0;
|
|
90746
91400
|
const exitFeeBps = exitFee !== void 0 ? Number(exitFee) : void 0;
|
|
90747
91401
|
const exitRoutes = [
|
|
90748
91402
|
{
|
|
@@ -90787,7 +91441,7 @@ var readerAlchemixTransmuter = (entry2) => {
|
|
|
90787
91441
|
};
|
|
90788
91442
|
|
|
90789
91443
|
// src/vaults/savings/readers/gapSweep.ts
|
|
90790
|
-
var
|
|
91444
|
+
var NEUTRAL_PROBE8 = "0x000000000000000000000000000000000000dead";
|
|
90791
91445
|
var MAX_UINT256 = 2n ** 256n - 1n;
|
|
90792
91446
|
var readerUsdaiStaked = (entry2) => {
|
|
90793
91447
|
const a = entry2.address;
|
|
@@ -90837,7 +91491,7 @@ var readerYuzuIlp = (entry2) => {
|
|
|
90837
91491
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
90838
91492
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
90839
91493
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
90840
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
91494
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE8] },
|
|
90841
91495
|
{ address: entry2.address, name: "paused", params: [] }
|
|
90842
91496
|
],
|
|
90843
91497
|
abis: [
|
|
@@ -90952,6 +91606,8 @@ var buildReader2 = (entry2) => {
|
|
|
90952
91606
|
return readerSuperformVault(entry2);
|
|
90953
91607
|
case "ipor-fusion":
|
|
90954
91608
|
return readerIporFusion(entry2);
|
|
91609
|
+
case "mezzanine-tranche":
|
|
91610
|
+
return readerMezzanine(entry2);
|
|
90955
91611
|
case "ember-vault":
|
|
90956
91612
|
return readerEmberVault(entry2);
|
|
90957
91613
|
case "mellow-core":
|
|
@@ -91349,7 +92005,7 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
91349
92005
|
// Only the NAV-oracle reader's entries publish their share price from a
|
|
91350
92006
|
// feed; on every other entry `priceOracle` is unset, so this stays absent
|
|
91351
92007
|
// rather than pointing at an unrelated contract.
|
|
91352
|
-
navOracle: entry2.reader === "nav-oracle" || entry2.reader === "inverter-oracle" ? entry2.priceOracle?.toLowerCase() : void 0,
|
|
92008
|
+
navOracle: entry2.reader === "nav-oracle" || entry2.reader === "inverter-oracle" || entry2.reader === "mezzanine-tranche" ? entry2.priceOracle?.toLowerCase() : void 0,
|
|
91353
92009
|
asset,
|
|
91354
92010
|
priceUsd,
|
|
91355
92011
|
totalAssetsFormatted,
|
|
@@ -93202,6 +93858,10 @@ var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
|
|
|
93202
93858
|
// StockMarketTRBasisTrade
|
|
93203
93859
|
"1-0x99351baed3d8ab544ccb08af96a105910fda71e7",
|
|
93204
93860
|
// aFXArbUSDTRY
|
|
93861
|
+
// Mezzanine's junior tranche: first loss on a levered loop, and paid a rate
|
|
93862
|
+
// that one NAV report can triple. Pinned in `mezzanine.test.ts`.
|
|
93863
|
+
"1-0x6f5d94dc0c8bbf052abf024259d087da45ad96a1",
|
|
93864
|
+
// mjHastra
|
|
93205
93865
|
// IPOR Fusion loops and carries — the share price is collateral at an
|
|
93206
93866
|
// oracle mark minus debt, levered 5–9× on the loops, and on the carries the
|
|
93207
93867
|
// debt sits in a different currency than the vault (dollars against ETH or
|
|
@@ -95240,6 +95900,281 @@ function buildVaultLookup(data) {
|
|
|
95240
95900
|
return map;
|
|
95241
95901
|
}
|
|
95242
95902
|
|
|
95903
|
+
// src/terms/choices.ts
|
|
95904
|
+
function buildPositionChoices(b) {
|
|
95905
|
+
const out = [
|
|
95906
|
+
modeChoice(b),
|
|
95907
|
+
termChoice(b),
|
|
95908
|
+
parameterChoice(b),
|
|
95909
|
+
rateChoice(b)
|
|
95910
|
+
].filter((c) => c != null);
|
|
95911
|
+
return out.length ? out : void 0;
|
|
95912
|
+
}
|
|
95913
|
+
var STANCES = ["cheapest", "balanced", "protected"];
|
|
95914
|
+
var num15 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
95915
|
+
function rateChoice(b) {
|
|
95916
|
+
const us = b.rate.userSet;
|
|
95917
|
+
if (!us?.required || us.min == null || us.max == null) return void 0;
|
|
95918
|
+
const presets = (us.picks ?? []).map((p) => ({
|
|
95919
|
+
id: p.id,
|
|
95920
|
+
value: p.apr,
|
|
95921
|
+
effects: rateEffectsAfterFill(p)
|
|
95922
|
+
}));
|
|
95923
|
+
const fills = presets.some((p) => p.effects.capacity != null);
|
|
95924
|
+
return {
|
|
95925
|
+
id: "rate",
|
|
95926
|
+
kind: "interest-rate",
|
|
95927
|
+
param: { name: "interestRate", encoding: "wad-fraction" },
|
|
95928
|
+
unit: "percent-apr",
|
|
95929
|
+
domain: { min: us.min, max: us.max, step: 0.01 },
|
|
95930
|
+
...us.default != null ? { default: us.default } : {},
|
|
95931
|
+
moves: fills ? ["cost", "capacity", "protection"] : ["cost", "protection"],
|
|
95932
|
+
...presets.length ? { presets } : {},
|
|
95933
|
+
...us.recommended ? { recommended: us.recommended } : {},
|
|
95934
|
+
ladder: { pricing: "queue" },
|
|
95935
|
+
lock: {
|
|
95936
|
+
adjustable: us.adjustable,
|
|
95937
|
+
...us.adjustmentCooldownSecs ? { cooldownSecs: us.adjustmentCooldownSecs } : {},
|
|
95938
|
+
cost: us.adjustable ? "upfront-fee-again" : "close-and-reopen"
|
|
95939
|
+
},
|
|
95940
|
+
...us.pressure ? { pressure: us.pressure } : {},
|
|
95941
|
+
// where the rate decides the fill, the picks move with the size
|
|
95942
|
+
...fills ? { dependsOn: ["size"] } : {}
|
|
95943
|
+
};
|
|
95944
|
+
}
|
|
95945
|
+
function parameterChoice(b) {
|
|
95946
|
+
const liq = b.liquidation;
|
|
95947
|
+
const op = liq.openParameter;
|
|
95948
|
+
if (!op || op.dimension !== "collateralFactor") return void 0;
|
|
95949
|
+
const range2 = "min" in op.domain ? op.domain : void 0;
|
|
95950
|
+
const lock = {
|
|
95951
|
+
adjustable: !op.immutableAfterOpen,
|
|
95952
|
+
...op.adjustCooldownSeconds ? { cooldownSecs: op.adjustCooldownSeconds } : {},
|
|
95953
|
+
cost: op.immutableAfterOpen ? "close-and-reopen" : "none"
|
|
95954
|
+
};
|
|
95955
|
+
if (op.kind === "llamalend-bands") {
|
|
95956
|
+
const curve = liq.bandLtv ?? {};
|
|
95957
|
+
const lo = range2?.min ?? 4;
|
|
95958
|
+
const hi = range2?.max ?? 50;
|
|
95959
|
+
return {
|
|
95960
|
+
id: "bands",
|
|
95961
|
+
kind: "llamalend-bands",
|
|
95962
|
+
param: { name: "bands", encoding: "integer" },
|
|
95963
|
+
unit: "count",
|
|
95964
|
+
domain: { min: lo, max: hi, step: 1 },
|
|
95965
|
+
default: op.default,
|
|
95966
|
+
moves: ["capacity", "protection"],
|
|
95967
|
+
presets: bandPresets(liq, op.default, lo, hi),
|
|
95968
|
+
recommended: "balanced",
|
|
95969
|
+
// without the curve there is nothing to draw a ladder from
|
|
95970
|
+
...Object.keys(curve).length ? { ladder: { pricing: "parameter" } } : {},
|
|
95971
|
+
lock
|
|
95972
|
+
};
|
|
95973
|
+
}
|
|
95974
|
+
if (!range2) return void 0;
|
|
95975
|
+
const mid = Math.round((range2.min + range2.max) / 2 * 1e4) / 1e4;
|
|
95976
|
+
const values = {
|
|
95977
|
+
cheapest: range2.max,
|
|
95978
|
+
balanced: mid,
|
|
95979
|
+
protected: range2.min
|
|
95980
|
+
};
|
|
95981
|
+
return {
|
|
95982
|
+
id: "liqLtv",
|
|
95983
|
+
kind: op.kind,
|
|
95984
|
+
param: { name: "liqLtv", encoding: "fraction" },
|
|
95985
|
+
unit: "percent-ltv",
|
|
95986
|
+
domain: { min: range2.min * 100, max: range2.max * 100, step: 0.01 },
|
|
95987
|
+
default: op.default * 100,
|
|
95988
|
+
moves: ["capacity", "protection"],
|
|
95989
|
+
presets: STANCES.map((id) => ({
|
|
95990
|
+
id,
|
|
95991
|
+
value: values[id] * 100,
|
|
95992
|
+
effects: { maxLtv: values[id] }
|
|
95993
|
+
})),
|
|
95994
|
+
lock
|
|
95995
|
+
};
|
|
95996
|
+
}
|
|
95997
|
+
function termChoice(b) {
|
|
95998
|
+
const menu = b.rate.menu;
|
|
95999
|
+
if (!menu || menu.length < 2) return void 0;
|
|
96000
|
+
const options = menu.map((m) => ({
|
|
96001
|
+
value: m.termId,
|
|
96002
|
+
label: `${Math.round(m.durationDays)} d`,
|
|
96003
|
+
effects: {
|
|
96004
|
+
aprPct: m.apr,
|
|
96005
|
+
...m.available != null ? { capacity: m.available } : {}
|
|
96006
|
+
}
|
|
96007
|
+
}));
|
|
96008
|
+
return {
|
|
96009
|
+
id: "term",
|
|
96010
|
+
kind: "term",
|
|
96011
|
+
param: { name: "termId", encoding: "id" },
|
|
96012
|
+
unit: "id",
|
|
96013
|
+
domain: { values: options.map((o) => o.value) },
|
|
96014
|
+
moves: options.some((o) => o.effects.capacity != null) ? ["cost", "capacity"] : ["cost"],
|
|
96015
|
+
options,
|
|
96016
|
+
lock: { adjustable: false, cost: "close-and-reopen" }
|
|
96017
|
+
};
|
|
96018
|
+
}
|
|
96019
|
+
function modeChoice(b) {
|
|
96020
|
+
const modes = (b.modes ?? []).filter(
|
|
96021
|
+
(m) => m.entry == null || m.entry === "user-selected"
|
|
96022
|
+
);
|
|
96023
|
+
if (modes.length < 2) return void 0;
|
|
96024
|
+
const options = modes.map((m) => {
|
|
96025
|
+
const maxLtv = num15(m.liquidation?.ltv);
|
|
96026
|
+
return {
|
|
96027
|
+
value: m.modeId,
|
|
96028
|
+
...m.label ? { label: m.label } : {},
|
|
96029
|
+
effects: maxLtv != null ? { maxLtv } : {}
|
|
96030
|
+
};
|
|
96031
|
+
});
|
|
96032
|
+
const def = modes.find((m) => m.isDefault)?.modeId;
|
|
96033
|
+
return {
|
|
96034
|
+
id: "mode",
|
|
96035
|
+
kind: "e-mode",
|
|
96036
|
+
param: { name: "modeId", encoding: "id" },
|
|
96037
|
+
unit: "id",
|
|
96038
|
+
domain: { values: options.map((o) => o.value) },
|
|
96039
|
+
...def != null ? { default: def } : {},
|
|
96040
|
+
moves: ["capacity"],
|
|
96041
|
+
options,
|
|
96042
|
+
lock: { adjustable: true, cost: "none" }
|
|
96043
|
+
};
|
|
96044
|
+
}
|
|
96045
|
+
var bandEffects = (liq, n) => {
|
|
96046
|
+
const maxLtv = num15(liq.bandLtv?.[String(n)]);
|
|
96047
|
+
const a = num15(liq.ammA);
|
|
96048
|
+
return {
|
|
96049
|
+
...maxLtv != null ? { maxLtv } : {},
|
|
96050
|
+
...a != null && a > 1 ? { rangeWidth: 1 - ((a - 1) / a) ** n } : {}
|
|
96051
|
+
};
|
|
96052
|
+
};
|
|
96053
|
+
function bandsForStance(curve, def, stance, ltv, lo = 4, hi = 50) {
|
|
96054
|
+
const fits = (n) => {
|
|
96055
|
+
if (ltv == null || !curve || !Object.keys(curve).length) return true;
|
|
96056
|
+
const max = num15(curve[String(n)]);
|
|
96057
|
+
return max != null && max >= ltv;
|
|
96058
|
+
};
|
|
96059
|
+
const domain = [];
|
|
96060
|
+
for (let n = lo; n <= hi; n++) if (fits(n)) domain.push(n);
|
|
96061
|
+
if (!domain.length) return lo;
|
|
96062
|
+
if (stance === "cheapest") return domain[0];
|
|
96063
|
+
if (stance === "protected") return domain[domain.length - 1];
|
|
96064
|
+
return domain.includes(def) ? def : domain[domain.length - 1];
|
|
96065
|
+
}
|
|
96066
|
+
function bandPresets(liq, def, lo, hi, ltv) {
|
|
96067
|
+
return STANCES.map((id) => {
|
|
96068
|
+
const n = bandsForStance(liq.bandLtv, def, id, ltv, lo, hi);
|
|
96069
|
+
return { id, value: n, effects: bandEffects(liq, n) };
|
|
96070
|
+
});
|
|
96071
|
+
}
|
|
96072
|
+
function parameterLadder(b) {
|
|
96073
|
+
const liq = b.liquidation;
|
|
96074
|
+
return Object.entries(liq.bandLtv ?? {}).map(([k, maxLtv]) => {
|
|
96075
|
+
const value = Number(k);
|
|
96076
|
+
return { value, maxLtv, ...bandEffects(liq, value) };
|
|
96077
|
+
}).sort((x, y) => x.value - y.value);
|
|
96078
|
+
}
|
|
96079
|
+
var rateEffects = (q, apr) => {
|
|
96080
|
+
const total = q.totalDebt;
|
|
96081
|
+
const assets = debtAheadOf(q.levels, apr);
|
|
96082
|
+
return {
|
|
96083
|
+
aprPct: apr,
|
|
96084
|
+
...q.picks[0] ? { upfrontFeePct: q.picks[0].upfrontFeePct } : {},
|
|
96085
|
+
ahead: { assets, share: total > 0 ? assets / total : 0 },
|
|
96086
|
+
...q.fill ? { capacity: fillCapacityAt(q.levels, q.fill.idle, apr) } : {}
|
|
96087
|
+
};
|
|
96088
|
+
};
|
|
96089
|
+
function resolveChoices(b, req, queue) {
|
|
96090
|
+
const size = Math.max(0, req.size ?? 0);
|
|
96091
|
+
const choices = (buildPositionChoices(b) ?? []).map((c) => ({ ...c }));
|
|
96092
|
+
const selected = {};
|
|
96093
|
+
const warnings = [];
|
|
96094
|
+
const outcome = {};
|
|
96095
|
+
for (const c of choices) {
|
|
96096
|
+
if (c.id === "rate" && queue) {
|
|
96097
|
+
const picks = resolveRatePicks(queue, size);
|
|
96098
|
+
const presets = picks.map((p) => ({
|
|
96099
|
+
id: p.id,
|
|
96100
|
+
value: p.apr,
|
|
96101
|
+
effects: rateEffectsAfterFill(p)
|
|
96102
|
+
}));
|
|
96103
|
+
c.presets = presets.length ? presets : void 0;
|
|
96104
|
+
if (queue.recommended) c.recommended = queue.recommended;
|
|
96105
|
+
c.pressure = queue.pressure;
|
|
96106
|
+
}
|
|
96107
|
+
if (c.id === "bands" && req.ltv != null && "min" in c.domain)
|
|
96108
|
+
c.presets = bandPresets(
|
|
96109
|
+
b.liquidation,
|
|
96110
|
+
Number(c.default),
|
|
96111
|
+
c.domain.min,
|
|
96112
|
+
c.domain.max,
|
|
96113
|
+
req.ltv
|
|
96114
|
+
);
|
|
96115
|
+
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;
|
|
96116
|
+
if (value == null) continue;
|
|
96117
|
+
selected[c.id] = value;
|
|
96118
|
+
const effects = c.id === "rate" && queue ? rateEffects(queue, Number(value)) : c.id === "bands" ? bandEffects(b.liquidation, Number(value)) : [...c.presets ?? [], ...c.options ?? []].find(
|
|
96119
|
+
(o) => o.value === value
|
|
96120
|
+
)?.effects ?? {};
|
|
96121
|
+
if (effects.aprPct != null) outcome.aprPct = effects.aprPct;
|
|
96122
|
+
if (effects.upfrontFeePct != null)
|
|
96123
|
+
outcome.upfrontFeePct = effects.upfrontFeePct;
|
|
96124
|
+
if (effects.ahead) outcome.ahead = effects.ahead;
|
|
96125
|
+
if (effects.rangeWidth != null) outcome.rangeWidth = effects.rangeWidth;
|
|
96126
|
+
if (effects.maxLtv != null)
|
|
96127
|
+
outcome.maxLtv = Math.min(outcome.maxLtv ?? 1, effects.maxLtv);
|
|
96128
|
+
if (effects.capacity != null)
|
|
96129
|
+
outcome.capacity = Math.min(
|
|
96130
|
+
outcome.capacity ?? Infinity,
|
|
96131
|
+
effects.capacity
|
|
96132
|
+
);
|
|
96133
|
+
if (effects.capacity != null && size > effects.capacity * (1 + 1e-9))
|
|
96134
|
+
warnings.push({ code: "EXCEEDS_CAPACITY", blocking: true, choice: c.id });
|
|
96135
|
+
if (req.ltv != null && effects.maxLtv != null && req.ltv > effects.maxLtv + 1e-9)
|
|
96136
|
+
warnings.push({ code: "LTV_ABOVE_MAX", blocking: true, choice: c.id });
|
|
96137
|
+
if (c.id === "rate" && effects.ahead?.assets === 0 && queue?.totalDebt)
|
|
96138
|
+
warnings.push({ code: "NOTHING_AHEAD", blocking: false, choice: c.id });
|
|
96139
|
+
}
|
|
96140
|
+
return { choices, selected, outcome, warnings };
|
|
96141
|
+
}
|
|
96142
|
+
var rateEffectsAfterFill = (p) => ({
|
|
96143
|
+
aprPct: p.apr,
|
|
96144
|
+
upfrontFeePct: p.upfrontFeePct,
|
|
96145
|
+
ahead: { assets: p.debtAhead, share: p.share },
|
|
96146
|
+
...p.capacity != null ? { capacity: p.capacity } : {}
|
|
96147
|
+
});
|
|
96148
|
+
function resolveStance(c, stance) {
|
|
96149
|
+
const want = STANCES.indexOf(stance);
|
|
96150
|
+
for (let i = want; i >= 0; i--) {
|
|
96151
|
+
const p = c.presets?.find((x) => x.id === STANCES[i]);
|
|
96152
|
+
if (p) return p.value;
|
|
96153
|
+
}
|
|
96154
|
+
return c.presets?.[0]?.value ?? c.default;
|
|
96155
|
+
}
|
|
96156
|
+
function encodeChoiceValue(c, value) {
|
|
96157
|
+
switch (c.param.encoding) {
|
|
96158
|
+
case "wad-fraction":
|
|
96159
|
+
return (BigInt(Math.round(Number(value) * 1e6)) * 10n ** 10n).toString();
|
|
96160
|
+
case "fraction":
|
|
96161
|
+
return String(Number(value) / 100);
|
|
96162
|
+
default:
|
|
96163
|
+
return String(value);
|
|
96164
|
+
}
|
|
96165
|
+
}
|
|
96166
|
+
function digestChoices(choices) {
|
|
96167
|
+
if (!choices?.length) return void 0;
|
|
96168
|
+
return choices.map((c) => ({
|
|
96169
|
+
id: c.id,
|
|
96170
|
+
param: c.param,
|
|
96171
|
+
unit: c.unit,
|
|
96172
|
+
...c.default != null ? { default: c.default } : {},
|
|
96173
|
+
...c.recommended ? { recommended: c.recommended } : {},
|
|
96174
|
+
...c.presets?.length ? { presets: c.presets.map((p) => ({ id: p.id, value: p.value })) } : {}
|
|
96175
|
+
}));
|
|
96176
|
+
}
|
|
96177
|
+
|
|
95243
96178
|
// src/terms/tags.ts
|
|
95244
96179
|
var push = (set, ...tags) => {
|
|
95245
96180
|
for (const t of tags) set.add(t);
|
|
@@ -96871,7 +97806,8 @@ function rewardTerms(input, side2) {
|
|
|
96871
97806
|
return out.length ? out : void 0;
|
|
96872
97807
|
}
|
|
96873
97808
|
function buildRate(input, side2) {
|
|
96874
|
-
const
|
|
97809
|
+
const rowKind = rateKindOf(input);
|
|
97810
|
+
const kind = side2 === "supply" && rowKind === "user-set" ? "variable-curve" : rowKind;
|
|
96875
97811
|
const rewards = rewardTerms(input, side2);
|
|
96876
97812
|
const priceableRewards = (rewards ?? []).filter((r) => !r.indicative).reduce((s, r) => s + r.apr, 0);
|
|
96877
97813
|
const menuBest = input.terms?.length ? Math.min(...input.terms.map((t) => t.apr)) : void 0;
|
|
@@ -97048,7 +97984,8 @@ function buildAvailability(input, side2) {
|
|
|
97048
97984
|
const total = side2 === "supply" ? input.totalDeposits : input.totalDebt;
|
|
97049
97985
|
const capUtilization = capUtil(total, cap);
|
|
97050
97986
|
const capFull = capUtilization != null && capUtilization >= 1;
|
|
97051
|
-
const
|
|
97987
|
+
const queuePicks = input.market?.flex?.queue?.picks;
|
|
97988
|
+
const noLiquidity = side2 === "borrow" && isNum(input.borrowLiquidity) && input.borrowLiquidity <= 0 && !queuePicks?.some((p) => (p.capacity ?? 0) > 0);
|
|
97052
97989
|
const canOpen = enabled && !frozen && !inactive && !capFull && !noLiquidity;
|
|
97053
97990
|
let blockedBy;
|
|
97054
97991
|
if (!canOpen) {
|
|
@@ -97328,6 +98265,9 @@ function finalizeInfo(sheet) {
|
|
|
97328
98265
|
implications: sheet.borrow.info.implications,
|
|
97329
98266
|
tags: deriveBorrowTags(sheet.borrow, market)
|
|
97330
98267
|
};
|
|
98268
|
+
const choices = buildPositionChoices(sheet.borrow);
|
|
98269
|
+
if (choices) sheet.borrow.choices = choices;
|
|
98270
|
+
else delete sheet.borrow.choices;
|
|
97331
98271
|
}
|
|
97332
98272
|
return sheet;
|
|
97333
98273
|
}
|
|
@@ -98811,7 +99751,7 @@ function resolveEarnIdentity(venue, brand, publishedProtocol) {
|
|
|
98811
99751
|
}
|
|
98812
99752
|
return { protocol: { key: key5, name: protocolName }, curator: { name } };
|
|
98813
99753
|
}
|
|
98814
|
-
function
|
|
99754
|
+
function num16(v) {
|
|
98815
99755
|
if (v == null || v === "") return void 0;
|
|
98816
99756
|
const n = typeof v === "number" ? v : Number(v);
|
|
98817
99757
|
return Number.isFinite(n) ? n : void 0;
|
|
@@ -98911,8 +99851,8 @@ function resolveExitMode2(provider, meta, tvl, liq) {
|
|
|
98911
99851
|
if (declared) return declared;
|
|
98912
99852
|
const fallback = vaultTraits(provider)?.defaultExitMode ?? "instant";
|
|
98913
99853
|
if (fallback !== "instant-capped") return fallback;
|
|
98914
|
-
const total =
|
|
98915
|
-
const available =
|
|
99854
|
+
const total = num16(tvl?.totalAssetsFormatted) ?? num16(tvl?.totalAssetsUsd);
|
|
99855
|
+
const available = num16(liq?.liquidityFormatted) ?? num16(liq?.liquidityUsd);
|
|
98916
99856
|
if (total === void 0 || available === void 0) return "instant-capped";
|
|
98917
99857
|
if (total <= 0) return "instant";
|
|
98918
99858
|
return available >= total ? "instant" : "instant-capped";
|
|
@@ -98950,8 +99890,8 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
98950
99890
|
const rates = row.rates ?? {};
|
|
98951
99891
|
const tvl = row.tvl ?? {};
|
|
98952
99892
|
const liq = row.liquidity ?? {};
|
|
98953
|
-
const shareDecimals =
|
|
98954
|
-
const assetDecimals =
|
|
99893
|
+
const shareDecimals = num16(row.decimals) ?? 18;
|
|
99894
|
+
const assetDecimals = num16(row.assetDecimals) ?? num16(row.underlyingInfo?.asset?.decimals) ?? shareDecimals;
|
|
98955
99895
|
const rateUnavailable = isRateSourceUnavailable(str6(meta.rateSource));
|
|
98956
99896
|
const toPercent2 = (v) => rateUnavailable ? void 0 : ratePercent(v, provider, opts.fractionRateProviders);
|
|
98957
99897
|
const rewards = toPercent2(rates.rewardsRate);
|
|
@@ -99041,7 +99981,7 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
99041
99981
|
symbol: str6(row.underlyingInfo?.asset?.symbol) ?? "",
|
|
99042
99982
|
decimals: assetDecimals,
|
|
99043
99983
|
assetGroup: str6(info.assetGroup),
|
|
99044
|
-
priceUsd:
|
|
99984
|
+
priceUsd: num16(row.underlyingInfo?.prices?.priceUsd)
|
|
99045
99985
|
},
|
|
99046
99986
|
// The vault IS a share token by construction; carry it so a withdraw in
|
|
99047
99987
|
// share units can be built without a second lookup.
|
|
@@ -99071,8 +100011,8 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
99071
100011
|
exit: {
|
|
99072
100012
|
mode: exitMode,
|
|
99073
100013
|
settlement: str6(meta.redemptionType),
|
|
99074
|
-
cooldownSecs:
|
|
99075
|
-
feeBps:
|
|
100014
|
+
cooldownSecs: num16(meta.withdrawalCooldownSeconds),
|
|
100015
|
+
feeBps: num16(meta.withdrawFeeBps),
|
|
99076
100016
|
// Passed through, never re-derived: the earn row and the vault row must
|
|
99077
100017
|
// not disagree about what the legs out are.
|
|
99078
100018
|
routes: Array.isArray(meta.exitRoutes) ? meta.exitRoutes : void 0
|
|
@@ -99085,12 +100025,12 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
99085
100025
|
// since the surface was written and never populated — a tranche's
|
|
99086
100026
|
// first-loss position is the term most worth surfacing on a rate list.
|
|
99087
100027
|
counterparty: str6(meta.solvency),
|
|
99088
|
-
score:
|
|
100028
|
+
score: num16(row.rating?.score),
|
|
99089
100029
|
label: str6(row.rating?.level),
|
|
99090
100030
|
illiquid: isIlliquid({
|
|
99091
100031
|
exitMode,
|
|
99092
|
-
tvlUsd:
|
|
99093
|
-
liquidityUsd:
|
|
100032
|
+
tvlUsd: num16(tvl.totalAssetsUsd),
|
|
100033
|
+
liquidityUsd: num16(liq.liquidityUsd)
|
|
99094
100034
|
})
|
|
99095
100035
|
},
|
|
99096
100036
|
// Filled by `capabilities.ts` — kept required on the type so a normalizer
|
|
@@ -99102,7 +100042,7 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
99102
100042
|
return market;
|
|
99103
100043
|
}
|
|
99104
100044
|
function ratePercent(value, provider, fractionProviders = FRACTION_RATE_PROVIDERS) {
|
|
99105
|
-
const n =
|
|
100045
|
+
const n = num16(value);
|
|
99106
100046
|
if (n === void 0) return void 0;
|
|
99107
100047
|
return fractionProviders.has(provider) ? n * 100 : n;
|
|
99108
100048
|
}
|
|
@@ -99111,7 +100051,7 @@ function implausibleRatePercent(percent) {
|
|
|
99111
100051
|
}
|
|
99112
100052
|
function resolveRateKind(provider, meta) {
|
|
99113
100053
|
if (meta.navOracle || meta.solvency === "nav-attested") return "nav-accrual";
|
|
99114
|
-
if (meta.rateBasis === "entry-discount" && ((
|
|
100054
|
+
if (meta.rateBasis === "entry-discount" && ((num16(meta.termSeconds) ?? 0) > 0 || (num16(meta.expiry) ?? 0) > 0))
|
|
99115
100055
|
return "fixed-term";
|
|
99116
100056
|
return RATE_KIND[provider] ?? "variable-managed";
|
|
99117
100057
|
}
|
|
@@ -99164,9 +100104,9 @@ function vaultDisplayName(row, info) {
|
|
|
99164
100104
|
return str6(row.name) ?? str6(info.name) ?? str6(row.displayName) ?? str6(share?.name) ?? str6(share?.symbol) ?? str6(info.symbol) ?? str6(row.symbol);
|
|
99165
100105
|
}
|
|
99166
100106
|
function resolveMaturity(meta) {
|
|
99167
|
-
const expiry =
|
|
100107
|
+
const expiry = num16(meta.expiry) ?? num16(meta.maturity);
|
|
99168
100108
|
if (expiry === void 0 || expiry <= 0) {
|
|
99169
|
-
const term =
|
|
100109
|
+
const term = num16(meta.termSeconds);
|
|
99170
100110
|
if (term !== void 0 && term > 0)
|
|
99171
100111
|
return {
|
|
99172
100112
|
kind: "rolling-duration",
|
|
@@ -99214,8 +100154,8 @@ function amount3(raw, formatted, usd, decimals) {
|
|
|
99214
100154
|
const rawStr = raw != null ? String(raw) : void 0;
|
|
99215
100155
|
return {
|
|
99216
100156
|
raw: rawStr,
|
|
99217
|
-
formatted:
|
|
99218
|
-
usd:
|
|
100157
|
+
formatted: num16(formatted) ?? formatRaw(rawStr, decimals),
|
|
100158
|
+
usd: num16(usd)
|
|
99219
100159
|
};
|
|
99220
100160
|
}
|
|
99221
100161
|
function withCuratorEntity(id, entity) {
|
|
@@ -99262,7 +100202,7 @@ function managedVaultCuration(provider, chainId, address) {
|
|
|
99262
100202
|
}
|
|
99263
100203
|
|
|
99264
100204
|
// src/terms/vault/input.ts
|
|
99265
|
-
var
|
|
100205
|
+
var num17 = (v) => {
|
|
99266
100206
|
if (typeof v === "number") return Number.isFinite(v) ? v : void 0;
|
|
99267
100207
|
if (typeof v === "string" && v.trim() !== "") {
|
|
99268
100208
|
const n = Number(v);
|
|
@@ -99293,13 +100233,13 @@ var fromRaw = (raw, decimals) => {
|
|
|
99293
100233
|
function sdkRates(row, provider) {
|
|
99294
100234
|
if (!SDK_FRACTION_RATE_PROVIDERS.has(provider)) {
|
|
99295
100235
|
return {
|
|
99296
|
-
supplyRate:
|
|
99297
|
-
rewardsRate:
|
|
99298
|
-
totalRate:
|
|
100236
|
+
supplyRate: num17(row.supplyRate),
|
|
100237
|
+
rewardsRate: num17(row.rewardsRate),
|
|
100238
|
+
totalRate: num17(row.depositRate)
|
|
99299
100239
|
};
|
|
99300
100240
|
}
|
|
99301
100241
|
const pct5 = (v) => {
|
|
99302
|
-
const n =
|
|
100242
|
+
const n = num17(v);
|
|
99303
100243
|
return n === void 0 ? void 0 : n * 100;
|
|
99304
100244
|
};
|
|
99305
100245
|
return {
|
|
@@ -99313,7 +100253,7 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
99313
100253
|
const row = vault;
|
|
99314
100254
|
const address = str7(row.address)?.toLowerCase();
|
|
99315
100255
|
if (!address) return void 0;
|
|
99316
|
-
const assetDecimals =
|
|
100256
|
+
const assetDecimals = num17(row.assetDecimals) ?? num17(row.decimals);
|
|
99317
100257
|
const asset = row.asset;
|
|
99318
100258
|
return {
|
|
99319
100259
|
provider,
|
|
@@ -99339,25 +100279,25 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
99339
100279
|
// GMX / HyperCore / Pendle report USD only and set the token-denominated
|
|
99340
100280
|
// fields to their USD figure — `totalAssetsFormatted` is the cross-provider
|
|
99341
100281
|
// magnitude either way, so prefer it over re-deriving from raw.
|
|
99342
|
-
totalAssets:
|
|
99343
|
-
totalAssetsUsd:
|
|
99344
|
-
liquidity:
|
|
99345
|
-
liquidityUsd:
|
|
99346
|
-
instantLiquidityRatio:
|
|
100282
|
+
totalAssets: num17(row.totalAssetsFormatted) ?? fromRaw(row.totalAssets, assetDecimals),
|
|
100283
|
+
totalAssetsUsd: num17(row.totalAssetsUsd) ?? num17(row.tvlUsd),
|
|
100284
|
+
liquidity: num17(row.liquidityFormatted) ?? fromRaw(row.liquidity, assetDecimals),
|
|
100285
|
+
liquidityUsd: num17(row.liquidityUsd),
|
|
100286
|
+
instantLiquidityRatio: num17(row.instantLiquidityRatio),
|
|
99347
100287
|
totalBorrowed: fromRaw(row.totalBorrowed, assetDecimals),
|
|
99348
100288
|
expectedLiquidity: fromRaw(row.expectedLiquidity, assetDecimals),
|
|
99349
100289
|
withdrawalMode: str7(row.withdrawalMode),
|
|
99350
|
-
withdrawalCooldownSeconds:
|
|
99351
|
-
withdrawFeeBps:
|
|
99352
|
-
depositFeeBps:
|
|
100290
|
+
withdrawalCooldownSeconds: num17(row.withdrawalCooldownSeconds),
|
|
100291
|
+
withdrawFeeBps: num17(row.withdrawFeeBps),
|
|
100292
|
+
depositFeeBps: num17(row.depositFeeBps),
|
|
99353
100293
|
feeScheduleComplete: bool5(row.feeScheduleComplete),
|
|
99354
100294
|
exitRoutes: routes(row.exitRoutes),
|
|
99355
|
-
fee:
|
|
99356
|
-
managementFee:
|
|
99357
|
-
swapFeeRate:
|
|
99358
|
-
redemptionDiscountBps:
|
|
100295
|
+
fee: num17(row.fee),
|
|
100296
|
+
managementFee: num17(row.managementFee),
|
|
100297
|
+
swapFeeRate: num17(row.feeRate),
|
|
100298
|
+
redemptionDiscountBps: num17(row.redemptionDiscountBps),
|
|
99359
100299
|
instantRedeemEnabled: bool5(row.instantRedeemEnabled),
|
|
99360
|
-
yieldWarmupSeconds:
|
|
100300
|
+
yieldWarmupSeconds: num17(row.yieldWarmupSeconds),
|
|
99361
100301
|
accrual: str7(row.accrual),
|
|
99362
100302
|
needsDepositApproval: bool5(row.needsDepositApproval),
|
|
99363
100303
|
isMintable: bool5(row.isMintable),
|
|
@@ -99368,10 +100308,10 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
99368
100308
|
withdrawalsPaused: bool5(row.isWithdrawalPaused),
|
|
99369
100309
|
isClosed: bool5(row.isClosed),
|
|
99370
100310
|
whitelisted: bool5(row.whitelisted),
|
|
99371
|
-
expiry:
|
|
99372
|
-
termSeconds:
|
|
100311
|
+
expiry: num17(row.expiry),
|
|
100312
|
+
termSeconds: num17(row.termSeconds),
|
|
99373
100313
|
rateBasis: str7(row.rateBasis),
|
|
99374
|
-
timelock:
|
|
100314
|
+
timelock: num17(row.timelock),
|
|
99375
100315
|
allocators: strArray(row.allocators),
|
|
99376
100316
|
owner: str7(row.owner),
|
|
99377
100317
|
curator: str7(row.curator),
|
|
@@ -99448,19 +100388,19 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
99448
100388
|
totalAssetsUsd: m.tvl.usd,
|
|
99449
100389
|
liquidity: m.liquidity?.formatted,
|
|
99450
100390
|
liquidityUsd: m.liquidity?.usd,
|
|
99451
|
-
instantLiquidityRatio:
|
|
99452
|
-
totalBorrowed:
|
|
99453
|
-
expectedLiquidity:
|
|
100391
|
+
instantLiquidityRatio: num17(meta.instantLiquidityRatio),
|
|
100392
|
+
totalBorrowed: num17(meta.totalBorrowed),
|
|
100393
|
+
expectedLiquidity: num17(meta.expectedLiquidity),
|
|
99454
100394
|
withdrawalMode: m.exit.mode,
|
|
99455
100395
|
withdrawalCooldownSeconds: m.exit.cooldownSecs,
|
|
99456
100396
|
withdrawFeeBps: m.exit.feeBps,
|
|
99457
100397
|
exitRoutes: routes(m.exit.routes),
|
|
99458
100398
|
fee: m.rate.fee,
|
|
99459
|
-
managementFee:
|
|
99460
|
-
swapFeeRate:
|
|
99461
|
-
redemptionDiscountBps:
|
|
100399
|
+
managementFee: num17(meta.managementFee),
|
|
100400
|
+
swapFeeRate: num17(meta.feeRate),
|
|
100401
|
+
redemptionDiscountBps: num17(meta.redemptionDiscountBps),
|
|
99462
100402
|
instantRedeemEnabled: bool5(meta.instantRedeemEnabled),
|
|
99463
|
-
yieldWarmupSeconds:
|
|
100403
|
+
yieldWarmupSeconds: num17(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
|
|
99464
100404
|
accrual: str7(meta.accrual) ?? curated.accrual,
|
|
99465
100405
|
needsDepositApproval: bool5(meta.needsDepositApproval) ?? curated.needsDepositApproval,
|
|
99466
100406
|
// `canDeposit` already folds in the cap, the pause and the gate, so it is
|
|
@@ -99474,9 +100414,9 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
99474
100414
|
isClosed: bool5(meta.isClosed),
|
|
99475
100415
|
whitelisted: bool5(meta.whitelisted),
|
|
99476
100416
|
expiry: m.maturity?.maturity ?? curated.expiry,
|
|
99477
|
-
termSeconds: (m.maturity?.kind === "rolling-duration" ? m.maturity.maxDurationSecs : void 0) ??
|
|
100417
|
+
termSeconds: (m.maturity?.kind === "rolling-duration" ? m.maturity.maxDurationSecs : void 0) ?? num17(meta.termSeconds) ?? curated.termSeconds,
|
|
99478
100418
|
rateBasis: str7(meta.rateBasis) ?? curated.rateBasis,
|
|
99479
|
-
timelock:
|
|
100419
|
+
timelock: num17(meta.timelock),
|
|
99480
100420
|
allocators: strArray(meta.allocators),
|
|
99481
100421
|
owner: str7(meta.owner),
|
|
99482
100422
|
curator: str7(meta.curator),
|
|
@@ -99489,13 +100429,13 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
99489
100429
|
};
|
|
99490
100430
|
}
|
|
99491
100431
|
function originRates(rates) {
|
|
99492
|
-
const supply =
|
|
99493
|
-
const rewards =
|
|
99494
|
-
const deposit =
|
|
100432
|
+
const supply = num17(rates.supplyRate);
|
|
100433
|
+
const rewards = num17(rates.rewardsRate);
|
|
100434
|
+
const deposit = num17(rates.depositRate);
|
|
99495
100435
|
return {
|
|
99496
100436
|
supplyRate: supply ?? (deposit !== void 0 && rewards !== void 0 ? deposit - rewards : deposit),
|
|
99497
100437
|
rewardsRate: rewards,
|
|
99498
|
-
totalRate:
|
|
100438
|
+
totalRate: num17(rates.totalRate) ?? deposit
|
|
99499
100439
|
};
|
|
99500
100440
|
}
|
|
99501
100441
|
function vaultTermInputFromSourceRow(row, chainId) {
|
|
@@ -99508,7 +100448,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
99508
100448
|
const liq = row.liquidity ?? {};
|
|
99509
100449
|
const info = row.vaultInfo ?? {};
|
|
99510
100450
|
const assetInfo = row.underlyingInfo?.asset;
|
|
99511
|
-
const assetDecimals =
|
|
100451
|
+
const assetDecimals = num17(row.assetDecimals) ?? num17(assetInfo?.decimals) ?? num17(row.decimals);
|
|
99512
100452
|
const curated = savingsCuration(provider, chainId, address, {
|
|
99513
100453
|
brand: str7(row.curatorName) ?? str7(meta.brand),
|
|
99514
100454
|
name: str7(info.name) ?? str7(row.displayName) ?? str7(row.name)
|
|
@@ -99533,23 +100473,23 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
99533
100473
|
...originRates(rates),
|
|
99534
100474
|
isForwardApr: bool5(meta.isForwardApr),
|
|
99535
100475
|
aprWindow: str7(meta.aprWindow),
|
|
99536
|
-
totalAssets:
|
|
99537
|
-
totalAssetsUsd:
|
|
99538
|
-
liquidity:
|
|
99539
|
-
liquidityUsd:
|
|
99540
|
-
instantLiquidityRatio:
|
|
100476
|
+
totalAssets: num17(tvl.totalAssetsFormatted) ?? fromRaw(tvl.totalAssets, assetDecimals),
|
|
100477
|
+
totalAssetsUsd: num17(tvl.totalAssetsUsd),
|
|
100478
|
+
liquidity: num17(liq.liquidityFormatted) ?? fromRaw(liq.liquidity, assetDecimals),
|
|
100479
|
+
liquidityUsd: num17(liq.liquidityUsd),
|
|
100480
|
+
instantLiquidityRatio: num17(meta.instantLiquidityRatio),
|
|
99541
100481
|
totalBorrowed: fromRaw(meta.totalBorrowed, assetDecimals),
|
|
99542
100482
|
expectedLiquidity: fromRaw(meta.expectedLiquidity, assetDecimals),
|
|
99543
100483
|
withdrawalMode: str7(meta.withdrawalMode),
|
|
99544
|
-
withdrawalCooldownSeconds:
|
|
99545
|
-
withdrawFeeBps:
|
|
100484
|
+
withdrawalCooldownSeconds: num17(meta.withdrawalCooldownSeconds),
|
|
100485
|
+
withdrawFeeBps: num17(meta.withdrawFeeBps),
|
|
99546
100486
|
exitRoutes: routes(meta.exitRoutes),
|
|
99547
|
-
fee:
|
|
99548
|
-
managementFee:
|
|
99549
|
-
swapFeeRate:
|
|
99550
|
-
redemptionDiscountBps:
|
|
100487
|
+
fee: num17(rates.fee),
|
|
100488
|
+
managementFee: num17(meta.managementFee),
|
|
100489
|
+
swapFeeRate: num17(meta.feeRate),
|
|
100490
|
+
redemptionDiscountBps: num17(meta.redemptionDiscountBps),
|
|
99551
100491
|
instantRedeemEnabled: bool5(meta.instantRedeemEnabled),
|
|
99552
|
-
yieldWarmupSeconds:
|
|
100492
|
+
yieldWarmupSeconds: num17(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
|
|
99553
100493
|
accrual: str7(meta.accrual) ?? curated.accrual,
|
|
99554
100494
|
needsDepositApproval: bool5(meta.needsDepositApproval) ?? curated.needsDepositApproval,
|
|
99555
100495
|
isMintable: bool5(meta.isMintable),
|
|
@@ -99560,10 +100500,10 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
99560
100500
|
withdrawalsPaused: bool5(meta.isWithdrawalPaused),
|
|
99561
100501
|
isClosed: bool5(meta.isClosed),
|
|
99562
100502
|
whitelisted: bool5(meta.whitelisted),
|
|
99563
|
-
expiry:
|
|
99564
|
-
termSeconds:
|
|
100503
|
+
expiry: num17(meta.expiry) ?? num17(meta.maturity) ?? curated.expiry,
|
|
100504
|
+
termSeconds: num17(meta.termSeconds) ?? curated.termSeconds,
|
|
99565
100505
|
rateBasis: str7(meta.rateBasis) ?? curated.rateBasis,
|
|
99566
|
-
timelock:
|
|
100506
|
+
timelock: num17(meta.timelock),
|
|
99567
100507
|
allocators: strArray(meta.allocators),
|
|
99568
100508
|
owner: str7(meta.owner),
|
|
99569
100509
|
curator: str7(meta.curator),
|
|
@@ -100390,7 +101330,7 @@ async function fetchTokenBalances(chainId, account, tokens, options = {}) {
|
|
|
100390
101330
|
}
|
|
100391
101331
|
|
|
100392
101332
|
// src/terms/input.ts
|
|
100393
|
-
var
|
|
101333
|
+
var num18 = (v) => {
|
|
100394
101334
|
if (v == null) return void 0;
|
|
100395
101335
|
const n = typeof v === "string" ? Number(v) : v;
|
|
100396
101336
|
return Number.isFinite(n) ? n : void 0;
|
|
@@ -100421,20 +101361,20 @@ function toTermSheetInput(row, ctx = {}) {
|
|
|
100421
101361
|
{
|
|
100422
101362
|
category: v?.category ?? k,
|
|
100423
101363
|
label: v?.label,
|
|
100424
|
-
borrowCollateralFactor:
|
|
100425
|
-
collateralFactor:
|
|
100426
|
-
borrowFactor:
|
|
100427
|
-
liquidationPenalty:
|
|
100428
|
-
closeFactor:
|
|
100429
|
-
targetHealthFactor:
|
|
101364
|
+
borrowCollateralFactor: num18(v?.borrowCollateralFactor),
|
|
101365
|
+
collateralFactor: num18(v?.collateralFactor),
|
|
101366
|
+
borrowFactor: num18(v?.borrowFactor),
|
|
101367
|
+
liquidationPenalty: num18(v?.liquidationPenalty),
|
|
101368
|
+
closeFactor: num18(v?.closeFactor),
|
|
101369
|
+
targetHealthFactor: num18(v?.targetHealthFactor),
|
|
100430
101370
|
collateralDisabled: v?.collateralDisabled === true,
|
|
100431
101371
|
debtDisabled: v?.debtDisabled === true,
|
|
100432
101372
|
// the mode-level position fields (UNIFIED_API_AUDIT §11) — set
|
|
100433
101373
|
// only where the row carries them, so EVM inputs are unchanged
|
|
100434
|
-
...v?.liquidationBorrowFactor != null ? { liquidationBorrowFactor:
|
|
100435
|
-
...v?.debtCapacity != null ? { debtCapacity:
|
|
100436
|
-
...v?.collateralDebtCapacity != null ? { collateralDebtCapacity:
|
|
100437
|
-
...v?.maxCollateralAssets != null ? { maxCollateralAssets:
|
|
101374
|
+
...v?.liquidationBorrowFactor != null ? { liquidationBorrowFactor: num18(v.liquidationBorrowFactor) } : {},
|
|
101375
|
+
...v?.debtCapacity != null ? { debtCapacity: num18(v.debtCapacity) } : {},
|
|
101376
|
+
...v?.collateralDebtCapacity != null ? { collateralDebtCapacity: num18(v.collateralDebtCapacity) } : {},
|
|
101377
|
+
...v?.maxCollateralAssets != null ? { maxCollateralAssets: num18(v.maxCollateralAssets) } : {},
|
|
100438
101378
|
...v?.exclusiveCollateral != null ? { exclusiveCollateral: v.exclusiveCollateral === true } : {},
|
|
100439
101379
|
...v?.openParameter ? { openParameter: v.openParameter } : {}
|
|
100440
101380
|
}
|
|
@@ -100442,11 +101382,11 @@ function toTermSheetInput(row, ctx = {}) {
|
|
|
100442
101382
|
) : void 0;
|
|
100443
101383
|
const rewards = pick2(row, "rewards")?.map((r) => ({
|
|
100444
101384
|
asset: r?.asset,
|
|
100445
|
-
depositRate:
|
|
100446
|
-
variableBorrowRate:
|
|
100447
|
-
stableBorrowRate:
|
|
101385
|
+
depositRate: num18(r?.depositRate),
|
|
101386
|
+
variableBorrowRate: num18(r?.variableBorrowRate),
|
|
101387
|
+
stableBorrowRate: num18(r?.stableBorrowRate),
|
|
100448
101388
|
kind: r?.kind,
|
|
100449
|
-
endsAt:
|
|
101389
|
+
endsAt: num18(r?.endsAt),
|
|
100450
101390
|
claim: r?.claim
|
|
100451
101391
|
}));
|
|
100452
101392
|
return {
|
|
@@ -100460,29 +101400,29 @@ function toTermSheetInput(row, ctx = {}) {
|
|
|
100460
101400
|
(v) => !!v && typeof v === "object"
|
|
100461
101401
|
),
|
|
100462
101402
|
underlying: pick2(row, "underlying"),
|
|
100463
|
-
decimals:
|
|
100464
|
-
depositRate:
|
|
100465
|
-
variableBorrowRate:
|
|
100466
|
-
stableBorrowRate:
|
|
100467
|
-
intrinsicYield:
|
|
101403
|
+
decimals: num18(pick2(row, "decimals")),
|
|
101404
|
+
depositRate: num18(pick2(row, "depositRate")),
|
|
101405
|
+
variableBorrowRate: num18(pick2(row, "variableBorrowRate")),
|
|
101406
|
+
stableBorrowRate: num18(pick2(row, "stableBorrowRate")),
|
|
101407
|
+
intrinsicYield: num18(pick2(row, "intrinsicYield")),
|
|
100468
101408
|
rewards,
|
|
100469
101409
|
rateModel: pick2(row, "rateModel"),
|
|
100470
|
-
originationFee:
|
|
100471
|
-
totalDeposits:
|
|
100472
|
-
totalDebt:
|
|
100473
|
-
totalDebtStable:
|
|
100474
|
-
totalLiquidity:
|
|
100475
|
-
borrowLiquidity:
|
|
100476
|
-
totalDepositsUsd:
|
|
100477
|
-
totalDebtUsd:
|
|
100478
|
-
totalLiquidityUsd:
|
|
100479
|
-
utilization:
|
|
100480
|
-
irmTotalDeposits:
|
|
100481
|
-
irmTotalDebt:
|
|
100482
|
-
lockupRatio:
|
|
101410
|
+
originationFee: num18(pick2(row, "originationFee")),
|
|
101411
|
+
totalDeposits: num18(pick2(row, "totalDeposits")),
|
|
101412
|
+
totalDebt: num18(pick2(row, "totalDebt")),
|
|
101413
|
+
totalDebtStable: num18(pick2(row, "totalDebtStable")),
|
|
101414
|
+
totalLiquidity: num18(pick2(row, "totalLiquidity")),
|
|
101415
|
+
borrowLiquidity: num18(pick2(row, "borrowLiquidity")),
|
|
101416
|
+
totalDepositsUsd: num18(pick2(row, "totalDepositsUSD", "totalDepositsUsd")),
|
|
101417
|
+
totalDebtUsd: num18(pick2(row, "totalDebtUSD", "totalDebtUsd")),
|
|
101418
|
+
totalLiquidityUsd: num18(pick2(row, "totalLiquidityUSD", "totalLiquidityUsd")),
|
|
101419
|
+
utilization: num18(pick2(row, "utilization")),
|
|
101420
|
+
irmTotalDeposits: num18(pick2(row, "irmTotalDeposits")),
|
|
101421
|
+
irmTotalDebt: num18(pick2(row, "irmTotalDebt")),
|
|
101422
|
+
lockupRatio: num18(pick2(row, "lockupRatio")),
|
|
100483
101423
|
minBorrow: pick2(row, "minBorrow", "caps.minBorrow") ?? void 0,
|
|
100484
|
-
supplyCap:
|
|
100485
|
-
borrowCap:
|
|
101424
|
+
supplyCap: num18(pick2(row, "supplyCap", "caps.supplyCap")),
|
|
101425
|
+
borrowCap: num18(pick2(row, "borrowCap", "caps.borrowCap")),
|
|
100486
101426
|
debtCeiling: pick2(row, "debtCeiling", "caps.debtCeiling"),
|
|
100487
101427
|
isActive: pick2(row, "isActive", "flags.isActive"),
|
|
100488
101428
|
isFrozen: pick2(row, "isFrozen", "flags.isFrozen"),
|
|
@@ -100519,8 +101459,8 @@ function toTermSheetInput(row, ctx = {}) {
|
|
|
100519
101459
|
// builder's `?? 1`, so Aave and Compound V2 published "the whole debt can
|
|
100520
101460
|
// be repaid in one liquidation" against a real close factor of 0.5, and
|
|
100521
101461
|
// Aave V4's `targetHealthFactor` vanished entirely.
|
|
100522
|
-
closeFactor:
|
|
100523
|
-
targetHealthFactor:
|
|
101462
|
+
closeFactor: num18(pick2(row, "closeFactor", "caps.closeFactor")),
|
|
101463
|
+
targetHealthFactor: num18(
|
|
100524
101464
|
pick2(row, "targetHealthFactor", "caps.targetHealthFactor")
|
|
100525
101465
|
),
|
|
100526
101466
|
fixedTerm: pick2(row, "fixedTerm") ?? ctx.fixedTerm,
|
|
@@ -101681,7 +102621,7 @@ var ripeAdapter = {
|
|
|
101681
102621
|
};
|
|
101682
102622
|
}
|
|
101683
102623
|
};
|
|
101684
|
-
var
|
|
102624
|
+
var num19 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
101685
102625
|
var alchemixAdapter = {
|
|
101686
102626
|
id: "alchemix",
|
|
101687
102627
|
matches: isAlchemix,
|
|
@@ -101689,8 +102629,8 @@ var alchemixAdapter = {
|
|
|
101689
102629
|
build: (input) => {
|
|
101690
102630
|
const a = input.market?.alchemix ?? {};
|
|
101691
102631
|
const isCollateralRow = input.collateralActive !== false;
|
|
101692
|
-
const protocolFeeBps =
|
|
101693
|
-
const liquidatorFeeBps =
|
|
102632
|
+
const protocolFeeBps = num19(a.protocolFeeBps);
|
|
102633
|
+
const liquidatorFeeBps = num19(a.liquidatorFeeBps);
|
|
101694
102634
|
const fees2 = [];
|
|
101695
102635
|
if (protocolFeeBps != null)
|
|
101696
102636
|
fees2.push({
|
|
@@ -101730,7 +102670,7 @@ var alchemixAdapter = {
|
|
|
101730
102670
|
if (cap > 0) capUtilization = Math.min(1, Number(a.totalDeposited) / cap);
|
|
101731
102671
|
}
|
|
101732
102672
|
const capFull = capUtilization != null && capUtilization >= 1;
|
|
101733
|
-
const termSecs =
|
|
102673
|
+
const termSecs = num19(a.transmuterQueue?.termSeconds);
|
|
101734
102674
|
return {
|
|
101735
102675
|
oracle: {
|
|
101736
102676
|
// Not a market price feed: collateral is valued at the MYT's OWN share
|
|
@@ -101823,9 +102763,9 @@ var alchemixAdapter = {
|
|
|
101823
102763
|
alchemix: {
|
|
101824
102764
|
debtValuation: "face",
|
|
101825
102765
|
redemptionFeeBps: protocolFeeBps,
|
|
101826
|
-
redemptionRatePerYear:
|
|
102766
|
+
redemptionRatePerYear: num19(a.redemptionRatePerYear),
|
|
101827
102767
|
transmuterTermSecs: termSecs,
|
|
101828
|
-
transmuterTermBlocks:
|
|
102768
|
+
transmuterTermBlocks: num19(a.transmuterQueue?.termBlocks)
|
|
101829
102769
|
}
|
|
101830
102770
|
}
|
|
101831
102771
|
},
|
|
@@ -101842,7 +102782,7 @@ var alchemixAdapter = {
|
|
|
101842
102782
|
};
|
|
101843
102783
|
}
|
|
101844
102784
|
};
|
|
101845
|
-
var
|
|
102785
|
+
var num20 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
101846
102786
|
var flexAdapter = {
|
|
101847
102787
|
id: "flex",
|
|
101848
102788
|
matches: isFlex,
|
|
@@ -101850,18 +102790,18 @@ var flexAdapter = {
|
|
|
101850
102790
|
build: (input) => {
|
|
101851
102791
|
const f = input.market?.flex ?? {};
|
|
101852
102792
|
const isCollateralRow = input.collateralActive !== false;
|
|
101853
|
-
const minApr =
|
|
101854
|
-
const maxApr =
|
|
101855
|
-
const minFee =
|
|
101856
|
-
const maxFee =
|
|
101857
|
-
const repayCooldown =
|
|
102793
|
+
const minApr = num20(f.minAnnualInterestRate) != null ? f.minAnnualInterestRate * 100 : void 0;
|
|
102794
|
+
const maxApr = num20(f.maxAnnualInterestRate) != null ? f.maxAnnualInterestRate * 100 : void 0;
|
|
102795
|
+
const minFee = num20(f.minLiquidationFee);
|
|
102796
|
+
const maxFee = num20(f.maxLiquidationFee);
|
|
102797
|
+
const repayCooldown = num20(f.repayCooldown);
|
|
101858
102798
|
const decimals = input.asset?.decimals ?? input.decimals;
|
|
101859
|
-
const minDebt =
|
|
101860
|
-
const perfFeeBps =
|
|
101861
|
-
const idle =
|
|
102799
|
+
const minDebt = num20(f.minDebt) != null && decimals != null ? parseUnits(String(f.minDebt), decimals).toString() : void 0;
|
|
102800
|
+
const perfFeeBps = num20(f.performanceFeeBps);
|
|
102801
|
+
const idle = num20(f.idleLiquidity);
|
|
101862
102802
|
const borrowFees = [];
|
|
101863
|
-
const upfrontPct =
|
|
101864
|
-
if (upfrontPct != null &&
|
|
102803
|
+
const upfrontPct = num20(input.originationFee) ?? (num20(f.averageInterestRate) != null && num20(f.upfrontInterestPeriod) ? f.averageInterestRate * (f.upfrontInterestPeriod / 31536e3) * 100 : void 0);
|
|
102804
|
+
if (upfrontPct != null && num20(f.upfrontInterestPeriod))
|
|
101865
102805
|
borrowFees.push({
|
|
101866
102806
|
id: "origination",
|
|
101867
102807
|
label: "Upfront fee",
|
|
@@ -101924,7 +102864,7 @@ var flexAdapter = {
|
|
|
101924
102864
|
default: input.variableBorrowRate,
|
|
101925
102865
|
adjustable: true,
|
|
101926
102866
|
adjustmentCostNote: "Changing the rate again within the adjustment cooldown re-charges the upfront fee.",
|
|
101927
|
-
adjustmentCooldownSecs:
|
|
102867
|
+
adjustmentCooldownSecs: num20(f.interestRateAdjCooldown),
|
|
101928
102868
|
...queueUserSetFields(f.queue)
|
|
101929
102869
|
}
|
|
101930
102870
|
},
|
|
@@ -102123,6 +103063,7 @@ var llamaLendAdapter = {
|
|
|
102123
103063
|
] : void 0,
|
|
102124
103064
|
bandLtv,
|
|
102125
103065
|
defaultBands: typeof ll.defaultBands === "number" ? ll.defaultBands : void 0,
|
|
103066
|
+
ammA: Number(ll.ammA) > 1 ? Number(ll.ammA) : void 0,
|
|
102126
103067
|
/**
|
|
102127
103068
|
* The band count as an editable TERM, not just a curve to read.
|
|
102128
103069
|
*
|
|
@@ -102506,7 +103447,7 @@ var flyingTulipAdapter = {
|
|
|
102506
103447
|
};
|
|
102507
103448
|
}
|
|
102508
103449
|
};
|
|
102509
|
-
var
|
|
103450
|
+
var num21 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
102510
103451
|
var pct2 = (v) => `${(v * 100).toFixed(2)} %`;
|
|
102511
103452
|
var twyneAdapter = {
|
|
102512
103453
|
id: "twyne",
|
|
@@ -102514,13 +103455,13 @@ var twyneAdapter = {
|
|
|
102514
103455
|
profileId: () => "twyne.credit-delegation@v1",
|
|
102515
103456
|
build: (input) => {
|
|
102516
103457
|
const tw = input.market?.twyne ?? {};
|
|
102517
|
-
const floorLtv =
|
|
102518
|
-
const maxLtv =
|
|
102519
|
-
const externalLiqLtv =
|
|
102520
|
-
const creditApr =
|
|
102521
|
-
const maturity =
|
|
103458
|
+
const floorLtv = num21(tw.floorLtv);
|
|
103459
|
+
const maxLtv = num21(tw.maxLtv);
|
|
103460
|
+
const externalLiqLtv = num21(tw.externalLiqLtv);
|
|
103461
|
+
const creditApr = num21(tw.creditApr);
|
|
103462
|
+
const maturity = num21(tw.collateralMaturity);
|
|
102522
103463
|
const matured = tw.collateralMatured === true;
|
|
102523
|
-
const creditAvailable =
|
|
103464
|
+
const creditAvailable = num21(tw.creditAvailable);
|
|
102524
103465
|
const vaultType = typeof tw.vaultType === "string" ? tw.vaultType : void 0;
|
|
102525
103466
|
const externalName = vaultType === "AAVE_V3" ? "Aave V3" : vaultType === "EULER_V2" ? "Euler V2" : "the external market";
|
|
102526
103467
|
const creditExhausted = creditAvailable != null && creditAvailable <= 0;
|
|
@@ -102695,7 +103636,7 @@ var aaveV4Adapter = {
|
|
|
102695
103636
|
build: (input) => {
|
|
102696
103637
|
const target = input.targetHealthFactor;
|
|
102697
103638
|
const desc = input.market?.aaveV4 ?? {};
|
|
102698
|
-
const maxBonusHf =
|
|
103639
|
+
const maxBonusHf = num22(desc.healthFactorForMaxBonus);
|
|
102699
103640
|
return {
|
|
102700
103641
|
borrow: {
|
|
102701
103642
|
liquidation: {
|
|
@@ -102709,7 +103650,7 @@ var aaveV4Adapter = {
|
|
|
102709
103650
|
};
|
|
102710
103651
|
}
|
|
102711
103652
|
};
|
|
102712
|
-
function
|
|
103653
|
+
function num22(v) {
|
|
102713
103654
|
if (v == null) return void 0;
|
|
102714
103655
|
const n = typeof v === "string" ? Number(v) : v;
|
|
102715
103656
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
@@ -103972,7 +104913,8 @@ function toDigest(sheet) {
|
|
|
103972
104913
|
(p) => p.id === sheet.borrow.rate.userSet.recommended
|
|
103973
104914
|
)?.apr
|
|
103974
104915
|
}
|
|
103975
|
-
} : {}
|
|
104916
|
+
} : {},
|
|
104917
|
+
...sheet.borrow.choices ? { choices: digestChoices(sheet.borrow.choices) } : {}
|
|
103976
104918
|
} : void 0,
|
|
103977
104919
|
swap: sheet.swap ? {
|
|
103978
104920
|
kind: sheet.swap.kind,
|
|
@@ -104578,17 +105520,17 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
104578
105520
|
const assetInfo = row.underlyingInfo?.asset ?? row.asset ?? {};
|
|
104579
105521
|
const underlying = addr5(assetInfo.address, chainId) ?? addr5(row.underlying, chainId) ?? addr5(row.poolId, chainId);
|
|
104580
105522
|
if (!underlying) return void 0;
|
|
104581
|
-
const decimals =
|
|
104582
|
-
const priceUsd =
|
|
104583
|
-
const base =
|
|
104584
|
-
const intrinsic =
|
|
105523
|
+
const decimals = num16(assetInfo.decimals) ?? num16(row.decimals) ?? 18;
|
|
105524
|
+
const priceUsd = num16(row.underlyingInfo?.prices?.priceUsd) ?? num16(row.price);
|
|
105525
|
+
const base = num16(row.depositRate);
|
|
105526
|
+
const intrinsic = num16(row.intrinsicYield);
|
|
104585
105527
|
const rewards = sumRewardAprs(row.rewards);
|
|
104586
105528
|
const marketOwn = sum2(base, rewards);
|
|
104587
105529
|
const rate = {
|
|
104588
105530
|
// Prefer our own sum over the origin's `apr`, because `apr` is documented
|
|
104589
105531
|
// as `depositRate + intrinsicYield` and therefore EXCLUDES incentives —
|
|
104590
105532
|
// using it as the headline would under-report every incentivized market.
|
|
104591
|
-
total: sum2(base, intrinsic, rewards) ??
|
|
105533
|
+
total: sum2(base, intrinsic, rewards) ?? num16(row.apr) ?? 0,
|
|
104592
105534
|
base,
|
|
104593
105535
|
rewards,
|
|
104594
105536
|
intrinsic,
|
|
@@ -104656,7 +105598,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
104656
105598
|
row.totalLiquidityUSD ?? row.totalLiquidityUsd
|
|
104657
105599
|
),
|
|
104658
105600
|
depositCapacity: void 0,
|
|
104659
|
-
utilization:
|
|
105601
|
+
utilization: num16(row.utilization),
|
|
104660
105602
|
// Lending withdrawals are same-block, bounded by available liquidity —
|
|
104661
105603
|
// which is exactly `instant-capped`, not `instant`. A pool at 100 %
|
|
104662
105604
|
// utilization cannot be exited, and calling that `instant` is the kind of
|
|
@@ -104664,12 +105606,12 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
104664
105606
|
exit: { mode: "instant-capped", settlement: "sync" },
|
|
104665
105607
|
availability: availability2,
|
|
104666
105608
|
risk: {
|
|
104667
|
-
score:
|
|
105609
|
+
score: num16(row.risk?.score),
|
|
104668
105610
|
label: str6(row.risk?.label),
|
|
104669
105611
|
illiquid: isIlliquid({
|
|
104670
105612
|
exitMode: "instant-capped",
|
|
104671
|
-
tvlUsd:
|
|
104672
|
-
liquidityUsd:
|
|
105613
|
+
tvlUsd: num16(row.totalDepositsUSD ?? row.totalDepositsUsd),
|
|
105614
|
+
liquidityUsd: num16(row.totalLiquidityUSD ?? row.totalLiquidityUsd)
|
|
104673
105615
|
})
|
|
104674
105616
|
},
|
|
104675
105617
|
...basket ? { basket } : {},
|
|
@@ -104735,9 +105677,9 @@ function resolveAvailability2(row, flags, totalRate) {
|
|
|
104735
105677
|
};
|
|
104736
105678
|
}
|
|
104737
105679
|
function isSupplyCapFull(row) {
|
|
104738
|
-
const cap =
|
|
105680
|
+
const cap = num16(row.caps?.supplyCap) ?? num16(row.supplyCap);
|
|
104739
105681
|
if (cap === void 0 || cap <= 0) return false;
|
|
104740
|
-
const deposits =
|
|
105682
|
+
const deposits = num16(row.totalDeposits);
|
|
104741
105683
|
if (deposits === void 0) return false;
|
|
104742
105684
|
return deposits >= cap;
|
|
104743
105685
|
}
|
|
@@ -104746,7 +105688,7 @@ function sumRewardAprs(rewards) {
|
|
|
104746
105688
|
let total = 0;
|
|
104747
105689
|
let seen = false;
|
|
104748
105690
|
for (const r of rewards) {
|
|
104749
|
-
const apr =
|
|
105691
|
+
const apr = num16(r?.depositRate);
|
|
104750
105692
|
if (apr === void 0) continue;
|
|
104751
105693
|
total += apr;
|
|
104752
105694
|
seen = true;
|
|
@@ -104754,7 +105696,7 @@ function sumRewardAprs(rewards) {
|
|
|
104754
105696
|
return seen ? total : void 0;
|
|
104755
105697
|
}
|
|
104756
105698
|
function amount4(formatted, usd) {
|
|
104757
|
-
return { formatted:
|
|
105699
|
+
return { formatted: num16(formatted), usd: num16(usd) };
|
|
104758
105700
|
}
|
|
104759
105701
|
function sum2(...parts) {
|
|
104760
105702
|
const present = parts.filter((p) => p !== void 0);
|
|
@@ -105444,7 +106386,7 @@ function vaultCapabilities(row) {
|
|
|
105444
106386
|
caps.push({
|
|
105445
106387
|
action: "withdraw",
|
|
105446
106388
|
requires: withdrawRequires(provider),
|
|
105447
|
-
feeBps:
|
|
106389
|
+
feeBps: num16(meta.withdrawFeeBps) ?? row.exit.feeBps,
|
|
105448
106390
|
// a fee-paying single-token exit: pays the vault's token only
|
|
105449
106391
|
acceptsNative: false
|
|
105450
106392
|
});
|
|
@@ -105588,7 +106530,7 @@ function legEarnUid(marketUid) {
|
|
|
105588
106530
|
if (isVaultVenue(parts[0])) return void 0;
|
|
105589
106531
|
return marketUid;
|
|
105590
106532
|
}
|
|
105591
|
-
function
|
|
106533
|
+
function num23(v) {
|
|
105592
106534
|
const n = typeof v === "number" ? v : Number(v);
|
|
105593
106535
|
return Number.isFinite(n) ? n : 0;
|
|
105594
106536
|
}
|
|
@@ -105615,10 +106557,10 @@ function legAsset(pos) {
|
|
|
105615
106557
|
};
|
|
105616
106558
|
}
|
|
105617
106559
|
function toLeg(pos) {
|
|
105618
|
-
const depositsUsd =
|
|
105619
|
-
const debtUsd =
|
|
105620
|
-
const hasSupply = depositsUsd !== 0 ||
|
|
105621
|
-
const hasDebt = debtUsd !== 0 ||
|
|
106560
|
+
const depositsUsd = num23(pos.depositsUSD);
|
|
106561
|
+
const debtUsd = num23(pos.debtUSD) + num23(pos.debtStableUSD);
|
|
106562
|
+
const hasSupply = depositsUsd !== 0 || num23(pos.deposits) !== 0;
|
|
106563
|
+
const hasDebt = debtUsd !== 0 || num23(pos.debt) !== 0 || num23(pos.debtStable) !== 0;
|
|
105622
106564
|
return {
|
|
105623
106565
|
earnUid: legEarnUid(pos.marketUid),
|
|
105624
106566
|
marketUid: pos.marketUid,
|
|
@@ -105663,12 +106605,12 @@ function earnPositionFromLenderEntry(entry2) {
|
|
|
105663
106605
|
(s) => s.legs.some((l) => l.side !== "none") || s.netUsd !== 0
|
|
105664
106606
|
);
|
|
105665
106607
|
const crossMargin = active.length <= 1;
|
|
105666
|
-
const suppliedUsd =
|
|
105667
|
-
const borrowedUsd =
|
|
106608
|
+
const suppliedUsd = num23(entry2.balanceData?.deposits);
|
|
106609
|
+
const borrowedUsd = num23(entry2.balanceData?.debt);
|
|
105668
106610
|
const aprBreakdown = {
|
|
105669
|
-
market:
|
|
105670
|
-
rewards:
|
|
105671
|
-
intrinsic:
|
|
106611
|
+
market: num23(entry2.aprData?.apr),
|
|
106612
|
+
rewards: num23(entry2.aprData?.rewardApr),
|
|
106613
|
+
intrinsic: num23(entry2.aprData?.intrinsicApr)
|
|
105672
106614
|
};
|
|
105673
106615
|
return {
|
|
105674
106616
|
positionUid: buildLendingPositionUid(entry2.lender, entry2.chainId),
|
|
@@ -105682,15 +106624,15 @@ function earnPositionFromLenderEntry(entry2) {
|
|
|
105682
106624
|
...entry2.lenderInfo?.logoUri ? { logoURI: entry2.lenderInfo.logoUri } : {},
|
|
105683
106625
|
suppliedUsd,
|
|
105684
106626
|
borrowedUsd,
|
|
105685
|
-
netUsd:
|
|
106627
|
+
netUsd: num23(entry2.balanceData?.nav),
|
|
105686
106628
|
apr: aprBreakdown.market + aprBreakdown.rewards + aprBreakdown.intrinsic,
|
|
105687
106629
|
aprBreakdown,
|
|
105688
|
-
depositApr:
|
|
105689
|
-
borrowApr:
|
|
106630
|
+
depositApr: num23(entry2.aprData?.depositApr),
|
|
106631
|
+
borrowApr: num23(entry2.aprData?.borrowApr),
|
|
105690
106632
|
// Only a cross-margin account HAS one health factor. Publishing the first
|
|
105691
106633
|
// sub-account's as the row's would be a number about a different position.
|
|
105692
106634
|
health: crossMargin ? active[0]?.health ?? null : null,
|
|
105693
|
-
leverage:
|
|
106635
|
+
leverage: num23(entry2.leverage),
|
|
105694
106636
|
crossMargin,
|
|
105695
106637
|
legs: subAccounts.flatMap((s) => s.legs),
|
|
105696
106638
|
subAccounts: active,
|
|
@@ -106328,8 +107270,8 @@ async function fetchBorosAccount(account, fetchImpl) {
|
|
|
106328
107270
|
}
|
|
106329
107271
|
|
|
106330
107272
|
// src/boros/margin.ts
|
|
106331
|
-
var
|
|
106332
|
-
var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) /
|
|
107273
|
+
var SECONDS_PER_YEAR25 = 365 * 24 * 3600;
|
|
107274
|
+
var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) / SECONDS_PER_YEAR25;
|
|
106333
107275
|
function borosInitialMargin(m, size, ratePct, ttmSec) {
|
|
106334
107276
|
const r = Math.max(Math.abs(ratePct) / 100, m.margin.rateFloor);
|
|
106335
107277
|
return Math.abs(size) * r * m.margin.kIM * ttmYears(m, ttmSec);
|
|
@@ -106339,7 +107281,7 @@ function borosMaintenanceMargin(m, size, markPct, ttmSec) {
|
|
|
106339
107281
|
return Math.abs(size) * r * m.margin.kMM * ttmYears(m, ttmSec);
|
|
106340
107282
|
}
|
|
106341
107283
|
function borosTakerFee(m, size) {
|
|
106342
|
-
return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec /
|
|
107284
|
+
return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec / SECONDS_PER_YEAR25;
|
|
106343
107285
|
}
|
|
106344
107286
|
function walkBorosBook(levels, size) {
|
|
106345
107287
|
let left = size;
|
|
@@ -106361,7 +107303,7 @@ function walkBorosBook(levels, size) {
|
|
|
106361
107303
|
};
|
|
106362
107304
|
}
|
|
106363
107305
|
function borosRateMoveToLiquidation(m, size, equity, markPct) {
|
|
106364
|
-
const ttm = m.timeToMaturitySec /
|
|
107306
|
+
const ttm = m.timeToMaturitySec / SECONDS_PER_YEAR25;
|
|
106365
107307
|
if (!(Math.abs(size) > 0) || !(ttm > 0)) return null;
|
|
106366
107308
|
const mm = borosMaintenanceMargin(m, size, markPct);
|
|
106367
107309
|
const slack = equity - mm;
|
|
@@ -106453,7 +107395,7 @@ function quoteBorosHedgeLeg(p) {
|
|
|
106453
107395
|
const fixed = fill.avgAprPct;
|
|
106454
107396
|
const floating = m.rates.floatingApr;
|
|
106455
107397
|
const takerFee = borosTakerFee(m, size);
|
|
106456
|
-
const ttmYears2 = m.timeToMaturitySec /
|
|
107398
|
+
const ttmYears2 = m.timeToMaturitySec / SECONDS_PER_YEAR25;
|
|
106457
107399
|
const settleAprPct = m.fees.settleFee != null ? m.fees.settleFee * 100 : null;
|
|
106458
107400
|
const allIn = ttmYears2 > 0 ? takerFee / size / ttmYears2 * 100 + (settleAprPct ?? 0) : null;
|
|
106459
107401
|
const rateForMargin = fixed ?? m.rates.markApr ?? 0;
|
|
@@ -106606,11 +107548,11 @@ function buildFundingHedgeTerms(i) {
|
|
|
106606
107548
|
};
|
|
106607
107549
|
}
|
|
106608
107550
|
function basisBlock(b) {
|
|
106609
|
-
const
|
|
106610
|
-
const meanGapApr =
|
|
106611
|
-
const trackingErrorApr =
|
|
106612
|
-
const correlation =
|
|
106613
|
-
const beta =
|
|
107551
|
+
const num24 = (x) => x != null && Number.isFinite(x) ? x : void 0;
|
|
107552
|
+
const meanGapApr = num24(b.meanGap);
|
|
107553
|
+
const trackingErrorApr = num24(b.trackingError);
|
|
107554
|
+
const correlation = num24(b.correlation);
|
|
107555
|
+
const beta = num24(b.beta);
|
|
106614
107556
|
const parts = [];
|
|
106615
107557
|
if (meanGapApr != null)
|
|
106616
107558
|
parts.push(
|
|
@@ -106675,6 +107617,6 @@ function hedgeImplications(h, p) {
|
|
|
106675
107617
|
return out;
|
|
106676
107618
|
}
|
|
106677
107619
|
|
|
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 };
|
|
107620
|
+
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
107621
|
//# sourceMappingURL=index.js.map
|
|
106680
107622
|
//# sourceMappingURL=index.js.map
|