@1delta/margin-fetcher 5.0.138 → 5.0.139
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 +343 -92
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -21487,6 +21487,10 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
21487
21487
|
borrowed: 0n,
|
|
21488
21488
|
available: 0n
|
|
21489
21489
|
};
|
|
21490
|
+
const minDebtRaw = BigInt(facade.minDebt ?? 0);
|
|
21491
|
+
const maxDebtRaw = BigInt(facade.maxDebt ?? 0);
|
|
21492
|
+
const openable = maxDebtRaw > 0n && maxDebtRaw >= minDebtRaw && cmDebt.available > 0n && cmDebt.available >= minDebtRaw;
|
|
21493
|
+
if (!openable && cmDebt.borrowed === 0n) continue;
|
|
21490
21494
|
const availableToBorrow = Number(
|
|
21491
21495
|
parseRawAmount(cmDebt.available.toString(), underlyingDecimals)
|
|
21492
21496
|
);
|
|
@@ -21543,7 +21547,10 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
21543
21547
|
liquidationBonus: liquidationPenalty,
|
|
21544
21548
|
closeFactor: 1,
|
|
21545
21549
|
collateralActive: false,
|
|
21546
|
-
|
|
21550
|
+
// False when the CM cannot be opened (liquidity below `minDebt`),
|
|
21551
|
+
// so the pair book and listings skip it while existing
|
|
21552
|
+
// positions still read.
|
|
21553
|
+
borrowingEnabled: openable,
|
|
21547
21554
|
depositsEnabled: false,
|
|
21548
21555
|
hasStable: false,
|
|
21549
21556
|
isActive: true,
|
|
@@ -21630,6 +21637,19 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
21630
21637
|
forbiddenTokenMask: facade.forbiddenTokensMask?.toString() ?? "0",
|
|
21631
21638
|
isDegenMode: false
|
|
21632
21639
|
// filtered above; kept for shape-compat
|
|
21640
|
+
},
|
|
21641
|
+
// The descriptor the term sheet reads (`market.gearbox`):
|
|
21642
|
+
// `minDebt` → `availability.minSize` + `exit.minDebt`, and
|
|
21643
|
+
// `openable` → `canOpen` / `blockedBy: 'no-liquidity'`.
|
|
21644
|
+
// Deliberately NOT under `params.market`: yield-tracer ingests
|
|
21645
|
+
// any `params.market` as a `morpho_markets` row, and this one
|
|
21646
|
+
// has no lender/oracle/irm — the NOT NULL insert would fail the
|
|
21647
|
+
// whole batch. `toTermSheetInput` reads `params.gearbox` too.
|
|
21648
|
+
gearbox: {
|
|
21649
|
+
minDebt: minDebtRaw.toString(),
|
|
21650
|
+
maxDebt: maxDebtRaw.toString(),
|
|
21651
|
+
availableToBorrow: cmDebt.available.toString(),
|
|
21652
|
+
openable
|
|
21633
21653
|
}
|
|
21634
21654
|
},
|
|
21635
21655
|
chainId
|
|
@@ -21892,6 +21912,23 @@ var getLenderPublicData = async (chainId, lenders, prices, additionalYields, mul
|
|
|
21892
21912
|
} catch {
|
|
21893
21913
|
}
|
|
21894
21914
|
}
|
|
21915
|
+
const gearboxLender = validLenders.find(isGearboxV3);
|
|
21916
|
+
if (gearboxLender !== void 0) {
|
|
21917
|
+
const start = sliceStart[gearboxLender];
|
|
21918
|
+
const results = rawResults;
|
|
21919
|
+
for (let attempt = 1; attempt <= 3 && !Array.isArray(results?.[start]); attempt++) {
|
|
21920
|
+
try {
|
|
21921
|
+
const [retried] = await multicallRetry({
|
|
21922
|
+
chain: chainId,
|
|
21923
|
+
calls: [calls[start].call],
|
|
21924
|
+
abi: [calls[start].abi],
|
|
21925
|
+
providerId: attempt
|
|
21926
|
+
});
|
|
21927
|
+
if (Array.isArray(retried)) results[start] = retried;
|
|
21928
|
+
} catch {
|
|
21929
|
+
}
|
|
21930
|
+
}
|
|
21931
|
+
}
|
|
21895
21932
|
const invalidLenders = [];
|
|
21896
21933
|
let lenderData = {};
|
|
21897
21934
|
const rateUnitSeconds = /* @__PURE__ */ new Map();
|
|
@@ -51860,6 +51897,7 @@ var rwaFundsFetcher = {
|
|
|
51860
51897
|
// src/yields/intrinsic/fetchers/inverse.ts
|
|
51861
51898
|
var DOLA_STAKING_URL = "https://www.inverse.finance/api/dola-staking";
|
|
51862
51899
|
var JDOLA_STAKING_URL = "https://www.inverse.finance/api/junior/jdola-staking";
|
|
51900
|
+
var INV_STAKING_URL = "https://www.inverse.finance/api/inv-staking";
|
|
51863
51901
|
var SDOLA_KEY = "SDOLA";
|
|
51864
51902
|
var SDOLA_GROUP_KEY = "sDOLA::SDOLA";
|
|
51865
51903
|
var fetchJson3 = async (url) => {
|
|
@@ -51890,6 +51928,35 @@ var sdolaFetcher = {
|
|
|
51890
51928
|
return { [SDOLA_KEY]: apr, [SDOLA_GROUP_KEY]: apr };
|
|
51891
51929
|
}
|
|
51892
51930
|
};
|
|
51931
|
+
var JRDOLA_KEY = "JRDOLA";
|
|
51932
|
+
var JRDOLA_GROUP_KEYS = [
|
|
51933
|
+
"Junior DOLA::JRDOLA",
|
|
51934
|
+
"Junior DOLA::JRDOLA::1::0"
|
|
51935
|
+
];
|
|
51936
|
+
var jrdolaFetcher = {
|
|
51937
|
+
label: "JRDOLA",
|
|
51938
|
+
fetch: async () => {
|
|
51939
|
+
const d = await fetchJson3(JDOLA_STAKING_URL);
|
|
51940
|
+
const apy = Number(d?.apy ?? d?.calculatedApy);
|
|
51941
|
+
if (!Number.isFinite(apy) || apy < 0) throw new Error("jrDOLA apy missing");
|
|
51942
|
+
const apr = apyToAprPercent(apy);
|
|
51943
|
+
const out = { [JRDOLA_KEY]: apr };
|
|
51944
|
+
for (const k of JRDOLA_GROUP_KEYS) out[k] = apr;
|
|
51945
|
+
return out;
|
|
51946
|
+
}
|
|
51947
|
+
};
|
|
51948
|
+
var SINV_KEY = "SINV";
|
|
51949
|
+
var SINV_GROUP_KEY = "Staked INV::SINV";
|
|
51950
|
+
var sinvFetcher = {
|
|
51951
|
+
label: "SINV",
|
|
51952
|
+
fetch: async () => {
|
|
51953
|
+
const d = await fetchJson3(INV_STAKING_URL);
|
|
51954
|
+
const apy = Number(d?.apy ?? d?.auctionApy);
|
|
51955
|
+
if (!Number.isFinite(apy) || apy < 0) throw new Error("sINV apy missing");
|
|
51956
|
+
const apr = apyToAprPercent(apy);
|
|
51957
|
+
return { [SINV_KEY]: apr, [SINV_GROUP_KEY]: apr };
|
|
51958
|
+
}
|
|
51959
|
+
};
|
|
51893
51960
|
|
|
51894
51961
|
// src/yields/intrinsic/fetchers/reProtocol.ts
|
|
51895
51962
|
var REUSD_KEY = "RE::reUSD";
|
|
@@ -57140,6 +57207,39 @@ var FIRM_ENTRIES = {
|
|
|
57140
57207
|
withdrawalMode: "instant",
|
|
57141
57208
|
yieldFetcher: firmCollateralFetcher,
|
|
57142
57209
|
yieldKey: STYCRV_KEY
|
|
57210
|
+
},
|
|
57211
|
+
{
|
|
57212
|
+
reader: "inverse-jrdola",
|
|
57213
|
+
address: "0x6f80a22a57c7f0257094ea8d426af3f747defbc7",
|
|
57214
|
+
underlying: "0xb45ad160634c528cc3d2926d9807104fa3157305",
|
|
57215
|
+
// sDOLA
|
|
57216
|
+
symbol: "jrDOLA",
|
|
57217
|
+
brand: "Inverse",
|
|
57218
|
+
solvency: "tranched-junior",
|
|
57219
|
+
description: "jrDOLA is the junior, first-loss tranche of Inverse's DOLA savings: it holds sDOLA, which can be taken to cover FiRM bad debt before sDOLA holders are touched. It earns DBR sold for sDOLA; the rate shown is that leg, in sDOLA, on top of sDOLA's own rate. Exit is a queue: request it (0.05% fee), wait 1\u201310 days, then complete within a 48-hour window, paid in sDOLA. Missing the window means queueing and paying again; cancelling works only once the window opens.",
|
|
57220
|
+
decimals: 18,
|
|
57221
|
+
isRebasing: false,
|
|
57222
|
+
isMintable: true,
|
|
57223
|
+
withdrawalMode: "request-based",
|
|
57224
|
+
withdrawalCooldownSeconds: 86400,
|
|
57225
|
+
withdrawQueue: "0x8554d8a6bcc5b6d6eb7bea2189e6a8f8d24c7e45",
|
|
57226
|
+
yieldFetcher: jrdolaFetcher,
|
|
57227
|
+
yieldKey: JRDOLA_GROUP_KEYS[0]
|
|
57228
|
+
},
|
|
57229
|
+
{
|
|
57230
|
+
reader: "inverse-sinv",
|
|
57231
|
+
address: "0x08d23468a467d2bb86fae0e32f247a26c7e2e994",
|
|
57232
|
+
underlying: "0x41d5d79431a913c4ae7d69a668ecdfe5ff9dfb68",
|
|
57233
|
+
// INV
|
|
57234
|
+
symbol: "sINV",
|
|
57235
|
+
brand: "Inverse",
|
|
57236
|
+
description: "sINV stakes INV, Inverse Finance's governance token, in FiRM's INV market, where staked INV earns DBR. The vault sells that DBR for more INV in an on-chain auction and adds it to the share price over the following week, so the rate shown is earned in INV and the position's dollar value moves with INV's price. Deposits are capped by a guardian-set limit; withdrawals are instant, with no fee or cooldown.",
|
|
57237
|
+
decimals: 18,
|
|
57238
|
+
isRebasing: false,
|
|
57239
|
+
isMintable: true,
|
|
57240
|
+
withdrawalMode: "instant",
|
|
57241
|
+
yieldFetcher: sinvFetcher,
|
|
57242
|
+
yieldKey: SINV_GROUP_KEY
|
|
57143
57243
|
}
|
|
57144
57244
|
]
|
|
57145
57245
|
};
|
|
@@ -59632,9 +59732,8 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
59632
59732
|
// auction, no rehypothecation. Instant permissionless exit
|
|
59633
59733
|
// (maxDeposit = uint.max verified 2026-08; ~6.9M DOLA TVL).
|
|
59634
59734
|
// Ethereum-only; Inverse propagates the rate cross-chain via
|
|
59635
|
-
// CCIP, so bridged deployments may appear later. The
|
|
59636
|
-
// junior tranche
|
|
59637
|
-
// not registered.
|
|
59735
|
+
// CCIP, so bridged deployments may appear later. The jrDOLA
|
|
59736
|
+
// junior tranche and sINV are in `registryFirm.ts`.
|
|
59638
59737
|
address: "0xb45ad160634c528cc3d2926d9807104fa3157305",
|
|
59639
59738
|
underlying: "0x865377367054516e17014ccded1e7d814edc9ce4",
|
|
59640
59739
|
// DOLA
|
|
@@ -82503,86 +82602,6 @@ var NavOracleReadAbi = [
|
|
|
82503
82602
|
}
|
|
82504
82603
|
];
|
|
82505
82604
|
|
|
82506
|
-
// src/vaults/savings/readers/shared.ts
|
|
82507
|
-
var ONE_E1823 = 10n ** 18n;
|
|
82508
|
-
var toBigInt16 = (v) => {
|
|
82509
|
-
if (v === void 0 || v === null) return void 0;
|
|
82510
|
-
if (typeof v === "bigint") return v;
|
|
82511
|
-
if (typeof v === "number") return BigInt(v);
|
|
82512
|
-
if (typeof v === "string") {
|
|
82513
|
-
if (v === "" || v === "0x" || v === "0X") return void 0;
|
|
82514
|
-
try {
|
|
82515
|
-
return BigInt(v);
|
|
82516
|
-
} catch {
|
|
82517
|
-
return void 0;
|
|
82518
|
-
}
|
|
82519
|
-
}
|
|
82520
|
-
return void 0;
|
|
82521
|
-
};
|
|
82522
|
-
|
|
82523
|
-
// src/vaults/savings/readers/erc4626.ts
|
|
82524
|
-
var readerErc46262 = (entry2) => {
|
|
82525
|
-
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
82526
|
-
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
82527
|
-
return {
|
|
82528
|
-
calls: [
|
|
82529
|
-
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
82530
|
-
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
82531
|
-
{
|
|
82532
|
-
address: entry2.address,
|
|
82533
|
-
name: "convertToAssets",
|
|
82534
|
-
params: [shareUnit]
|
|
82535
|
-
}
|
|
82536
|
-
],
|
|
82537
|
-
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
82538
|
-
parse: ([assets, supply, rate]) => {
|
|
82539
|
-
const totalAssets = toBigInt16(assets);
|
|
82540
|
-
const totalSupply = toBigInt16(supply);
|
|
82541
|
-
const convertToAssetsRaw = toBigInt16(rate);
|
|
82542
|
-
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
82543
|
-
return void 0;
|
|
82544
|
-
}
|
|
82545
|
-
return {
|
|
82546
|
-
totalAssets,
|
|
82547
|
-
totalSupply,
|
|
82548
|
-
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit
|
|
82549
|
-
};
|
|
82550
|
-
}
|
|
82551
|
-
};
|
|
82552
|
-
};
|
|
82553
|
-
|
|
82554
|
-
// src/vaults/savings/readers/erc4626Cooldown.ts
|
|
82555
|
-
var readerErc4626Cooldown = (entry2) => {
|
|
82556
|
-
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
82557
|
-
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
82558
|
-
const cooldownGetter = entry2.cooldownGetter ?? "cooldownDuration";
|
|
82559
|
-
const cooldownAbi = cooldownGetter === "lockupPeriod" ? LockupPeriodAbi : CooldownDurationAbi;
|
|
82560
|
-
return {
|
|
82561
|
-
calls: [
|
|
82562
|
-
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
82563
|
-
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
82564
|
-
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
82565
|
-
{ address: entry2.address, name: cooldownGetter, params: [] }
|
|
82566
|
-
],
|
|
82567
|
-
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, cooldownAbi],
|
|
82568
|
-
parse: ([assets, supply, rate, cooldown]) => {
|
|
82569
|
-
const totalAssets = toBigInt16(assets);
|
|
82570
|
-
const totalSupply = toBigInt16(supply);
|
|
82571
|
-
const convertToAssetsRaw = toBigInt16(rate);
|
|
82572
|
-
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
82573
|
-
return void 0;
|
|
82574
|
-
}
|
|
82575
|
-
const cooldownSecs = toBigInt16(cooldown);
|
|
82576
|
-
return {
|
|
82577
|
-
totalAssets,
|
|
82578
|
-
totalSupply,
|
|
82579
|
-
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
|
|
82580
|
-
withdrawalCooldownSeconds: cooldownSecs === void 0 ? void 0 : Number(cooldownSecs)
|
|
82581
|
-
};
|
|
82582
|
-
}
|
|
82583
|
-
};
|
|
82584
|
-
};
|
|
82585
|
-
|
|
82586
82605
|
// src/vaults/savings/abis/native.ts
|
|
82587
82606
|
var NativeWnlpReadAbi = [
|
|
82588
82607
|
{
|
|
@@ -83522,6 +83541,222 @@ var EmberPauseStatusAbi = [
|
|
|
83522
83541
|
}
|
|
83523
83542
|
];
|
|
83524
83543
|
|
|
83544
|
+
// src/vaults/savings/abis/inverse.ts
|
|
83545
|
+
var uintView = (name) => [
|
|
83546
|
+
{
|
|
83547
|
+
name,
|
|
83548
|
+
type: "function",
|
|
83549
|
+
stateMutability: "view",
|
|
83550
|
+
inputs: [],
|
|
83551
|
+
outputs: [{ type: "uint256" }]
|
|
83552
|
+
}
|
|
83553
|
+
];
|
|
83554
|
+
var InverseWithdrawFeeBpsAbi = uintView("withdrawFeeBps");
|
|
83555
|
+
var InverseWithdrawalsPausedUntilAbi = uintView(
|
|
83556
|
+
"withdrawalsPausedUntil"
|
|
83557
|
+
);
|
|
83558
|
+
var InverseMinDelayAbi = uintView("minDelay");
|
|
83559
|
+
var InverseMaxDelayAbi = uintView("maxDelay");
|
|
83560
|
+
var InverseMaxDelayThresholdBpsAbi = uintView("maxDelayThresholdBps");
|
|
83561
|
+
var InverseDepositLimitAbi = uintView("depositLimit");
|
|
83562
|
+
|
|
83563
|
+
// src/vaults/savings/readers/shared.ts
|
|
83564
|
+
var ONE_E1823 = 10n ** 18n;
|
|
83565
|
+
var toBigInt16 = (v) => {
|
|
83566
|
+
if (v === void 0 || v === null) return void 0;
|
|
83567
|
+
if (typeof v === "bigint") return v;
|
|
83568
|
+
if (typeof v === "number") return BigInt(v);
|
|
83569
|
+
if (typeof v === "string") {
|
|
83570
|
+
if (v === "" || v === "0x" || v === "0X") return void 0;
|
|
83571
|
+
try {
|
|
83572
|
+
return BigInt(v);
|
|
83573
|
+
} catch {
|
|
83574
|
+
return void 0;
|
|
83575
|
+
}
|
|
83576
|
+
}
|
|
83577
|
+
return void 0;
|
|
83578
|
+
};
|
|
83579
|
+
|
|
83580
|
+
// src/vaults/savings/readers/inverseStaking.ts
|
|
83581
|
+
var JRDOLA_DELAY_MODEL = "0x75fda12cb3341cccd41b77c2515f0da716119b07";
|
|
83582
|
+
var MIN_WITHDRAW_DELAY = 86400;
|
|
83583
|
+
var MAX_WITHDRAW_DELAY = 60 * 86400;
|
|
83584
|
+
var jrDolaWithdrawDelay = (p) => {
|
|
83585
|
+
const threshold = p.totalSupply * p.thresholdBps / 10000n;
|
|
83586
|
+
const raw = threshold === 0n || p.withdrawing >= threshold ? p.maxDelay : (p.minDelay * (threshold - p.withdrawing) + p.maxDelay * p.withdrawing) / threshold;
|
|
83587
|
+
const n = Number(raw);
|
|
83588
|
+
return Math.min(Math.max(n, MIN_WITHDRAW_DELAY), MAX_WITHDRAW_DELAY);
|
|
83589
|
+
};
|
|
83590
|
+
var readerInverseJrDola = (entry2) => {
|
|
83591
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
83592
|
+
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
83593
|
+
const escrow = entry2.withdrawQueue;
|
|
83594
|
+
if (!escrow)
|
|
83595
|
+
throw new Error(`jrDOLA entry ${entry2.address} needs withdrawQueue`);
|
|
83596
|
+
return {
|
|
83597
|
+
calls: [
|
|
83598
|
+
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
83599
|
+
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
83600
|
+
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
83601
|
+
{ address: entry2.address, name: "balanceOf", params: [escrow] },
|
|
83602
|
+
{ address: escrow, name: "withdrawFeeBps", params: [] },
|
|
83603
|
+
{ address: escrow, name: "withdrawalsPausedUntil", params: [] },
|
|
83604
|
+
{ address: JRDOLA_DELAY_MODEL, name: "minDelay", params: [] },
|
|
83605
|
+
{ address: JRDOLA_DELAY_MODEL, name: "maxDelay", params: [] },
|
|
83606
|
+
{ address: JRDOLA_DELAY_MODEL, name: "maxDelayThresholdBps", params: [] }
|
|
83607
|
+
],
|
|
83608
|
+
abis: [
|
|
83609
|
+
Erc4626ReadAbi2,
|
|
83610
|
+
TotalSupplyAbi2,
|
|
83611
|
+
Erc4626ReadAbi2,
|
|
83612
|
+
BalanceOfAbi,
|
|
83613
|
+
InverseWithdrawFeeBpsAbi,
|
|
83614
|
+
InverseWithdrawalsPausedUntilAbi,
|
|
83615
|
+
InverseMinDelayAbi,
|
|
83616
|
+
InverseMaxDelayAbi,
|
|
83617
|
+
InverseMaxDelayThresholdBpsAbi
|
|
83618
|
+
],
|
|
83619
|
+
parse: ([
|
|
83620
|
+
assets,
|
|
83621
|
+
supply,
|
|
83622
|
+
rate,
|
|
83623
|
+
queued,
|
|
83624
|
+
fee,
|
|
83625
|
+
pausedUntil,
|
|
83626
|
+
minDelay,
|
|
83627
|
+
maxDelay,
|
|
83628
|
+
thresholdBps
|
|
83629
|
+
]) => {
|
|
83630
|
+
const totalAssets = toBigInt16(assets);
|
|
83631
|
+
const totalSupply = toBigInt16(supply);
|
|
83632
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
83633
|
+
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
83634
|
+
return void 0;
|
|
83635
|
+
}
|
|
83636
|
+
const feeBps = toBigInt16(fee);
|
|
83637
|
+
const paused = toBigInt16(pausedUntil);
|
|
83638
|
+
const withdrawing = toBigInt16(queued);
|
|
83639
|
+
const lo = toBigInt16(minDelay);
|
|
83640
|
+
const hi = toBigInt16(maxDelay);
|
|
83641
|
+
const bps = toBigInt16(thresholdBps);
|
|
83642
|
+
const delay = withdrawing !== void 0 && lo !== void 0 && hi !== void 0 && bps !== void 0 ? jrDolaWithdrawDelay({
|
|
83643
|
+
totalSupply,
|
|
83644
|
+
withdrawing,
|
|
83645
|
+
minDelay: lo,
|
|
83646
|
+
maxDelay: hi,
|
|
83647
|
+
thresholdBps: bps
|
|
83648
|
+
}) : void 0;
|
|
83649
|
+
return {
|
|
83650
|
+
totalAssets,
|
|
83651
|
+
totalSupply,
|
|
83652
|
+
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
|
|
83653
|
+
withdrawQueue: escrow.toLowerCase(),
|
|
83654
|
+
...feeBps !== void 0 ? { withdrawFeeBps: Number(feeBps) } : {},
|
|
83655
|
+
...delay !== void 0 ? { withdrawalCooldownSeconds: delay } : {},
|
|
83656
|
+
...paused !== void 0 ? { exitPaused: Number(paused) > Math.floor(Date.now() / 1e3) } : {}
|
|
83657
|
+
};
|
|
83658
|
+
}
|
|
83659
|
+
};
|
|
83660
|
+
};
|
|
83661
|
+
var readerInverseSinv = (entry2) => {
|
|
83662
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
83663
|
+
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
83664
|
+
return {
|
|
83665
|
+
calls: [
|
|
83666
|
+
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
83667
|
+
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
83668
|
+
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
83669
|
+
{ address: entry2.address, name: "depositLimit", params: [] }
|
|
83670
|
+
],
|
|
83671
|
+
abis: [
|
|
83672
|
+
Erc4626ReadAbi2,
|
|
83673
|
+
TotalSupplyAbi2,
|
|
83674
|
+
Erc4626ReadAbi2,
|
|
83675
|
+
InverseDepositLimitAbi
|
|
83676
|
+
],
|
|
83677
|
+
parse: ([assets, supply, rate, limit]) => {
|
|
83678
|
+
const totalAssets = toBigInt16(assets);
|
|
83679
|
+
const totalSupply = toBigInt16(supply);
|
|
83680
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
83681
|
+
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
83682
|
+
return void 0;
|
|
83683
|
+
}
|
|
83684
|
+
const depositLimit = toBigInt16(limit);
|
|
83685
|
+
return {
|
|
83686
|
+
totalAssets,
|
|
83687
|
+
totalSupply,
|
|
83688
|
+
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
|
|
83689
|
+
...depositLimit !== void 0 ? {
|
|
83690
|
+
depositCapacity: depositLimit > totalAssets ? depositLimit - totalAssets : 0n
|
|
83691
|
+
} : {}
|
|
83692
|
+
};
|
|
83693
|
+
}
|
|
83694
|
+
};
|
|
83695
|
+
};
|
|
83696
|
+
|
|
83697
|
+
// src/vaults/savings/readers/erc4626.ts
|
|
83698
|
+
var readerErc46262 = (entry2) => {
|
|
83699
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
83700
|
+
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
83701
|
+
return {
|
|
83702
|
+
calls: [
|
|
83703
|
+
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
83704
|
+
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
83705
|
+
{
|
|
83706
|
+
address: entry2.address,
|
|
83707
|
+
name: "convertToAssets",
|
|
83708
|
+
params: [shareUnit]
|
|
83709
|
+
}
|
|
83710
|
+
],
|
|
83711
|
+
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
83712
|
+
parse: ([assets, supply, rate]) => {
|
|
83713
|
+
const totalAssets = toBigInt16(assets);
|
|
83714
|
+
const totalSupply = toBigInt16(supply);
|
|
83715
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
83716
|
+
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
83717
|
+
return void 0;
|
|
83718
|
+
}
|
|
83719
|
+
return {
|
|
83720
|
+
totalAssets,
|
|
83721
|
+
totalSupply,
|
|
83722
|
+
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit
|
|
83723
|
+
};
|
|
83724
|
+
}
|
|
83725
|
+
};
|
|
83726
|
+
};
|
|
83727
|
+
|
|
83728
|
+
// src/vaults/savings/readers/erc4626Cooldown.ts
|
|
83729
|
+
var readerErc4626Cooldown = (entry2) => {
|
|
83730
|
+
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
83731
|
+
const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
|
|
83732
|
+
const cooldownGetter = entry2.cooldownGetter ?? "cooldownDuration";
|
|
83733
|
+
const cooldownAbi = cooldownGetter === "lockupPeriod" ? LockupPeriodAbi : CooldownDurationAbi;
|
|
83734
|
+
return {
|
|
83735
|
+
calls: [
|
|
83736
|
+
{ address: entry2.address, name: "totalAssets", params: [] },
|
|
83737
|
+
{ address: entry2.address, name: "totalSupply", params: [] },
|
|
83738
|
+
{ address: entry2.address, name: "convertToAssets", params: [shareUnit] },
|
|
83739
|
+
{ address: entry2.address, name: cooldownGetter, params: [] }
|
|
83740
|
+
],
|
|
83741
|
+
abis: [Erc4626ReadAbi2, TotalSupplyAbi2, Erc4626ReadAbi2, cooldownAbi],
|
|
83742
|
+
parse: ([assets, supply, rate, cooldown]) => {
|
|
83743
|
+
const totalAssets = toBigInt16(assets);
|
|
83744
|
+
const totalSupply = toBigInt16(supply);
|
|
83745
|
+
const convertToAssetsRaw = toBigInt16(rate);
|
|
83746
|
+
if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
|
|
83747
|
+
return void 0;
|
|
83748
|
+
}
|
|
83749
|
+
const cooldownSecs = toBigInt16(cooldown);
|
|
83750
|
+
return {
|
|
83751
|
+
totalAssets,
|
|
83752
|
+
totalSupply,
|
|
83753
|
+
exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
|
|
83754
|
+
withdrawalCooldownSeconds: cooldownSecs === void 0 ? void 0 : Number(cooldownSecs)
|
|
83755
|
+
};
|
|
83756
|
+
}
|
|
83757
|
+
};
|
|
83758
|
+
};
|
|
83759
|
+
|
|
83525
83760
|
// src/vaults/savings/readers/erc4626Idle.ts
|
|
83526
83761
|
var readerErc4626Idle = (entry2) => {
|
|
83527
83762
|
const shareUnit = 10n ** BigInt(entry2.decimals);
|
|
@@ -85585,6 +85820,10 @@ var buildReader2 = (entry2) => {
|
|
|
85585
85820
|
return readerAccountableVault(entry2);
|
|
85586
85821
|
case "morpho-vault-v2":
|
|
85587
85822
|
return readerMorphoVaultV2(entry2);
|
|
85823
|
+
case "inverse-jrdola":
|
|
85824
|
+
return readerInverseJrDola(entry2);
|
|
85825
|
+
case "inverse-sinv":
|
|
85826
|
+
return readerInverseSinv(entry2);
|
|
85588
85827
|
case "erc4626-cooldown":
|
|
85589
85828
|
return readerErc4626Cooldown(entry2);
|
|
85590
85829
|
case "erc4626-idle":
|
|
@@ -85853,7 +86092,9 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
85853
86092
|
entry2.reader === "ember-vault" || // sBOLD and the Alchemix MYTs (Morpho Vault V2) are conforming 4626 on
|
|
85854
86093
|
// both legs; their readers exist for the exit cap (SP BOLD / the
|
|
85855
86094
|
// liquidity adapter) and sBOLD's collateral gate.
|
|
85856
|
-
entry2.reader === "sbold" || entry2.reader === "morpho-vault-v2"
|
|
86095
|
+
entry2.reader === "sbold" || entry2.reader === "morpho-vault-v2" || // Inverse sINV is 4626 on every leg; jrDOLA is 4626 on views and
|
|
86096
|
+
// deposit, its exit is the WithdrawalEscrow the savings kind builds.
|
|
86097
|
+
entry2.reader === "inverse-sinv" || entry2.reader === "inverse-jrdola",
|
|
85857
86098
|
isRebasing: entry2.isRebasing,
|
|
85858
86099
|
isMintable: entry2.isMintable,
|
|
85859
86100
|
mintContract: entry2.mintContract?.toLowerCase() ?? addressLc,
|
|
@@ -94715,7 +94956,9 @@ function resolveMarketDescriptors(row, ctxMarket) {
|
|
|
94715
94956
|
const fromParams = pick2(row, "params.market");
|
|
94716
94957
|
const rowLevel = {};
|
|
94717
94958
|
for (const k of ROW_DESCRIPTOR_KEYS) {
|
|
94959
|
+
const underParams = row.params?.[k];
|
|
94718
94960
|
if (row[k] != null) rowLevel[k] = row[k];
|
|
94961
|
+
else if (underParams != null && k !== "fee") rowLevel[k] = underParams;
|
|
94719
94962
|
}
|
|
94720
94963
|
const merged = { ...ctxMarket ?? {}, ...fromParams ?? {}, ...rowLevel };
|
|
94721
94964
|
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
@@ -96193,13 +96436,21 @@ var gearboxAdapter = {
|
|
|
96193
96436
|
id: "gearbox",
|
|
96194
96437
|
matches: isGearboxV3,
|
|
96195
96438
|
profileId: () => "pool.variable@v1",
|
|
96196
|
-
build: () =>
|
|
96197
|
-
|
|
96198
|
-
|
|
96199
|
-
|
|
96200
|
-
|
|
96201
|
-
|
|
96202
|
-
|
|
96439
|
+
build: (input) => {
|
|
96440
|
+
const g = input.market?.gearbox;
|
|
96441
|
+
return {
|
|
96442
|
+
utilization: { basis: "pool" },
|
|
96443
|
+
...g?.openable === false ? {
|
|
96444
|
+
borrow: {
|
|
96445
|
+
availability: { canOpen: false, blockedBy: "no-liquidity" }
|
|
96446
|
+
}
|
|
96447
|
+
} : {},
|
|
96448
|
+
constraints: {
|
|
96449
|
+
positionModel: "sub-account",
|
|
96450
|
+
positionIdMeaning: "The credit-account address opened for this user."
|
|
96451
|
+
}
|
|
96452
|
+
};
|
|
96453
|
+
}
|
|
96203
96454
|
};
|
|
96204
96455
|
var llamaLendAdapter = {
|
|
96205
96456
|
id: "llamalend",
|