@1delta/margin-fetcher 0.0.276 → 0.0.277
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 +270 -10
- package/dist/index.js.map +1 -1
- package/dist/vaults/classification.d.ts +13 -6
- package/dist/vaults/classification.d.ts.map +1 -1
- package/dist/vaults/lookup.d.ts +7 -4
- package/dist/vaults/lookup.d.ts.map +1 -1
- package/dist/vaults/lst/fetchPublic.d.ts.map +1 -1
- package/dist/vaults/lst/registry.d.ts +10 -1
- package/dist/vaults/lst/registry.d.ts.map +1 -1
- package/dist/vaults/morpho/allocationWalk.d.ts +16 -0
- package/dist/vaults/morpho/allocationWalk.d.ts.map +1 -1
- package/dist/vaults/morpho/fetchFromChain.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Lender, isAaveType, isCompoundV3, isMultiMarket, isSiloV2Type, isSiloV3
|
|
|
5
5
|
export { isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR } from '@1delta/lender-registry';
|
|
6
6
|
import lodash from 'lodash';
|
|
7
7
|
import { getEvmChain, getEvmClient, getEvmClientUniversal, multicallRetryUniversal, getEvmClientWithCustomRpcsUniversal } from '@1delta/providers';
|
|
8
|
-
import { FluidLendingResolverAbi, FluidVaultResolverAbi,
|
|
8
|
+
import { MetaMorphoAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, MoolahVaultAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, GearboxCreditAccountCompressorV310Abi } from '@1delta/abis';
|
|
9
9
|
export { MorphoLensAbi } from '@1delta/abis';
|
|
10
10
|
import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, InitMarginAddresses, getLstAcceptedInputs } from '@1delta/calldata-sdk';
|
|
11
11
|
import { proxyNativeFetch } from '@1delta/proxy-fetch';
|
|
@@ -36276,6 +36276,52 @@ function computeVaultAllocation(vaultAddress, decimals, totalAssetsFormatted, fe
|
|
|
36276
36276
|
liquidityFormatted: Math.min(totalAssetsFormatted, idle + withdrawable)
|
|
36277
36277
|
};
|
|
36278
36278
|
}
|
|
36279
|
+
function computeV2Allocation(decimals, totalAssetsFormatted, feePercent, priceUsd, marketAssetsRaw, rateMap, tokenList, uidCtx) {
|
|
36280
|
+
if (totalAssetsFormatted <= 0) {
|
|
36281
|
+
return { depositRate: 0, exposures: [], liquidityFormatted: 0 };
|
|
36282
|
+
}
|
|
36283
|
+
if (marketAssetsRaw.size === 0) {
|
|
36284
|
+
return {
|
|
36285
|
+
depositRate: 0,
|
|
36286
|
+
exposures: withIdleExposure([], totalAssetsFormatted, priceUsd),
|
|
36287
|
+
liquidityFormatted: totalAssetsFormatted
|
|
36288
|
+
};
|
|
36289
|
+
}
|
|
36290
|
+
let weighted = 0;
|
|
36291
|
+
let allocated = 0;
|
|
36292
|
+
let withdrawable = 0;
|
|
36293
|
+
const exposures = [];
|
|
36294
|
+
for (const [id, assetsRaw] of marketAssetsRaw) {
|
|
36295
|
+
const allocAssets = Number(parseRawAmount(assetsRaw.toString(), decimals));
|
|
36296
|
+
if (allocAssets <= 0) continue;
|
|
36297
|
+
const rate = rateMap.get(id);
|
|
36298
|
+
allocated += allocAssets;
|
|
36299
|
+
const supplyApr = rate?.supplyApr ?? 0;
|
|
36300
|
+
weighted += allocAssets * supplyApr;
|
|
36301
|
+
const marketLiquidity = rate?.liquidity != null ? Number(parseRawAmount(rate.liquidity.toString(), decimals)) : allocAssets;
|
|
36302
|
+
withdrawable += Math.min(allocAssets, Math.max(0, marketLiquidity));
|
|
36303
|
+
const marketUid = marketUidFor(uidCtx, id);
|
|
36304
|
+
const collateralAddress = rate?.collateralAddress ?? "";
|
|
36305
|
+
exposures.push({
|
|
36306
|
+
marketId: id,
|
|
36307
|
+
...marketUid ? { marketUid } : {},
|
|
36308
|
+
collateralAddress,
|
|
36309
|
+
collateral: collateralAddress ? tokenList[collateralAddress] : void 0,
|
|
36310
|
+
assets: allocAssets,
|
|
36311
|
+
assetsUsd: allocAssets * priceUsd,
|
|
36312
|
+
weightPct: allocAssets / totalAssetsFormatted * 100,
|
|
36313
|
+
supplyApr
|
|
36314
|
+
});
|
|
36315
|
+
}
|
|
36316
|
+
exposures.sort((a, b) => b.weightPct - a.weightPct);
|
|
36317
|
+
const grossApr = weighted / totalAssetsFormatted;
|
|
36318
|
+
const idle = Math.max(0, totalAssetsFormatted - allocated);
|
|
36319
|
+
return {
|
|
36320
|
+
depositRate: grossApr * (1 - feePercent / 100),
|
|
36321
|
+
exposures: withIdleExposure(exposures, totalAssetsFormatted, priceUsd),
|
|
36322
|
+
liquidityFormatted: Math.min(totalAssetsFormatted, idle + withdrawable)
|
|
36323
|
+
};
|
|
36324
|
+
}
|
|
36279
36325
|
|
|
36280
36326
|
// src/vaults/morpho/fetchFromChain.ts
|
|
36281
36327
|
var { chunk: chunk5 } = lodash;
|
|
@@ -36292,13 +36338,36 @@ var VAULT_CALLS = [
|
|
|
36292
36338
|
"guardian"
|
|
36293
36339
|
];
|
|
36294
36340
|
var CALLS_PER_VAULT = VAULT_CALLS.length;
|
|
36295
|
-
var PHASE1_CALLS = [
|
|
36341
|
+
var PHASE1_CALLS = [
|
|
36342
|
+
...VAULT_CALLS,
|
|
36343
|
+
"withdrawQueueLength",
|
|
36344
|
+
// V1 (MetaMorpho) — reverts on V2
|
|
36345
|
+
"adaptersLength",
|
|
36346
|
+
// V2 (Vaults V2) — reverts on V1
|
|
36347
|
+
"performanceFee"
|
|
36348
|
+
// V2 fee getter (V1 uses `fee()`)
|
|
36349
|
+
];
|
|
36296
36350
|
var PHASE1_PER_VAULT = PHASE1_CALLS.length;
|
|
36297
36351
|
var WITHDRAW_QUEUE_LENGTH_INDEX = CALLS_PER_VAULT;
|
|
36352
|
+
var ADAPTERS_LENGTH_INDEX = CALLS_PER_VAULT + 1;
|
|
36353
|
+
var PERFORMANCE_FEE_INDEX = CALLS_PER_VAULT + 2;
|
|
36298
36354
|
var MORPHO_LENS_ABI = parseAbi([
|
|
36299
36355
|
"function getMarketDataCompact(address morpho, bytes32[] calldata marketsIds) external view returns (bytes memory data)"
|
|
36300
36356
|
]);
|
|
36301
36357
|
var MARKET_CHUNK = 100;
|
|
36358
|
+
var VAULT_V2_PHASE1_ABI = parseAbi([
|
|
36359
|
+
"function adaptersLength() view returns (uint256)",
|
|
36360
|
+
"function performanceFee() view returns (uint96)"
|
|
36361
|
+
]);
|
|
36362
|
+
var VAULT_V2_ABI = parseAbi([
|
|
36363
|
+
"function adapters(uint256) view returns (address)"
|
|
36364
|
+
]);
|
|
36365
|
+
var VAULT_V2_ADAPTER_ABI = parseAbi([
|
|
36366
|
+
"function marketIdsLength() view returns (uint256)",
|
|
36367
|
+
"function marketIds(uint256) view returns (bytes32)",
|
|
36368
|
+
"function expectedSupplyAssets(bytes32) view returns (uint256)"
|
|
36369
|
+
]);
|
|
36370
|
+
var PHASE1_ABI = [...MetaMorphoAbi, ...VAULT_V2_PHASE1_ABI];
|
|
36302
36371
|
var FEE_SCALE = 1e18;
|
|
36303
36372
|
var isHex40 = (addr) => typeof addr === "string" && /^0x[0-9a-f]{40}$/i.test(addr);
|
|
36304
36373
|
var isHex64 = (v) => typeof v === "string" && /^0x[0-9a-f]{64}$/i.test(v);
|
|
@@ -36312,6 +36381,17 @@ var toStringSafe = (raw, fallback = "") => {
|
|
|
36312
36381
|
if (raw === void 0 || raw === null) return fallback;
|
|
36313
36382
|
return String(raw);
|
|
36314
36383
|
};
|
|
36384
|
+
var toBigIntSafe2 = (raw) => {
|
|
36385
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
36386
|
+
try {
|
|
36387
|
+
if (typeof raw === "bigint") return raw;
|
|
36388
|
+
if (typeof raw === "number") return BigInt(Math.trunc(raw));
|
|
36389
|
+
if (typeof raw === "string" && /^\d+$/.test(raw)) return BigInt(raw);
|
|
36390
|
+
return void 0;
|
|
36391
|
+
} catch {
|
|
36392
|
+
return void 0;
|
|
36393
|
+
}
|
|
36394
|
+
};
|
|
36315
36395
|
var toRawAmount = (formatted, decimals) => {
|
|
36316
36396
|
try {
|
|
36317
36397
|
return parseUnits(formatted.toFixed(decimals), decimals).toString();
|
|
@@ -36350,10 +36430,19 @@ var fetchMorphoVaultsFromChain = async (chainId, multicallRetry, prices = {}, to
|
|
|
36350
36430
|
const phase1 = await multicallRetry({
|
|
36351
36431
|
chain: chainId,
|
|
36352
36432
|
calls: phase1Calls,
|
|
36353
|
-
abi: phase1Calls.map(() =>
|
|
36433
|
+
abi: phase1Calls.map(() => PHASE1_ABI),
|
|
36354
36434
|
allowFailure: true
|
|
36355
36435
|
});
|
|
36436
|
+
const adapterLens = entries.map(
|
|
36437
|
+
(_3, i) => Number(phase1[i * PHASE1_PER_VAULT + ADAPTERS_LENGTH_INDEX])
|
|
36438
|
+
);
|
|
36439
|
+
const isV2 = entries.map(({ entry }, i) => {
|
|
36440
|
+
if (entry.version === "v2") return true;
|
|
36441
|
+
if (entry.version === "v1") return false;
|
|
36442
|
+
return Number.isFinite(adapterLens[i]);
|
|
36443
|
+
});
|
|
36356
36444
|
const queueLens = entries.map((_3, i) => {
|
|
36445
|
+
if (isV2[i]) return 0;
|
|
36357
36446
|
const n = Number(phase1[i * PHASE1_PER_VAULT + WITHDRAW_QUEUE_LENGTH_INDEX]);
|
|
36358
36447
|
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
36359
36448
|
});
|
|
@@ -36397,11 +36486,41 @@ var fetchMorphoVaultsFromChain = async (chainId, multicallRetry, prices = {}, to
|
|
|
36397
36486
|
),
|
|
36398
36487
|
fetchAssetDecimals(chainId, underlyings, multicallRetry)
|
|
36399
36488
|
]);
|
|
36489
|
+
const resolveDecimals = (i) => {
|
|
36490
|
+
const { entry } = entries[i];
|
|
36491
|
+
const underlying = entry.underlying?.toLowerCase() ?? "";
|
|
36492
|
+
const decimalsRaw = phase1[i * PHASE1_PER_VAULT + 2];
|
|
36493
|
+
return assetDecimals.get(underlying) ?? tokenList[underlying]?.decimals ?? Number(decimalsRaw ?? 18);
|
|
36494
|
+
};
|
|
36495
|
+
const v2Inputs = entries.map(({ entry }, i) => ({ entry, i })).filter(({ i }) => isV2[i]).map(({ entry, i }) => {
|
|
36496
|
+
const decimals = resolveDecimals(i);
|
|
36497
|
+
const underlying = entry.underlying?.toLowerCase() ?? "";
|
|
36498
|
+
const totalAssets = toStringSafe(phase1[i * PHASE1_PER_VAULT + 3], "0");
|
|
36499
|
+
const oracleKey = toOracleKey(tokenList[underlying]?.assetGroup) ?? toGenericPriceKey(underlying, chainId);
|
|
36500
|
+
return {
|
|
36501
|
+
vault: entry.vault.toLowerCase(),
|
|
36502
|
+
underlying,
|
|
36503
|
+
decimals,
|
|
36504
|
+
totalAssetsFormatted: Number(parseRawAmount(totalAssets, decimals)),
|
|
36505
|
+
feePercent: toNumberSafe(phase1[i * PHASE1_PER_VAULT + PERFORMANCE_FEE_INDEX]) / FEE_SCALE * 100,
|
|
36506
|
+
priceUsd: prices[oracleKey] ?? prices[underlying] ?? 0,
|
|
36507
|
+
adaptersLength: Math.max(0, Math.trunc(adapterLens[i]) || 0)
|
|
36508
|
+
};
|
|
36509
|
+
});
|
|
36510
|
+
const v2ByVault = await fetchV2Allocations(
|
|
36511
|
+
chainId,
|
|
36512
|
+
multicallRetry,
|
|
36513
|
+
v2Inputs,
|
|
36514
|
+
core,
|
|
36515
|
+
tokenList
|
|
36516
|
+
);
|
|
36400
36517
|
const out = {};
|
|
36401
36518
|
for (let i = 0; i < entries.length; i++) {
|
|
36402
36519
|
const { entry } = entries[i];
|
|
36403
36520
|
const base = i * PHASE1_PER_VAULT;
|
|
36404
36521
|
const slice = phase1.slice(base, base + CALLS_PER_VAULT);
|
|
36522
|
+
const v2 = isV2[i] ? v2ByVault.get(entry.vault.toLowerCase()) ?? null : null;
|
|
36523
|
+
const v2FeePercent = isV2[i] ? toNumberSafe(phase1[base + PERFORMANCE_FEE_INDEX]) / FEE_SCALE * 100 : void 0;
|
|
36405
36524
|
const parsed = parseVault3(
|
|
36406
36525
|
entry,
|
|
36407
36526
|
slice,
|
|
@@ -36411,12 +36530,132 @@ var fetchMorphoVaultsFromChain = async (chainId, multicallRetry, prices = {}, to
|
|
|
36411
36530
|
marketIdsByVault[i],
|
|
36412
36531
|
rateMap,
|
|
36413
36532
|
positionMap,
|
|
36414
|
-
assetDecimals
|
|
36533
|
+
assetDecimals,
|
|
36534
|
+
v2,
|
|
36535
|
+
v2FeePercent
|
|
36415
36536
|
);
|
|
36416
36537
|
if (parsed) out[parsed.address] = parsed;
|
|
36417
36538
|
}
|
|
36418
36539
|
return out;
|
|
36419
36540
|
};
|
|
36541
|
+
async function fetchV2Allocations(chainId, multicallRetry, v2, core, tokenList) {
|
|
36542
|
+
const out = /* @__PURE__ */ new Map();
|
|
36543
|
+
if (v2.length === 0) return out;
|
|
36544
|
+
const aCalls = [];
|
|
36545
|
+
const aVaultIdx = [];
|
|
36546
|
+
v2.forEach((v, vi) => {
|
|
36547
|
+
for (let a = 0; a < v.adaptersLength; a++) {
|
|
36548
|
+
aCalls.push({ address: v.vault, name: "adapters", params: [BigInt(a)] });
|
|
36549
|
+
aVaultIdx.push(vi);
|
|
36550
|
+
}
|
|
36551
|
+
});
|
|
36552
|
+
const adaptersByVault = v2.map(() => []);
|
|
36553
|
+
if (aCalls.length > 0) {
|
|
36554
|
+
const aRes = await multicallRetry({
|
|
36555
|
+
chain: chainId,
|
|
36556
|
+
calls: aCalls,
|
|
36557
|
+
abi: aCalls.map(() => VAULT_V2_ABI),
|
|
36558
|
+
allowFailure: true
|
|
36559
|
+
});
|
|
36560
|
+
aRes.forEach((r, k) => {
|
|
36561
|
+
if (isHex40(r)) adaptersByVault[aVaultIdx[k]].push(r.toLowerCase());
|
|
36562
|
+
});
|
|
36563
|
+
}
|
|
36564
|
+
const allAdapters = [...new Set(adaptersByVault.flat())];
|
|
36565
|
+
if (allAdapters.length === 0) return out;
|
|
36566
|
+
const bRes = await multicallRetry({
|
|
36567
|
+
chain: chainId,
|
|
36568
|
+
calls: allAdapters.map((a) => ({
|
|
36569
|
+
address: a,
|
|
36570
|
+
name: "marketIdsLength",
|
|
36571
|
+
params: []
|
|
36572
|
+
})),
|
|
36573
|
+
abi: allAdapters.map(() => VAULT_V2_ADAPTER_ABI),
|
|
36574
|
+
allowFailure: true
|
|
36575
|
+
});
|
|
36576
|
+
const mkLen = /* @__PURE__ */ new Map();
|
|
36577
|
+
allAdapters.forEach((a, i) => {
|
|
36578
|
+
const n = Number(bRes[i]);
|
|
36579
|
+
mkLen.set(a, Number.isFinite(n) && n > 0 ? n : 0);
|
|
36580
|
+
});
|
|
36581
|
+
const cCalls = [];
|
|
36582
|
+
const cAdapter = [];
|
|
36583
|
+
for (const a of allAdapters) {
|
|
36584
|
+
for (let j = 0; j < (mkLen.get(a) ?? 0); j++) {
|
|
36585
|
+
cCalls.push({ address: a, name: "marketIds", params: [BigInt(j)] });
|
|
36586
|
+
cAdapter.push(a);
|
|
36587
|
+
}
|
|
36588
|
+
}
|
|
36589
|
+
const marketIdsByAdapter = new Map(
|
|
36590
|
+
allAdapters.map((a) => [a, []])
|
|
36591
|
+
);
|
|
36592
|
+
if (cCalls.length > 0) {
|
|
36593
|
+
const cRes = await multicallRetry({
|
|
36594
|
+
chain: chainId,
|
|
36595
|
+
calls: cCalls,
|
|
36596
|
+
abi: cCalls.map(() => VAULT_V2_ADAPTER_ABI),
|
|
36597
|
+
allowFailure: true
|
|
36598
|
+
});
|
|
36599
|
+
cRes.forEach((r, k) => {
|
|
36600
|
+
if (isHex64(r)) marketIdsByAdapter.get(cAdapter[k]).push(r.toLowerCase());
|
|
36601
|
+
});
|
|
36602
|
+
}
|
|
36603
|
+
const dCalls = [];
|
|
36604
|
+
const dMeta = [];
|
|
36605
|
+
for (const a of allAdapters) {
|
|
36606
|
+
for (const mid of marketIdsByAdapter.get(a) ?? []) {
|
|
36607
|
+
dCalls.push({ address: a, name: "expectedSupplyAssets", params: [mid] });
|
|
36608
|
+
dMeta.push({ adapter: a, mid });
|
|
36609
|
+
}
|
|
36610
|
+
}
|
|
36611
|
+
const assetsByAdapter = /* @__PURE__ */ new Map();
|
|
36612
|
+
if (dCalls.length > 0) {
|
|
36613
|
+
const dRes = await multicallRetry({
|
|
36614
|
+
chain: chainId,
|
|
36615
|
+
calls: dCalls,
|
|
36616
|
+
abi: dCalls.map(() => VAULT_V2_ADAPTER_ABI),
|
|
36617
|
+
allowFailure: true
|
|
36618
|
+
});
|
|
36619
|
+
dRes.forEach((r, k) => {
|
|
36620
|
+
const v = toBigIntSafe2(r);
|
|
36621
|
+
if (v === void 0) return;
|
|
36622
|
+
const { adapter, mid } = dMeta[k];
|
|
36623
|
+
if (!assetsByAdapter.has(adapter)) assetsByAdapter.set(adapter, /* @__PURE__ */ new Map());
|
|
36624
|
+
assetsByAdapter.get(adapter).set(mid, v);
|
|
36625
|
+
});
|
|
36626
|
+
}
|
|
36627
|
+
const allMids = [...new Set([...marketIdsByAdapter.values()].flat())];
|
|
36628
|
+
const rateMap = await fetchMorphoMarketRates(
|
|
36629
|
+
chainId,
|
|
36630
|
+
core,
|
|
36631
|
+
allMids,
|
|
36632
|
+
multicallRetry
|
|
36633
|
+
);
|
|
36634
|
+
v2.forEach((v, vi) => {
|
|
36635
|
+
const marketAssetsRaw = /* @__PURE__ */ new Map();
|
|
36636
|
+
for (const a of adaptersByVault[vi]) {
|
|
36637
|
+
const m = assetsByAdapter.get(a);
|
|
36638
|
+
if (!m) continue;
|
|
36639
|
+
for (const [mid, amt] of m) {
|
|
36640
|
+
marketAssetsRaw.set(mid, (marketAssetsRaw.get(mid) ?? 0n) + amt);
|
|
36641
|
+
}
|
|
36642
|
+
}
|
|
36643
|
+
out.set(
|
|
36644
|
+
v.vault,
|
|
36645
|
+
computeV2Allocation(
|
|
36646
|
+
v.decimals,
|
|
36647
|
+
v.totalAssetsFormatted,
|
|
36648
|
+
v.feePercent,
|
|
36649
|
+
v.priceUsd,
|
|
36650
|
+
marketAssetsRaw,
|
|
36651
|
+
rateMap,
|
|
36652
|
+
tokenList,
|
|
36653
|
+
{ chainId, underlying: v.underlying, protocol: "MORPHO_BLUE" }
|
|
36654
|
+
)
|
|
36655
|
+
);
|
|
36656
|
+
});
|
|
36657
|
+
return out;
|
|
36658
|
+
}
|
|
36420
36659
|
async function fetchMorphoMarketRates(chainId, core, marketIds, multicallRetry) {
|
|
36421
36660
|
const map = /* @__PURE__ */ new Map();
|
|
36422
36661
|
const lens = MORPHO_LENS[chainId];
|
|
@@ -36472,7 +36711,7 @@ async function fetchMorphoMarketRates(chainId, core, marketIds, multicallRetry)
|
|
|
36472
36711
|
});
|
|
36473
36712
|
return map;
|
|
36474
36713
|
}
|
|
36475
|
-
function parseVault3(entry, results, chainId, prices, tokenList, marketIds, rateMap, positionMap, assetDecimals) {
|
|
36714
|
+
function parseVault3(entry, results, chainId, prices, tokenList, marketIds, rateMap, positionMap, assetDecimals, v2Allocation, v2FeePercent) {
|
|
36476
36715
|
const address = entry?.vault?.toLowerCase();
|
|
36477
36716
|
const underlying = entry?.underlying?.toLowerCase();
|
|
36478
36717
|
if (!address || !underlying) return null;
|
|
@@ -36503,9 +36742,9 @@ function parseVault3(entry, results, chainId, prices, tokenList, marketIds, rate
|
|
|
36503
36742
|
const onchainName = toStringSafe(nameRaw).trim();
|
|
36504
36743
|
const fallbackName = onchainName || (entry.name ?? "").trim();
|
|
36505
36744
|
const symbol = toStringSafe(symbolRaw);
|
|
36506
|
-
const fee = toNumberSafe(feeRaw) / FEE_SCALE * 100;
|
|
36745
|
+
const fee = v2FeePercent !== void 0 ? v2FeePercent : toNumberSafe(feeRaw) / FEE_SCALE * 100;
|
|
36507
36746
|
const timelock = toNumberSafe(timelockRaw);
|
|
36508
|
-
const { depositRate, exposures, liquidityFormatted } = computeVaultAllocation(
|
|
36747
|
+
const { depositRate, exposures, liquidityFormatted } = v2Allocation ?? computeVaultAllocation(
|
|
36509
36748
|
address,
|
|
36510
36749
|
decimals,
|
|
36511
36750
|
totalAssetsFormatted,
|
|
@@ -38630,6 +38869,8 @@ var LST_REGISTRY = {
|
|
|
38630
38869
|
// stake PoL assets in an Infrared vault). Exit is DEX-only.
|
|
38631
38870
|
address: "0xac03caba51e17c86c921e1f6cbfbdc91f8bb2e6b",
|
|
38632
38871
|
underlying: "0x656b95e550c07a9ffe548bd4085c72418ceb1dba",
|
|
38872
|
+
// BGT is unpriced; the wrapper is 1:1 redeemable to BERA → price via WBERA.
|
|
38873
|
+
priceUnderlying: "0x6969696969696969696969696969696969696969",
|
|
38633
38874
|
symbol: "iBGT",
|
|
38634
38875
|
brand: "Infrared",
|
|
38635
38876
|
decimals: 18,
|
|
@@ -38650,6 +38891,8 @@ var LST_REGISTRY = {
|
|
|
38650
38891
|
// queue that pays out native BERA (via BGT.redeem).
|
|
38651
38892
|
address: "0xbaadcc2962417c01af99fb2b7c75706b9bd6babe",
|
|
38652
38893
|
underlying: "0x656b95e550c07a9ffe548bd4085c72418ceb1dba",
|
|
38894
|
+
// BGT is unpriced; the wrapper is 1:1 redeemable to BERA → price via WBERA.
|
|
38895
|
+
priceUnderlying: "0x6969696969696969696969696969696969696969",
|
|
38653
38896
|
symbol: "LBGT",
|
|
38654
38897
|
brand: "BeraPaw",
|
|
38655
38898
|
decimals: 18,
|
|
@@ -38671,6 +38914,8 @@ var LST_REGISTRY = {
|
|
|
38671
38914
|
// native BERA (minus fee).
|
|
38672
38915
|
address: "0x7e768f47dfdd5dae874aac233f1bc5817137e453",
|
|
38673
38916
|
underlying: "0x656b95e550c07a9ffe548bd4085c72418ceb1dba",
|
|
38917
|
+
// BGT is unpriced; the wrapper is 1:1 redeemable to BERA → price via WBERA.
|
|
38918
|
+
priceUnderlying: "0x6969696969696969696969696969696969696969",
|
|
38674
38919
|
symbol: "yBGT",
|
|
38675
38920
|
brand: "Bearn",
|
|
38676
38921
|
decimals: 18,
|
|
@@ -38689,6 +38934,8 @@ var LST_REGISTRY = {
|
|
|
38689
38934
|
// redeem path is unverified, so treated as DEX-only exit.
|
|
38690
38935
|
address: "0x2cec7f1ac87f5345ced3d6c74bbb61bfae231ffb",
|
|
38691
38936
|
underlying: "0x656b95e550c07a9ffe548bd4085c72418ceb1dba",
|
|
38937
|
+
// BGT is unpriced; the wrapper is 1:1 redeemable to BERA → price via WBERA.
|
|
38938
|
+
priceUnderlying: "0x6969696969696969696969696969696969696969",
|
|
38692
38939
|
symbol: "stBGT",
|
|
38693
38940
|
brand: "Stride",
|
|
38694
38941
|
decimals: 18,
|
|
@@ -40295,7 +40542,7 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
40295
40542
|
const addressLc = entry.address.toLowerCase();
|
|
40296
40543
|
const underlyingLc = entry.underlying.toLowerCase();
|
|
40297
40544
|
const asset = tokenList[underlyingLc];
|
|
40298
|
-
const priceUsd = prices[underlyingLc];
|
|
40545
|
+
const priceUsd = prices[entry.priceUnderlying?.toLowerCase() ?? underlyingLc];
|
|
40299
40546
|
const supplyRate = aprByAddress[addressLc] ?? 0;
|
|
40300
40547
|
const rewardsRate = 0;
|
|
40301
40548
|
const depositRate = supplyRate + rewardsRate;
|
|
@@ -44501,7 +44748,18 @@ var stampVaultClassification = (data, chainId, tokenList = {}) => {
|
|
|
44501
44748
|
});
|
|
44502
44749
|
v.yieldProfile = c.yieldProfile;
|
|
44503
44750
|
v.denomination = c.denomination;
|
|
44504
|
-
|
|
44751
|
+
const raw = v.convertToAssets ?? v.pricePerShare;
|
|
44752
|
+
if (raw != null) {
|
|
44753
|
+
v.sharePriceRaw = raw;
|
|
44754
|
+
const assetDec = v.assetDecimals ?? v.decimals;
|
|
44755
|
+
if (assetDec != null) {
|
|
44756
|
+
const formatted = Number(raw) / 10 ** assetDec;
|
|
44757
|
+
if (Number.isFinite(formatted)) {
|
|
44758
|
+
v.sharePrice = formatted;
|
|
44759
|
+
if (v.priceUsd != null) v.sharePriceUSD = formatted * v.priceUsd;
|
|
44760
|
+
}
|
|
44761
|
+
}
|
|
44762
|
+
}
|
|
44505
44763
|
}
|
|
44506
44764
|
};
|
|
44507
44765
|
stampBag(data.fluid, "fluid");
|
|
@@ -45775,7 +46033,9 @@ function buildVaultLookup(data) {
|
|
|
45775
46033
|
// provider objects before the lookup is built).
|
|
45776
46034
|
yieldProfile: v.yieldProfile,
|
|
45777
46035
|
denomination: v.denomination,
|
|
45778
|
-
|
|
46036
|
+
sharePriceRaw: v.sharePriceRaw,
|
|
46037
|
+
sharePrice: v.sharePrice,
|
|
46038
|
+
sharePriceUSD: v.sharePriceUSD
|
|
45779
46039
|
});
|
|
45780
46040
|
}
|
|
45781
46041
|
};
|