@1delta/margin-fetcher 5.0.145 → 5.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +406 -44
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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, 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, 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 { BALANCER_V2_FORKS, BALANCER_V3_FORKS, UNISWAP_V4_FORKS, isFlashLoanSourceExcluded, FLASH_LOAN_IDS } from '@1delta/dex-registry';
|
|
15
15
|
import { getNativeDecimals, getWrappedNativeAddressSafe, isNativeWrapOneToOne } from '@1delta/wnative';
|
|
@@ -57411,6 +57411,123 @@ var SUPERFORM_ENTRIES = (() => {
|
|
|
57411
57411
|
}
|
|
57412
57412
|
return out;
|
|
57413
57413
|
})();
|
|
57414
|
+
var HISTORY_URL2 = "https://api.ipor.io/v2/fusion/vault-history";
|
|
57415
|
+
var TIMEOUT_MS5 = 1e4;
|
|
57416
|
+
var MIN_WINDOW_SECONDS2 = 7 * 86400;
|
|
57417
|
+
var SECONDS_PER_YEAR16 = 365 * 86400;
|
|
57418
|
+
var iporFusionYieldKey = (chainId, vault) => `IPOR Fusion::${chainId}::${vault.toLowerCase()}`;
|
|
57419
|
+
var realizedAprFromHistory = (points) => {
|
|
57420
|
+
const usable = points.map((p) => ({
|
|
57421
|
+
t: p.blockTimestamp ? Date.parse(p.blockTimestamp) / 1e3 : NaN,
|
|
57422
|
+
r: Number(p.assetsToSharesRatio)
|
|
57423
|
+
})).filter((p) => Number.isFinite(p.t) && Number.isFinite(p.r) && p.r > 0).sort((a, b) => a.t - b.t);
|
|
57424
|
+
if (usable.length < 2) return void 0;
|
|
57425
|
+
const first = usable[0];
|
|
57426
|
+
const last = usable[usable.length - 1];
|
|
57427
|
+
const dt = last.t - first.t;
|
|
57428
|
+
if (dt < MIN_WINDOW_SECONDS2) return void 0;
|
|
57429
|
+
return (last.r / first.r - 1) * (SECONDS_PER_YEAR16 / dt) * 100;
|
|
57430
|
+
};
|
|
57431
|
+
var fetchHistory = async (chainId, vault) => {
|
|
57432
|
+
const res = await fetch(`${HISTORY_URL2}/${chainId}/${vault}-30d`, {
|
|
57433
|
+
headers: { Accept: "application/json" },
|
|
57434
|
+
signal: AbortSignal.timeout(TIMEOUT_MS5)
|
|
57435
|
+
});
|
|
57436
|
+
if (!res.ok) throw new Error(`ipor-fusion ${vault} \u2192 HTTP ${res.status}`);
|
|
57437
|
+
const body = await res.json();
|
|
57438
|
+
if (!Array.isArray(body?.history))
|
|
57439
|
+
throw new Error(`ipor-fusion ${vault}: no history[]`);
|
|
57440
|
+
return body.history;
|
|
57441
|
+
};
|
|
57442
|
+
var iporFusionFetcher = {
|
|
57443
|
+
label: "IPOR Fusion",
|
|
57444
|
+
fetch: async () => {
|
|
57445
|
+
const out = {};
|
|
57446
|
+
const results = await Promise.allSettled(
|
|
57447
|
+
IPOR_FUSION_VAULTS.map(async (v) => {
|
|
57448
|
+
const apr = realizedAprFromHistory(
|
|
57449
|
+
await fetchHistory(v.chainId, v.vault)
|
|
57450
|
+
);
|
|
57451
|
+
if (apr !== void 0) out[iporFusionYieldKey(v.chainId, v.vault)] = apr;
|
|
57452
|
+
})
|
|
57453
|
+
);
|
|
57454
|
+
const failed = results.filter((r) => r.status === "rejected");
|
|
57455
|
+
if (failed.length > 0)
|
|
57456
|
+
console.warn(
|
|
57457
|
+
`[ipor-fusion] ${failed.length}/${results.length} vault histories failed:`,
|
|
57458
|
+
failed[0].reason
|
|
57459
|
+
);
|
|
57460
|
+
return out;
|
|
57461
|
+
}
|
|
57462
|
+
};
|
|
57463
|
+
|
|
57464
|
+
// src/vaults/savings/registryIporFusion.ts
|
|
57465
|
+
var exitProse = (v, asset) => {
|
|
57466
|
+
const instant = v.instantFuses ? "Instant withdrawals first pull the money out of the lending markets, so they are bounded by those markets' liquidity." : `Instant withdrawals are paid only from idle ${asset}, a few percent of the vault at most, less a fee.`;
|
|
57467
|
+
if (v.withdrawWindowSeconds === 0)
|
|
57468
|
+
return `${instant} There is no queued exit on this vault.`;
|
|
57469
|
+
const window = v.withdrawWindowSeconds % 86400 === 0 ? `${v.withdrawWindowSeconds / 86400 === 1 ? "24 hours" : `${v.withdrawWindowSeconds / 86400} days`}` : `${Math.round(v.withdrawWindowSeconds / 3600)} hours`;
|
|
57470
|
+
return `${instant} Or request a withdrawal: the fee is taken at request, and IPOR's operator must release it and you must claim within ${window} of asking, or it lapses.`;
|
|
57471
|
+
};
|
|
57472
|
+
var IPOR_FUSION_PROSE = {
|
|
57473
|
+
"1:0xb9e806e8f2d94c015ffefa90cd24ecce18f1663c": `Measured in WETH: posts wstETH in a Liquity V2 trove, borrows BOLD and earns on it in Curve and Uniswap V4 pools. The debt is in dollars, so the share price moves with ETH as well as the carry, and the trove can be liquidated or redeemed.`,
|
|
57474
|
+
"1:0xb8a451107a9f87fde481d4d686247d6e43ed715e": `An stETH loop: stETH is collateral on Spark, Aave and Morpho with WETH borrowed against it, about nine times over. A borrow rate above the staking yield or an stETH depeg cuts the share price, and the loans can be liquidated.`,
|
|
57475
|
+
"1:0xb0f56bb0bf13ee05fef8cd2d8df5ffdfcac7a74f": `TAU's infiniFi vault: USDC becomes staked siUSD held as Morpho collateral, set up to borrow and loop for infiniFi points. It earns siUSD's rate, with the borrow cost and liquidation risk whenever it is levered.`,
|
|
57476
|
+
"1:0xf8f226da66244f89e70c5b5d1a5c5b0d505eb1d8": `A USDC vault holding wsBTCD, a Bitcoin-backed dollar, as Morpho collateral and BORROWING WBTC against it \u2014 short Bitcoin: the share price falls when BTC rises, and the loan can be liquidated.`,
|
|
57477
|
+
"1:0x7659fc26bf3a63e8133bbecb7e16acd48ee8e292": `Measured in WBTC: posts WBTC on Morpho, borrows USDC and deposits it into another Fusion vault (Bitcoin Dollar USDC). The debt is in dollars, so the share price moves with BTC as well as the carry, and the loan can be liquidated.`,
|
|
57478
|
+
"1:0xe9385eff3f937fcb0f0085da9a3f53d6c2b4fb5f": `A Reservoir srUSD loop: wsrUSD is Morpho collateral with USDC borrowed against it, about five times over. A USDC rate above srUSD's or an srUSD/rUSD depeg cuts the share price, and the loan can be liquidated.`,
|
|
57479
|
+
"8453:0x17d0f109ee895bad0b68aa104aa72bd0b003ad8e": `A WETH lending optimizer on Base: supplies lending markets (Euler today) and moves between them for the best rate, with no borrowing.`,
|
|
57480
|
+
"8453:0xe883426b4fc84a7f5cc86415cabbef43e73a4cc8": `TAU's cbETH loop on Base: cbETH is collateral on Aave, Morpho and Euler with WETH borrowed against it, about nine times over. A borrow rate above the staking yield or a cbETH depeg cuts the share price, and the loans can be liquidated.`,
|
|
57481
|
+
"8453:0x7872893e528fe2c0829e405960db5b742112aa97": `Harvest's Autopilot WETH vault on Base: WETH is spread across Harvest's lending vaults for the best supply rate, with no borrowing.`,
|
|
57482
|
+
"8453:0x5900c3b72458f12967dc1bef35b92d271f5cdbc1": `A cbETH loop on Base measured in WETH: cbETH is collateral on Aave, Morpho and Euler with WETH borrowed, about six times over. A borrow rate above the staking yield or a cbETH depeg cuts the share price; loans can be liquidated.`,
|
|
57483
|
+
"8453:0xd46a3c2d958d0a2cb098d48c48dc19fe3a710f37": `A USDC lending optimizer on Base: supplies Morpho markets and moves between them for the best rate, with no borrowing.`,
|
|
57484
|
+
"8453:0x0d877dc7c8fa3ad980dfdb18b48ec9f8768359c4": `Harvest's Autopilot USDC vault on Base: USDC is spread across Harvest's lending vaults for the best supply rate, with no borrowing.`
|
|
57485
|
+
};
|
|
57486
|
+
var IPOR_FUSION_ASSET = {
|
|
57487
|
+
"1:0xb9e806e8f2d94c015ffefa90cd24ecce18f1663c": "WETH",
|
|
57488
|
+
"1:0xb8a451107a9f87fde481d4d686247d6e43ed715e": "stETH",
|
|
57489
|
+
"1:0xb0f56bb0bf13ee05fef8cd2d8df5ffdfcac7a74f": "USDC",
|
|
57490
|
+
"1:0x7659fc26bf3a63e8133bbecb7e16acd48ee8e292": "WBTC",
|
|
57491
|
+
"1:0xe9385eff3f937fcb0f0085da9a3f53d6c2b4fb5f": "rUSD",
|
|
57492
|
+
"8453:0xe883426b4fc84a7f5cc86415cabbef43e73a4cc8": "cbETH",
|
|
57493
|
+
"8453:0x5900c3b72458f12967dc1bef35b92d271f5cdbc1": "WETH"
|
|
57494
|
+
};
|
|
57495
|
+
IPOR_FUSION_VAULTS.filter(
|
|
57496
|
+
(v) => v.strategy !== "lending"
|
|
57497
|
+
).map((v) => `${v.chainId}-${v.vault}`);
|
|
57498
|
+
var toEntry2 = (v) => ({
|
|
57499
|
+
reader: "ipor-fusion",
|
|
57500
|
+
address: v.vault,
|
|
57501
|
+
underlying: v.underlying,
|
|
57502
|
+
symbol: v.symbol,
|
|
57503
|
+
label: v.name,
|
|
57504
|
+
brand: v.brand,
|
|
57505
|
+
description: IPOR_FUSION_PROSE[`${v.chainId}:${v.vault}`] ? `${IPOR_FUSION_PROSE[`${v.chainId}:${v.vault}`]} ${exitProse(v, IPOR_FUSION_ASSET[`${v.chainId}:${v.vault}`] ?? "cash")}` : "",
|
|
57506
|
+
decimals: v.decimals,
|
|
57507
|
+
underlyingDecimals: v.underlyingDecimals,
|
|
57508
|
+
isRebasing: false,
|
|
57509
|
+
isMintable: true,
|
|
57510
|
+
// A zero withdraw window (both Autopilot vaults) makes every request
|
|
57511
|
+
// unclaimable: those rows have the instant leg only.
|
|
57512
|
+
withdrawalMode: v.withdrawWindowSeconds === 0 ? "instant-capped" : "fee-or-queued",
|
|
57513
|
+
feeScheduleCheckedAt: "2026-10-30",
|
|
57514
|
+
iporFusion: {
|
|
57515
|
+
accessManager: v.accessManager,
|
|
57516
|
+
withdrawManager: v.withdrawManager,
|
|
57517
|
+
instantFuses: v.instantFuses
|
|
57518
|
+
},
|
|
57519
|
+
withdrawQueue: v.withdrawManager,
|
|
57520
|
+
yieldFetcher: iporFusionFetcher,
|
|
57521
|
+
yieldKey: iporFusionYieldKey(v.chainId, v.vault)
|
|
57522
|
+
});
|
|
57523
|
+
var IPOR_FUSION_ENTRIES = (() => {
|
|
57524
|
+
const out = {};
|
|
57525
|
+
for (const v of IPOR_FUSION_VAULTS) {
|
|
57526
|
+
if (!out[v.chainId]) out[v.chainId] = [];
|
|
57527
|
+
out[v.chainId].push(toEntry2(v));
|
|
57528
|
+
}
|
|
57529
|
+
return out;
|
|
57530
|
+
})();
|
|
57414
57531
|
var L2SD_YIELD_KEYS = {
|
|
57415
57532
|
limUSD: "limUSD::LIMUSD",
|
|
57416
57533
|
haHYPE: "haHYPE::haHYPE",
|
|
@@ -57850,7 +57967,7 @@ var L2SD_ENTRIES = {
|
|
|
57850
57967
|
|
|
57851
57968
|
// src/yields/intrinsic/fetchers/royco.ts
|
|
57852
57969
|
var ROYCO_POOLS_URL = "https://vault.api.royco.org/api/v1/defillama/pools";
|
|
57853
|
-
var
|
|
57970
|
+
var TIMEOUT_MS6 = 8e3;
|
|
57854
57971
|
var ROY_ST_APYUSD_KEY = "Royco Senior Tranche apyUSD::ROY-ST-apyUSD";
|
|
57855
57972
|
var ROY_JT_APYUSD_KEY = "Royco Junior Tranche apyUSD::ROY-JT-apyUSD";
|
|
57856
57973
|
var ROYCO_POOLS = {
|
|
@@ -57874,7 +57991,7 @@ var roycoFetcher = {
|
|
|
57874
57991
|
fetch: async () => {
|
|
57875
57992
|
const res = await fetch(ROYCO_POOLS_URL, {
|
|
57876
57993
|
headers: { accept: "application/json" },
|
|
57877
|
-
signal: AbortSignal.timeout(
|
|
57994
|
+
signal: AbortSignal.timeout(TIMEOUT_MS6)
|
|
57878
57995
|
});
|
|
57879
57996
|
if (!res.ok) throw new Error(`Royco pools HTTP ${res.status}`);
|
|
57880
57997
|
const data = await res.json();
|
|
@@ -59408,7 +59525,7 @@ var ROWS = [
|
|
|
59408
59525
|
)
|
|
59409
59526
|
}
|
|
59410
59527
|
];
|
|
59411
|
-
var
|
|
59528
|
+
var toEntry3 = (r) => ({
|
|
59412
59529
|
reader: "alchemix-transmuter",
|
|
59413
59530
|
address: r.transmuter,
|
|
59414
59531
|
underlying: r.alAsset,
|
|
@@ -59438,7 +59555,7 @@ var toEntry2 = (r) => ({
|
|
|
59438
59555
|
alchemixTransmuter: r.cfg
|
|
59439
59556
|
});
|
|
59440
59557
|
var ALCHEMIX_TRANSMUTER_ENTRIES = ROWS.reduce((out, r) => {
|
|
59441
|
-
(out[r.chainId] ??= []).push(
|
|
59558
|
+
(out[r.chainId] ??= []).push(toEntry3(r));
|
|
59442
59559
|
return out;
|
|
59443
59560
|
}, {});
|
|
59444
59561
|
var CHAIN_ID19 = "1";
|
|
@@ -63567,6 +63684,10 @@ var SAVINGS_REGISTRY = (() => {
|
|
|
63567
63684
|
if (!out[chainId]) out[chainId] = [];
|
|
63568
63685
|
out[chainId].push(...entries);
|
|
63569
63686
|
}
|
|
63687
|
+
for (const [chainId, entries] of Object.entries(IPOR_FUSION_ENTRIES)) {
|
|
63688
|
+
if (!out[chainId]) out[chainId] = [];
|
|
63689
|
+
out[chainId].push(...entries);
|
|
63690
|
+
}
|
|
63570
63691
|
for (const [chainId, entries] of Object.entries(LLAMA_GAP_ENTRIES)) {
|
|
63571
63692
|
if (!out[chainId]) out[chainId] = [];
|
|
63572
63693
|
out[chainId].push(...entries);
|
|
@@ -65706,7 +65827,7 @@ var exponentTrancheFetcher = {
|
|
|
65706
65827
|
|
|
65707
65828
|
// src/yields/intrinsic/fetchers/loopscaleVaultShares.ts
|
|
65708
65829
|
var LOOPSCALE_VAULTS_INFO = "https://tars.loopscale.com/v1/markets/lending_vaults/info";
|
|
65709
|
-
var
|
|
65830
|
+
var SECONDS_PER_YEAR17 = 31536e3;
|
|
65710
65831
|
var CBPS = 1e6;
|
|
65711
65832
|
var MAX_PLAUSIBLE_APR_PERCENT = 50;
|
|
65712
65833
|
var LOOPSCALE_SHARE_ROSTER = [
|
|
@@ -65723,7 +65844,7 @@ function loopscaleShareApr(v, nowSec9 = Math.floor(Date.now() / 1e3)) {
|
|
|
65723
65844
|
const tvlRaw = n(s.tokenBalance) + n(s.externalYieldAmount) + n(s.currentDeployedAmount) + n(s.outstandingInterestAmount);
|
|
65724
65845
|
if (!(tvlRaw > 0)) return void 0;
|
|
65725
65846
|
const extApr = n(v.vaultStrategy?.externalYieldInfo?.apy) / CBPS;
|
|
65726
|
-
const gross = (n(s.interestPerSecond) *
|
|
65847
|
+
const gross = (n(s.interestPerSecond) * SECONDS_PER_YEAR17 + extApr * n(s.externalYieldAmount)) / tvlRaw * 100;
|
|
65727
65848
|
const net = gross * (1 - n(s.interestFee) / CBPS);
|
|
65728
65849
|
const principal = s.principalMint ?? v.vault?.principalMint;
|
|
65729
65850
|
let stream = 0;
|
|
@@ -65732,7 +65853,7 @@ function loopscaleShareApr(v, nowSec9 = Math.floor(Date.now() / 1e3)) {
|
|
|
65732
65853
|
const start = n(r.rewardStartTime);
|
|
65733
65854
|
const end = n(r.rewardEndTime);
|
|
65734
65855
|
if (!(nowSec9 >= start && nowSec9 <= end)) continue;
|
|
65735
|
-
stream += n(r.emissionsPerSecond) *
|
|
65856
|
+
stream += n(r.emissionsPerSecond) * SECONDS_PER_YEAR17 / tvlRaw * 100;
|
|
65736
65857
|
}
|
|
65737
65858
|
const apr = net + stream;
|
|
65738
65859
|
if (!Number.isFinite(apr) || apr < 0 || apr > MAX_PLAUSIBLE_APR_PERCENT)
|
|
@@ -66295,7 +66416,7 @@ function distressedEntries(chainId, tokenList, raw, usdPrices) {
|
|
|
66295
66416
|
var PENDLE_PT_PRICES_URL = "https://api-v2.pendle.finance/core/v1/prices/assets?type=PT";
|
|
66296
66417
|
var PENDLE_PRICE_KEY = "PENDLE";
|
|
66297
66418
|
var CACHE_MS = 6e4;
|
|
66298
|
-
var
|
|
66419
|
+
var TIMEOUT_MS7 = 1e4;
|
|
66299
66420
|
var cached = {
|
|
66300
66421
|
at: 0,
|
|
66301
66422
|
prices: Promise.resolve(null)
|
|
@@ -66306,7 +66427,7 @@ function fetchPendlePtPricesRaw() {
|
|
|
66306
66427
|
const prices = (async () => {
|
|
66307
66428
|
try {
|
|
66308
66429
|
const res = await fetch(PENDLE_PT_PRICES_URL, {
|
|
66309
|
-
signal: AbortSignal.timeout(
|
|
66430
|
+
signal: AbortSignal.timeout(TIMEOUT_MS7)
|
|
66310
66431
|
});
|
|
66311
66432
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
66312
66433
|
const data = await res.json();
|
|
@@ -66348,9 +66469,9 @@ function fetchPendleUnderlyingPricesRaw() {
|
|
|
66348
66469
|
const prices = (async () => {
|
|
66349
66470
|
try {
|
|
66350
66471
|
const [mRes, pRes] = await Promise.all([
|
|
66351
|
-
fetch(PENDLE_MARKETS_URL, { signal: AbortSignal.timeout(
|
|
66472
|
+
fetch(PENDLE_MARKETS_URL, { signal: AbortSignal.timeout(TIMEOUT_MS7) }),
|
|
66352
66473
|
fetch(PENDLE_ALL_PRICES_URL, {
|
|
66353
|
-
signal: AbortSignal.timeout(
|
|
66474
|
+
signal: AbortSignal.timeout(TIMEOUT_MS7)
|
|
66354
66475
|
})
|
|
66355
66476
|
]);
|
|
66356
66477
|
if (!mRes.ok) throw new Error(`markets HTTP ${mRes.status}`);
|
|
@@ -66517,7 +66638,7 @@ function fetchPendleAssetPricesRaw() {
|
|
|
66517
66638
|
const prices = (async () => {
|
|
66518
66639
|
try {
|
|
66519
66640
|
const res = await fetch(PENDLE_ALL_PRICES_URL, {
|
|
66520
|
-
signal: AbortSignal.timeout(
|
|
66641
|
+
signal: AbortSignal.timeout(TIMEOUT_MS7)
|
|
66521
66642
|
});
|
|
66522
66643
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
66523
66644
|
const data = await res.json();
|
|
@@ -67982,7 +68103,7 @@ var DLEND_POOLS = [
|
|
|
67982
68103
|
}
|
|
67983
68104
|
];
|
|
67984
68105
|
var ZERO_ADDRESS8 = "0x0000000000000000000000000000000000000000";
|
|
67985
|
-
var
|
|
68106
|
+
var SECONDS_PER_YEAR18 = 31536e3;
|
|
67986
68107
|
var ABI2 = [
|
|
67987
68108
|
{
|
|
67988
68109
|
name: "getReservesList",
|
|
@@ -68123,7 +68244,7 @@ function rebateApr(params) {
|
|
|
68123
68244
|
if (nowSeconds2 >= Number(distributionEnd)) return 0;
|
|
68124
68245
|
if (emissionPerSecond <= 0n || balanceTotalSupply <= 0n) return 0;
|
|
68125
68246
|
if (!(rewardPrice > 0) || !(assetPrice > 0)) return 0;
|
|
68126
|
-
const rewardsPerYearUsd = scale(emissionPerSecond, rewardDecimals) *
|
|
68247
|
+
const rewardsPerYearUsd = scale(emissionPerSecond, rewardDecimals) * SECONDS_PER_YEAR18 * rewardPrice;
|
|
68127
68248
|
const baseUsd = scale(balanceTotalSupply, balanceDecimals) * assetPrice;
|
|
68128
68249
|
if (!(baseUsd > 0)) return 0;
|
|
68129
68250
|
return rewardsPerYearUsd / baseUsd * 100;
|
|
@@ -68311,7 +68432,7 @@ var dtrinityRebateRewardFetcher = {
|
|
|
68311
68432
|
return { byLender: merged };
|
|
68312
68433
|
}
|
|
68313
68434
|
};
|
|
68314
|
-
var
|
|
68435
|
+
var SECONDS_PER_YEAR19 = 31536e3;
|
|
68315
68436
|
var MAX_EPOCH_AGE_SECONDS = 7 * 86400;
|
|
68316
68437
|
var EPOCH_LOOKBACK = 8;
|
|
68317
68438
|
var FT_DECIMALS = 18;
|
|
@@ -68396,7 +68517,7 @@ function ftEmissionApr(params) {
|
|
|
68396
68517
|
const ftUsd = Number(ft) / 10 ** FT_DECIMALS * ftPriceUsd;
|
|
68397
68518
|
const usdSeconds = Number(supplyTime) / 10 ** assetDecimals * assetPriceUsd;
|
|
68398
68519
|
if (!(usdSeconds > 0)) return 0;
|
|
68399
|
-
return ftUsd / usdSeconds *
|
|
68520
|
+
return ftUsd / usdSeconds * SECONDS_PER_YEAR19 * 100;
|
|
68400
68521
|
}
|
|
68401
68522
|
async function rosterFor(chainId) {
|
|
68402
68523
|
const fromMeta = flyingTulipAssetsFor(LENDER2, chainId)?.assets ?? [];
|
|
@@ -68833,7 +68954,7 @@ var listaEmissionRewardFetcher = {
|
|
|
68833
68954
|
return { byLender: merged };
|
|
68834
68955
|
}
|
|
68835
68956
|
};
|
|
68836
|
-
var
|
|
68957
|
+
var SECONDS_PER_YEAR20 = 31536e3;
|
|
68837
68958
|
var WAD17 = 10n ** 18n;
|
|
68838
68959
|
var ZERO6 = "0x0000000000000000000000000000000000000000";
|
|
68839
68960
|
var UNBOOSTED_FACTOR = 0.4;
|
|
@@ -68941,7 +69062,7 @@ function crvGaugeApr(params) {
|
|
|
68941
69062
|
return 0;
|
|
68942
69063
|
}
|
|
68943
69064
|
if (!(crvPriceUsd > 0) || !(assetPriceUsd > 0)) return 0;
|
|
68944
|
-
const crvPerYear = scale2(inflationRate, 18) * scale2(relativeWeight, 18) *
|
|
69065
|
+
const crvPerYear = scale2(inflationRate, 18) * scale2(relativeWeight, 18) * SECONDS_PER_YEAR20;
|
|
68945
69066
|
const stakedUsd = scale2(workingSupply, 18) * scale2(pricePerShare, 18) * assetPriceUsd;
|
|
68946
69067
|
if (!(stakedUsd > 0)) return 0;
|
|
68947
69068
|
return crvPerYear * crvPriceUsd / stakedUsd * 100 * UNBOOSTED_FACTOR;
|
|
@@ -68960,7 +69081,7 @@ function extraRewardApr(params) {
|
|
|
68960
69081
|
if (nowSeconds2 >= Number(periodFinish)) return 0;
|
|
68961
69082
|
if (rate <= 0n || totalSupply <= 0n) return 0;
|
|
68962
69083
|
if (!(rewardPriceUsd > 0) || !(assetPriceUsd > 0)) return 0;
|
|
68963
|
-
const rewardPerYearUsd = scale2(rate, rewardDecimals) *
|
|
69084
|
+
const rewardPerYearUsd = scale2(rate, rewardDecimals) * SECONDS_PER_YEAR20 * rewardPriceUsd;
|
|
68964
69085
|
const stakedUsd = scale2(totalSupply, 18) * scale2(pricePerShare, 18) * assetPriceUsd;
|
|
68965
69086
|
if (!(stakedUsd > 0)) return 0;
|
|
68966
69087
|
return rewardPerYearUsd / stakedUsd * 100;
|
|
@@ -70023,7 +70144,7 @@ async function markClaimSupport2(account, rewards, opts) {
|
|
|
70023
70144
|
}
|
|
70024
70145
|
var MERKL_API = "https://api.merkl.xyz/v4";
|
|
70025
70146
|
var MERKL_DISTRIBUTOR = "0x3ef3d8ba38ebe18db133cec108f4d14ce00dd9ae";
|
|
70026
|
-
var
|
|
70147
|
+
var TIMEOUT_MS8 = 8e3;
|
|
70027
70148
|
var OPP_CONCURRENCY = 8;
|
|
70028
70149
|
var ROOT_ABI = [
|
|
70029
70150
|
{
|
|
@@ -70046,7 +70167,7 @@ function fetchOpportunity(id, f) {
|
|
|
70046
70167
|
let p = oppCache2.get(id);
|
|
70047
70168
|
if (!p) {
|
|
70048
70169
|
p = f(`${MERKL_API}/opportunities/${id}`, {
|
|
70049
|
-
signal: AbortSignal.timeout(
|
|
70170
|
+
signal: AbortSignal.timeout(TIMEOUT_MS8)
|
|
70050
70171
|
}).then((r) => r.ok ? r.json() : void 0).catch(() => void 0);
|
|
70051
70172
|
p.then((o) => {
|
|
70052
70173
|
if (!o) oppCache2.delete(id);
|
|
@@ -70077,7 +70198,7 @@ async function fetchMerklUserRewards(account, chainIds, resolve, opts = {}) {
|
|
|
70077
70198
|
try {
|
|
70078
70199
|
const q = chainIds.map((c) => `chainId=${encodeURIComponent(c)}`).join("&");
|
|
70079
70200
|
const res = await f(`${MERKL_API}/users/${account}/rewards?${q}`, {
|
|
70080
|
-
signal: AbortSignal.timeout(
|
|
70201
|
+
signal: AbortSignal.timeout(TIMEOUT_MS8)
|
|
70081
70202
|
});
|
|
70082
70203
|
if (!res.ok) throw new Error(`Merkl API ${res.status}`);
|
|
70083
70204
|
const json = await res.json();
|
|
@@ -78335,7 +78456,7 @@ function computeSiloUtilization(vaultId, totalAssetsFormatted, positionsByVault,
|
|
|
78335
78456
|
}
|
|
78336
78457
|
var clamp012 = (n) => !Number.isFinite(n) ? 0 : n < 0 ? 0 : n > 1 ? 1 : n;
|
|
78337
78458
|
var PERFORMANCE_FEE_SCALE = 1e16;
|
|
78338
|
-
var
|
|
78459
|
+
var SECONDS_PER_YEAR21 = 31536e3;
|
|
78339
78460
|
function buildVaultRewards(vaultId, totalAssetsUsd, programsByShareToken, priceOf2, nowSeconds2) {
|
|
78340
78461
|
const programs = programsByShareToken.get(vaultId) ?? [];
|
|
78341
78462
|
const rewards = [];
|
|
@@ -78351,7 +78472,7 @@ function buildVaultRewards(vaultId, totalAssetsUsd, programsByShareToken, priceO
|
|
|
78351
78472
|
const tokenPrice = tokenAddress ? priceOf2(tokenAddress) : 0;
|
|
78352
78473
|
let apr;
|
|
78353
78474
|
if (tokenPrice > 0 && totalAssetsUsd > 0) {
|
|
78354
|
-
const annualTokens = emission / 10 ** tokenDecimals *
|
|
78475
|
+
const annualTokens = emission / 10 ** tokenDecimals * SECONDS_PER_YEAR21;
|
|
78355
78476
|
apr = annualTokens * tokenPrice / totalAssetsUsd * 100;
|
|
78356
78477
|
rewardsRate += apr;
|
|
78357
78478
|
} else {
|
|
@@ -86868,6 +86989,110 @@ var SuperformStrategyConfigAbi = [
|
|
|
86868
86989
|
}
|
|
86869
86990
|
];
|
|
86870
86991
|
|
|
86992
|
+
// src/vaults/savings/abis/iporFusion.ts
|
|
86993
|
+
var PlasmaVaultReadAbi = [
|
|
86994
|
+
{
|
|
86995
|
+
name: "totalSupply",
|
|
86996
|
+
type: "function",
|
|
86997
|
+
stateMutability: "view",
|
|
86998
|
+
inputs: [],
|
|
86999
|
+
outputs: [{ type: "uint256" }]
|
|
87000
|
+
},
|
|
87001
|
+
{
|
|
87002
|
+
name: "maxDeposit",
|
|
87003
|
+
type: "function",
|
|
87004
|
+
stateMutability: "view",
|
|
87005
|
+
inputs: [{ type: "address", name: "receiver" }],
|
|
87006
|
+
outputs: [{ type: "uint256" }]
|
|
87007
|
+
},
|
|
87008
|
+
{
|
|
87009
|
+
name: "previewDeposit",
|
|
87010
|
+
type: "function",
|
|
87011
|
+
stateMutability: "view",
|
|
87012
|
+
inputs: [{ type: "uint256", name: "assets" }],
|
|
87013
|
+
outputs: [{ type: "uint256" }]
|
|
87014
|
+
},
|
|
87015
|
+
{
|
|
87016
|
+
name: "convertToShares",
|
|
87017
|
+
type: "function",
|
|
87018
|
+
stateMutability: "view",
|
|
87019
|
+
inputs: [{ type: "uint256", name: "assets" }],
|
|
87020
|
+
outputs: [{ type: "uint256" }]
|
|
87021
|
+
},
|
|
87022
|
+
{
|
|
87023
|
+
name: "getPerformanceFeeData",
|
|
87024
|
+
type: "function",
|
|
87025
|
+
stateMutability: "view",
|
|
87026
|
+
inputs: [],
|
|
87027
|
+
outputs: [
|
|
87028
|
+
{ type: "address", name: "feeAccount" },
|
|
87029
|
+
{ type: "uint16", name: "feeInPercentage" }
|
|
87030
|
+
]
|
|
87031
|
+
},
|
|
87032
|
+
{
|
|
87033
|
+
name: "getManagementFeeData",
|
|
87034
|
+
type: "function",
|
|
87035
|
+
stateMutability: "view",
|
|
87036
|
+
inputs: [],
|
|
87037
|
+
outputs: [
|
|
87038
|
+
{ type: "address", name: "feeAccount" },
|
|
87039
|
+
{ type: "uint16", name: "feeInPercentage" },
|
|
87040
|
+
{ type: "uint32", name: "lastUpdateTimestamp" }
|
|
87041
|
+
]
|
|
87042
|
+
}
|
|
87043
|
+
];
|
|
87044
|
+
var FusionAccessManagerReadAbi = [
|
|
87045
|
+
{
|
|
87046
|
+
name: "getTargetFunctionRole",
|
|
87047
|
+
type: "function",
|
|
87048
|
+
stateMutability: "view",
|
|
87049
|
+
inputs: [
|
|
87050
|
+
{ type: "address", name: "target" },
|
|
87051
|
+
{ type: "bytes4", name: "selector" }
|
|
87052
|
+
],
|
|
87053
|
+
outputs: [{ type: "uint64" }]
|
|
87054
|
+
},
|
|
87055
|
+
{
|
|
87056
|
+
name: "isTargetClosed",
|
|
87057
|
+
type: "function",
|
|
87058
|
+
stateMutability: "view",
|
|
87059
|
+
inputs: [{ type: "address", name: "target" }],
|
|
87060
|
+
outputs: [{ type: "bool" }]
|
|
87061
|
+
}
|
|
87062
|
+
];
|
|
87063
|
+
var FusionWithdrawManagerReadAbi = [
|
|
87064
|
+
{
|
|
87065
|
+
name: "getWithdrawFee",
|
|
87066
|
+
type: "function",
|
|
87067
|
+
stateMutability: "view",
|
|
87068
|
+
inputs: [],
|
|
87069
|
+
outputs: [{ type: "uint256" }]
|
|
87070
|
+
},
|
|
87071
|
+
{
|
|
87072
|
+
name: "getRequestFee",
|
|
87073
|
+
type: "function",
|
|
87074
|
+
stateMutability: "view",
|
|
87075
|
+
inputs: [],
|
|
87076
|
+
outputs: [{ type: "uint256" }]
|
|
87077
|
+
},
|
|
87078
|
+
{
|
|
87079
|
+
name: "getSharesToRelease",
|
|
87080
|
+
type: "function",
|
|
87081
|
+
stateMutability: "view",
|
|
87082
|
+
inputs: [],
|
|
87083
|
+
outputs: [{ type: "uint256" }]
|
|
87084
|
+
}
|
|
87085
|
+
];
|
|
87086
|
+
var FusionBalanceOfAbi = [
|
|
87087
|
+
{
|
|
87088
|
+
name: "balanceOf",
|
|
87089
|
+
type: "function",
|
|
87090
|
+
stateMutability: "view",
|
|
87091
|
+
inputs: [{ type: "address", name: "account" }],
|
|
87092
|
+
outputs: [{ type: "uint256" }]
|
|
87093
|
+
}
|
|
87094
|
+
];
|
|
87095
|
+
|
|
86871
87096
|
// src/vaults/savings/abis/ember.ts
|
|
86872
87097
|
var EmberMaxDepositAbi = [
|
|
86873
87098
|
{
|
|
@@ -87849,7 +88074,7 @@ var readerHyperbeatVault = (entry2) => {
|
|
|
87849
88074
|
|
|
87850
88075
|
// src/vaults/savings/readers/listaRwaPool.ts
|
|
87851
88076
|
var PERIOD_SECONDS = 7n * 86400n;
|
|
87852
|
-
var
|
|
88077
|
+
var SECONDS_PER_YEAR22 = 365n * 86400n;
|
|
87853
88078
|
var readerListaRwaPool = (entry2) => {
|
|
87854
88079
|
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
87855
88080
|
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
@@ -87882,7 +88107,7 @@ var readerListaRwaPool = (entry2) => {
|
|
|
87882
88107
|
const rewards = toBigInt16(periodRewards);
|
|
87883
88108
|
const supplyRate = rewards !== void 0 && rewards > 0n && totalAssets > 0n ? (
|
|
87884
88109
|
// percent, nominal: rewards per period → per year ÷ TVL.
|
|
87885
|
-
Number(rewards *
|
|
88110
|
+
Number(rewards * SECONDS_PER_YEAR22 * 1000000n / PERIOD_SECONDS) / Number(totalAssets) / 1e4
|
|
87886
88111
|
) : void 0;
|
|
87887
88112
|
return {
|
|
87888
88113
|
totalAssets,
|
|
@@ -88627,8 +88852,117 @@ var readerSuperformVault = (entry2) => {
|
|
|
88627
88852
|
};
|
|
88628
88853
|
};
|
|
88629
88854
|
|
|
88630
|
-
// src/vaults/savings/readers/
|
|
88855
|
+
// src/vaults/savings/readers/iporFusion.ts
|
|
88631
88856
|
var NEUTRAL_PROBE4 = "0x000000000000000000000000000000000000dead";
|
|
88857
|
+
var DEPOSIT_SELECTOR = "0x6e553f65";
|
|
88858
|
+
var PUBLIC_ROLE = 2n ** 64n - 1n;
|
|
88859
|
+
var WAD18 = 10n ** 18n;
|
|
88860
|
+
var readerIporFusion = (entry2) => {
|
|
88861
|
+
const cfg = entry2.iporFusion;
|
|
88862
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
88863
|
+
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
88864
|
+
const v = entry2.address;
|
|
88865
|
+
const am = cfg?.accessManager;
|
|
88866
|
+
const wm = cfg?.withdrawManager;
|
|
88867
|
+
return {
|
|
88868
|
+
calls: [
|
|
88869
|
+
{ address: v, name: "totalAssets", params: [] },
|
|
88870
|
+
{ address: v, name: "totalSupply", params: [] },
|
|
88871
|
+
{ address: v, name: "convertToAssets", params: [shareUnit] },
|
|
88872
|
+
{ address: v, name: "maxDeposit", params: [NEUTRAL_PROBE4] },
|
|
88873
|
+
{ address: v, name: "previewDeposit", params: [underlyingUnit] },
|
|
88874
|
+
{ address: v, name: "convertToShares", params: [underlyingUnit] },
|
|
88875
|
+
{ address: v, name: "getPerformanceFeeData", params: [] },
|
|
88876
|
+
{ address: v, name: "getManagementFeeData", params: [] },
|
|
88877
|
+
{ address: entry2.underlying, name: "balanceOf", params: [v] },
|
|
88878
|
+
...am ? [
|
|
88879
|
+
{
|
|
88880
|
+
address: am,
|
|
88881
|
+
name: "getTargetFunctionRole",
|
|
88882
|
+
params: [v, DEPOSIT_SELECTOR]
|
|
88883
|
+
},
|
|
88884
|
+
{ address: am, name: "isTargetClosed", params: [v] }
|
|
88885
|
+
] : [],
|
|
88886
|
+
...wm ? [
|
|
88887
|
+
{ address: wm, name: "getWithdrawFee", params: [] },
|
|
88888
|
+
{ address: wm, name: "getRequestFee", params: [] },
|
|
88889
|
+
{ address: wm, name: "getSharesToRelease", params: [] }
|
|
88890
|
+
] : []
|
|
88891
|
+
],
|
|
88892
|
+
abis: [
|
|
88893
|
+
Erc4626ReadAbi2,
|
|
88894
|
+
PlasmaVaultReadAbi,
|
|
88895
|
+
Erc4626ReadAbi2,
|
|
88896
|
+
PlasmaVaultReadAbi,
|
|
88897
|
+
PlasmaVaultReadAbi,
|
|
88898
|
+
PlasmaVaultReadAbi,
|
|
88899
|
+
PlasmaVaultReadAbi,
|
|
88900
|
+
PlasmaVaultReadAbi,
|
|
88901
|
+
FusionBalanceOfAbi,
|
|
88902
|
+
...am ? [FusionAccessManagerReadAbi, FusionAccessManagerReadAbi] : [],
|
|
88903
|
+
...wm ? [
|
|
88904
|
+
FusionWithdrawManagerReadAbi,
|
|
88905
|
+
FusionWithdrawManagerReadAbi,
|
|
88906
|
+
FusionWithdrawManagerReadAbi
|
|
88907
|
+
] : []
|
|
88908
|
+
],
|
|
88909
|
+
parse: (slice2) => {
|
|
88910
|
+
const [assets, supply, rate, maxDep, preview, conv, perf, mgmt, idle] = slice2;
|
|
88911
|
+
let i = 9;
|
|
88912
|
+
const role = am ? slice2[i++] : void 0;
|
|
88913
|
+
const closed = am ? slice2[i++] : void 0;
|
|
88914
|
+
const wFee = wm ? toBigInt16(slice2[i++]) : void 0;
|
|
88915
|
+
const rFee = wm ? toBigInt16(slice2[i++]) : void 0;
|
|
88916
|
+
const toRelease = wm ? toBigInt16(slice2[i++]) : void 0;
|
|
88917
|
+
const totalAssets = toBigInt16(assets);
|
|
88918
|
+
const totalSupply = toBigInt16(supply);
|
|
88919
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
88920
|
+
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0)
|
|
88921
|
+
return void 0;
|
|
88922
|
+
const previewShares = toBigInt16(preview);
|
|
88923
|
+
const convShares = toBigInt16(conv);
|
|
88924
|
+
const depositFeeBps = previewShares !== void 0 && convShares !== void 0 && convShares > 0n ? (
|
|
88925
|
+
// Nearest bp: the fee is minted from the shares, so the ratio lands
|
|
88926
|
+
// a hair under its nominal value (0.2 % reads 19.99 bps).
|
|
88927
|
+
Number(
|
|
88928
|
+
((convShares - previewShares) * 10000n + convShares / 2n) / convShares
|
|
88929
|
+
)
|
|
88930
|
+
) : void 0;
|
|
88931
|
+
const feeBps = (cell) => {
|
|
88932
|
+
const raw = Array.isArray(cell) ? cell[1] : cell?.feeInPercentage;
|
|
88933
|
+
const b = toBigInt16(raw);
|
|
88934
|
+
return b !== void 0 ? Number(b) : void 0;
|
|
88935
|
+
};
|
|
88936
|
+
const performanceFeeBps = feeBps(perf);
|
|
88937
|
+
const managementFeeBps = feeBps(mgmt);
|
|
88938
|
+
const roleId = toBigInt16(role);
|
|
88939
|
+
const gated = roleId !== void 0 && roleId !== PUBLIC_ROLE || closed === true;
|
|
88940
|
+
const maxDeposit = toBigInt16(maxDep);
|
|
88941
|
+
const depositCapacity = gated ? 0n : maxDeposit !== void 0 && maxDeposit < totalAssets * 1000000n ? maxDeposit : void 0;
|
|
88942
|
+
const idleRaw = toBigInt16(idle);
|
|
88943
|
+
const reserved = toRelease !== void 0 && toRelease > 0n && totalSupply > 0n ? toRelease * totalAssets / totalSupply : 0n;
|
|
88944
|
+
const instantRedeemCapacity = cfg?.instantFuses ? totalAssets : idleRaw !== void 0 ? idleRaw > reserved ? idleRaw - reserved : 0n : void 0;
|
|
88945
|
+
return {
|
|
88946
|
+
totalAssets,
|
|
88947
|
+
totalSupply,
|
|
88948
|
+
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
|
|
88949
|
+
// Raw shares one WHOLE underlying mints, NET of the deposit fee.
|
|
88950
|
+
...previewShares !== void 0 ? { convertToShares: previewShares } : {},
|
|
88951
|
+
...depositFeeBps !== void 0 ? { depositFeeBps } : {},
|
|
88952
|
+
...performanceFeeBps !== void 0 ? { performanceFeeBps } : {},
|
|
88953
|
+
...managementFeeBps !== void 0 ? { managementFeeBps } : {},
|
|
88954
|
+
...wFee !== void 0 ? { withdrawFeeBps: Number(wFee * 10000n / WAD18) } : {},
|
|
88955
|
+
...rFee !== void 0 ? { queuedFeeBps: Number(rFee * 10000n / WAD18) } : {},
|
|
88956
|
+
...instantRedeemCapacity !== void 0 ? { instantRedeemCapacity } : {},
|
|
88957
|
+
...depositCapacity !== void 0 ? { depositCapacity } : {},
|
|
88958
|
+
...closed === true ? { paused: true } : {}
|
|
88959
|
+
};
|
|
88960
|
+
}
|
|
88961
|
+
};
|
|
88962
|
+
};
|
|
88963
|
+
|
|
88964
|
+
// src/vaults/savings/readers/emberVault.ts
|
|
88965
|
+
var NEUTRAL_PROBE5 = "0x000000000000000000000000000000000000dead";
|
|
88632
88966
|
var readerEmberVault = (entry2) => {
|
|
88633
88967
|
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
88634
88968
|
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
@@ -88637,7 +88971,7 @@ var readerEmberVault = (entry2) => {
|
|
|
88637
88971
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
88638
88972
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
88639
88973
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
88640
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
88974
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE5] },
|
|
88641
88975
|
{ address: entry2.address, name: "pauseStatus", params: [] }
|
|
88642
88976
|
],
|
|
88643
88977
|
abis: [
|
|
@@ -89264,7 +89598,7 @@ var readerUnitasXgld = (entry2) => {
|
|
|
89264
89598
|
};
|
|
89265
89599
|
|
|
89266
89600
|
// src/vaults/savings/readers/roycoTranche.ts
|
|
89267
|
-
var
|
|
89601
|
+
var NEUTRAL_PROBE6 = "0x000000000000000000000000000000000000dead";
|
|
89268
89602
|
var ASSET_CLAIMS = {
|
|
89269
89603
|
name: "claims",
|
|
89270
89604
|
type: "tuple",
|
|
@@ -89367,7 +89701,7 @@ var readerRoycoTranche = (entry2) => {
|
|
|
89367
89701
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
89368
89702
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
89369
89703
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
89370
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
89704
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE6] },
|
|
89371
89705
|
{ address: entry2.address, name: "paused", params: [] },
|
|
89372
89706
|
...entryPoint ? [
|
|
89373
89707
|
{
|
|
@@ -89806,7 +90140,7 @@ var readerAccountableVault = (entry2) => {
|
|
|
89806
90140
|
};
|
|
89807
90141
|
|
|
89808
90142
|
// src/vaults/savings/readers/alchemixTransmuter.ts
|
|
89809
|
-
var
|
|
90143
|
+
var SECONDS_PER_YEAR23 = 31536e3;
|
|
89810
90144
|
var UNCAPPED_FLOOR = 2n ** 200n;
|
|
89811
90145
|
var pow10 = (n) => 10n ** BigInt(n);
|
|
89812
90146
|
var readerAlchemixTransmuter = (entry2) => {
|
|
@@ -89882,7 +90216,7 @@ var readerAlchemixTransmuter = (entry2) => {
|
|
|
89882
90216
|
const price1e18 = out !== void 0 && out > 0n ? out * ONE_E1823 * pow10(18 - cfg.underlyingDecimals) / q.unit : void 0;
|
|
89883
90217
|
const marketDiscountBps = price1e18 !== void 0 ? Number((price1e18 - ONE_E1823) * 100000n / ONE_E1823) / 10 : void 0;
|
|
89884
90218
|
const tf = transmutationFee !== void 0 ? Number(transmutationFee) / 1e4 : 0;
|
|
89885
|
-
const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (
|
|
90219
|
+
const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR23 / termSeconds) * 100 : void 0;
|
|
89886
90220
|
const exitFeeBps = exitFee !== void 0 ? Number(exitFee) : void 0;
|
|
89887
90221
|
const exitRoutes = [
|
|
89888
90222
|
{
|
|
@@ -89927,7 +90261,7 @@ var readerAlchemixTransmuter = (entry2) => {
|
|
|
89927
90261
|
};
|
|
89928
90262
|
|
|
89929
90263
|
// src/vaults/savings/readers/gapSweep.ts
|
|
89930
|
-
var
|
|
90264
|
+
var NEUTRAL_PROBE7 = "0x000000000000000000000000000000000000dead";
|
|
89931
90265
|
var MAX_UINT256 = 2n ** 256n - 1n;
|
|
89932
90266
|
var readerUsdaiStaked = (entry2) => {
|
|
89933
90267
|
const a = entry2.address;
|
|
@@ -89977,7 +90311,7 @@ var readerYuzuIlp = (entry2) => {
|
|
|
89977
90311
|
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
89978
90312
|
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
89979
90313
|
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
89980
|
-
{ address: entry2.address, name: "maxDeposit", params: [
|
|
90314
|
+
{ address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE7] },
|
|
89981
90315
|
{ address: entry2.address, name: "paused", params: [] }
|
|
89982
90316
|
],
|
|
89983
90317
|
abis: [
|
|
@@ -90090,6 +90424,8 @@ var buildReader2 = (entry2) => {
|
|
|
90090
90424
|
return readerErc4626CooldownInstantFee(entry2);
|
|
90091
90425
|
case "superform-supervault":
|
|
90092
90426
|
return readerSuperformVault(entry2);
|
|
90427
|
+
case "ipor-fusion":
|
|
90428
|
+
return readerIporFusion(entry2);
|
|
90093
90429
|
case "ember-vault":
|
|
90094
90430
|
return readerEmberVault(entry2);
|
|
90095
90431
|
case "mellow-core":
|
|
@@ -90384,7 +90720,10 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
90384
90720
|
// opposite and correctly falls through to `false`.
|
|
90385
90721
|
entry2.reader === "bitfi-vault" || // SuperVaults ARE 4626 on the deposit side and 7540 on the exit, the
|
|
90386
90722
|
// Lagoon / yoETH shape. NB `previewRedeem` reverts — see the reader.
|
|
90387
|
-
entry2.reader === "superform-supervault" || //
|
|
90723
|
+
entry2.reader === "superform-supervault" || // IPOR Fusion PlasmaVaults are conforming 4626 on every leg; the
|
|
90724
|
+
// bespoke reader exists for the WithdrawManager's fees and the
|
|
90725
|
+
// idle-cash cap, not because the standard surface is missing.
|
|
90726
|
+
entry2.reader === "ipor-fusion" || // Ember vaults are conforming 4626 VIEWS (`asset`, `totalAssets`,
|
|
90388
90727
|
// `convertToAssets`) and deposit; `redeem`/`withdraw` revert
|
|
90389
90728
|
// `UseRedeemShares()`, which the savings kind routes around.
|
|
90390
90729
|
entry2.reader === "ember-vault" || // sBOLD and the Alchemix MYTs (Morpho Vault V2) are conforming 4626 on
|
|
@@ -92335,8 +92674,31 @@ var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
|
|
|
92335
92674
|
// CarryTradeUSDTRYLeverage
|
|
92336
92675
|
"1-0x827ce7e8e35861d9ac7fe002755767b695a5594a",
|
|
92337
92676
|
// StockMarketTRBasisTrade
|
|
92338
|
-
"1-0x99351baed3d8ab544ccb08af96a105910fda71e7"
|
|
92677
|
+
"1-0x99351baed3d8ab544ccb08af96a105910fda71e7",
|
|
92339
92678
|
// aFXArbUSDTRY
|
|
92679
|
+
// IPOR Fusion loops and carries — the share price is collateral at an
|
|
92680
|
+
// oracle mark minus debt, levered 5–9× on the loops, and on the carries the
|
|
92681
|
+
// debt sits in a different currency than the vault (dollars against ETH or
|
|
92682
|
+
// BTC, WBTC against a dollar). Max 30-day drawdown measured 2026-10-30 was
|
|
92683
|
+
// 0.35 %; the risk is the mark, the liquidation and the depeg, not the
|
|
92684
|
+
// window. The four lending optimizers stay yield-bearing. Pinned by
|
|
92685
|
+
// `iporFusion.test.ts` against `IPOR_FUSION_VOLATILE_KEYS`.
|
|
92686
|
+
"1-0xb9e806e8f2d94c015ffefa90cd24ecce18f1663c",
|
|
92687
|
+
// rETHLPC
|
|
92688
|
+
"1-0xb8a451107a9f87fde481d4d686247d6e43ed715e",
|
|
92689
|
+
// fusnstETH
|
|
92690
|
+
"1-0xb0f56bb0bf13ee05fef8cd2d8df5ffdfcac7a74f",
|
|
92691
|
+
// $TAUSIUSD
|
|
92692
|
+
"1-0xf8f226da66244f89e70c5b5d1a5c5b0d505eb1d8",
|
|
92693
|
+
// bdUSD
|
|
92694
|
+
"1-0x7659fc26bf3a63e8133bbecb7e16acd48ee8e292",
|
|
92695
|
+
// BTCdc
|
|
92696
|
+
"1-0xe9385eff3f937fcb0f0085da9a3f53d6c2b4fb5f",
|
|
92697
|
+
// ipsrUSDfusion
|
|
92698
|
+
"8453-0xe883426b4fc84a7f5cc86415cabbef43e73a4cc8",
|
|
92699
|
+
// TAUCBETH
|
|
92700
|
+
"8453-0x5900c3b72458f12967dc1bef35b92d271f5cdbc1"
|
|
92701
|
+
// CSCBETHLL
|
|
92340
92702
|
]);
|
|
92341
92703
|
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
92342
92704
|
// USD majors
|
|
@@ -104888,7 +105250,7 @@ function earnPositionTotals(items) {
|
|
|
104888
105250
|
|
|
104889
105251
|
// src/boros/api.ts
|
|
104890
105252
|
var BOROS_API_BASE = "https://api.boros.finance/open-api";
|
|
104891
|
-
var
|
|
105253
|
+
var TIMEOUT_MS9 = 8e3;
|
|
104892
105254
|
var BorosApiError = class extends Error {
|
|
104893
105255
|
constructor(message2, status, errorCode) {
|
|
104894
105256
|
super(message2);
|
|
@@ -104906,7 +105268,7 @@ async function borosApi(path, init, fetchImpl = fetch) {
|
|
|
104906
105268
|
...init?.body !== void 0 ? { "content-type": "application/json" } : {}
|
|
104907
105269
|
},
|
|
104908
105270
|
body: init?.body !== void 0 ? JSON.stringify(init.body) : void 0,
|
|
104909
|
-
signal: AbortSignal.timeout(
|
|
105271
|
+
signal: AbortSignal.timeout(TIMEOUT_MS9)
|
|
104910
105272
|
});
|
|
104911
105273
|
const text = await res.text();
|
|
104912
105274
|
let json;
|
|
@@ -105440,8 +105802,8 @@ async function fetchBorosAccount(account, fetchImpl) {
|
|
|
105440
105802
|
}
|
|
105441
105803
|
|
|
105442
105804
|
// src/boros/margin.ts
|
|
105443
|
-
var
|
|
105444
|
-
var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) /
|
|
105805
|
+
var SECONDS_PER_YEAR24 = 365 * 24 * 3600;
|
|
105806
|
+
var ttmYears = (m, ttmSec) => Math.max(ttmSec ?? m.timeToMaturitySec, m.margin.tThreshSec) / SECONDS_PER_YEAR24;
|
|
105445
105807
|
function borosInitialMargin(m, size, ratePct, ttmSec) {
|
|
105446
105808
|
const r = Math.max(Math.abs(ratePct) / 100, m.margin.rateFloor);
|
|
105447
105809
|
return Math.abs(size) * r * m.margin.kIM * ttmYears(m, ttmSec);
|
|
@@ -105451,7 +105813,7 @@ function borosMaintenanceMargin(m, size, markPct, ttmSec) {
|
|
|
105451
105813
|
return Math.abs(size) * r * m.margin.kMM * ttmYears(m, ttmSec);
|
|
105452
105814
|
}
|
|
105453
105815
|
function borosTakerFee(m, size) {
|
|
105454
|
-
return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec /
|
|
105816
|
+
return Math.abs(size) * m.fees.takerFee * m.timeToMaturitySec / SECONDS_PER_YEAR24;
|
|
105455
105817
|
}
|
|
105456
105818
|
function walkBorosBook(levels, size) {
|
|
105457
105819
|
let left = size;
|
|
@@ -105473,7 +105835,7 @@ function walkBorosBook(levels, size) {
|
|
|
105473
105835
|
};
|
|
105474
105836
|
}
|
|
105475
105837
|
function borosRateMoveToLiquidation(m, size, equity, markPct) {
|
|
105476
|
-
const ttm = m.timeToMaturitySec /
|
|
105838
|
+
const ttm = m.timeToMaturitySec / SECONDS_PER_YEAR24;
|
|
105477
105839
|
if (!(Math.abs(size) > 0) || !(ttm > 0)) return null;
|
|
105478
105840
|
const mm = borosMaintenanceMargin(m, size, markPct);
|
|
105479
105841
|
const slack = equity - mm;
|
|
@@ -105565,7 +105927,7 @@ function quoteBorosHedgeLeg(p) {
|
|
|
105565
105927
|
const fixed = fill.avgAprPct;
|
|
105566
105928
|
const floating = m.rates.floatingApr;
|
|
105567
105929
|
const takerFee = borosTakerFee(m, size);
|
|
105568
|
-
const ttmYears2 = m.timeToMaturitySec /
|
|
105930
|
+
const ttmYears2 = m.timeToMaturitySec / SECONDS_PER_YEAR24;
|
|
105569
105931
|
const settleAprPct = m.fees.settleFee != null ? m.fees.settleFee * 100 : null;
|
|
105570
105932
|
const allIn = ttmYears2 > 0 ? takerFee / size / ttmYears2 * 100 + (settleAprPct ?? 0) : null;
|
|
105571
105933
|
const rateForMargin = fixed ?? m.rates.markApr ?? 0;
|