@1delta/margin-fetcher 5.0.119 → 5.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +130 -27
- package/dist/index.js +1935 -521
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10326,8 +10326,8 @@ var isDeterministicCallError = (error) => {
|
|
|
10326
10326
|
let err = error;
|
|
10327
10327
|
for (let depth = 0; err && depth < 8; depth++) {
|
|
10328
10328
|
if (DETERMINISTIC_ERROR_NAMES.has(err.name)) return true;
|
|
10329
|
-
const
|
|
10330
|
-
if (
|
|
10329
|
+
const message2 = String(err.shortMessage ?? err.message ?? "").toLowerCase();
|
|
10330
|
+
if (message2.includes("execution reverted") || message2.includes("returned no data"))
|
|
10331
10331
|
return true;
|
|
10332
10332
|
err = err.cause;
|
|
10333
10333
|
}
|
|
@@ -10749,9 +10749,9 @@ async function resolveListaBrokers(chainId, marketKeys, getClient = getEvmClient
|
|
|
10749
10749
|
multicallRetry,
|
|
10750
10750
|
getClient
|
|
10751
10751
|
);
|
|
10752
|
-
results.forEach((
|
|
10753
|
-
if (
|
|
10754
|
-
cache7[missing[i]] =
|
|
10752
|
+
results.forEach((addr5, i) => {
|
|
10753
|
+
if (addr5 === void 0) return;
|
|
10754
|
+
cache7[missing[i]] = addr5.toLowerCase();
|
|
10755
10755
|
});
|
|
10756
10756
|
} catch (e) {
|
|
10757
10757
|
console.warn(
|
|
@@ -11538,9 +11538,9 @@ function applyPositionDelta(positions, targetMarketUid, depositsDeltaUSD, debtDe
|
|
|
11538
11538
|
}
|
|
11539
11539
|
|
|
11540
11540
|
// src/lending/margin/base/sumer/deposit.ts
|
|
11541
|
-
function computeSumerDepositDelta(
|
|
11541
|
+
function computeSumerDepositDelta(amount5, price2, targetMarketUid, balanceData2, positions, createNewSubAccount = false, apr, yieldParams) {
|
|
11542
11542
|
const base = createNewSubAccount ? EMPTY_BALANCE : balanceData2;
|
|
11543
|
-
const dollarAmount =
|
|
11543
|
+
const dollarAmount = amount5 * price2;
|
|
11544
11544
|
const updatedPositions = applyPositionDelta(
|
|
11545
11545
|
positions,
|
|
11546
11546
|
targetMarketUid,
|
|
@@ -11606,8 +11606,8 @@ function computeSumerDepositDelta(amount4, price2, targetMarketUid, balanceData2
|
|
|
11606
11606
|
}
|
|
11607
11607
|
|
|
11608
11608
|
// src/lending/margin/base/sumer/withdraw.ts
|
|
11609
|
-
function computeSumerWithdrawDelta(
|
|
11610
|
-
const dollarAmount =
|
|
11609
|
+
function computeSumerWithdrawDelta(amount5, price2, targetMarketUid, balanceData2, positions, apr, yieldParams) {
|
|
11610
|
+
const dollarAmount = amount5 * price2;
|
|
11611
11611
|
const updatedPositions = applyPositionDelta(
|
|
11612
11612
|
positions,
|
|
11613
11613
|
targetMarketUid,
|
|
@@ -11673,8 +11673,8 @@ function computeSumerWithdrawDelta(amount4, price2, targetMarketUid, balanceData
|
|
|
11673
11673
|
}
|
|
11674
11674
|
|
|
11675
11675
|
// src/lending/margin/base/sumer/borrow.ts
|
|
11676
|
-
function computeSumerBorrowDelta(
|
|
11677
|
-
const dollarAmount =
|
|
11676
|
+
function computeSumerBorrowDelta(amount5, price2, targetMarketUid, balanceData2, positions, apr, yieldParams, irMode) {
|
|
11677
|
+
const dollarAmount = amount5 * price2;
|
|
11678
11678
|
const mode = irMode ?? 2;
|
|
11679
11679
|
const updatedPositions = applyPositionDelta(
|
|
11680
11680
|
positions,
|
|
@@ -11744,8 +11744,8 @@ function computeSumerBorrowDelta(amount4, price2, targetMarketUid, balanceData2,
|
|
|
11744
11744
|
}
|
|
11745
11745
|
|
|
11746
11746
|
// src/lending/margin/base/sumer/repay.ts
|
|
11747
|
-
function computeSumerRepayDelta(
|
|
11748
|
-
const dollarAmount =
|
|
11747
|
+
function computeSumerRepayDelta(amount5, price2, targetMarketUid, balanceData2, positions, apr, yieldParams, irMode) {
|
|
11748
|
+
const dollarAmount = amount5 * price2;
|
|
11749
11749
|
const mode = irMode ?? 2;
|
|
11750
11750
|
const updatedPositions = applyPositionDelta(
|
|
11751
11751
|
positions,
|
|
@@ -18847,13 +18847,13 @@ function findVaultInfo(normalizedAddr, vaultData) {
|
|
|
18847
18847
|
function buildAdjacencyList(vaultData) {
|
|
18848
18848
|
const adj = /* @__PURE__ */ new Map();
|
|
18849
18849
|
const knownVaults = /* @__PURE__ */ new Set();
|
|
18850
|
-
for (const
|
|
18851
|
-
const norm =
|
|
18850
|
+
for (const addr5 of vaultData.keys()) {
|
|
18851
|
+
const norm = addr5.toLowerCase();
|
|
18852
18852
|
knownVaults.add(norm);
|
|
18853
18853
|
adj.set(norm, /* @__PURE__ */ new Set());
|
|
18854
18854
|
}
|
|
18855
|
-
for (const [
|
|
18856
|
-
const from =
|
|
18855
|
+
for (const [addr5, info] of vaultData) {
|
|
18856
|
+
const from = addr5.toLowerCase();
|
|
18857
18857
|
const activeCollaterals = getActiveCollaterals(info.collateralLTVInfo);
|
|
18858
18858
|
for (const to of activeCollaterals) {
|
|
18859
18859
|
if (knownVaults.has(to) && from !== to) {
|
|
@@ -18896,8 +18896,8 @@ function findConnectedComponents(adj) {
|
|
|
18896
18896
|
function deriveGovernor(vaultAddresses, vaultData) {
|
|
18897
18897
|
const counts = /* @__PURE__ */ new Map();
|
|
18898
18898
|
const zeroNorm = zeroAddress;
|
|
18899
|
-
for (const
|
|
18900
|
-
const info = findVaultInfo(
|
|
18899
|
+
for (const addr5 of vaultAddresses) {
|
|
18900
|
+
const info = findVaultInfo(addr5, vaultData);
|
|
18901
18901
|
if (!info) continue;
|
|
18902
18902
|
const gov = info.governorAdmin?.toLowerCase();
|
|
18903
18903
|
if (!gov || gov === zeroNorm) continue;
|
|
@@ -18922,8 +18922,8 @@ function deriveClusters(vaultData, includeSingletons = false) {
|
|
|
18922
18922
|
if (!includeSingletons && component.length < 2) continue;
|
|
18923
18923
|
if (!includeSingletons) {
|
|
18924
18924
|
let hasActiveEdge = false;
|
|
18925
|
-
for (const
|
|
18926
|
-
const neighbors = adj.get(
|
|
18925
|
+
for (const addr5 of component) {
|
|
18926
|
+
const neighbors = adj.get(addr5);
|
|
18927
18927
|
if (neighbors && neighbors.size > 0) {
|
|
18928
18928
|
hasActiveEdge = true;
|
|
18929
18929
|
break;
|
|
@@ -18932,9 +18932,9 @@ function deriveClusters(vaultData, includeSingletons = false) {
|
|
|
18932
18932
|
if (!hasActiveEdge) continue;
|
|
18933
18933
|
}
|
|
18934
18934
|
const clusterVaultData = /* @__PURE__ */ new Map();
|
|
18935
|
-
for (const
|
|
18936
|
-
const info = findVaultInfo(
|
|
18937
|
-
if (info) clusterVaultData.set(
|
|
18935
|
+
for (const addr5 of component) {
|
|
18936
|
+
const info = findVaultInfo(addr5, vaultData);
|
|
18937
|
+
if (info) clusterVaultData.set(addr5, info);
|
|
18938
18938
|
}
|
|
18939
18939
|
clusters.push({
|
|
18940
18940
|
governor: deriveGovernor(component, vaultData),
|
|
@@ -18959,21 +18959,21 @@ function toTokenAmount(raw, decimals) {
|
|
|
18959
18959
|
}
|
|
18960
18960
|
function identifyBorrowVaults(cluster) {
|
|
18961
18961
|
const borrowVaults = /* @__PURE__ */ new Set();
|
|
18962
|
-
for (const [
|
|
18962
|
+
for (const [addr5, info] of cluster.vaultData) {
|
|
18963
18963
|
const hasIRM = info.interestRateModel && info.interestRateModel.toLowerCase() !== zeroAddress;
|
|
18964
18964
|
const hasActiveCollateral = (info.collateralLTVInfo ?? []).some(
|
|
18965
18965
|
(ltv) => ltv.borrowLTV > 0n
|
|
18966
18966
|
);
|
|
18967
18967
|
if (hasIRM && hasActiveCollateral) {
|
|
18968
|
-
borrowVaults.add(
|
|
18968
|
+
borrowVaults.add(addr5.toLowerCase());
|
|
18969
18969
|
}
|
|
18970
18970
|
}
|
|
18971
18971
|
return borrowVaults;
|
|
18972
18972
|
}
|
|
18973
18973
|
function buildReverseLTVIndex(cluster) {
|
|
18974
18974
|
const index = /* @__PURE__ */ new Map();
|
|
18975
|
-
for (const [
|
|
18976
|
-
const borrowVault =
|
|
18975
|
+
for (const [addr5, info] of cluster.vaultData) {
|
|
18976
|
+
const borrowVault = addr5.toLowerCase();
|
|
18977
18977
|
for (const ltv of info.collateralLTVInfo ?? []) {
|
|
18978
18978
|
if (ltv.borrowLTV <= 0n) continue;
|
|
18979
18979
|
const collateral = ltv.collateral.toLowerCase();
|
|
@@ -19026,8 +19026,8 @@ function buildTokenConfig(vaultAddr, reverseLTV, borrowVaults, vaultData) {
|
|
|
19026
19026
|
}
|
|
19027
19027
|
function buildEModes(borrowVaults, cluster) {
|
|
19028
19028
|
const eModes = {};
|
|
19029
|
-
for (const
|
|
19030
|
-
const info = findInfo(
|
|
19029
|
+
for (const addr5 of borrowVaults) {
|
|
19030
|
+
const info = findInfo(addr5, cluster.vaultData);
|
|
19031
19031
|
if (!info) continue;
|
|
19032
19032
|
const activeLTVs = info.collateralLTVInfo.filter((l) => l.borrowLTV > 0n);
|
|
19033
19033
|
const avgBorrowLTV = activeLTVs.length > 0 ? activeLTVs.reduce((sum3, l) => sum3 + ltvToNumber(l.borrowLTV), 0) / activeLTVs.length : 0;
|
|
@@ -19035,8 +19035,8 @@ function buildEModes(borrowVaults, cluster) {
|
|
|
19035
19035
|
(sum3, l) => sum3 + ltvToNumber(l.liquidationLTV),
|
|
19036
19036
|
0
|
|
19037
19037
|
) / activeLTVs.length : 0;
|
|
19038
|
-
eModes[
|
|
19039
|
-
category:
|
|
19038
|
+
eModes[addr5] = {
|
|
19039
|
+
category: addr5,
|
|
19040
19040
|
label: `${info.assetSymbol} Borrow (${info.vaultSymbol})`,
|
|
19041
19041
|
borrowCollateralFactor: avgBorrowLTV,
|
|
19042
19042
|
collateralFactor: avgLiqLTV,
|
|
@@ -19069,11 +19069,11 @@ function buildMetadata(info) {
|
|
|
19069
19069
|
}
|
|
19070
19070
|
function buildTokenEntry(info, config, collateralActive, borrowVaults, opts) {
|
|
19071
19071
|
if (!info.asset) return void 0;
|
|
19072
|
-
const
|
|
19073
|
-
const tokenMeta = opts.tokenList?.[
|
|
19072
|
+
const addr5 = info.asset.toLowerCase();
|
|
19073
|
+
const tokenMeta = opts.tokenList?.[addr5];
|
|
19074
19074
|
const asset = {
|
|
19075
19075
|
chainId: opts.chainId,
|
|
19076
|
-
address:
|
|
19076
|
+
address: addr5,
|
|
19077
19077
|
name: tokenMeta?.name ?? info.assetName,
|
|
19078
19078
|
symbol: tokenMeta?.symbol ?? info.assetSymbol,
|
|
19079
19079
|
decimals: tokenMeta?.decimals ?? Number(info.assetDecimals)
|
|
@@ -19154,9 +19154,9 @@ function buildTokenEntry(info, config, collateralActive, borrowVaults, opts) {
|
|
|
19154
19154
|
params: { metadata: buildMetadata(info) }
|
|
19155
19155
|
};
|
|
19156
19156
|
}
|
|
19157
|
-
function findInfo(
|
|
19157
|
+
function findInfo(addr5, vaultData) {
|
|
19158
19158
|
for (const [key4, value] of vaultData) {
|
|
19159
|
-
if (key4.toLowerCase() ===
|
|
19159
|
+
if (key4.toLowerCase() === addr5) return value;
|
|
19160
19160
|
}
|
|
19161
19161
|
return void 0;
|
|
19162
19162
|
}
|
|
@@ -19171,8 +19171,8 @@ function normalizeCluster(cluster, opts) {
|
|
|
19171
19171
|
}
|
|
19172
19172
|
const eModes = buildEModes(borrowVaults, cluster);
|
|
19173
19173
|
const data = {};
|
|
19174
|
-
for (const [
|
|
19175
|
-
const norm =
|
|
19174
|
+
for (const [addr5, info] of cluster.vaultData) {
|
|
19175
|
+
const norm = addr5.toLowerCase();
|
|
19176
19176
|
const config = buildTokenConfig(
|
|
19177
19177
|
norm,
|
|
19178
19178
|
reverseLTV,
|
|
@@ -19318,8 +19318,8 @@ var getEulerV2ReservesDataConverter = (lender, chainId, prices, additionalYields
|
|
|
19318
19318
|
var BASE_CALLS_PER_RESERVE = 5;
|
|
19319
19319
|
var CALLS_PER_SPOKE_TAIL = 1;
|
|
19320
19320
|
var MAX_HUB_ASSETS = 25;
|
|
19321
|
-
function isValidAddress(
|
|
19322
|
-
return !!
|
|
19321
|
+
function isValidAddress(addr5) {
|
|
19322
|
+
return !!addr5 && addr5 !== "0x" && addr5.length > 2;
|
|
19323
19323
|
}
|
|
19324
19324
|
function getDynamicConfigCount(spokeEntry) {
|
|
19325
19325
|
const max = spokeEntry?.dynamicConfigKeyMax ?? 0;
|
|
@@ -19675,8 +19675,8 @@ function normalizeAaveV4(spokeDataList, chainId, spokeLenderKeyArg, prices, addi
|
|
|
19675
19675
|
}
|
|
19676
19676
|
|
|
19677
19677
|
// src/lending/public-data/aave-v4-type/publicCallParse.ts
|
|
19678
|
-
function isValidAddress2(
|
|
19679
|
-
return !!
|
|
19678
|
+
function isValidAddress2(addr5) {
|
|
19679
|
+
return !!addr5 && addr5 !== "0x" && addr5.length > 2;
|
|
19680
19680
|
}
|
|
19681
19681
|
var getAaveV4ReservesDataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
19682
19682
|
const expectedCalls = getAaveV4ExpectedCallCount(chainId, lender);
|
|
@@ -20577,7 +20577,7 @@ var getCachedFluidDexState = (chainId) => cache3[chainId]?.data;
|
|
|
20577
20577
|
|
|
20578
20578
|
// src/lending/public-data/fluid/publicCallParse.ts
|
|
20579
20579
|
var FLUID_EEE_LOWER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
20580
|
-
var normalizeUnderlying = (
|
|
20580
|
+
var normalizeUnderlying = (addr5) => addr5 === FLUID_EEE_LOWER ? zeroAddress : addr5;
|
|
20581
20581
|
var FLUID_RATE_SCALE = 100;
|
|
20582
20582
|
var scaleFluidRate = (raw) => {
|
|
20583
20583
|
if (raw === void 0 || raw === null) return 0;
|
|
@@ -21399,9 +21399,9 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
21399
21399
|
const underlyingPrice = prices[underlyingPriceKey] ?? 0;
|
|
21400
21400
|
const debtByCm = {};
|
|
21401
21401
|
for (const dp of pool.creditManagerDebtParams ?? []) {
|
|
21402
|
-
const
|
|
21403
|
-
if (!
|
|
21404
|
-
debtByCm[
|
|
21402
|
+
const addr5 = (dp?.creditManager ?? "").toString().toLowerCase();
|
|
21403
|
+
if (!addr5) continue;
|
|
21404
|
+
debtByCm[addr5] = {
|
|
21405
21405
|
borrowed: BigInt(dp.borrowed ?? 0),
|
|
21406
21406
|
limit: BigInt(dp.limit ?? 0),
|
|
21407
21407
|
available: BigInt(dp.available ?? 0)
|
|
@@ -24353,7 +24353,7 @@ async function fetchTellerMarkets(chainId) {
|
|
|
24353
24353
|
} catch {
|
|
24354
24354
|
return { chainId, pools: [] };
|
|
24355
24355
|
}
|
|
24356
|
-
const
|
|
24356
|
+
const big27 = (i) => {
|
|
24357
24357
|
const r = results[i];
|
|
24358
24358
|
if (typeof r === "bigint") return r;
|
|
24359
24359
|
if (typeof r === "number") return BigInt(r);
|
|
@@ -24367,20 +24367,20 @@ async function fetchTellerMarkets(chainId) {
|
|
|
24367
24367
|
return null;
|
|
24368
24368
|
};
|
|
24369
24369
|
const num20 = (i) => {
|
|
24370
|
-
const b =
|
|
24370
|
+
const b = big27(i);
|
|
24371
24371
|
return b === null ? null : Number(b);
|
|
24372
24372
|
};
|
|
24373
24373
|
const pool0 = pools.map((config, i) => {
|
|
24374
24374
|
const base = i * READS_PER_POOL;
|
|
24375
24375
|
return {
|
|
24376
24376
|
config,
|
|
24377
|
-
available:
|
|
24378
|
-
committed:
|
|
24377
|
+
available: big27(base),
|
|
24378
|
+
committed: big27(base + 1),
|
|
24379
24379
|
minRateBps: num20(base + 2),
|
|
24380
|
-
collateralPerPrincipal:
|
|
24380
|
+
collateralPerPrincipal: big27(base + 3),
|
|
24381
24381
|
maxLoanDuration: num20(base + 4),
|
|
24382
|
-
marketId:
|
|
24383
|
-
totalAssets:
|
|
24382
|
+
marketId: big27(base + 5),
|
|
24383
|
+
totalAssets: big27(base + 6)
|
|
24384
24384
|
};
|
|
24385
24385
|
});
|
|
24386
24386
|
const attByMarket = /* @__PURE__ */ new Map();
|
|
@@ -24621,11 +24621,11 @@ var TermMaxApiSource = class {
|
|
|
24621
24621
|
const assetDecimals = /* @__PURE__ */ new Map();
|
|
24622
24622
|
const assetSymbols = /* @__PURE__ */ new Map();
|
|
24623
24623
|
for (const a of Array.isArray(data.assetConfigs) ? data.assetConfigs : []) {
|
|
24624
|
-
const
|
|
24625
|
-
if (!
|
|
24624
|
+
const addr5 = lower(a?.contractAddress ?? a?.assetAddress);
|
|
24625
|
+
if (!addr5) continue;
|
|
24626
24626
|
const dec2 = Number(a?.decimals ?? a?.assetDecimals);
|
|
24627
|
-
if (Number.isFinite(dec2)) assetDecimals.set(
|
|
24628
|
-
if (a?.symbol) assetSymbols.set(
|
|
24627
|
+
if (Number.isFinite(dec2)) assetDecimals.set(addr5, dec2);
|
|
24628
|
+
if (a?.symbol) assetSymbols.set(addr5, String(a.symbol));
|
|
24629
24629
|
}
|
|
24630
24630
|
const markets = [];
|
|
24631
24631
|
for (const m of Array.isArray(data.markets) ? data.markets : []) {
|
|
@@ -26148,10 +26148,10 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26148
26148
|
} catch {
|
|
26149
26149
|
dec2 = [];
|
|
26150
26150
|
}
|
|
26151
|
-
const
|
|
26151
|
+
const addr5 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v) && !/^0x0+$/.test(v) ? v : void 0;
|
|
26152
26152
|
const wrapped = pending.map((_3, i) => {
|
|
26153
|
-
const curve =
|
|
26154
|
-
const frax =
|
|
26153
|
+
const curve = addr5(dec2[i * 4 + 2]);
|
|
26154
|
+
const frax = addr5(dec2[i * 4 + 3]);
|
|
26155
26155
|
return {
|
|
26156
26156
|
token: curve ?? frax,
|
|
26157
26157
|
family: curve ? "curvelend" : frax ? "fraxlend" : void 0
|
|
@@ -26300,7 +26300,7 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26300
26300
|
return { lender, config, pairs, rsup };
|
|
26301
26301
|
}
|
|
26302
26302
|
async function readRewardContext(chainId, registry, utilities) {
|
|
26303
|
-
const
|
|
26303
|
+
const addr5 = (v) => typeof v === "string" && v.startsWith("0x") && !/^0x0+$/.test(v) ? v : void 0;
|
|
26304
26304
|
try {
|
|
26305
26305
|
const first = await multicallRetryUniversal({
|
|
26306
26306
|
chain: chainId,
|
|
@@ -26316,9 +26316,9 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
26316
26316
|
],
|
|
26317
26317
|
allowFailure: true
|
|
26318
26318
|
});
|
|
26319
|
-
const rewardHandler =
|
|
26320
|
-
const govToken =
|
|
26321
|
-
const convexPoolUtil = utilities ?
|
|
26319
|
+
const rewardHandler = addr5(first[0]);
|
|
26320
|
+
const govToken = addr5(first[1]);
|
|
26321
|
+
const convexPoolUtil = utilities ? addr5(first[2]) : void 0;
|
|
26322
26322
|
if (!rewardHandler || !govToken) return { convexPoolUtil };
|
|
26323
26323
|
const [emissions] = await multicallRetryUniversal({
|
|
26324
26324
|
chain: chainId,
|
|
@@ -26326,7 +26326,7 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
26326
26326
|
abi: ResupplyRewardHandlerAbi,
|
|
26327
26327
|
allowFailure: true
|
|
26328
26328
|
});
|
|
26329
|
-
const pairEmissions =
|
|
26329
|
+
const pairEmissions = addr5(emissions);
|
|
26330
26330
|
if (!pairEmissions) return { convexPoolUtil };
|
|
26331
26331
|
const stream = await multicallRetryUniversal({
|
|
26332
26332
|
chain: chainId,
|
|
@@ -29554,12 +29554,12 @@ async function fetchDssMarkets(lender, chainId) {
|
|
|
29554
29554
|
} catch {
|
|
29555
29555
|
return { lender, config, chainData, markets: [] };
|
|
29556
29556
|
}
|
|
29557
|
-
const
|
|
29557
|
+
const big27 = (v) => {
|
|
29558
29558
|
if (typeof v === "bigint") return v;
|
|
29559
29559
|
if (typeof v === "number") return BigInt(v);
|
|
29560
29560
|
return null;
|
|
29561
29561
|
};
|
|
29562
|
-
const field15 = (res, name, idx) =>
|
|
29562
|
+
const field15 = (res, name, idx) => big27(res?.[name] ?? res?.[idx]);
|
|
29563
29563
|
let cursor = 0;
|
|
29564
29564
|
const out = markets.map((market, i) => {
|
|
29565
29565
|
const base = cursor;
|
|
@@ -29576,7 +29576,7 @@ async function fetchDssMarkets(lender, chainId) {
|
|
|
29576
29576
|
dust: field15(vatIlk, "dust", 4),
|
|
29577
29577
|
duty: field15(jugIlk, "duty", 0),
|
|
29578
29578
|
mat: field15(spotIlk, "mat", 1),
|
|
29579
|
-
joinBalance: joinReadIndex[i] >= 0 ?
|
|
29579
|
+
joinBalance: joinReadIndex[i] >= 0 ? big27(results[joinReadIndex[i]]) : null
|
|
29580
29580
|
};
|
|
29581
29581
|
});
|
|
29582
29582
|
return { lender, config, chainData, markets: out };
|
|
@@ -29850,26 +29850,26 @@ async function fetchFrankencoinMarkets(lender, chainId) {
|
|
|
29850
29850
|
} catch {
|
|
29851
29851
|
return { lender, config, chainData, markets: [] };
|
|
29852
29852
|
}
|
|
29853
|
-
const
|
|
29853
|
+
const big27 = (v) => {
|
|
29854
29854
|
if (typeof v === "bigint") return v;
|
|
29855
29855
|
if (typeof v === "number") return BigInt(v);
|
|
29856
29856
|
return null;
|
|
29857
29857
|
};
|
|
29858
29858
|
const out = markets.map((market, i) => {
|
|
29859
29859
|
const base = i * READS_PER_MARKET3;
|
|
29860
|
-
const expiration =
|
|
29860
|
+
const expiration = big27(results[base + 7]);
|
|
29861
29861
|
return {
|
|
29862
29862
|
market,
|
|
29863
|
-
price:
|
|
29864
|
-
minted:
|
|
29865
|
-
availableForClones:
|
|
29866
|
-
annualInterestPPM:
|
|
29867
|
-
currentFeePPM:
|
|
29868
|
-
reserveContribution:
|
|
29869
|
-
challengedAmount:
|
|
29863
|
+
price: big27(results[base]),
|
|
29864
|
+
minted: big27(results[base + 1]),
|
|
29865
|
+
availableForClones: big27(results[base + 2]),
|
|
29866
|
+
annualInterestPPM: big27(results[base + 3]),
|
|
29867
|
+
currentFeePPM: big27(results[base + 4]),
|
|
29868
|
+
reserveContribution: big27(results[base + 5]),
|
|
29869
|
+
challengedAmount: big27(results[base + 6]),
|
|
29870
29870
|
expiration,
|
|
29871
29871
|
isClosed: typeof results[base + 8] === "boolean" ? results[base + 8] : null,
|
|
29872
|
-
collateralBalance:
|
|
29872
|
+
collateralBalance: big27(results[base + 9])
|
|
29873
29873
|
};
|
|
29874
29874
|
});
|
|
29875
29875
|
return { lender, config, chainData, markets: out };
|
|
@@ -32267,8 +32267,8 @@ function getSubAccountAddress(owner, index) {
|
|
|
32267
32267
|
const suffix = newLastByte.toString(16).padStart(2, "0");
|
|
32268
32268
|
return (prefix + suffix).toLowerCase();
|
|
32269
32269
|
}
|
|
32270
|
-
function getSubAccountIndex(
|
|
32271
|
-
const addrLastByte = parseInt(
|
|
32270
|
+
function getSubAccountIndex(addr5, owner) {
|
|
32271
|
+
const addrLastByte = parseInt(addr5.slice(40), 16);
|
|
32272
32272
|
if (!owner) return addrLastByte;
|
|
32273
32273
|
const ownerLastByte = parseInt(owner.slice(40), 16);
|
|
32274
32274
|
return (addrLastByte ^ ownerLastByte) & 255;
|
|
@@ -36191,7 +36191,7 @@ function toBigInt8(v) {
|
|
|
36191
36191
|
// src/lending/user-data/silo-v3/userCallParse.ts
|
|
36192
36192
|
var getSiloV3UserDataConverter = (lender, chainId, account, meta, params) => getSiloV2UserDataConverter(lender, chainId, account, meta, params);
|
|
36193
36193
|
var FLUID_EEE_LOWER2 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
36194
|
-
var normalizeUnderlying2 = (
|
|
36194
|
+
var normalizeUnderlying2 = (addr5) => addr5 === FLUID_EEE_LOWER2 ? zeroAddress : addr5;
|
|
36195
36195
|
function toBigInt9(v) {
|
|
36196
36196
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
36197
36197
|
if (typeof v === "bigint") return v;
|
|
@@ -36322,25 +36322,25 @@ var getFluidUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
36322
36322
|
legRaw(leg, supplyRaw).toString(),
|
|
36323
36323
|
leg.decimals
|
|
36324
36324
|
);
|
|
36325
|
-
const
|
|
36325
|
+
const amount5 = Number(amountStr);
|
|
36326
36326
|
const e = entryFor(leg);
|
|
36327
36327
|
e.deposits = amountStr;
|
|
36328
|
-
e.depositsUSD =
|
|
36329
|
-
e.depositsUSDOracle =
|
|
36328
|
+
e.depositsUSD = amount5 * leg.displayPrice;
|
|
36329
|
+
e.depositsUSDOracle = amount5 * leg.oraclePrice;
|
|
36330
36330
|
e.collateralEnabled = supplyRaw > 0n;
|
|
36331
|
-
deposits24h +=
|
|
36331
|
+
deposits24h += amount5 * leg.priceHist;
|
|
36332
36332
|
}
|
|
36333
36333
|
for (const leg of debtLegs) {
|
|
36334
36334
|
const amountStr = parseRawAmount(
|
|
36335
36335
|
legRaw(leg, borrowRaw).toString(),
|
|
36336
36336
|
leg.decimals
|
|
36337
36337
|
);
|
|
36338
|
-
const
|
|
36338
|
+
const amount5 = Number(amountStr);
|
|
36339
36339
|
const e = entryFor(leg);
|
|
36340
36340
|
e.debt = amountStr;
|
|
36341
|
-
e.debtUSD =
|
|
36342
|
-
e.debtUSDOracle =
|
|
36343
|
-
debt24h +=
|
|
36341
|
+
e.debtUSD = amount5 * leg.displayPrice;
|
|
36342
|
+
e.debtUSDOracle = amount5 * leg.oraclePrice;
|
|
36343
|
+
debt24h += amount5 * leg.priceHist;
|
|
36344
36344
|
}
|
|
36345
36345
|
histData[nftId] = {
|
|
36346
36346
|
totalDeposits24h: deposits24h,
|
|
@@ -36596,10 +36596,10 @@ var getDolomiteUserDataConverter = (lender, chainId, account, metaMap) => {
|
|
|
36596
36596
|
const meta = metaMap?.[key4];
|
|
36597
36597
|
if (!meta) return;
|
|
36598
36598
|
const decimals = meta.asset?.decimals ?? 18;
|
|
36599
|
-
const
|
|
36599
|
+
const amount5 = parseRawAmount(wei.value, decimals);
|
|
36600
36600
|
const isSupply = wei.sign;
|
|
36601
|
-
const deposits = isSupply ?
|
|
36602
|
-
const debt = isSupply ? "0" :
|
|
36601
|
+
const deposits = isSupply ? amount5 : "0";
|
|
36602
|
+
const debt = isSupply ? "0" : amount5;
|
|
36603
36603
|
const debtPar = isSupply ? "0" : pars[k]?.value?.toString() ?? "0";
|
|
36604
36604
|
const price2 = getDisplayPrice(meta);
|
|
36605
36605
|
const oPrice = getOraclePrice(meta);
|
|
@@ -37743,9 +37743,9 @@ var getRipeUserDataConverter = (lender, chainId, account, meta, opts) => {
|
|
|
37743
37743
|
const r = data[cursor++];
|
|
37744
37744
|
if (isFailedCall(r) || r == null) continue;
|
|
37745
37745
|
const asset = String(field10(r, "asset", 0) ?? "").toLowerCase();
|
|
37746
|
-
const
|
|
37747
|
-
if (!/^0x[0-9a-f]{40}$/.test(asset) ||
|
|
37748
|
-
held.set(asset, (held.get(asset) ?? 0n) +
|
|
37746
|
+
const amount5 = big13(field10(r, "amount", 1));
|
|
37747
|
+
if (!/^0x[0-9a-f]{40}$/.test(asset) || amount5 === 0n) continue;
|
|
37748
|
+
held.set(asset, (held.get(asset) ?? 0n) + amount5);
|
|
37749
37749
|
}
|
|
37750
37750
|
}
|
|
37751
37751
|
const rows = {};
|
|
@@ -37769,12 +37769,12 @@ var getRipeUserDataConverter = (lender, chainId, account, meta, opts) => {
|
|
|
37769
37769
|
claimableRewards: 0,
|
|
37770
37770
|
ripeInfo: info
|
|
37771
37771
|
});
|
|
37772
|
-
for (const [asset,
|
|
37772
|
+
for (const [asset, amount5] of held) {
|
|
37773
37773
|
const uid = createMarketUid(chainId, lender, asset);
|
|
37774
37774
|
const m = meta[uid];
|
|
37775
37775
|
if (!m || !m.collateralActive) continue;
|
|
37776
37776
|
const dec2 = m.asset?.decimals ?? m.decimals ?? 18;
|
|
37777
|
-
const amtStr = parseRawAmount(
|
|
37777
|
+
const amtStr = parseRawAmount(amount5.toString(), dec2);
|
|
37778
37778
|
const amtNum = Number(amtStr);
|
|
37779
37779
|
const display = getDisplayPrice(m);
|
|
37780
37780
|
const oracle = getOraclePrice(m);
|
|
@@ -37865,12 +37865,12 @@ var getFlyingTulipUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
37865
37865
|
let debt24h = 0;
|
|
37866
37866
|
for (let i = 0; i < p.collAssets.length; i++) {
|
|
37867
37867
|
const asset = String(p.collAssets[i]).toLowerCase();
|
|
37868
|
-
const
|
|
37869
|
-
if (
|
|
37868
|
+
const amount5 = big14(p.collAvail?.[i]) + big14(p.collHold?.[i]);
|
|
37869
|
+
if (amount5 === 0n) continue;
|
|
37870
37870
|
const uid = createMarketUid(chainId, lender, asset);
|
|
37871
37871
|
const m = meta[uid];
|
|
37872
37872
|
const dec2 = decimalsOf(asset);
|
|
37873
|
-
const amtStr = parseRawAmount(
|
|
37873
|
+
const amtStr = parseRawAmount(amount5.toString(), dec2);
|
|
37874
37874
|
const amtNum = Number(amtStr);
|
|
37875
37875
|
const display = m ? getDisplayPrice(m) : 0;
|
|
37876
37876
|
const oracle = m ? getOraclePrice(m) : 0;
|
|
@@ -37896,12 +37896,12 @@ var getFlyingTulipUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
37896
37896
|
}
|
|
37897
37897
|
for (let i = 0; i < p.debtAssets.length; i++) {
|
|
37898
37898
|
const asset = String(p.debtAssets[i]).toLowerCase();
|
|
37899
|
-
const
|
|
37900
|
-
if (
|
|
37899
|
+
const amount5 = big14(p.debtUnitsNow?.[i]);
|
|
37900
|
+
if (amount5 === 0n) continue;
|
|
37901
37901
|
const uid = createMarketUid(chainId, lender, asset);
|
|
37902
37902
|
const m = meta[uid];
|
|
37903
37903
|
const dec2 = decimalsOf(asset);
|
|
37904
|
-
const amtStr = parseRawAmount(
|
|
37904
|
+
const amtStr = parseRawAmount(amount5.toString(), dec2);
|
|
37905
37905
|
const amtNum = Number(amtStr);
|
|
37906
37906
|
const display = m ? getDisplayPrice(m) : 0;
|
|
37907
37907
|
const oracle = m ? getOraclePrice(m) : 0;
|
|
@@ -38293,11 +38293,11 @@ var big17 = (v) => {
|
|
|
38293
38293
|
};
|
|
38294
38294
|
function fraxlendToAmount(shares, totalAmount, totalShares, roundUp) {
|
|
38295
38295
|
if (totalShares === 0n) return shares;
|
|
38296
|
-
let
|
|
38297
|
-
if (roundUp && totalAmount > 0n &&
|
|
38298
|
-
|
|
38296
|
+
let amount5 = shares * totalAmount / totalShares;
|
|
38297
|
+
if (roundUp && totalAmount > 0n && amount5 * totalShares / totalAmount < shares) {
|
|
38298
|
+
amount5 = amount5 + 1n;
|
|
38299
38299
|
}
|
|
38300
|
-
return
|
|
38300
|
+
return amount5;
|
|
38301
38301
|
}
|
|
38302
38302
|
var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
|
|
38303
38303
|
const pairs = fraxlendPairsFor(lender, chainId);
|
|
@@ -44563,29 +44563,29 @@ async function getMergedUserData(chainId, balanceQueries, permissionParams, lend
|
|
|
44563
44563
|
});
|
|
44564
44564
|
return parseMergedResult(chainId, rawResults, prepared, lenderState);
|
|
44565
44565
|
}
|
|
44566
|
-
function toCompoundV2Shares(entry,
|
|
44566
|
+
function toCompoundV2Shares(entry, amount5) {
|
|
44567
44567
|
const raw = entry.params?.exchangeRateCurrent;
|
|
44568
|
-
if (!raw || raw === "0x") return
|
|
44568
|
+
if (!raw || raw === "0x") return amount5;
|
|
44569
44569
|
try {
|
|
44570
44570
|
const exRate = BigInt(raw);
|
|
44571
|
-
if (exRate === 0n) return
|
|
44572
|
-
return
|
|
44571
|
+
if (exRate === 0n) return amount5;
|
|
44572
|
+
return amount5 * 10n ** 18n / exRate * 1001n / 1000n;
|
|
44573
44573
|
} catch {
|
|
44574
|
-
return
|
|
44574
|
+
return amount5;
|
|
44575
44575
|
}
|
|
44576
44576
|
}
|
|
44577
|
-
function toSiloShares(entry,
|
|
44577
|
+
function toSiloShares(entry, amount5, chainId, lender, tokenAddress) {
|
|
44578
44578
|
const raw = entry.params?.collateralRate;
|
|
44579
|
-
if (!raw || raw === "0x") return
|
|
44579
|
+
if (!raw || raw === "0x") return amount5;
|
|
44580
44580
|
try {
|
|
44581
44581
|
const rate = BigInt(raw);
|
|
44582
|
-
if (rate === 0n) return
|
|
44582
|
+
if (rate === 0n) return amount5;
|
|
44583
44583
|
const half = getSiloHalfForUnderlying(chainId, lender, tokenAddress);
|
|
44584
|
-
if (!half) return
|
|
44584
|
+
if (!half) return amount5;
|
|
44585
44585
|
const oneUnit = BigInt(10) ** BigInt(half.decimals);
|
|
44586
|
-
return
|
|
44586
|
+
return amount5 * oneUnit / rate * 1001n / 1000n;
|
|
44587
44587
|
} catch {
|
|
44588
|
-
return
|
|
44588
|
+
return amount5;
|
|
44589
44589
|
}
|
|
44590
44590
|
}
|
|
44591
44591
|
function resolveDebitDataKey(chainId, lender, tokenAddress, cToken, isProtected, isBorrow, mode) {
|
|
@@ -44644,7 +44644,7 @@ function resolveDebitDataKey(chainId, lender, tokenAddress, cToken, isProtected,
|
|
|
44644
44644
|
return tokenAddress.toLowerCase();
|
|
44645
44645
|
}
|
|
44646
44646
|
function needsLenderApproval(params) {
|
|
44647
|
-
const { lender, lenderDebitData, tokenAddress, amount:
|
|
44647
|
+
const { lender, lenderDebitData, tokenAddress, amount: amount5, chainId, cToken, isProtected, isBorrow, mode } = params;
|
|
44648
44648
|
if (!lenderDebitData) return true;
|
|
44649
44649
|
if (isAaveV4Type(lender)) {
|
|
44650
44650
|
const key5 = (params.aaveV4Spoke ?? tokenAddress).toLowerCase();
|
|
@@ -44667,33 +44667,33 @@ function needsLenderApproval(params) {
|
|
|
44667
44667
|
return entry.amount === 0n;
|
|
44668
44668
|
}
|
|
44669
44669
|
if (isCompoundV2Type(lender) || isVenusType(lender)) {
|
|
44670
|
-
const requiredShares = toCompoundV2Shares(entry,
|
|
44670
|
+
const requiredShares = toCompoundV2Shares(entry, amount5);
|
|
44671
44671
|
return entry.amount < requiredShares;
|
|
44672
44672
|
}
|
|
44673
44673
|
if (isSiloV2Type(lender) || isSiloV3Type(lender)) {
|
|
44674
|
-
const requiredShares = toSiloShares(entry,
|
|
44674
|
+
const requiredShares = toSiloShares(entry, amount5, chainId, lender, tokenAddress);
|
|
44675
44675
|
return entry.amount < requiredShares;
|
|
44676
44676
|
}
|
|
44677
44677
|
if (isCompoundV3(lender)) {
|
|
44678
44678
|
return entry.amount === 0n;
|
|
44679
44679
|
}
|
|
44680
|
-
return entry.amount <
|
|
44680
|
+
return entry.amount < amount5;
|
|
44681
44681
|
}
|
|
44682
44682
|
function needsTokenApproval(params) {
|
|
44683
|
-
const { debitData, spender, amount:
|
|
44683
|
+
const { debitData, spender, amount: amount5, chainId, usePermit2 } = params;
|
|
44684
44684
|
if (!debitData) return true;
|
|
44685
44685
|
const spenderLower = spender.toLowerCase();
|
|
44686
44686
|
if (usePermit2) {
|
|
44687
44687
|
const p2 = debitData.permit2?.[spenderLower];
|
|
44688
|
-
return !p2 || p2.amount <
|
|
44688
|
+
return !p2 || p2.amount < amount5;
|
|
44689
44689
|
}
|
|
44690
44690
|
const permit2Address = getPermit2ContractAddress(chainId).toLowerCase();
|
|
44691
44691
|
if (spenderLower === permit2Address) {
|
|
44692
44692
|
const p2 = debitData.permit2?.[spenderLower];
|
|
44693
|
-
if (p2 && p2.amount >=
|
|
44693
|
+
if (p2 && p2.amount >= amount5) return false;
|
|
44694
44694
|
}
|
|
44695
44695
|
const allowance = debitData.allowances?.[spenderLower] ?? 0n;
|
|
44696
|
-
return allowance <
|
|
44696
|
+
return allowance < amount5;
|
|
44697
44697
|
}
|
|
44698
44698
|
var MORPHO_USER_SUBGRAPH_URLS = {
|
|
44699
44699
|
[Chain.SEI_NETWORK]: "https://api.goldsky.com/api/public/project_cmiergfbv4vma01vb642yaeam/subgraphs/morphoblue-sei/1.0.1/gn",
|
|
@@ -45537,11 +45537,11 @@ var INF_EPOCHS = 10;
|
|
|
45537
45537
|
var MAX_PLAUSIBLE_APY = 0.3;
|
|
45538
45538
|
function meanEpochApy(rows, n = INF_EPOCHS) {
|
|
45539
45539
|
if (!Array.isArray(rows)) return void 0;
|
|
45540
|
-
const
|
|
45540
|
+
const ok4 = rows.map((r) => ({ epoch: Number(r?.epoch), apy: Number(r?.apy) })).filter(
|
|
45541
45541
|
(r) => Number.isFinite(r.epoch) && Number.isFinite(r.apy) && r.apy > 0 && r.apy < MAX_PLAUSIBLE_APY
|
|
45542
45542
|
).sort((a, b) => b.epoch - a.epoch).slice(0, n);
|
|
45543
|
-
if (
|
|
45544
|
-
return
|
|
45543
|
+
if (ok4.length === 0) return void 0;
|
|
45544
|
+
return ok4.reduce((s, r) => s + r.apy, 0) / ok4.length;
|
|
45545
45545
|
}
|
|
45546
45546
|
async function kaminoInfApy() {
|
|
45547
45547
|
const end = /* @__PURE__ */ new Date();
|
|
@@ -49856,6 +49856,26 @@ var STAKED_NUSD_ABI = [
|
|
|
49856
49856
|
outputs: [{ type: "uint256" }]
|
|
49857
49857
|
}
|
|
49858
49858
|
];
|
|
49859
|
+
var NUSD_REDEMPTION = "0xb3f07d3392102fc23264a78e2a1a8b6421123828";
|
|
49860
|
+
var NUSD_REDEMPTION_ABI = [
|
|
49861
|
+
{
|
|
49862
|
+
name: "redemptionRate",
|
|
49863
|
+
type: "function",
|
|
49864
|
+
stateMutability: "view",
|
|
49865
|
+
inputs: [],
|
|
49866
|
+
outputs: [{ type: "uint256" }]
|
|
49867
|
+
}
|
|
49868
|
+
];
|
|
49869
|
+
var snusdAprFromState = (st) => {
|
|
49870
|
+
if (st.redemptionRate !== void 0 && st.redemptionRate < ONE_E1810) return 0;
|
|
49871
|
+
if (st.totalAssets === 0n || st.vestingPeriod <= 0n) return 0;
|
|
49872
|
+
const elapsed = st.now - st.lastDistributionTimestamp;
|
|
49873
|
+
if (elapsed > 2n * st.vestingPeriod) return 0;
|
|
49874
|
+
const window = elapsed > st.vestingPeriod ? elapsed : st.vestingPeriod;
|
|
49875
|
+
if (window <= 0n) return 0;
|
|
49876
|
+
const perSecond = st.vestingAmount / window;
|
|
49877
|
+
return Number(perSecond * YEAR_SECONDS9 * ONE_E1810 / st.totalAssets) / 1e16;
|
|
49878
|
+
};
|
|
49859
49879
|
var fetchSnusdAprOnChain = async () => {
|
|
49860
49880
|
const [vestingAmount, lastDistribution, vestingPeriod, totalAssets] = await multicallRetryUniversal({
|
|
49861
49881
|
chain: CHAIN_ID10,
|
|
@@ -49868,12 +49888,20 @@ var fetchSnusdAprOnChain = async () => {
|
|
|
49868
49888
|
],
|
|
49869
49889
|
allowFailure: false
|
|
49870
49890
|
});
|
|
49871
|
-
|
|
49872
|
-
|
|
49873
|
-
|
|
49874
|
-
|
|
49875
|
-
|
|
49876
|
-
|
|
49891
|
+
const [redemptionRate] = await multicallRetryUniversal({
|
|
49892
|
+
chain: CHAIN_ID10,
|
|
49893
|
+
abi: NUSD_REDEMPTION_ABI,
|
|
49894
|
+
calls: [{ address: NUSD_REDEMPTION, name: "redemptionRate", params: [] }],
|
|
49895
|
+
allowFailure: true
|
|
49896
|
+
}).catch(() => [void 0]);
|
|
49897
|
+
return snusdAprFromState({
|
|
49898
|
+
vestingAmount,
|
|
49899
|
+
lastDistributionTimestamp: lastDistribution,
|
|
49900
|
+
vestingPeriod,
|
|
49901
|
+
totalAssets,
|
|
49902
|
+
redemptionRate: typeof redemptionRate === "bigint" ? redemptionRate : void 0,
|
|
49903
|
+
now: BigInt(Math.floor(Date.now() / 1e3))
|
|
49904
|
+
});
|
|
49877
49905
|
};
|
|
49878
49906
|
var snusdFetcher = {
|
|
49879
49907
|
label: "SNUSD",
|
|
@@ -50151,7 +50179,16 @@ var STRATA_MARKETS = [
|
|
|
50151
50179
|
{
|
|
50152
50180
|
cdo: "neutrlCdo",
|
|
50153
50181
|
sr: { key: SRNUSD_KEY, llamaPool: "979711ce-d0c0-4aae-a5fc-d7b76e868649" },
|
|
50154
|
-
jr: { key: JRNUSD_KEY, llamaPool: "947928b7-c446-49d7-a378-392df37660f7" }
|
|
50182
|
+
jr: { key: JRNUSD_KEY, llamaPool: "947928b7-c446-49d7-a378-392df37660f7" },
|
|
50183
|
+
// Measured 2026-10-17: v19 `neutrlCdo.week` srt/jrt apr = 0 (the month
|
|
50184
|
+
// window reads srt −486 % / jrt −1,259 %); collateral sNUSD marked
|
|
50185
|
+
// 1.0644 → 0.5428 USD; jrNUSD `convertToAssets(1e18)` = 3.6e-6 NUSD
|
|
50186
|
+
// (wiped), srNUSD 1.2397 NUSD ≈ $0.63; both tranches `maxDeposit = 0`;
|
|
50187
|
+
// senior TVL $94.5k from $1.39M.
|
|
50188
|
+
distressed: {
|
|
50189
|
+
since: "2026-08-13",
|
|
50190
|
+
reason: "Neutrl NUSD reserves impaired; NUSD redeems at 0.51 USDC via the recovery portal"
|
|
50191
|
+
}
|
|
50155
50192
|
},
|
|
50156
50193
|
{
|
|
50157
50194
|
cdo: "mhyperCdo",
|
|
@@ -50207,7 +50244,7 @@ var strataFetcher = {
|
|
|
50207
50244
|
const out = {};
|
|
50208
50245
|
await Promise.all(
|
|
50209
50246
|
STRATA_MARKETS.flatMap(
|
|
50210
|
-
({ cdo, sr, jr }) => [
|
|
50247
|
+
({ cdo, sr, jr, distressed }) => [
|
|
50211
50248
|
[sr, analytics?.[cdo]?.week?.srt?.apr],
|
|
50212
50249
|
[jr, analytics?.[cdo]?.week?.jrt?.apr]
|
|
50213
50250
|
].map(async ([tranche, apr]) => {
|
|
@@ -50215,6 +50252,10 @@ var strataFetcher = {
|
|
|
50215
50252
|
out[tranche.key] = apr;
|
|
50216
50253
|
return;
|
|
50217
50254
|
}
|
|
50255
|
+
if (distressed) {
|
|
50256
|
+
out[tranche.key] = 0;
|
|
50257
|
+
return;
|
|
50258
|
+
}
|
|
50218
50259
|
const llamaApy = await fetchDefiLlamaApy(tranche.llamaPool).catch(
|
|
50219
50260
|
() => null
|
|
50220
50261
|
);
|
|
@@ -50932,7 +50973,7 @@ var fetchRatesFromApi = async () => {
|
|
|
50932
50973
|
const perChain = body?.status?.[d.chainId];
|
|
50933
50974
|
if (!perChain) continue;
|
|
50934
50975
|
const entry = Object.entries(perChain).find(
|
|
50935
|
-
([
|
|
50976
|
+
([addr5]) => addr5.toLowerCase() === d.module.toLowerCase()
|
|
50936
50977
|
)?.[1];
|
|
50937
50978
|
const rate = entry?.rate;
|
|
50938
50979
|
if (typeof rate === "number" && Number.isFinite(rate)) {
|
|
@@ -54164,11 +54205,11 @@ var AXIS_REWARD_ABI = [
|
|
|
54164
54205
|
];
|
|
54165
54206
|
var SAID_STORAGE_LOCATION = 0xd197494adafa19d3a857aec5aa27953ad3ec7bcc987f02501e4ce68fa49d8500n;
|
|
54166
54207
|
var nowSeconds = () => BigInt(Math.floor(Date.now() / 1e3));
|
|
54167
|
-
var vestingPerSecond = (
|
|
54168
|
-
if (
|
|
54208
|
+
var vestingPerSecond = (amount5, start, period, now) => {
|
|
54209
|
+
if (amount5 === 0n || period === 0n) return 0n;
|
|
54169
54210
|
const elapsed = now > start ? now - start : 0n;
|
|
54170
54211
|
const window = elapsed > period ? elapsed : period;
|
|
54171
|
-
return
|
|
54212
|
+
return amount5 / window;
|
|
54172
54213
|
};
|
|
54173
54214
|
var streamAprPercent = (perSecond, totalAssets) => totalAssets === 0n ? 0 : Number(perSecond * BigInt(YEAR_SECONDS3) * ONE_E1817 / totalAssets) / 1e16;
|
|
54174
54215
|
var fetchAxisSusdxApr = async () => {
|
|
@@ -54184,10 +54225,10 @@ var fetchAxisSusdxApr = async () => {
|
|
|
54184
54225
|
});
|
|
54185
54226
|
const duration2 = config.duration;
|
|
54186
54227
|
if (duration2 === 0n) return 0;
|
|
54187
|
-
const
|
|
54228
|
+
const amount5 = state.rewardRate * duration2;
|
|
54188
54229
|
const start = state.periodFinish - duration2;
|
|
54189
54230
|
return streamAprPercent(
|
|
54190
|
-
vestingPerSecond(
|
|
54231
|
+
vestingPerSecond(amount5, start, duration2, nowSeconds()),
|
|
54191
54232
|
totalAssets
|
|
54192
54233
|
);
|
|
54193
54234
|
};
|
|
@@ -54197,7 +54238,7 @@ var fetchGaibSaidApr = async () => {
|
|
|
54197
54238
|
try {
|
|
54198
54239
|
const client = getEvmClient(CHAIN_ID16, rpcId);
|
|
54199
54240
|
const slot = (i) => `0x${(SAID_STORAGE_LOCATION + i).toString(16).padStart(64, "0")}`;
|
|
54200
|
-
const [
|
|
54241
|
+
const [amount5, start, period, totalAssets] = await Promise.all([
|
|
54201
54242
|
client.getStorageAt({ address: GAIB_SAID, slot: slot(1n) }),
|
|
54202
54243
|
client.getStorageAt({ address: GAIB_SAID, slot: slot(2n) }),
|
|
54203
54244
|
client.getStorageAt({ address: GAIB_SAID, slot: slot(3n) }),
|
|
@@ -54209,7 +54250,7 @@ var fetchGaibSaidApr = async () => {
|
|
|
54209
54250
|
]);
|
|
54210
54251
|
return streamAprPercent(
|
|
54211
54252
|
vestingPerSecond(
|
|
54212
|
-
BigInt(
|
|
54253
|
+
BigInt(amount5 ?? "0x0"),
|
|
54213
54254
|
BigInt(start ?? "0x0"),
|
|
54214
54255
|
BigInt(period ?? "0x0"),
|
|
54215
54256
|
nowSeconds()
|
|
@@ -55809,15 +55850,28 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
55809
55850
|
// revisit as `fee-or-queued` if Neutrl ever funds the buffer.
|
|
55810
55851
|
// Arbitrum/Plasma carry same-address LayerZero OFT bridges whose
|
|
55811
55852
|
// 4626 surface reverts (bare ERC-20s) — Ethereum-only row.
|
|
55853
|
+
//
|
|
55854
|
+
// DISTRESSED since 2026-08-13 (measured 2026-10-17, see
|
|
55855
|
+
// `fetchers/neutrl.ts` + `prices/oracle-prices/fetchers/distressed.ts`):
|
|
55856
|
+
// NUSD mint/redeem frozen after a reserve impairment; Neutrl's recovery
|
|
55857
|
+
// portal `NusdRedemption` 0xB3f07D33…3828 burns NUSD for 0.51 USDC until
|
|
55858
|
+
// 2026-11-14. The last reward landed 2026-08-11, so `convertToAssets`
|
|
55859
|
+
// has sat at 1.0644 NUSD (≈ $0.543) since; TVL 35.3M → 18.6M NUSD.
|
|
55860
|
+
// `cooldownDuration()` was cut 864000 → 1 s so holders can reach the
|
|
55861
|
+
// portal — the exit is now a 1-second cooldown + `unstake`, then the
|
|
55862
|
+
// portal. `isMintable: false` although `maxDeposit` still reads
|
|
55863
|
+
// uint.max: staking would buy a 51-cent claim with zero yield, and NUSD
|
|
55864
|
+
// itself can no longer be minted. The 10-day pin stays as the
|
|
55865
|
+
// documented steady state; nothing here reads the live dial.
|
|
55812
55866
|
address: "0x08efcc2f3e61185d0ea7f8830b3fec9bfa2ee313",
|
|
55813
55867
|
underlying: "0xe556aba6fe6036275ec1f87eda296be72c811bce",
|
|
55814
55868
|
// NUSD
|
|
55815
55869
|
symbol: "sNUSD",
|
|
55816
55870
|
brand: "Neutrl",
|
|
55817
|
-
description: "NUSD is Neutrl's
|
|
55871
|
+
description: "DISTRESSED \u2014 do not deposit. NUSD is Neutrl's synthetic dollar (hedged OTC-discount arbitrage plus funding-rate strategies); in August 2026 a reserve impairment froze minting and redemptions, and since 17 September Neutrl's recovery portal pays 0.51 USDC per NUSD (open until 14 November 2026). sNUSD's share price has been frozen at 1.0644 NUSD since the last reward on 11 August, so one sNUSD is worth about $0.54 and earns nothing. The unstake cooldown was cut to 1 second so holders can redeem through the portal.",
|
|
55818
55872
|
decimals: 18,
|
|
55819
55873
|
isRebasing: false,
|
|
55820
|
-
isMintable:
|
|
55874
|
+
isMintable: false,
|
|
55821
55875
|
withdrawalMode: "fixed-cooldown",
|
|
55822
55876
|
withdrawalCooldownSeconds: 10 * 86400,
|
|
55823
55877
|
yieldFetcher: snusdFetcher,
|
|
@@ -56230,10 +56284,14 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
56230
56284
|
symbol: "srNUSD",
|
|
56231
56285
|
solvency: "tranched-senior",
|
|
56232
56286
|
brand: "Strata",
|
|
56233
|
-
|
|
56287
|
+
// DISTRESSED with Neutrl (2026-08-13): the 0.51 NUSD haircut exceeded
|
|
56288
|
+
// the junior's cover, so the senior absorbs the rest — 1.2397 NUSD per
|
|
56289
|
+
// share ≈ $0.632 on 2026-10-17 (= Strata v19 `srt.price`), TVL $1.39M →
|
|
56290
|
+
// $94.5k, `maxDeposit = 0`. Strata's feed rates it 0.
|
|
56291
|
+
description: "DISTRESSED \u2014 do not deposit. Strata's senior tranche over Neutrl NUSD (pooled in sNUSD). Neutrl's August 2026 reserve impairment cut NUSD to a 0.51 USDC recovery rate; the loss exceeded the junior tranche's cover, which went to zero, and the senior took the rest: one srNUSD is worth about 1.24 NUSD, roughly $0.63. Deposits are closed and the tranche earns nothing; exits claim through the cooldown contracts into sNUSD or NUSD and then Neutrl's redemption portal.",
|
|
56234
56292
|
decimals: 18,
|
|
56235
56293
|
isRebasing: false,
|
|
56236
|
-
isMintable:
|
|
56294
|
+
isMintable: false,
|
|
56237
56295
|
withdrawalMode: "request-based",
|
|
56238
56296
|
withdrawalCooldownSeconds: 10 * 86400,
|
|
56239
56297
|
withdrawQueue: "0x2a52363a2a0d765b31cb117a8e4d9ce58c2bc749",
|
|
@@ -56247,10 +56305,12 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
56247
56305
|
symbol: "jrNUSD",
|
|
56248
56306
|
solvency: "tranched-junior",
|
|
56249
56307
|
brand: "Strata",
|
|
56250
|
-
|
|
56308
|
+
// WIPED OUT by the Neutrl haircut: `convertToAssets(1e18)` = 3.6e-6 NUSD
|
|
56309
|
+
// on 2026-10-17 (1.024 before), `maxDeposit = 0`.
|
|
56310
|
+
description: "WIPED OUT \u2014 do not deposit. Strata's first-loss tranche over Neutrl NUSD. Neutrl's August 2026 reserve impairment cut NUSD to a 0.51 USDC recovery rate, more than the junior could absorb: one jrNUSD is now worth about 0.0000036 NUSD. Deposits are closed and it earns nothing.",
|
|
56251
56311
|
decimals: 18,
|
|
56252
56312
|
isRebasing: false,
|
|
56253
|
-
isMintable:
|
|
56313
|
+
isMintable: false,
|
|
56254
56314
|
withdrawalMode: "request-based",
|
|
56255
56315
|
withdrawalCooldownSeconds: 10 * 86400,
|
|
56256
56316
|
withdrawQueue: "0x2a52363a2a0d765b31cb117a8e4d9ce58c2bc749",
|
|
@@ -57826,12 +57886,12 @@ function enumerateEmitters(chainId) {
|
|
|
57826
57886
|
label: "VaultFactory (position NFT)"
|
|
57827
57887
|
});
|
|
57828
57888
|
}
|
|
57829
|
-
for (const [
|
|
57889
|
+
for (const [addr5, name] of Object.entries(
|
|
57830
57890
|
gearboxMarketConfigurators(chainId) ?? {}
|
|
57831
57891
|
)) {
|
|
57832
57892
|
push2({
|
|
57833
57893
|
chainId,
|
|
57834
|
-
address:
|
|
57894
|
+
address: addr5,
|
|
57835
57895
|
lenderKey: "GEARBOX_V3",
|
|
57836
57896
|
family: "gearbox",
|
|
57837
57897
|
role: "factory",
|
|
@@ -58418,10 +58478,10 @@ function emitterCoverage(chainId) {
|
|
|
58418
58478
|
}
|
|
58419
58479
|
|
|
58420
58480
|
// src/lending/margin/base/standard/deposit.ts
|
|
58421
|
-
function computeDepositDelta(
|
|
58481
|
+
function computeDepositDelta(amount5, price2, balanceData2, config, modeId, createNewSubAccount = false, apr, yieldParams) {
|
|
58422
58482
|
const { borrowCollateralFactor, collateralFactor } = getAssetConfig(config, modeId);
|
|
58423
58483
|
const base = createNewSubAccount ? EMPTY_BALANCE : balanceData2;
|
|
58424
|
-
const dollarAmount =
|
|
58484
|
+
const dollarAmount = amount5 * price2;
|
|
58425
58485
|
const postTrade = {
|
|
58426
58486
|
...base,
|
|
58427
58487
|
borrowDiscountedCollateral: base.borrowDiscountedCollateral + borrowCollateralFactor * dollarAmount,
|
|
@@ -58468,13 +58528,13 @@ function computeDepositDelta(amount4, price2, balanceData2, config, modeId, crea
|
|
|
58468
58528
|
}
|
|
58469
58529
|
|
|
58470
58530
|
// src/lending/margin/base/deposit.ts
|
|
58471
|
-
function computeDepositDelta2(lender,
|
|
58531
|
+
function computeDepositDelta2(lender, amount5, price2, balanceData2, config, modeId, createNewSubAccount, apr, yieldParams, targetMarketUid, positions) {
|
|
58472
58532
|
if (isSumerType(lender)) {
|
|
58473
58533
|
if (!positions || targetMarketUid === void 0) {
|
|
58474
58534
|
throw new Error("Sumer operations require positions and targetMarketUid");
|
|
58475
58535
|
}
|
|
58476
58536
|
return computeSumerDepositDelta(
|
|
58477
|
-
|
|
58537
|
+
amount5,
|
|
58478
58538
|
price2,
|
|
58479
58539
|
targetMarketUid,
|
|
58480
58540
|
balanceData2,
|
|
@@ -58488,7 +58548,7 @@ function computeDepositDelta2(lender, amount4, price2, balanceData2, config, mod
|
|
|
58488
58548
|
throw new Error("Standard operations require config and modeId");
|
|
58489
58549
|
}
|
|
58490
58550
|
return computeDepositDelta(
|
|
58491
|
-
|
|
58551
|
+
amount5,
|
|
58492
58552
|
price2,
|
|
58493
58553
|
balanceData2,
|
|
58494
58554
|
config,
|
|
@@ -58500,9 +58560,9 @@ function computeDepositDelta2(lender, amount4, price2, balanceData2, config, mod
|
|
|
58500
58560
|
}
|
|
58501
58561
|
|
|
58502
58562
|
// src/lending/margin/base/standard/withdraw.ts
|
|
58503
|
-
function computeWithdrawDelta(
|
|
58563
|
+
function computeWithdrawDelta(amount5, price2, balanceData2, config, modeId, apr, yieldParams) {
|
|
58504
58564
|
const { borrowCollateralFactor, collateralFactor } = getAssetConfig(config, modeId);
|
|
58505
|
-
const dollarAmount =
|
|
58565
|
+
const dollarAmount = amount5 * price2;
|
|
58506
58566
|
const postTrade = {
|
|
58507
58567
|
...balanceData2,
|
|
58508
58568
|
borrowDiscountedCollateral: balanceData2.borrowDiscountedCollateral - borrowCollateralFactor * dollarAmount,
|
|
@@ -58549,13 +58609,13 @@ function computeWithdrawDelta(amount4, price2, balanceData2, config, modeId, apr
|
|
|
58549
58609
|
}
|
|
58550
58610
|
|
|
58551
58611
|
// src/lending/margin/base/withdraw.ts
|
|
58552
|
-
function computeWithdrawDelta2(lender,
|
|
58612
|
+
function computeWithdrawDelta2(lender, amount5, price2, balanceData2, config, modeId, apr, yieldParams, targetMarketUid, positions) {
|
|
58553
58613
|
if (isSumerType(lender)) {
|
|
58554
58614
|
if (!positions || targetMarketUid === void 0) {
|
|
58555
58615
|
throw new Error("Sumer operations require positions and targetMarketUid");
|
|
58556
58616
|
}
|
|
58557
58617
|
return computeSumerWithdrawDelta(
|
|
58558
|
-
|
|
58618
|
+
amount5,
|
|
58559
58619
|
price2,
|
|
58560
58620
|
targetMarketUid,
|
|
58561
58621
|
balanceData2,
|
|
@@ -58568,7 +58628,7 @@ function computeWithdrawDelta2(lender, amount4, price2, balanceData2, config, mo
|
|
|
58568
58628
|
throw new Error("Standard operations require config and modeId");
|
|
58569
58629
|
}
|
|
58570
58630
|
return computeWithdrawDelta(
|
|
58571
|
-
|
|
58631
|
+
amount5,
|
|
58572
58632
|
price2,
|
|
58573
58633
|
balanceData2,
|
|
58574
58634
|
config,
|
|
@@ -58579,9 +58639,9 @@ function computeWithdrawDelta2(lender, amount4, price2, balanceData2, config, mo
|
|
|
58579
58639
|
}
|
|
58580
58640
|
|
|
58581
58641
|
// src/lending/margin/base/standard/borrow.ts
|
|
58582
|
-
function computeBorrowDelta(
|
|
58642
|
+
function computeBorrowDelta(amount5, price2, balanceData2, config, modeId, apr, yieldParams, irMode) {
|
|
58583
58643
|
const { borrowFactor } = getAssetConfig(config, modeId);
|
|
58584
|
-
const dollarAmount =
|
|
58644
|
+
const dollarAmount = amount5 * price2;
|
|
58585
58645
|
const postTrade = {
|
|
58586
58646
|
...balanceData2,
|
|
58587
58647
|
debt: balanceData2.debt + dollarAmount,
|
|
@@ -58630,13 +58690,13 @@ function computeBorrowDelta(amount4, price2, balanceData2, config, modeId, apr,
|
|
|
58630
58690
|
}
|
|
58631
58691
|
|
|
58632
58692
|
// src/lending/margin/base/borrow.ts
|
|
58633
|
-
function computeBorrowDelta2(lender,
|
|
58693
|
+
function computeBorrowDelta2(lender, amount5, price2, balanceData2, config, modeId, apr, yieldParams, irMode, targetMarketUid, positions) {
|
|
58634
58694
|
if (isSumerType(lender)) {
|
|
58635
58695
|
if (!positions || targetMarketUid === void 0) {
|
|
58636
58696
|
throw new Error("Sumer operations require positions and targetMarketUid");
|
|
58637
58697
|
}
|
|
58638
58698
|
return computeSumerBorrowDelta(
|
|
58639
|
-
|
|
58699
|
+
amount5,
|
|
58640
58700
|
price2,
|
|
58641
58701
|
targetMarketUid,
|
|
58642
58702
|
balanceData2,
|
|
@@ -58650,7 +58710,7 @@ function computeBorrowDelta2(lender, amount4, price2, balanceData2, config, mode
|
|
|
58650
58710
|
throw new Error("Standard operations require config and modeId");
|
|
58651
58711
|
}
|
|
58652
58712
|
return computeBorrowDelta(
|
|
58653
|
-
|
|
58713
|
+
amount5,
|
|
58654
58714
|
price2,
|
|
58655
58715
|
balanceData2,
|
|
58656
58716
|
config,
|
|
@@ -58662,9 +58722,9 @@ function computeBorrowDelta2(lender, amount4, price2, balanceData2, config, mode
|
|
|
58662
58722
|
}
|
|
58663
58723
|
|
|
58664
58724
|
// src/lending/margin/base/standard/repay.ts
|
|
58665
|
-
function computeRepayDelta(
|
|
58725
|
+
function computeRepayDelta(amount5, price2, balanceData2, config, modeId, apr, yieldParams, irMode) {
|
|
58666
58726
|
const { borrowFactor } = getAssetConfig(config, modeId);
|
|
58667
|
-
const dollarAmount =
|
|
58727
|
+
const dollarAmount = amount5 * price2;
|
|
58668
58728
|
const postTrade = {
|
|
58669
58729
|
...balanceData2,
|
|
58670
58730
|
debt: balanceData2.debt - dollarAmount,
|
|
@@ -58713,13 +58773,13 @@ function computeRepayDelta(amount4, price2, balanceData2, config, modeId, apr, y
|
|
|
58713
58773
|
}
|
|
58714
58774
|
|
|
58715
58775
|
// src/lending/margin/base/repay.ts
|
|
58716
|
-
function computeRepayDelta2(lender,
|
|
58776
|
+
function computeRepayDelta2(lender, amount5, price2, balanceData2, config, modeId, apr, yieldParams, irMode, targetMarketUid, positions) {
|
|
58717
58777
|
if (isSumerType(lender)) {
|
|
58718
58778
|
if (!positions || targetMarketUid === void 0) {
|
|
58719
58779
|
throw new Error("Sumer operations require positions and targetMarketUid");
|
|
58720
58780
|
}
|
|
58721
58781
|
return computeSumerRepayDelta(
|
|
58722
|
-
|
|
58782
|
+
amount5,
|
|
58723
58783
|
price2,
|
|
58724
58784
|
targetMarketUid,
|
|
58725
58785
|
balanceData2,
|
|
@@ -58733,7 +58793,7 @@ function computeRepayDelta2(lender, amount4, price2, balanceData2, config, modeI
|
|
|
58733
58793
|
throw new Error("Standard operations require config and modeId");
|
|
58734
58794
|
}
|
|
58735
58795
|
return computeRepayDelta(
|
|
58736
|
-
|
|
58796
|
+
amount5,
|
|
58737
58797
|
price2,
|
|
58738
58798
|
balanceData2,
|
|
58739
58799
|
config,
|
|
@@ -59817,19 +59877,534 @@ var gmxFetcher = {
|
|
|
59817
59877
|
]);
|
|
59818
59878
|
const list = lists?.[GMX_CHAIN]?.list ?? {};
|
|
59819
59879
|
const rData = {};
|
|
59820
|
-
const put = (
|
|
59821
|
-
const a =
|
|
59880
|
+
const put = (addr5, d) => {
|
|
59881
|
+
const a = addr5.toLowerCase();
|
|
59822
59882
|
const apr = apyToApr(d.apy) * 100;
|
|
59823
59883
|
const group = list[a]?.assetGroup;
|
|
59824
59884
|
if (group) rData[group] = apr;
|
|
59825
59885
|
const legacy = LEGACY_KEYS[a];
|
|
59826
59886
|
if (legacy && legacy !== group) rData[legacy] = apr;
|
|
59827
59887
|
};
|
|
59828
|
-
for (const [
|
|
59829
|
-
for (const [
|
|
59888
|
+
for (const [addr5, d] of Object.entries(apy.markets ?? {})) put(addr5, d);
|
|
59889
|
+
for (const [addr5, d] of Object.entries(apy.glvs ?? {})) put(addr5, d);
|
|
59830
59890
|
return rData;
|
|
59831
59891
|
}
|
|
59832
59892
|
};
|
|
59893
|
+
var DISTRESSED_PRICE_KEY = "DISTRESSED";
|
|
59894
|
+
var ETH = Chain.ETHEREUM_MAINNET;
|
|
59895
|
+
var HYPEREVM = Chain.HYPEREVM;
|
|
59896
|
+
var USDC_ETH = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
|
|
59897
|
+
var USDC_HYPEREVM = "0xb88339cb7199b77e23db6e890353e22632ba630f";
|
|
59898
|
+
var NUSD = "0xe556aba6fe6036275ec1f87eda296be72c811bce";
|
|
59899
|
+
var MSUSD = "0x4ba01f22827018b4772cd326c7627fb4956a7c00";
|
|
59900
|
+
var DISTRESSED_ASSETS = [
|
|
59901
|
+
// ── Neutrl ────────────────────────────────────────────────────────────
|
|
59902
|
+
// Mint/redeem frozen 2026-08-13 (reserve impairment, ~$27M liquid disclosed
|
|
59903
|
+
// 2026-08-28). Recovery portal `NusdRedemption` 0xB3f07D33…3828 (Sourcify
|
|
59904
|
+
// exact) burns the caller's WHOLE NUSD balance for USDC at
|
|
59905
|
+
// `redemptionRate()` = 0.51e18, open until 2026-11-14 (whitelist off; one
|
|
59906
|
+
// acknowledgement tx first). Its AssetReserve 0xfee69fa9… held 2.33M USDC
|
|
59907
|
+
// against 32.46M NUSD supply on 2026-10-17. No DEX market of size remains
|
|
59908
|
+
// (largest NUSD/USDC pool $26k, zero volume); CoinGecko's ~$1 is stale since
|
|
59909
|
+
// 2026-08-14. The portal rate is the only price an NUSD holder can realize.
|
|
59910
|
+
{
|
|
59911
|
+
chainId: ETH,
|
|
59912
|
+
asset: NUSD,
|
|
59913
|
+
symbol: "NUSD",
|
|
59914
|
+
since: "2026-08-13",
|
|
59915
|
+
reason: "Neutrl reserve impairment; NUSD redeems at the portal rate",
|
|
59916
|
+
source: {
|
|
59917
|
+
kind: "redemption",
|
|
59918
|
+
contract: "0xb3f07d3392102fc23264a78e2a1a8b6421123828",
|
|
59919
|
+
quote: USDC_ETH
|
|
59920
|
+
}
|
|
59921
|
+
},
|
|
59922
|
+
// sNUSD: `cooldownDuration()` = 1 s, so a holder unstakes to NUSD at
|
|
59923
|
+
// `convertToAssets` (1.064387, frozen since the last distribution
|
|
59924
|
+
// 2026-08-11) and redeems that. Strata's feed marks it 0.5428 — the same
|
|
59925
|
+
// product.
|
|
59926
|
+
{
|
|
59927
|
+
chainId: ETH,
|
|
59928
|
+
asset: "0x08efcc2f3e61185d0ea7f8830b3fec9bfa2ee313",
|
|
59929
|
+
symbol: "sNUSD",
|
|
59930
|
+
since: "2026-08-13",
|
|
59931
|
+
reason: "staked NUSD \u2014 share value \xD7 NUSD portal rate",
|
|
59932
|
+
source: { kind: "share", of: NUSD, shareDecimals: 18, assetDecimals: 18 }
|
|
59933
|
+
},
|
|
59934
|
+
// Strata tranches over sNUSD, accounted in NUSD. The haircut exceeded the
|
|
59935
|
+
// junior's cover: jrNUSD `convertToAssets(1e18)` = 3.6e-6 NUSD, srNUSD
|
|
59936
|
+
// 1.2397 NUSD (≈ $0.632, = Strata v19 `srt.price` 0.63225).
|
|
59937
|
+
{
|
|
59938
|
+
chainId: ETH,
|
|
59939
|
+
asset: "0x65a44528e8868166401ea08b549e19552af589db",
|
|
59940
|
+
symbol: "srNUSD",
|
|
59941
|
+
since: "2026-08-13",
|
|
59942
|
+
reason: "Strata senior over sNUSD \u2014 share value \xD7 NUSD portal rate",
|
|
59943
|
+
source: { kind: "share", of: NUSD, shareDecimals: 18, assetDecimals: 18 }
|
|
59944
|
+
},
|
|
59945
|
+
{
|
|
59946
|
+
chainId: ETH,
|
|
59947
|
+
asset: "0xfc807058a352b61aeef6a38e2d0fc3990225e772",
|
|
59948
|
+
symbol: "jrNUSD",
|
|
59949
|
+
since: "2026-08-13",
|
|
59950
|
+
reason: "Strata junior over sNUSD \u2014 written to ~0 by the NUSD haircut",
|
|
59951
|
+
source: { kind: "share", of: NUSD, shareDecimals: 18, assetDecimals: 18 }
|
|
59952
|
+
},
|
|
59953
|
+
// ── Main Street (msUSD / msY) ────────────────────────────────────────
|
|
59954
|
+
// Proof-of-reserves dashboard went dark ~2026-06-20 and Accountable ended
|
|
59955
|
+
// its attestation ("unable to meet our verification standards"); msUSD fell
|
|
59956
|
+
// to ~$0.06, supply froze at ~74M, KYC'd redemption ran dry. It has since
|
|
59957
|
+
// recovered to ~$0.54–0.56 (DefiLlama conf 0.99) with no redemption path.
|
|
59958
|
+
// Euler's chain-1 router still prices it 1.0. The deepest venue is the
|
|
59959
|
+
// Uni V3 msUSD/USDC 1 bp pool (0x536a6580…): 427k msUSD vs 1.4k USDC on
|
|
59960
|
+
// 2026-10-17, spot 0.548 — a mark, there is no bid of size behind it.
|
|
59961
|
+
{
|
|
59962
|
+
chainId: ETH,
|
|
59963
|
+
asset: MSUSD,
|
|
59964
|
+
symbol: "msUSD",
|
|
59965
|
+
since: "2026-06-20",
|
|
59966
|
+
reason: "Main Street reserve attestation withdrawn; no redemption \u2014 market mark",
|
|
59967
|
+
source: {
|
|
59968
|
+
kind: "v3-spot",
|
|
59969
|
+
pool: "0x536a65800167b07b9e5cabb9088b17df3f827fb2",
|
|
59970
|
+
quote: USDC_ETH,
|
|
59971
|
+
assetIsToken0: true,
|
|
59972
|
+
assetDecimals: 18,
|
|
59973
|
+
quoteDecimals: 6
|
|
59974
|
+
}
|
|
59975
|
+
},
|
|
59976
|
+
// msY: ERC-4626 over msUSD (1.0820 msUSD/share); its 7-day cooldown exit
|
|
59977
|
+
// pays msUSD, so it is worth exactly its share of msUSD. The Morpho API's
|
|
59978
|
+
// own msY quote (0.584) agrees with 1.082 × msUSD.
|
|
59979
|
+
{
|
|
59980
|
+
chainId: ETH,
|
|
59981
|
+
asset: "0x890a5122aa1da30fec4286de7904ff808f0bd74a",
|
|
59982
|
+
symbol: "msY",
|
|
59983
|
+
since: "2026-06-20",
|
|
59984
|
+
reason: "msY vault over msUSD \u2014 share value \xD7 msUSD mark",
|
|
59985
|
+
source: { kind: "share", of: MSUSD, shareDecimals: 18, assetDecimals: 18 }
|
|
59986
|
+
},
|
|
59987
|
+
// ── Altura (AVLT, HyperEVM) ───────────────────────────────────────────
|
|
59988
|
+
// Wind-down announced 2026-06-21 after an $8.5M run; withdrawals paused for
|
|
59989
|
+
// a "maturity mismatch". On 2026-10-17 the vault held 8 wei-units (0.000008)
|
|
59990
|
+
// of USDT0 against 29.64M AVLT; `availableLiquidity()` = 8. Its NAV oracle
|
|
59991
|
+
// 0x314a7961… is still RE-REPORTED daily at the same 1.0944929 (the
|
|
59992
|
+
// 2026-10-16 22:55 UTC update is identical to the one ~110 days earlier),
|
|
59993
|
+
// so a freshness check cannot catch it. The market: AVLT/USDC 2 % pool
|
|
59994
|
+
// 0xb0ca298d… ($7.2k) and AVLT/USDT0 1 bp 0x7cc3439c… ($2.3k), both
|
|
59995
|
+
// ~$0.015. The share is one symbol on Ethereum too (an OFT, same group), so
|
|
59996
|
+
// this one entry prices the group on both chains.
|
|
59997
|
+
{
|
|
59998
|
+
chainId: HYPEREVM,
|
|
59999
|
+
asset: "0xd0ee0cf300dfb598270cd7f4d0c6e0d8f6e13f29",
|
|
60000
|
+
symbol: "AVLT",
|
|
60001
|
+
since: "2026-06-21",
|
|
60002
|
+
reason: "Altura vault wound down; withdrawals paused, NAV frozen \u2014 market mark",
|
|
60003
|
+
source: {
|
|
60004
|
+
kind: "v3-spot",
|
|
60005
|
+
pool: "0xb0ca298dd776421ee1b9b053c06168971395cd1a",
|
|
60006
|
+
quote: USDC_HYPEREVM,
|
|
60007
|
+
assetIsToken0: false,
|
|
60008
|
+
assetDecimals: 6,
|
|
60009
|
+
quoteDecimals: 6
|
|
60010
|
+
}
|
|
60011
|
+
}
|
|
60012
|
+
];
|
|
60013
|
+
var distressedAssetsForChain = (chainId) => DISTRESSED_ASSETS.filter((a) => a.chainId === chainId);
|
|
60014
|
+
var DISTRESSED_ABI = [
|
|
60015
|
+
{
|
|
60016
|
+
name: "redemptionRate",
|
|
60017
|
+
type: "function",
|
|
60018
|
+
stateMutability: "view",
|
|
60019
|
+
inputs: [],
|
|
60020
|
+
outputs: [{ type: "uint256" }]
|
|
60021
|
+
},
|
|
60022
|
+
{
|
|
60023
|
+
name: "slot0",
|
|
60024
|
+
type: "function",
|
|
60025
|
+
stateMutability: "view",
|
|
60026
|
+
inputs: [],
|
|
60027
|
+
// Only the leading word is read; Algebra / V3 variants differ after it.
|
|
60028
|
+
outputs: [{ name: "sqrtPriceX96", type: "uint160" }]
|
|
60029
|
+
},
|
|
60030
|
+
{
|
|
60031
|
+
name: "convertToAssets",
|
|
60032
|
+
type: "function",
|
|
60033
|
+
stateMutability: "view",
|
|
60034
|
+
inputs: [{ name: "shares", type: "uint256" }],
|
|
60035
|
+
outputs: [{ type: "uint256" }]
|
|
60036
|
+
}
|
|
60037
|
+
];
|
|
60038
|
+
var callFor = (a) => {
|
|
60039
|
+
const s = a.source;
|
|
60040
|
+
if (s.kind === "redemption")
|
|
60041
|
+
return { address: s.contract, name: "redemptionRate", params: [] };
|
|
60042
|
+
if (s.kind === "v3-spot") return { address: s.pool, name: "slot0", params: [] };
|
|
60043
|
+
return {
|
|
60044
|
+
address: a.asset,
|
|
60045
|
+
name: "convertToAssets",
|
|
60046
|
+
params: [10n ** BigInt(s.shareDecimals)]
|
|
60047
|
+
};
|
|
60048
|
+
};
|
|
60049
|
+
var firstWord = (r) => {
|
|
60050
|
+
if (typeof r === "bigint") return r;
|
|
60051
|
+
if (Array.isArray(r) && typeof r[0] === "bigint") return r[0];
|
|
60052
|
+
return void 0;
|
|
60053
|
+
};
|
|
60054
|
+
async function fetchDistressedPricesRaw(chainId, rpcOverrides) {
|
|
60055
|
+
const rules = distressedAssetsForChain(chainId);
|
|
60056
|
+
if (rules.length === 0) return null;
|
|
60057
|
+
try {
|
|
60058
|
+
const results = await multicallRetryUniversal({
|
|
60059
|
+
chain: chainId,
|
|
60060
|
+
abi: DISTRESSED_ABI,
|
|
60061
|
+
calls: rules.map(callFor),
|
|
60062
|
+
allowFailure: true,
|
|
60063
|
+
overrides: rpcOverrides
|
|
60064
|
+
});
|
|
60065
|
+
const raw = {};
|
|
60066
|
+
rules.forEach((a, i) => {
|
|
60067
|
+
const w = firstWord(results[i]);
|
|
60068
|
+
if (w !== void 0 && w > 0n) raw[a.asset] = w;
|
|
60069
|
+
});
|
|
60070
|
+
return raw;
|
|
60071
|
+
} catch (e) {
|
|
60072
|
+
console.warn(`[distressed] chain ${chainId}: read failed`, e);
|
|
60073
|
+
return null;
|
|
60074
|
+
}
|
|
60075
|
+
}
|
|
60076
|
+
var Q192 = 2n ** 192n;
|
|
60077
|
+
var SCALE = 10n ** 36n;
|
|
60078
|
+
var v3SpotToken1PerToken0 = (sqrtPriceX96, decimals0, decimals1) => Number(sqrtPriceX96 * sqrtPriceX96 * SCALE / Q192) / 1e36 * 10 ** (decimals0 - decimals1);
|
|
60079
|
+
function distressedEntries(chainId, tokenList, raw, usdPrices) {
|
|
60080
|
+
const resolved2 = {};
|
|
60081
|
+
const usdOf = (addr5) => {
|
|
60082
|
+
if (resolved2[addr5] !== void 0) return resolved2[addr5];
|
|
60083
|
+
const group = tokenList?.[addr5]?.assetGroup;
|
|
60084
|
+
const p = group && usdPrices[group] || usdPrices[addr5];
|
|
60085
|
+
return typeof p === "number" && p > 0 ? p : void 0;
|
|
60086
|
+
};
|
|
60087
|
+
const entries = [];
|
|
60088
|
+
for (const a of distressedAssetsForChain(chainId)) {
|
|
60089
|
+
const word = raw[a.asset];
|
|
60090
|
+
if (word === void 0) continue;
|
|
60091
|
+
const s = a.source;
|
|
60092
|
+
let priceUSD;
|
|
60093
|
+
let ratio;
|
|
60094
|
+
let base;
|
|
60095
|
+
if (s.kind === "redemption") {
|
|
60096
|
+
base = s.quote;
|
|
60097
|
+
ratio = Number(word) / 1e18;
|
|
60098
|
+
if (!(ratio > 0 && ratio <= 1)) continue;
|
|
60099
|
+
} else if (s.kind === "v3-spot") {
|
|
60100
|
+
base = s.quote;
|
|
60101
|
+
const t1PerT0 = s.assetIsToken0 ? v3SpotToken1PerToken0(word, s.assetDecimals, s.quoteDecimals) : v3SpotToken1PerToken0(word, s.quoteDecimals, s.assetDecimals);
|
|
60102
|
+
ratio = s.assetIsToken0 ? t1PerT0 : 1 / t1PerT0;
|
|
60103
|
+
if (!(ratio > 0 && ratio < 1.5)) continue;
|
|
60104
|
+
} else {
|
|
60105
|
+
base = s.of;
|
|
60106
|
+
ratio = Number(word) / 10 ** s.assetDecimals;
|
|
60107
|
+
if (!(ratio >= 0 && Number.isFinite(ratio) && ratio < 100)) continue;
|
|
60108
|
+
}
|
|
60109
|
+
const baseUsd = usdOf(base);
|
|
60110
|
+
if (baseUsd === void 0) continue;
|
|
60111
|
+
priceUSD = ratio * baseUsd;
|
|
60112
|
+
if (!(priceUSD >= 0) || !Number.isFinite(priceUSD)) continue;
|
|
60113
|
+
resolved2[a.asset] = priceUSD;
|
|
60114
|
+
const published = priceUSD > 0 ? priceUSD : 1e-12;
|
|
60115
|
+
entries.push({
|
|
60116
|
+
asset: a.asset,
|
|
60117
|
+
price: ratio,
|
|
60118
|
+
priceUSD: published,
|
|
60119
|
+
marketUid: `${DISTRESSED_PRICE_KEY}:${chainId}:${a.asset}`,
|
|
60120
|
+
targetLender: DISTRESSED_PRICE_KEY,
|
|
60121
|
+
baseAsset: base,
|
|
60122
|
+
description: `${a.symbol}: ${a.reason} (since ${a.since})`,
|
|
60123
|
+
derivation: s.kind === "share" ? "derived" : "quoted",
|
|
60124
|
+
authoritative: true
|
|
60125
|
+
});
|
|
60126
|
+
}
|
|
60127
|
+
return entries;
|
|
60128
|
+
}
|
|
60129
|
+
var PENDLE_PT_PRICES_URL = "https://api-v2.pendle.finance/core/v1/prices/assets?type=PT";
|
|
60130
|
+
var PENDLE_PRICE_KEY = "PENDLE";
|
|
60131
|
+
var CACHE_MS = 6e4;
|
|
60132
|
+
var TIMEOUT_MS6 = 1e4;
|
|
60133
|
+
var cached = {
|
|
60134
|
+
at: 0,
|
|
60135
|
+
prices: Promise.resolve(null)
|
|
60136
|
+
};
|
|
60137
|
+
function fetchPendlePtPricesRaw() {
|
|
60138
|
+
const now = Date.now();
|
|
60139
|
+
if (now - cached.at < CACHE_MS) return cached.prices;
|
|
60140
|
+
const prices = (async () => {
|
|
60141
|
+
try {
|
|
60142
|
+
const res = await fetch(PENDLE_PT_PRICES_URL, {
|
|
60143
|
+
signal: AbortSignal.timeout(TIMEOUT_MS6)
|
|
60144
|
+
});
|
|
60145
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
60146
|
+
const data = await res.json();
|
|
60147
|
+
return data.prices ?? null;
|
|
60148
|
+
} catch (e) {
|
|
60149
|
+
console.warn(`[prices] pendle PT prices unavailable: ${String(e)}`);
|
|
60150
|
+
cached = { at: 0, prices: Promise.resolve(null) };
|
|
60151
|
+
return null;
|
|
60152
|
+
}
|
|
60153
|
+
})();
|
|
60154
|
+
cached = { at: now, prices };
|
|
60155
|
+
return prices;
|
|
60156
|
+
}
|
|
60157
|
+
function pendlePtEntries(chainId, tokenList, raw) {
|
|
60158
|
+
const out = [];
|
|
60159
|
+
for (const [address, entry] of Object.entries(tokenList)) {
|
|
60160
|
+
if (entry?.props?.pendle?.tokenType !== "PT") continue;
|
|
60161
|
+
const asset = address.toLowerCase();
|
|
60162
|
+
const usd = raw[`${chainId}-${asset}`];
|
|
60163
|
+
if (!(typeof usd === "number" && Number.isFinite(usd) && usd > 0)) continue;
|
|
60164
|
+
out.push({
|
|
60165
|
+
asset,
|
|
60166
|
+
price: usd,
|
|
60167
|
+
priceUSD: usd,
|
|
60168
|
+
marketUid: `${PENDLE_PRICE_KEY}:${chainId}:${asset}`,
|
|
60169
|
+
description: "Pendle PT market price (USD)",
|
|
60170
|
+
derivation: "direct"
|
|
60171
|
+
});
|
|
60172
|
+
}
|
|
60173
|
+
return out;
|
|
60174
|
+
}
|
|
60175
|
+
var PENDLE_UNDERLYING_PRICE_KEY = "PENDLE_UNDERLYING";
|
|
60176
|
+
var PENDLE_ALL_PRICES_URL = "https://api-v2.pendle.finance/core/v1/prices/assets";
|
|
60177
|
+
var PENDLE_MARKETS_URL = "https://api-v2.pendle.finance/core/v1/markets/all";
|
|
60178
|
+
var underlyingCached = { at: 0, prices: Promise.resolve(null) };
|
|
60179
|
+
function fetchPendleUnderlyingPricesRaw() {
|
|
60180
|
+
const now = Date.now();
|
|
60181
|
+
if (now - underlyingCached.at < CACHE_MS) return underlyingCached.prices;
|
|
60182
|
+
const prices = (async () => {
|
|
60183
|
+
try {
|
|
60184
|
+
const [mRes, pRes] = await Promise.all([
|
|
60185
|
+
fetch(PENDLE_MARKETS_URL, { signal: AbortSignal.timeout(TIMEOUT_MS6) }),
|
|
60186
|
+
fetch(PENDLE_ALL_PRICES_URL, {
|
|
60187
|
+
signal: AbortSignal.timeout(TIMEOUT_MS6)
|
|
60188
|
+
})
|
|
60189
|
+
]);
|
|
60190
|
+
if (!mRes.ok) throw new Error(`markets HTTP ${mRes.status}`);
|
|
60191
|
+
if (!pRes.ok) throw new Error(`prices HTTP ${pRes.status}`);
|
|
60192
|
+
const markets = (await mRes.json()).markets ?? [];
|
|
60193
|
+
const all = (await pRes.json()).prices ?? {};
|
|
60194
|
+
const out = {};
|
|
60195
|
+
for (const m of markets) {
|
|
60196
|
+
if (!(Date.parse(m?.expiry) > now)) continue;
|
|
60197
|
+
const keys = [
|
|
60198
|
+
m?.underlyingAsset,
|
|
60199
|
+
m?.accountingAsset,
|
|
60200
|
+
...Array.isArray(m?.inputTokens) ? m.inputTokens : [],
|
|
60201
|
+
...Array.isArray(m?.outputTokens) ? m.outputTokens : []
|
|
60202
|
+
];
|
|
60203
|
+
for (const k of keys) {
|
|
60204
|
+
const key4 = String(k ?? "").toLowerCase();
|
|
60205
|
+
const usd = all[key4];
|
|
60206
|
+
if (typeof usd === "number" && Number.isFinite(usd) && usd > 0)
|
|
60207
|
+
out[key4] = usd;
|
|
60208
|
+
}
|
|
60209
|
+
}
|
|
60210
|
+
return out;
|
|
60211
|
+
} catch (e) {
|
|
60212
|
+
console.warn(
|
|
60213
|
+
`[prices] pendle underlying prices unavailable: ${String(e)}`
|
|
60214
|
+
);
|
|
60215
|
+
underlyingCached = { at: 0, prices: Promise.resolve(null) };
|
|
60216
|
+
return null;
|
|
60217
|
+
}
|
|
60218
|
+
})();
|
|
60219
|
+
underlyingCached = { at: now, prices };
|
|
60220
|
+
return prices;
|
|
60221
|
+
}
|
|
60222
|
+
function pendleUnderlyingEntries(chainId, tokenList, raw) {
|
|
60223
|
+
const out = [];
|
|
60224
|
+
const prefix = `${chainId}-`;
|
|
60225
|
+
for (const [key4, usd] of Object.entries(raw)) {
|
|
60226
|
+
if (!key4.startsWith(prefix)) continue;
|
|
60227
|
+
const asset = key4.slice(prefix.length);
|
|
60228
|
+
if (!tokenList[asset]) continue;
|
|
60229
|
+
out.push({
|
|
60230
|
+
asset,
|
|
60231
|
+
price: usd,
|
|
60232
|
+
priceUSD: usd,
|
|
60233
|
+
marketUid: `${PENDLE_UNDERLYING_PRICE_KEY}:${chainId}:${asset}`,
|
|
60234
|
+
description: "Pendle quote of a market underlying (USD, fallback)",
|
|
60235
|
+
derivation: "quoted",
|
|
60236
|
+
fallbackOnly: true
|
|
60237
|
+
});
|
|
60238
|
+
}
|
|
60239
|
+
return out;
|
|
60240
|
+
}
|
|
60241
|
+
var PT_SY_ABI = [
|
|
60242
|
+
{
|
|
60243
|
+
name: "SY",
|
|
60244
|
+
type: "function",
|
|
60245
|
+
stateMutability: "view",
|
|
60246
|
+
inputs: [],
|
|
60247
|
+
outputs: [{ type: "address" }]
|
|
60248
|
+
},
|
|
60249
|
+
{
|
|
60250
|
+
name: "yieldToken",
|
|
60251
|
+
type: "function",
|
|
60252
|
+
stateMutability: "view",
|
|
60253
|
+
inputs: [],
|
|
60254
|
+
outputs: [{ type: "address" }]
|
|
60255
|
+
},
|
|
60256
|
+
{
|
|
60257
|
+
name: "assetInfo",
|
|
60258
|
+
type: "function",
|
|
60259
|
+
stateMutability: "view",
|
|
60260
|
+
inputs: [],
|
|
60261
|
+
outputs: [
|
|
60262
|
+
{ name: "assetType", type: "uint8" },
|
|
60263
|
+
{ name: "assetAddress", type: "address" },
|
|
60264
|
+
{ name: "assetDecimals", type: "uint8" }
|
|
60265
|
+
]
|
|
60266
|
+
}
|
|
60267
|
+
];
|
|
60268
|
+
var backingMemo = /* @__PURE__ */ new Map();
|
|
60269
|
+
var backingFailedAt = /* @__PURE__ */ new Map();
|
|
60270
|
+
var BACKING_RETRY_MS = 60 * 6e4;
|
|
60271
|
+
var ADDR = /^0x[0-9a-fA-F]{40}$/;
|
|
60272
|
+
var asAddr = (v) => typeof v === "string" && ADDR.test(v) ? v.toLowerCase() : void 0;
|
|
60273
|
+
async function fetchDistressedPendlePtsRaw(chainId, tokenList, rpcOverrides) {
|
|
60274
|
+
const roster = new Set(distressedAssetsForChain(chainId).map((a) => a.asset));
|
|
60275
|
+
if (roster.size === 0) return null;
|
|
60276
|
+
const now = Date.now();
|
|
60277
|
+
const todo = [];
|
|
60278
|
+
for (const [address, entry] of Object.entries(tokenList ?? {})) {
|
|
60279
|
+
const p = entry?.props?.pendle;
|
|
60280
|
+
if (p?.tokenType !== "PT" || p.bridgedFrom) continue;
|
|
60281
|
+
const pt = address.toLowerCase();
|
|
60282
|
+
const key4 = `${chainId}-${pt}`;
|
|
60283
|
+
if (backingMemo.has(key4)) continue;
|
|
60284
|
+
if (now - (backingFailedAt.get(key4) ?? -Infinity) < BACKING_RETRY_MS)
|
|
60285
|
+
continue;
|
|
60286
|
+
const underlying = asAddr(p.underlyingAsset);
|
|
60287
|
+
if (underlying && !roster.has(underlying)) {
|
|
60288
|
+
backingMemo.set(key4, { yieldToken: underlying });
|
|
60289
|
+
continue;
|
|
60290
|
+
}
|
|
60291
|
+
todo.push({ pt, sy: asAddr(p.syAddress), underlying });
|
|
60292
|
+
}
|
|
60293
|
+
if (todo.length > 0) {
|
|
60294
|
+
try {
|
|
60295
|
+
const needSy = todo.filter((t) => !t.sy);
|
|
60296
|
+
if (needSy.length) {
|
|
60297
|
+
const r2 = await multicallRetryUniversal({
|
|
60298
|
+
chain: chainId,
|
|
60299
|
+
abi: PT_SY_ABI,
|
|
60300
|
+
calls: needSy.map((t) => ({ address: t.pt, name: "SY", params: [] })),
|
|
60301
|
+
allowFailure: true,
|
|
60302
|
+
overrides: rpcOverrides
|
|
60303
|
+
});
|
|
60304
|
+
needSy.forEach((t, i) => t.sy = asAddr(r2[i]));
|
|
60305
|
+
}
|
|
60306
|
+
const withSy = todo.filter((t) => t.sy);
|
|
60307
|
+
const r = withSy.length ? await multicallRetryUniversal({
|
|
60308
|
+
chain: chainId,
|
|
60309
|
+
abi: PT_SY_ABI,
|
|
60310
|
+
calls: withSy.flatMap((t) => [
|
|
60311
|
+
{ address: t.sy, name: "yieldToken", params: [] },
|
|
60312
|
+
{ address: t.sy, name: "assetInfo", params: [] }
|
|
60313
|
+
]),
|
|
60314
|
+
allowFailure: true,
|
|
60315
|
+
overrides: rpcOverrides
|
|
60316
|
+
}) : [];
|
|
60317
|
+
const byPt = /* @__PURE__ */ new Map();
|
|
60318
|
+
withSy.forEach((t, i) => {
|
|
60319
|
+
const yieldToken = asAddr(r[2 * i]) ?? t.underlying;
|
|
60320
|
+
const info = r[2 * i + 1];
|
|
60321
|
+
const accounting = asAddr(Array.isArray(info) ? info[1] : void 0);
|
|
60322
|
+
byPt.set(t.pt, yieldToken ? { yieldToken, accounting } : null);
|
|
60323
|
+
});
|
|
60324
|
+
for (const t of todo) {
|
|
60325
|
+
const key4 = `${chainId}-${t.pt}`;
|
|
60326
|
+
const b = byPt.get(t.pt);
|
|
60327
|
+
if (b) backingMemo.set(key4, b);
|
|
60328
|
+
else backingFailedAt.set(key4, now);
|
|
60329
|
+
}
|
|
60330
|
+
} catch (e) {
|
|
60331
|
+
console.warn(`[prices] pendle PT backing read failed on ${chainId}`, e);
|
|
60332
|
+
for (const t of todo) backingFailedAt.set(`${chainId}-${t.pt}`, now);
|
|
60333
|
+
}
|
|
60334
|
+
}
|
|
60335
|
+
const pts = {};
|
|
60336
|
+
const prefix = `${chainId}-`;
|
|
60337
|
+
for (const [key4, b] of backingMemo) {
|
|
60338
|
+
if (!b || !key4.startsWith(prefix)) continue;
|
|
60339
|
+
const pt = key4.slice(prefix.length);
|
|
60340
|
+
if (!tokenList?.[pt] && !tokenList?.[pt.toLowerCase()]) continue;
|
|
60341
|
+
if (roster.has(b.yieldToken) || b.accounting && roster.has(b.accounting))
|
|
60342
|
+
pts[pt] = b;
|
|
60343
|
+
}
|
|
60344
|
+
if (Object.keys(pts).length === 0) return { pts, quotes: null };
|
|
60345
|
+
return { pts, quotes: await fetchPendleAssetPricesRaw() };
|
|
60346
|
+
}
|
|
60347
|
+
var allCached = { at: 0, prices: Promise.resolve(null) };
|
|
60348
|
+
function fetchPendleAssetPricesRaw() {
|
|
60349
|
+
const now = Date.now();
|
|
60350
|
+
if (now - allCached.at < CACHE_MS) return allCached.prices;
|
|
60351
|
+
const prices = (async () => {
|
|
60352
|
+
try {
|
|
60353
|
+
const res = await fetch(PENDLE_ALL_PRICES_URL, {
|
|
60354
|
+
signal: AbortSignal.timeout(TIMEOUT_MS6)
|
|
60355
|
+
});
|
|
60356
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
60357
|
+
const data = await res.json();
|
|
60358
|
+
return data.prices ?? null;
|
|
60359
|
+
} catch (e) {
|
|
60360
|
+
console.warn(`[prices] pendle asset prices unavailable: ${String(e)}`);
|
|
60361
|
+
allCached = { at: 0, prices: Promise.resolve(null) };
|
|
60362
|
+
return null;
|
|
60363
|
+
}
|
|
60364
|
+
})();
|
|
60365
|
+
allCached = { at: now, prices };
|
|
60366
|
+
return prices;
|
|
60367
|
+
}
|
|
60368
|
+
function distressedPendlePtEntries(chainId, raw, distressed) {
|
|
60369
|
+
if (!raw || Object.keys(raw.pts).length === 0) return [];
|
|
60370
|
+
const usd = /* @__PURE__ */ new Map();
|
|
60371
|
+
for (const e of distressed) {
|
|
60372
|
+
if (e.priceUSD > 0 && Number.isFinite(e.priceUSD))
|
|
60373
|
+
usd.set(e.asset.toLowerCase(), e.priceUSD);
|
|
60374
|
+
}
|
|
60375
|
+
const q = raw.quotes ?? {};
|
|
60376
|
+
const quote = (a) => {
|
|
60377
|
+
const v = q[`${chainId}-${a}`];
|
|
60378
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : void 0;
|
|
60379
|
+
};
|
|
60380
|
+
const out = [];
|
|
60381
|
+
for (const [pt, b] of Object.entries(raw.pts)) {
|
|
60382
|
+
const refIsAccounting = !!b.accounting && usd.has(b.accounting);
|
|
60383
|
+
const ref = refIsAccounting ? b.accounting : b.yieldToken;
|
|
60384
|
+
const refUsd = usd.get(ref);
|
|
60385
|
+
if (refUsd === void 0) continue;
|
|
60386
|
+
const ptQ = quote(pt);
|
|
60387
|
+
const refQ = quote(ref);
|
|
60388
|
+
let ratio = ptQ !== void 0 && refQ !== void 0 ? ptQ / refQ : 1;
|
|
60389
|
+
if (!(ratio > 0) || !Number.isFinite(ratio)) ratio = 1;
|
|
60390
|
+
ratio = Math.min(1, ratio);
|
|
60391
|
+
let priceUSD = ratio * refUsd;
|
|
60392
|
+
const undUsd = usd.get(b.yieldToken);
|
|
60393
|
+
if (undUsd !== void 0) priceUSD = Math.min(priceUSD, undUsd);
|
|
60394
|
+
out.push({
|
|
60395
|
+
asset: pt,
|
|
60396
|
+
price: ratio,
|
|
60397
|
+
priceUSD: priceUSD > 0 ? priceUSD : 1e-12,
|
|
60398
|
+
marketUid: `${DISTRESSED_PRICE_KEY}:${chainId}:${pt}`,
|
|
60399
|
+
targetLender: DISTRESSED_PRICE_KEY,
|
|
60400
|
+
baseAsset: ref,
|
|
60401
|
+
description: `Pendle PT on a distressed ${refIsAccounting ? "unit of account" : "underlying"}: ${ratio.toPrecision(6)} \xD7 its realizable value, implied rate 0`,
|
|
60402
|
+
derivation: "derived",
|
|
60403
|
+
authoritative: true
|
|
60404
|
+
});
|
|
60405
|
+
}
|
|
60406
|
+
return out;
|
|
60407
|
+
}
|
|
59833
60408
|
|
|
59834
60409
|
// src/prices/pendle/fetchPendlePrices.ts
|
|
59835
60410
|
var PENDLE_API_BASE = "https://api-v2.pendle.finance/core";
|
|
@@ -59991,6 +60566,12 @@ async function fetchPendleYields(lists = {}) {
|
|
|
59991
60566
|
yields[assetKey2] = 0;
|
|
59992
60567
|
return;
|
|
59993
60568
|
}
|
|
60569
|
+
if (DISTRESSED_KEYS.has(String(market.underlyingAsset).toLowerCase()) || DISTRESSED_KEYS.has(
|
|
60570
|
+
String(market.accountingAsset ?? "").toLowerCase()
|
|
60571
|
+
)) {
|
|
60572
|
+
yields[assetKey2] = 0;
|
|
60573
|
+
return;
|
|
60574
|
+
}
|
|
59994
60575
|
if (ytPrice && ytPrice > 0) {
|
|
59995
60576
|
const yearFraction = yearFractionToExpiry(market.expiry, now);
|
|
59996
60577
|
const apr = ytPrice / ptPrice * 100 / yearFraction;
|
|
@@ -59998,12 +60579,48 @@ async function fetchPendleYields(lists = {}) {
|
|
|
59998
60579
|
}
|
|
59999
60580
|
});
|
|
60000
60581
|
});
|
|
60001
|
-
|
|
60582
|
+
const out = applyBridgedPendleYields(yields, lists, now);
|
|
60583
|
+
zeroMaturedListedPts(out, lists, now);
|
|
60584
|
+
await zeroDistressedPts(out, lists);
|
|
60585
|
+
return out;
|
|
60002
60586
|
} catch (error) {
|
|
60003
60587
|
console.error("Error in fetchPendlePrices:", error);
|
|
60004
60588
|
return {};
|
|
60005
60589
|
}
|
|
60006
60590
|
}
|
|
60591
|
+
var DISTRESSED_KEYS = new Set(
|
|
60592
|
+
DISTRESSED_ASSETS.map((a) => `${a.chainId}-${a.asset.toLowerCase()}`)
|
|
60593
|
+
);
|
|
60594
|
+
function zeroMaturedListedPts(yields, lists, now = /* @__PURE__ */ new Date()) {
|
|
60595
|
+
const nowS = now.getTime() / 1e3;
|
|
60596
|
+
for (const { list } of Object.values(lists)) {
|
|
60597
|
+
for (const entry of Object.values(list ?? {})) {
|
|
60598
|
+
const p = entry?.props?.pendle;
|
|
60599
|
+
if (p?.tokenType !== "PT" || !entry.assetGroup) continue;
|
|
60600
|
+
if (entry.assetGroup in yields) continue;
|
|
60601
|
+
const matured = typeof p.expiry === "number" && p.expiry <= nowS || p.expired === true;
|
|
60602
|
+
if (matured) yields[entry.assetGroup] = 0;
|
|
60603
|
+
}
|
|
60604
|
+
}
|
|
60605
|
+
}
|
|
60606
|
+
async function zeroDistressedPts(yields, lists) {
|
|
60607
|
+
const chains = new Set(DISTRESSED_ASSETS.map((a) => a.chainId));
|
|
60608
|
+
await Promise.all(
|
|
60609
|
+
[...chains].map(async (chainId) => {
|
|
60610
|
+
const list = lists[chainId]?.list;
|
|
60611
|
+
if (!list) return;
|
|
60612
|
+
try {
|
|
60613
|
+
const raw = await fetchDistressedPendlePtsRaw(chainId, list);
|
|
60614
|
+
for (const pt of Object.keys(raw?.pts ?? {})) {
|
|
60615
|
+
const group = list[pt]?.assetGroup;
|
|
60616
|
+
if (group) yields[group] = 0;
|
|
60617
|
+
}
|
|
60618
|
+
} catch (e) {
|
|
60619
|
+
console.warn(`pendle: distressed PT scan on ${chainId} failed`, e);
|
|
60620
|
+
}
|
|
60621
|
+
})
|
|
60622
|
+
);
|
|
60623
|
+
}
|
|
60007
60624
|
function yearFractionToExpiry(expiryISO, now = /* @__PURE__ */ new Date()) {
|
|
60008
60625
|
const expiry = new Date(expiryISO);
|
|
60009
60626
|
const diffMs = expiry.getTime() - now.getTime();
|
|
@@ -60300,59 +60917,141 @@ var accountableFetcher = {
|
|
|
60300
60917
|
}
|
|
60301
60918
|
};
|
|
60302
60919
|
|
|
60303
|
-
// src/vaults/upshift/
|
|
60304
|
-
var
|
|
60305
|
-
var
|
|
60306
|
-
|
|
60307
|
-
|
|
60308
|
-
|
|
60309
|
-
|
|
60310
|
-
|
|
60311
|
-
|
|
60312
|
-
|
|
60313
|
-
|
|
60314
|
-
"
|
|
60315
|
-
|
|
60316
|
-
"
|
|
60317
|
-
|
|
60318
|
-
|
|
60319
|
-
|
|
60320
|
-
|
|
60321
|
-
|
|
60322
|
-
|
|
60323
|
-
|
|
60324
|
-
|
|
60325
|
-
|
|
60326
|
-
|
|
60327
|
-
|
|
60328
|
-
|
|
60329
|
-
|
|
60330
|
-
|
|
60331
|
-
|
|
60332
|
-
|
|
60333
|
-
|
|
60334
|
-
|
|
60335
|
-
|
|
60336
|
-
|
|
60337
|
-
|
|
60338
|
-
|
|
60920
|
+
// src/vaults/upshift/august.ts
|
|
60921
|
+
var UPSHIFT_AUGUST_VAULTS_URL = "https://api.augustdigital.io/api/v1/tokenized_vault?load_snapshots=false";
|
|
60922
|
+
var ADDR2 = /^0x[0-9a-fA-F]{40}$/;
|
|
60923
|
+
var OLD_LENDING_POOLS = new Set(
|
|
60924
|
+
[
|
|
60925
|
+
"0xe1B4d34E8754600962Cd944B535180Bd758E6c2e",
|
|
60926
|
+
"0xEBac5e50003d4B17Be422ff9775043cD61002f7f",
|
|
60927
|
+
"0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42"
|
|
60928
|
+
].map((a) => a.toLowerCase())
|
|
60929
|
+
);
|
|
60930
|
+
function augustEvmVersion(v) {
|
|
60931
|
+
const a = String(v?.address ?? "");
|
|
60932
|
+
if (!ADDR2.test(a)) return void 0;
|
|
60933
|
+
if (OLD_LENDING_POOLS.has(a.toLowerCase())) return "evm-0";
|
|
60934
|
+
return v.internal_type === "multiAssetVault" ? "evm-2" : "evm-1";
|
|
60935
|
+
}
|
|
60936
|
+
var UPSHIFT_DEPOSIT_DENY_LIST = new Set(
|
|
60937
|
+
[
|
|
60938
|
+
"0x706162790b601A8514c18718d0c63C9D1268e89C",
|
|
60939
|
+
"0xd684AF965b1c17D628ee0d77cae94259c41260F4",
|
|
60940
|
+
// ETH: sUSDe
|
|
60941
|
+
"0xB78dAf3fD674B81ebeaaa88d711506fa069E1C5E",
|
|
60942
|
+
// ETH: ETH Optimizer
|
|
60943
|
+
"0x4e2D90f0307A93b54ACA31dc606F93FE6b9132d2",
|
|
60944
|
+
// Base: LBTC
|
|
60945
|
+
"0x18a5a3D575F34e5eBa92ac99B0976dBe26f9F869",
|
|
60946
|
+
// ETH: LBTC
|
|
60947
|
+
"0xD0b717ef23817b1a127139830Cf0FcD449ef74F0",
|
|
60948
|
+
// BNB: Sienna USDT Tulipa
|
|
60949
|
+
"0xeb402fc96C7ed2f889d837C9976D6d821c1B5f01",
|
|
60950
|
+
// ETH: Kelp TAC Vault
|
|
60951
|
+
"0xEBac5e50003d4B17Be422ff9775043cD61002f7f",
|
|
60952
|
+
// ETH: Upshift BTC
|
|
60953
|
+
"0x419386E3Ef42368e602720CC458e00c0B28c47A7"
|
|
60954
|
+
// ETH: Kelp TAC Vault
|
|
60955
|
+
].map((a) => a.toLowerCase())
|
|
60956
|
+
);
|
|
60957
|
+
function augustStrategists(v) {
|
|
60958
|
+
const subs = (v.subaccounts ?? []).filter((s) => s?.strategist);
|
|
60959
|
+
const src = subs.length ? subs.map((s) => s.strategist) : (v.hardcoded_strategists ?? []).filter((s) => !!s);
|
|
60960
|
+
return src.map((s) => ({
|
|
60961
|
+
name: s.strategist_name ?? null,
|
|
60962
|
+
logo: s.strategist_logo ?? null,
|
|
60963
|
+
website_url: s.website_url ?? null
|
|
60964
|
+
}));
|
|
60965
|
+
}
|
|
60966
|
+
function augustFeeWaived(toggle, untilDate, untilTvl, now = /* @__PURE__ */ new Date()) {
|
|
60967
|
+
if (!toggle) return false;
|
|
60968
|
+
const dateActive = untilDate != null && new Date(untilDate) > now;
|
|
60969
|
+
const tvlConfigured = untilTvl != null && untilTvl > 0;
|
|
60970
|
+
if (untilDate == null && !tvlConfigured) return true;
|
|
60971
|
+
return dateActive || tvlConfigured;
|
|
60972
|
+
}
|
|
60973
|
+
var finite = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
60974
|
+
function augustRealizedRate(v) {
|
|
60975
|
+
const h = v.historicalApy;
|
|
60976
|
+
if (!h) return { source: "unavailable" };
|
|
60977
|
+
const preferred = v.defaultApyHorizon === 7 ? "7" : "30";
|
|
60978
|
+
for (const d of [preferred, preferred === "7" ? "30" : "7"]) {
|
|
60979
|
+
const r = finite(h[d]);
|
|
60980
|
+
if (r !== void 0)
|
|
60981
|
+
return {
|
|
60982
|
+
rate: r * 100,
|
|
60983
|
+
source: d === "7" ? "realized-7d" : "realized-30d"
|
|
60984
|
+
};
|
|
60339
60985
|
}
|
|
60340
|
-
|
|
60341
|
-
|
|
60986
|
+
return { source: "unavailable" };
|
|
60987
|
+
}
|
|
60988
|
+
function augustTargetApy(v) {
|
|
60989
|
+
const o = v.apy_override;
|
|
60990
|
+
const hard = finite(o?.hardcoded_apy);
|
|
60991
|
+
if (o?.is_show_hardcoded_apy && hard !== void 0) return hard * 100;
|
|
60992
|
+
const target = finite(v.reported_apy?.apy);
|
|
60993
|
+
return target !== void 0 ? target * 100 : void 0;
|
|
60994
|
+
}
|
|
60995
|
+
function augustUtc(s) {
|
|
60996
|
+
if (!s) return void 0;
|
|
60997
|
+
const iso = /[zZ]|[+-]\d\d:?\d\d$/.test(s) ? s : `${s}Z`;
|
|
60998
|
+
return Number.isFinite(Date.parse(iso)) ? iso : void 0;
|
|
60999
|
+
}
|
|
61000
|
+
var LISTING_TTL_MS = 6e4;
|
|
61001
|
+
var memo;
|
|
61002
|
+
var inflight5;
|
|
61003
|
+
async function fetchAugustTokenizedVaults(opts = {}) {
|
|
61004
|
+
if (!opts.fresh && memo && Date.now() - memo.at < LISTING_TTL_MS)
|
|
61005
|
+
return memo.rows;
|
|
61006
|
+
if (inflight5) return inflight5;
|
|
61007
|
+
inflight5 = (async () => {
|
|
61008
|
+
const ctrl = new AbortController();
|
|
61009
|
+
const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 3e4);
|
|
61010
|
+
try {
|
|
61011
|
+
const res = await fetch(UPSHIFT_AUGUST_VAULTS_URL, {
|
|
61012
|
+
headers: { Accept: "application/json" },
|
|
61013
|
+
signal: ctrl.signal
|
|
61014
|
+
});
|
|
61015
|
+
if (!res.ok)
|
|
61016
|
+
throw new Error(
|
|
61017
|
+
`August tokenized_vault API failed: ${res.status} ${res.statusText}`
|
|
61018
|
+
);
|
|
61019
|
+
const body = await res.json();
|
|
61020
|
+
if (!Array.isArray(body))
|
|
61021
|
+
throw new Error("August tokenized_vault API: body is not an array");
|
|
61022
|
+
if (body.length === 0)
|
|
61023
|
+
throw new Error("August tokenized_vault API: empty catalogue");
|
|
61024
|
+
const rows = body;
|
|
61025
|
+
memo = { at: Date.now(), rows };
|
|
61026
|
+
return rows;
|
|
61027
|
+
} finally {
|
|
61028
|
+
clearTimeout(timer);
|
|
61029
|
+
}
|
|
61030
|
+
})().finally(() => {
|
|
61031
|
+
inflight5 = void 0;
|
|
61032
|
+
});
|
|
61033
|
+
return inflight5;
|
|
60342
61034
|
}
|
|
60343
61035
|
|
|
60344
61036
|
// src/yields/intrinsic/fetchers/upshift.ts
|
|
60345
61037
|
var EARN_AUSD_VAULT = "0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA";
|
|
61038
|
+
var EARN_AUSD_CHAIN = 143;
|
|
60346
61039
|
var earnAUSD = "earnAUSD::earnAUSD";
|
|
60347
61040
|
var upshiftFetcher = {
|
|
60348
61041
|
label: "UPSHIFT",
|
|
60349
61042
|
fetch: async () => {
|
|
60350
|
-
const vaults = await
|
|
61043
|
+
const vaults = await fetchAugustTokenizedVaults();
|
|
60351
61044
|
const vault = vaults.find(
|
|
60352
|
-
(v) => String(v?.address).toLowerCase() === EARN_AUSD_VAULT.toLowerCase()
|
|
61045
|
+
(v) => Number(v?.chain) === EARN_AUSD_CHAIN && String(v?.address).toLowerCase() === EARN_AUSD_VAULT.toLowerCase()
|
|
60353
61046
|
);
|
|
60354
|
-
|
|
60355
|
-
|
|
61047
|
+
if (!vault) throw new Error("Upshift: earnAUSD missing from the catalogue");
|
|
61048
|
+
const { rate } = augustRealizedRate({
|
|
61049
|
+
historicalApy: vault.historical_apy,
|
|
61050
|
+
defaultApyHorizon: vault.default_apy_horizon
|
|
61051
|
+
});
|
|
61052
|
+
if (rate === void 0)
|
|
61053
|
+
throw new Error("Upshift: earnAUSD publishes no realized window");
|
|
61054
|
+
return { [earnAUSD]: rate };
|
|
60356
61055
|
}
|
|
60357
61056
|
};
|
|
60358
61057
|
|
|
@@ -61543,7 +62242,7 @@ async function fetchForChain(chainId, nowSeconds2) {
|
|
|
61543
62242
|
abi: GAUGE_ABI,
|
|
61544
62243
|
allowFailure: true
|
|
61545
62244
|
});
|
|
61546
|
-
const
|
|
62245
|
+
const big27 = (v) => {
|
|
61547
62246
|
try {
|
|
61548
62247
|
if (typeof v === "bigint") return v;
|
|
61549
62248
|
if (typeof v === "string" && v !== "0x") return BigInt(v);
|
|
@@ -61557,15 +62256,15 @@ async function fetchForChain(chainId, nowSeconds2) {
|
|
|
61557
62256
|
const b = i * STRIDE;
|
|
61558
62257
|
return {
|
|
61559
62258
|
market: m,
|
|
61560
|
-
inflationRate:
|
|
61561
|
-
workingSupply:
|
|
61562
|
-
totalSupply:
|
|
62259
|
+
inflationRate: big27(r1[b]),
|
|
62260
|
+
workingSupply: big27(r1[b + 1]),
|
|
62261
|
+
totalSupply: big27(r1[b + 2]),
|
|
61563
62262
|
isKilled: r1[b + 3] === true,
|
|
61564
|
-
rewardCount: Number(
|
|
61565
|
-
pricePerShare:
|
|
62263
|
+
rewardCount: Number(big27(r1[b + 4])),
|
|
62264
|
+
pricePerShare: big27(r1[b + 5]),
|
|
61566
62265
|
// Off L1 the child gauge's own rate is already market-scoped, so the
|
|
61567
62266
|
// weight is the identity.
|
|
61568
|
-
relativeWeight: isL1 ?
|
|
62267
|
+
relativeWeight: isL1 ? big27(r1[b + 6]) : WAD16
|
|
61569
62268
|
};
|
|
61570
62269
|
});
|
|
61571
62270
|
const tokenCalls = state.flatMap(
|
|
@@ -61658,7 +62357,7 @@ async function fetchForChain(chainId, nowSeconds2) {
|
|
|
61658
62357
|
const decoded = decodeRewardData(data);
|
|
61659
62358
|
if (!decoded) continue;
|
|
61660
62359
|
const { periodFinish, rate } = decoded;
|
|
61661
|
-
const decimals = typeof decRaw === "number" ? decRaw : Number(
|
|
62360
|
+
const decimals = typeof decRaw === "number" ? decRaw : Number(big27(decRaw) || 18n);
|
|
61662
62361
|
const rewardPrice = priceOf(prices, chainId, token);
|
|
61663
62362
|
const apr = extraRewardApr({
|
|
61664
62363
|
rate,
|
|
@@ -62580,9 +63279,9 @@ function getTermCalls(chainId) {
|
|
|
62580
63279
|
}
|
|
62581
63280
|
}
|
|
62582
63281
|
const results = [];
|
|
62583
|
-
for (const [token, { amount:
|
|
63282
|
+
for (const [token, { amount: amount5, repoKeys }] of byToken) {
|
|
62584
63283
|
const calls = [
|
|
62585
|
-
{ address: oracle, name: "usdValueOfTokens", params: [token,
|
|
63284
|
+
{ address: oracle, name: "usdValueOfTokens", params: [token, amount5] }
|
|
62586
63285
|
];
|
|
62587
63286
|
results.push({
|
|
62588
63287
|
calls,
|
|
@@ -63083,9 +63782,9 @@ function parseTellerResults(data, meta, context) {
|
|
|
63083
63782
|
const principal = meta.principal;
|
|
63084
63783
|
const collateral = meta.collateral;
|
|
63085
63784
|
const lenderKey = tellerLenderKey(meta.pool);
|
|
63086
|
-
const usdOf = (
|
|
63087
|
-
const key4 = tokenList?.[
|
|
63088
|
-
return usdPrices[key4] ?? usdPrices[
|
|
63785
|
+
const usdOf = (addr5) => {
|
|
63786
|
+
const key4 = tokenList?.[addr5]?.assetGroup ?? `${chainId}-${addr5}`;
|
|
63787
|
+
return usdPrices[key4] ?? usdPrices[addr5];
|
|
63089
63788
|
};
|
|
63090
63789
|
const principalUSD = usdOf(principal);
|
|
63091
63790
|
const collateralUSD = usdOf(collateral);
|
|
@@ -63189,9 +63888,9 @@ function parseFraxlendResults(data, meta, context) {
|
|
|
63189
63888
|
const asset = assetRaw.toLowerCase();
|
|
63190
63889
|
const collateral = collateralRaw.toLowerCase();
|
|
63191
63890
|
const lenderKey = fraxlendLenderKey("FRAXLEND", chainId, meta.pair);
|
|
63192
|
-
const usdOf = (
|
|
63193
|
-
const key4 = tokenList?.[
|
|
63194
|
-
return usdPrices[key4] ?? usdPrices[
|
|
63891
|
+
const usdOf = (addr5) => {
|
|
63892
|
+
const key4 = tokenList?.[addr5]?.assetGroup ?? `${chainId}-${addr5}`;
|
|
63893
|
+
return usdPrices[key4] ?? usdPrices[addr5];
|
|
63195
63894
|
};
|
|
63196
63895
|
const assetUSD = usdOf(asset);
|
|
63197
63896
|
if (!assetUSD) return entries;
|
|
@@ -63738,8 +64437,15 @@ var priceLensAbi = [
|
|
|
63738
64437
|
// src/prices/oracle-prices/fetchers/euler.ts
|
|
63739
64438
|
var MAX_VIRTUAL_ADDRESS = 65535;
|
|
63740
64439
|
var MAX_SANE_PRICE_USD = 1e7;
|
|
63741
|
-
|
|
63742
|
-
|
|
64440
|
+
var MIN_SANE_PRICE_USD = 1e-9;
|
|
64441
|
+
var EULER_EXCLUDED_VAULT_ORACLES = /* @__PURE__ */ new Set([
|
|
64442
|
+
// Sonic msUSD — FixedRateOracle 0x3E35E10E…: rate 1e6 (1e-12 USD)
|
|
64443
|
+
"146:0x657cdc99dc15448e680ee39a4bd76bb0d5fcdc6d",
|
|
64444
|
+
// Sonic msUSD — FixedRateOracle 0x6Bfd6ABb…: rate 1 (1e-18 USD)
|
|
64445
|
+
"146:0xfc4f0376c364aafd178e16dace3a4441b90a65fa"
|
|
64446
|
+
]);
|
|
64447
|
+
function isUsdUnitOfAccount(addr5) {
|
|
64448
|
+
const numeric = parseInt(addr5, 16);
|
|
63743
64449
|
return numeric <= MAX_VIRTUAL_ADDRESS;
|
|
63744
64450
|
}
|
|
63745
64451
|
var PRICE_LENS_ADDRESS = "0x6392892f3C57c658d2c748fc64c6fe57680E889F";
|
|
@@ -63813,6 +64519,8 @@ function parseEulerV2Results(data, meta, context) {
|
|
|
63813
64519
|
data.forEach((result, index) => {
|
|
63814
64520
|
const queryMeta = meta[index];
|
|
63815
64521
|
if (!queryMeta || !result) return;
|
|
64522
|
+
if (EULER_EXCLUDED_VAULT_ORACLES.has(`${context.chainId}:${queryMeta.vault}`))
|
|
64523
|
+
return;
|
|
63816
64524
|
try {
|
|
63817
64525
|
let amountOutMid;
|
|
63818
64526
|
let unitOfAccountDecimals;
|
|
@@ -63848,6 +64556,7 @@ function parseEulerV2Results(data, meta, context) {
|
|
|
63848
64556
|
}
|
|
63849
64557
|
if (isNaN(priceUSD) || priceUSD === 0) return;
|
|
63850
64558
|
if (priceUSD > MAX_SANE_PRICE_USD) return;
|
|
64559
|
+
if (priceUSD < MIN_SANE_PRICE_USD) return;
|
|
63851
64560
|
entries.push({
|
|
63852
64561
|
asset,
|
|
63853
64562
|
price: priceInUoA,
|
|
@@ -64297,7 +65006,7 @@ var siloV3Fetcher = {
|
|
|
64297
65006
|
getAbi: getSiloV3Abi
|
|
64298
65007
|
};
|
|
64299
65008
|
var FLUID_EEE_LOWER3 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
64300
|
-
var normalizeUnderlying4 = (
|
|
65009
|
+
var normalizeUnderlying4 = (addr5) => addr5 === FLUID_EEE_LOWER3 ? zeroAddress : addr5;
|
|
64301
65010
|
function priceColInDebt(raw, colDec, debtDec) {
|
|
64302
65011
|
return formatMorphoPrice(raw, debtDec, colDec + 9);
|
|
64303
65012
|
}
|
|
@@ -64621,6 +65330,7 @@ function parseSiloV2GraphQLResults(items, context) {
|
|
|
64621
65330
|
if (!quoteStr) continue;
|
|
64622
65331
|
const quoteNum = Number(quoteStr);
|
|
64623
65332
|
if (!Number.isFinite(quoteNum) || quoteNum === 0) continue;
|
|
65333
|
+
if (quoteNum < 1e-9) continue;
|
|
64624
65334
|
const quoteTokenLc = (side.solvencyOracle?.quoteTokenId ?? "").toLowerCase();
|
|
64625
65335
|
if (!quoteTokenLc) continue;
|
|
64626
65336
|
const qtUSD = lookupUSD3(context, quoteTokenLc);
|
|
@@ -64764,6 +65474,7 @@ function parseSiloV3GraphQLResults(items, context) {
|
|
|
64764
65474
|
if (!quoteStr) continue;
|
|
64765
65475
|
const quoteNum = Number(quoteStr);
|
|
64766
65476
|
if (!Number.isFinite(quoteNum) || quoteNum === 0) continue;
|
|
65477
|
+
if (quoteNum < 1e-9) continue;
|
|
64767
65478
|
const quoteTokenLc = (side.solvencyOracle?.quoteTokenId ?? "").toLowerCase();
|
|
64768
65479
|
if (!quoteTokenLc) continue;
|
|
64769
65480
|
const qtUSD = lookupUSD4(context, quoteTokenLc);
|
|
@@ -64787,117 +65498,232 @@ function parseSiloV3GraphQLResults(items, context) {
|
|
|
64787
65498
|
}
|
|
64788
65499
|
return out;
|
|
64789
65500
|
}
|
|
64790
|
-
|
|
64791
|
-
|
|
64792
|
-
var
|
|
64793
|
-
var
|
|
64794
|
-
var
|
|
64795
|
-
var
|
|
64796
|
-
|
|
64797
|
-
|
|
64798
|
-
|
|
65501
|
+
var SHARE_RATE_PRICE_KEY = "SHARE_RATE";
|
|
65502
|
+
var SHARE_RATE_MIN = 0.2;
|
|
65503
|
+
var SHARE_RATE_MAX = 50;
|
|
65504
|
+
var WETH_1 = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
65505
|
+
var USDC_1 = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
|
|
65506
|
+
var UNDERLYING_OF = {
|
|
65507
|
+
uniETH: { underlying: WETH_1, decimals: 18 },
|
|
65508
|
+
// exchangeRatio(): ETH per uniETH
|
|
65509
|
+
sUSDa: {
|
|
65510
|
+
underlying: "0x8a60e489004ca22d775c5f2c657598278d17d9c2",
|
|
65511
|
+
// USDa
|
|
65512
|
+
decimals: 18
|
|
65513
|
+
},
|
|
65514
|
+
sUSP: {
|
|
65515
|
+
underlying: "0x97ccc1c046d067ab945d3cf3cc6920d3b1e54c88",
|
|
65516
|
+
// Pareto USP
|
|
65517
|
+
decimals: 18
|
|
65518
|
+
},
|
|
65519
|
+
wsuperOETHb: {
|
|
65520
|
+
underlying: "0xdbfefd2e8460a6ee4955a68582f85708baea60a3",
|
|
65521
|
+
// superOETHb (Base)
|
|
65522
|
+
decimals: 18
|
|
65523
|
+
},
|
|
65524
|
+
"ARM-WETH-stETH": { underlying: WETH_1, decimals: 18 },
|
|
65525
|
+
asdCRV: {
|
|
65526
|
+
underlying: "0xd1b5651e55d4ceed36251c61c50c889b36f6abb5",
|
|
65527
|
+
// sdCRV
|
|
65528
|
+
decimals: 18
|
|
65529
|
+
},
|
|
65530
|
+
asdPENDLE: {
|
|
65531
|
+
underlying: "0x5ea630e00d6ee438d3dea1556a110359acdc10a9",
|
|
65532
|
+
// sdPENDLE
|
|
65533
|
+
decimals: 18
|
|
65534
|
+
},
|
|
65535
|
+
fusnstETH: {
|
|
65536
|
+
underlying: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
|
|
65537
|
+
// stETH
|
|
65538
|
+
decimals: 18
|
|
65539
|
+
},
|
|
65540
|
+
x33: {
|
|
65541
|
+
// xSHADOW — not in the Sonic token list and priced by nothing today, so
|
|
65542
|
+
// the entry resolves to no price until it is (see the report: X33 stays
|
|
65543
|
+
// open on SHADOW / xSHADOW pricing)
|
|
65544
|
+
underlying: "0x5050bc082ff4a74fb6b0b04385defddb114b2424",
|
|
65545
|
+
decimals: 18
|
|
65546
|
+
},
|
|
65547
|
+
DUSD: { underlying: USDC_1, decimals: 6 },
|
|
65548
|
+
// machine accountingToken()
|
|
65549
|
+
DETH: { underlying: WETH_1, decimals: 18 },
|
|
65550
|
+
DBIT: {
|
|
65551
|
+
underlying: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
|
65552
|
+
// WBTC
|
|
65553
|
+
decimals: 8
|
|
65554
|
+
},
|
|
65555
|
+
eEARN: { underlying: USDC_1, decimals: 6 },
|
|
65556
|
+
PlasmaUSD: {
|
|
65557
|
+
underlying: "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
|
|
65558
|
+
// USDT0 (Plasma)
|
|
65559
|
+
decimals: 6
|
|
65560
|
+
},
|
|
65561
|
+
gUSDC: {
|
|
65562
|
+
underlying: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
65563
|
+
// USDC (Arbitrum)
|
|
65564
|
+
decimals: 6
|
|
65565
|
+
},
|
|
65566
|
+
// first read only: convertToAssets → kHYPE (the second read, kHYPE → HYPE,
|
|
65567
|
+
// is for the APR); priced against kHYPE's own price
|
|
65568
|
+
hakHYPE: {
|
|
65569
|
+
underlying: "0xfd739d4e423301ce9385c1fb8850539d657c296d",
|
|
65570
|
+
// kHYPE
|
|
65571
|
+
decimals: 18
|
|
65572
|
+
},
|
|
65573
|
+
sYUSD: {
|
|
65574
|
+
underlying: "0x4274cd7277c7bb0806bd5fe84b9adae466a8da0a",
|
|
65575
|
+
// Aegis YUSD
|
|
65576
|
+
decimals: 18
|
|
65577
|
+
}
|
|
64799
65578
|
};
|
|
64800
|
-
|
|
64801
|
-
|
|
64802
|
-
|
|
64803
|
-
const
|
|
64804
|
-
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
|
|
64808
|
-
|
|
64809
|
-
|
|
64810
|
-
|
|
64811
|
-
|
|
64812
|
-
|
|
64813
|
-
|
|
64814
|
-
|
|
65579
|
+
var NOT_PRICED = {};
|
|
65580
|
+
var decimalsOfUnit = (unit) => unit.toString().length - 1;
|
|
65581
|
+
function priceSpecFromRateSpec(spec) {
|
|
65582
|
+
const u = UNDERLYING_OF[spec.tag];
|
|
65583
|
+
if (!u) throw new Error(`share-rate price: no underlying for ${spec.tag}`);
|
|
65584
|
+
const r = spec.reads[0];
|
|
65585
|
+
return {
|
|
65586
|
+
tag: spec.tag,
|
|
65587
|
+
chainId: spec.chainId,
|
|
65588
|
+
share: spec.share.toLowerCase(),
|
|
65589
|
+
shareDecimals: decimalsOfUnit(spec.unit),
|
|
65590
|
+
underlying: u.underlying,
|
|
65591
|
+
underlyingDecimals: u.decimals,
|
|
65592
|
+
read: {
|
|
65593
|
+
kind: "assets",
|
|
65594
|
+
address: r.address.toLowerCase(),
|
|
65595
|
+
fn: r.fn,
|
|
65596
|
+
arg: r.arg ?? true ? spec.unit : null
|
|
64815
65597
|
}
|
|
64816
|
-
}
|
|
64817
|
-
cached = { at: now, prices };
|
|
64818
|
-
return prices;
|
|
65598
|
+
};
|
|
64819
65599
|
}
|
|
64820
|
-
|
|
64821
|
-
|
|
64822
|
-
|
|
64823
|
-
|
|
64824
|
-
|
|
64825
|
-
|
|
64826
|
-
|
|
64827
|
-
|
|
64828
|
-
|
|
64829
|
-
|
|
64830
|
-
|
|
64831
|
-
|
|
64832
|
-
|
|
64833
|
-
|
|
64834
|
-
|
|
65600
|
+
var MELLOW_SHARE_RATE_PRICE_SPECS = [
|
|
65601
|
+
{
|
|
65602
|
+
tag: "earnETH",
|
|
65603
|
+
chainId: "1",
|
|
65604
|
+
share: "0xbbfc8683c8fe8cf73777fede7ab9574935fea0a4",
|
|
65605
|
+
shareDecimals: 18,
|
|
65606
|
+
underlying: WETH_1,
|
|
65607
|
+
underlyingDecimals: 18,
|
|
65608
|
+
read: {
|
|
65609
|
+
kind: "mellow-report",
|
|
65610
|
+
oracle: "0xada1f4c24603ab2fe5abd35bcd12370e98a20358",
|
|
65611
|
+
asset: WETH_1
|
|
65612
|
+
}
|
|
65613
|
+
},
|
|
65614
|
+
{
|
|
65615
|
+
tag: "earnUSD",
|
|
65616
|
+
chainId: "1",
|
|
65617
|
+
share: "0x4ce1ac8f43e0e5bd7a346a98af777bf8fbea1981",
|
|
65618
|
+
shareDecimals: 18,
|
|
65619
|
+
underlying: USDC_1,
|
|
65620
|
+
underlyingDecimals: 6,
|
|
65621
|
+
read: {
|
|
65622
|
+
kind: "mellow-report",
|
|
65623
|
+
oracle: "0x827044735c9708a2cf850e7ea37eba43bc786028",
|
|
65624
|
+
asset: USDC_1
|
|
65625
|
+
}
|
|
64835
65626
|
}
|
|
64836
|
-
|
|
65627
|
+
];
|
|
65628
|
+
var SHARE_RATE_PRICE_SPECS = [
|
|
65629
|
+
...[...VAULT_SHARE_RATE_SPECS, ...EXPIRED_W_SAVINGS_SPECS].filter((s) => !(s.tag in NOT_PRICED)).map(priceSpecFromRateSpec),
|
|
65630
|
+
...MELLOW_SHARE_RATE_PRICE_SPECS
|
|
65631
|
+
];
|
|
65632
|
+
var ABI3 = parseAbi([
|
|
65633
|
+
"function getReport(address asset) view returns (uint224 priceD18, uint32 timestamp, bool isSuspicious)"
|
|
65634
|
+
]);
|
|
65635
|
+
var abiItemFor = (read) => read.kind === "mellow-report" ? ABI3 : parseAbi([
|
|
65636
|
+
read.arg === null ? `function ${read.fn}() view returns (uint256)` : `function ${read.fn}(uint256) view returns (uint256)`
|
|
65637
|
+
]);
|
|
65638
|
+
function shareRateCalls(chainId, specs = SHARE_RATE_PRICE_SPECS) {
|
|
65639
|
+
const mine = specs.filter((s) => s.chainId === chainId);
|
|
65640
|
+
const abi = [];
|
|
65641
|
+
const seen = /* @__PURE__ */ new Set();
|
|
65642
|
+
const calls = mine.map((s) => {
|
|
65643
|
+
for (const item of abiItemFor(s.read)) {
|
|
65644
|
+
const sig = `${item.name}(${item.inputs.length})`;
|
|
65645
|
+
if (!seen.has(sig)) {
|
|
65646
|
+
seen.add(sig);
|
|
65647
|
+
abi.push(item);
|
|
65648
|
+
}
|
|
65649
|
+
}
|
|
65650
|
+
return s.read.kind === "mellow-report" ? { address: s.read.oracle, name: "getReport", params: [s.read.asset] } : {
|
|
65651
|
+
address: s.read.address,
|
|
65652
|
+
name: s.read.fn,
|
|
65653
|
+
params: s.read.arg === null ? [] : [s.read.arg]
|
|
65654
|
+
};
|
|
65655
|
+
});
|
|
65656
|
+
return { specs: mine, calls, abi };
|
|
64837
65657
|
}
|
|
64838
|
-
var
|
|
64839
|
-
|
|
64840
|
-
|
|
64841
|
-
|
|
64842
|
-
function fetchPendleUnderlyingPricesRaw() {
|
|
64843
|
-
const now = Date.now();
|
|
64844
|
-
if (now - underlyingCached.at < CACHE_MS) return underlyingCached.prices;
|
|
64845
|
-
const prices = (async () => {
|
|
65658
|
+
var toBig6 = (v) => {
|
|
65659
|
+
if (typeof v === "bigint") return v;
|
|
65660
|
+
if (typeof v === "number" && Number.isFinite(v)) return BigInt(Math.trunc(v));
|
|
65661
|
+
if (typeof v === "string" && v !== "0x" && v !== "")
|
|
64846
65662
|
try {
|
|
64847
|
-
|
|
64848
|
-
|
|
64849
|
-
|
|
64850
|
-
signal: AbortSignal.timeout(TIMEOUT_MS6)
|
|
64851
|
-
})
|
|
64852
|
-
]);
|
|
64853
|
-
if (!mRes.ok) throw new Error(`markets HTTP ${mRes.status}`);
|
|
64854
|
-
if (!pRes.ok) throw new Error(`prices HTTP ${pRes.status}`);
|
|
64855
|
-
const markets = (await mRes.json()).markets ?? [];
|
|
64856
|
-
const all = (await pRes.json()).prices ?? {};
|
|
64857
|
-
const out = {};
|
|
64858
|
-
for (const m of markets) {
|
|
64859
|
-
if (!(Date.parse(m?.expiry) > now)) continue;
|
|
64860
|
-
const keys = [
|
|
64861
|
-
m?.underlyingAsset,
|
|
64862
|
-
m?.accountingAsset,
|
|
64863
|
-
...Array.isArray(m?.inputTokens) ? m.inputTokens : [],
|
|
64864
|
-
...Array.isArray(m?.outputTokens) ? m.outputTokens : []
|
|
64865
|
-
];
|
|
64866
|
-
for (const k of keys) {
|
|
64867
|
-
const key4 = String(k ?? "").toLowerCase();
|
|
64868
|
-
const usd = all[key4];
|
|
64869
|
-
if (typeof usd === "number" && Number.isFinite(usd) && usd > 0)
|
|
64870
|
-
out[key4] = usd;
|
|
64871
|
-
}
|
|
64872
|
-
}
|
|
64873
|
-
return out;
|
|
64874
|
-
} catch (e) {
|
|
64875
|
-
console.warn(
|
|
64876
|
-
`[prices] pendle underlying prices unavailable: ${String(e)}`
|
|
64877
|
-
);
|
|
64878
|
-
underlyingCached = { at: 0, prices: Promise.resolve(null) };
|
|
64879
|
-
return null;
|
|
65663
|
+
return BigInt(v);
|
|
65664
|
+
} catch {
|
|
65665
|
+
return void 0;
|
|
64880
65666
|
}
|
|
64881
|
-
|
|
64882
|
-
|
|
64883
|
-
|
|
65667
|
+
return void 0;
|
|
65668
|
+
};
|
|
65669
|
+
function decodeShareRate(spec, raw) {
|
|
65670
|
+
let rate;
|
|
65671
|
+
if (spec.read.kind === "mellow-report") {
|
|
65672
|
+
const tuple = raw;
|
|
65673
|
+
const price2 = toBig6(Array.isArray(tuple) ? tuple[0] : tuple?.priceD18);
|
|
65674
|
+
const suspicious = Array.isArray(tuple) ? tuple[2] : tuple?.isSuspicious;
|
|
65675
|
+
if (!price2 || price2 <= 0n || suspicious === true) return void 0;
|
|
65676
|
+
rate = 1e18 / Number(price2) * 10 ** (spec.shareDecimals - spec.underlyingDecimals);
|
|
65677
|
+
} else {
|
|
65678
|
+
const v = toBig6(raw);
|
|
65679
|
+
if (v === void 0 || v <= 0n) return void 0;
|
|
65680
|
+
rate = Number(v) / 10 ** spec.underlyingDecimals;
|
|
65681
|
+
}
|
|
65682
|
+
return Number.isFinite(rate) && rate >= SHARE_RATE_MIN && rate <= SHARE_RATE_MAX ? rate : void 0;
|
|
64884
65683
|
}
|
|
64885
|
-
function
|
|
65684
|
+
async function fetchShareRatesRaw(chainId, rpcOverrides, retries = 3, specs = SHARE_RATE_PRICE_SPECS) {
|
|
65685
|
+
const { specs: mine, calls, abi } = shareRateCalls(chainId, specs);
|
|
65686
|
+
if (!calls.length) return [];
|
|
65687
|
+
try {
|
|
65688
|
+
const results = await multicallRetryUniversal({
|
|
65689
|
+
chain: chainId,
|
|
65690
|
+
calls,
|
|
65691
|
+
abi,
|
|
65692
|
+
maxRetries: retries,
|
|
65693
|
+
allowFailure: true,
|
|
65694
|
+
overrides: rpcOverrides
|
|
65695
|
+
});
|
|
65696
|
+
const out = [];
|
|
65697
|
+
mine.forEach((spec, i) => {
|
|
65698
|
+
const rate = decodeShareRate(spec, results[i]);
|
|
65699
|
+
if (rate !== void 0) out.push({ spec, rate });
|
|
65700
|
+
else console.warn(`[prices] share rate ${spec.tag}@${chainId}: no rate`);
|
|
65701
|
+
});
|
|
65702
|
+
return out;
|
|
65703
|
+
} catch (e) {
|
|
65704
|
+
console.warn(`[prices] share rates on ${chainId} unavailable: ${String(e)}`);
|
|
65705
|
+
return [];
|
|
65706
|
+
}
|
|
65707
|
+
}
|
|
65708
|
+
function shareRateEntries(chainId, tokenList, rates) {
|
|
64886
65709
|
const out = [];
|
|
64887
|
-
const
|
|
64888
|
-
|
|
64889
|
-
|
|
64890
|
-
|
|
64891
|
-
|
|
64892
|
-
|
|
64893
|
-
|
|
64894
|
-
|
|
64895
|
-
|
|
64896
|
-
marketUid: `${PENDLE_UNDERLYING_PRICE_KEY}:${chainId}:${asset}`,
|
|
64897
|
-
description: "Pendle quote of a market underlying (USD, fallback)",
|
|
65710
|
+
for (const { spec, rate } of rates) {
|
|
65711
|
+
if (!tokenList[spec.share]) continue;
|
|
65712
|
+
const entry = {
|
|
65713
|
+
asset: spec.share,
|
|
65714
|
+
price: rate,
|
|
65715
|
+
priceUSD: 0,
|
|
65716
|
+
marketUid: `${SHARE_RATE_PRICE_KEY}:${chainId}:${spec.share}`,
|
|
65717
|
+
description: `Issuer share rate (${spec.tag}): ${rate.toPrecision(10)} underlying per share`,
|
|
65718
|
+
baseAsset: spec.underlying,
|
|
64898
65719
|
derivation: "quoted",
|
|
64899
|
-
|
|
64900
|
-
|
|
65720
|
+
shareRate: {
|
|
65721
|
+
rate,
|
|
65722
|
+
underlying: spec.underlying,
|
|
65723
|
+
source: spec.read.kind === "mellow-report" ? "mellow:getReport" : `${spec.read.fn}`
|
|
65724
|
+
}
|
|
65725
|
+
};
|
|
65726
|
+
out.push(entry);
|
|
64901
65727
|
}
|
|
64902
65728
|
return out;
|
|
64903
65729
|
}
|
|
@@ -65649,6 +66475,9 @@ async function fetchOraclePrices(chainIds, rpcOverrides, lists = {}, retries = 3
|
|
|
65649
66475
|
const siloV3GqlPromise = isActive("silov3") ? fetchSiloV3GraphQLPrices(chainId, basePrices, tokenList) : Promise.resolve(null);
|
|
65650
66476
|
const pendlePtPromise = isActive("pendle") ? fetchPendlePtPricesRaw() : Promise.resolve(null);
|
|
65651
66477
|
const pendleUnderlyingPromise = isActive("pendle") ? fetchPendleUnderlyingPricesRaw() : Promise.resolve(null);
|
|
66478
|
+
const shareRatePromise = isActive("sharerate") ? fetchShareRatesRaw(chainId, rpcOverrides, retries) : Promise.resolve([]);
|
|
66479
|
+
const distressedPromise = isActive("distressed") ? fetchDistressedPricesRaw(chainId, rpcOverrides) : Promise.resolve(null);
|
|
66480
|
+
const distressedPtPromise = isActive("distressed") && isActive("pendle") ? fetchDistressedPendlePtsRaw(chainId, tokenList, rpcOverrides) : Promise.resolve(null);
|
|
65652
66481
|
const feedTimestampsPromise = stalenessThresholdSeconds > 0 && probeFeedStaleness ? probeAaveFeedTimestamps(chainId, {
|
|
65653
66482
|
rpcOverrides,
|
|
65654
66483
|
batchSize: chainBatchSize,
|
|
@@ -66081,6 +66910,17 @@ async function fetchOraclePrices(chainIds, rpcOverrides, lists = {}, retries = 3
|
|
|
66081
66910
|
parsedEntries: entries.length
|
|
66082
66911
|
});
|
|
66083
66912
|
}
|
|
66913
|
+
{
|
|
66914
|
+
const rates = await shareRatePromise;
|
|
66915
|
+
const entries = shareRateEntries(chainId, tokenList, rates);
|
|
66916
|
+
if (entries.length) chainResult[SHARE_RATE_PRICE_KEY] = entries;
|
|
66917
|
+
trackerDiags.push({
|
|
66918
|
+
lender: `${SHARE_RATE_PRICE_KEY} (issuer rates)`,
|
|
66919
|
+
callCount: 0,
|
|
66920
|
+
failedCalls: 0,
|
|
66921
|
+
parsedEntries: entries.length
|
|
66922
|
+
});
|
|
66923
|
+
}
|
|
66084
66924
|
if (useMorphoHybrid) {
|
|
66085
66925
|
for (const entry of morphoGqlEntries) {
|
|
66086
66926
|
if (!(entry.priceUSD > 0)) continue;
|
|
@@ -66152,6 +66992,26 @@ async function fetchOraclePrices(chainIds, rpcOverrides, lists = {}, retries = 3
|
|
|
66152
66992
|
parseTrackers(tellerGroup, tellerData.results, false);
|
|
66153
66993
|
parseTrackers(fraxlendGroup, fraxlendData.results, false);
|
|
66154
66994
|
parseTrackers(llamaLendGroup, llamaLendData.results, false);
|
|
66995
|
+
const distressedRaw = await distressedPromise;
|
|
66996
|
+
if (distressedRaw != null) {
|
|
66997
|
+
const base = distressedEntries(
|
|
66998
|
+
chainId,
|
|
66999
|
+
tokenList,
|
|
67000
|
+
distressedRaw,
|
|
67001
|
+
usdPrices
|
|
67002
|
+
);
|
|
67003
|
+
const entries = [
|
|
67004
|
+
...base,
|
|
67005
|
+
...distressedPendlePtEntries(chainId, await distressedPtPromise, base)
|
|
67006
|
+
];
|
|
67007
|
+
if (entries.length) chainResult[DISTRESSED_PRICE_KEY] = entries;
|
|
67008
|
+
trackerDiags.push({
|
|
67009
|
+
lender: DISTRESSED_PRICE_KEY,
|
|
67010
|
+
callCount: 0,
|
|
67011
|
+
failedCalls: 0,
|
|
67012
|
+
parsedEntries: entries.length
|
|
67013
|
+
});
|
|
67014
|
+
}
|
|
66155
67015
|
if (stalenessThresholdSeconds > 0) {
|
|
66156
67016
|
const feedTimestamps = await feedTimestampsPromise;
|
|
66157
67017
|
for (const [lender, assetMap] of Object.entries(feedTimestamps)) {
|
|
@@ -66520,6 +67380,7 @@ var DEFAULT_PRIORITY = {
|
|
|
66520
67380
|
staleRejectSeconds: DEFAULT_STALE_REJECT_SECONDS,
|
|
66521
67381
|
outlierGuard: DEFAULT_OUTLIER_GUARD
|
|
66522
67382
|
};
|
|
67383
|
+
var SOURCE_RANK = { shareRate: 0, oracle: 1, fallback: 2 };
|
|
66523
67384
|
var LENDER_RANK_UNLISTED = 1e3;
|
|
66524
67385
|
var LENDER_RANK_LOW = 2e3;
|
|
66525
67386
|
var CHAIN_RANK_UNLISTED = 1e3;
|
|
@@ -66545,7 +67406,7 @@ function depthOf(entryMarketUid, lender, depth) {
|
|
|
66545
67406
|
return typeof perLender === "number" ? perLender : 0;
|
|
66546
67407
|
}
|
|
66547
67408
|
function compareCandidates(a, b) {
|
|
66548
|
-
return a.
|
|
67409
|
+
return a.sourceRank - b.sourceRank || a.freshnessRank - b.freshnessRank || a.reliabilityRank - b.reliabilityRank || a.derivationRank - b.derivationRank || a.lenderRank - b.lenderRank || b.depth - a.depth || a.chainRank - b.chainRank || cmpStr(a.lender, b.lender) || cmpStr(a.chainId, b.chainId) || // One lender can emit many entries for the same asset (Euler prices a
|
|
66549
67410
|
// token in every vault that lists it), so lender+chain is NOT a unique
|
|
66550
67411
|
// identity. Without these last two the winner among them fell out of
|
|
66551
67412
|
// enumeration order and the flat price moved between runs.
|
|
@@ -66554,6 +67415,7 @@ function compareCandidates(a, b) {
|
|
|
66554
67415
|
function cmpStr(a, b) {
|
|
66555
67416
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
66556
67417
|
}
|
|
67418
|
+
var SHARE_RATE_ROUNDS = 3;
|
|
66557
67419
|
function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, priorityCfg = DEFAULT_PRIORITY, options = {}) {
|
|
66558
67420
|
const staleRejectSeconds = priorityCfg.staleRejectSeconds ?? DEFAULT_STALE_REJECT_SECONDS;
|
|
66559
67421
|
const guard = priorityCfg.outlierGuard === void 0 ? DEFAULT_OUTLIER_GUARD : priorityCfg.outlierGuard;
|
|
@@ -66561,6 +67423,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66561
67423
|
const feedStats = options.feedStats;
|
|
66562
67424
|
const nowSeconds2 = options.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
66563
67425
|
const byKey = /* @__PURE__ */ new Map();
|
|
67426
|
+
const pendingShareRates = [];
|
|
66564
67427
|
for (const [chainId, lenders] of Object.entries(structuredPrices)) {
|
|
66565
67428
|
const tokenList = lists[chainId] ?? {};
|
|
66566
67429
|
for (const [lender, entries] of Object.entries(lenders)) {
|
|
@@ -66571,7 +67434,9 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66571
67434
|
const chainIdx = priorityCfg.chainPriority.indexOf(chainId);
|
|
66572
67435
|
const chainRank = chainIdx >= 0 ? chainIdx : CHAIN_RANK_UNLISTED;
|
|
66573
67436
|
for (const entry of entries) {
|
|
66574
|
-
if (!entry?.asset
|
|
67437
|
+
if (!entry?.asset) continue;
|
|
67438
|
+
const shareRate = entry.shareRate && Number.isFinite(entry.shareRate.rate) && entry.shareRate.rate > 0 ? entry.shareRate : void 0;
|
|
67439
|
+
if (!shareRate && !(entry.priceUSD > 0)) continue;
|
|
66575
67440
|
const feedKey = feedKeyOf(entry, lender);
|
|
66576
67441
|
const stat = feedStats?.[feedStatKey(chainId, feedKey)];
|
|
66577
67442
|
const freshness = staleRejectSeconds > 0 ? classifyFreshness(
|
|
@@ -66584,7 +67449,11 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66584
67449
|
if (group != null && isPlaceholderGroup(group)) continue;
|
|
66585
67450
|
const oracleKey = group ?? `${chainId}-${entry.asset.toLowerCase()}`;
|
|
66586
67451
|
const candidate = {
|
|
66587
|
-
|
|
67452
|
+
authoritative: entry.authoritative === true,
|
|
67453
|
+
// `fallbackOnly` wins over `shareRate`: a share rate can be a
|
|
67454
|
+
// last resort too (a registry-wide sweep of vault rates), and is
|
|
67455
|
+
// then resolved the same way but ranked as a fallback
|
|
67456
|
+
sourceRank: entry.fallbackOnly ? SOURCE_RANK.fallback : shareRate ? SOURCE_RANK.shareRate : SOURCE_RANK.oracle,
|
|
66588
67457
|
oracleKey,
|
|
66589
67458
|
priceUSD: entry.priceUSD,
|
|
66590
67459
|
chainId,
|
|
@@ -66599,6 +67468,17 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66599
67468
|
depth: depthOf(entry.marketUid, lender, depth),
|
|
66600
67469
|
chainRank
|
|
66601
67470
|
};
|
|
67471
|
+
if (shareRate) {
|
|
67472
|
+
const u = shareRate.underlying;
|
|
67473
|
+
const uGroup = tokenList[u]?.assetGroup ?? tokenList[u.toLowerCase()]?.assetGroup;
|
|
67474
|
+
pendingShareRates.push({
|
|
67475
|
+
candidate,
|
|
67476
|
+
rate: shareRate.rate,
|
|
67477
|
+
underlyingKey: uGroup != null && !isPlaceholderGroup(uGroup) ? uGroup : `${chainId}-${u.toLowerCase()}`,
|
|
67478
|
+
estimateUSD: entry.priceUSD > 0 ? entry.priceUSD : 0
|
|
67479
|
+
});
|
|
67480
|
+
continue;
|
|
67481
|
+
}
|
|
66602
67482
|
const bucket = byKey.get(oracleKey);
|
|
66603
67483
|
if (bucket) bucket.push(candidate);
|
|
66604
67484
|
else byKey.set(oracleKey, [candidate]);
|
|
@@ -66606,17 +67486,44 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66606
67486
|
}
|
|
66607
67487
|
}
|
|
66608
67488
|
const flatPrices = {};
|
|
67489
|
+
const chosen = /* @__PURE__ */ new Map();
|
|
66609
67490
|
for (const [oracleKey, all] of byKey) {
|
|
66610
|
-
const
|
|
66611
|
-
|
|
66612
|
-
|
|
66613
|
-
|
|
66614
|
-
|
|
66615
|
-
|
|
66616
|
-
|
|
66617
|
-
|
|
66618
|
-
|
|
66619
|
-
|
|
67491
|
+
const pick3 = pickBest(all, guard);
|
|
67492
|
+
if (!pick3) continue;
|
|
67493
|
+
chosen.set(oracleKey, pick3);
|
|
67494
|
+
flatPrices[oracleKey] = pick3.best.priceUSD;
|
|
67495
|
+
}
|
|
67496
|
+
let pending = pendingShareRates;
|
|
67497
|
+
for (let round = 0; round < SHARE_RATE_ROUNDS && pending.length; round++) {
|
|
67498
|
+
const last = round === SHARE_RATE_ROUNDS - 1;
|
|
67499
|
+
const waiting = [];
|
|
67500
|
+
const touched = /* @__PURE__ */ new Set();
|
|
67501
|
+
for (const p of pending) {
|
|
67502
|
+
const key4 = p.candidate.oracleKey;
|
|
67503
|
+
if (p.underlyingKey === key4) continue;
|
|
67504
|
+
if (!last && pending.some((q) => q.candidate.oracleKey === p.underlyingKey)) {
|
|
67505
|
+
waiting.push(p);
|
|
67506
|
+
continue;
|
|
67507
|
+
}
|
|
67508
|
+
const u = flatPrices[p.underlyingKey] ?? options.referencePrices?.[p.underlyingKey];
|
|
67509
|
+
const priceUSD = u !== void 0 && u > 0 ? p.rate * u : p.estimateUSD;
|
|
67510
|
+
if (!(priceUSD > 0) || !Number.isFinite(priceUSD)) continue;
|
|
67511
|
+
const bucket = byKey.get(key4);
|
|
67512
|
+
const c = { ...p.candidate, priceUSD };
|
|
67513
|
+
if (bucket) bucket.push(c);
|
|
67514
|
+
else byKey.set(key4, [c]);
|
|
67515
|
+
touched.add(key4);
|
|
67516
|
+
}
|
|
67517
|
+
for (const key4 of touched) {
|
|
67518
|
+
const pick3 = pickBest(byKey.get(key4), guard);
|
|
67519
|
+
if (!pick3) continue;
|
|
67520
|
+
chosen.set(key4, pick3);
|
|
67521
|
+
flatPrices[key4] = pick3.best.priceUSD;
|
|
67522
|
+
}
|
|
67523
|
+
pending = waiting;
|
|
67524
|
+
}
|
|
67525
|
+
if (options.onSelection) {
|
|
67526
|
+
for (const [oracleKey, { best, candidates, rejected }] of chosen) {
|
|
66620
67527
|
options.onSelection({
|
|
66621
67528
|
assetGroup: oracleKey,
|
|
66622
67529
|
priceUSD: best.priceUSD,
|
|
@@ -66624,13 +67531,29 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
66624
67531
|
lender: best.lender,
|
|
66625
67532
|
feedKey: best.feedKey,
|
|
66626
67533
|
derivation: derivationOfRank(best.derivationRank),
|
|
66627
|
-
candidates
|
|
66628
|
-
rejected
|
|
67534
|
+
candidates,
|
|
67535
|
+
rejected
|
|
66629
67536
|
});
|
|
66630
67537
|
}
|
|
66631
67538
|
}
|
|
66632
67539
|
return flatPrices;
|
|
66633
67540
|
}
|
|
67541
|
+
function pickBest(all, guard) {
|
|
67542
|
+
const authoritative = all.filter((c) => c.authoritative);
|
|
67543
|
+
const real = all.filter((c) => c.sourceRank < SOURCE_RANK.fallback);
|
|
67544
|
+
const candidates = authoritative.length ? authoritative : real.length ? real : all;
|
|
67545
|
+
const viable = guard ? rejectOutliers(candidates, guard) : candidates;
|
|
67546
|
+
let best = viable[0];
|
|
67547
|
+
for (const c of viable) {
|
|
67548
|
+
if (compareCandidates(c, best) < 0) best = c;
|
|
67549
|
+
}
|
|
67550
|
+
if (!best) return void 0;
|
|
67551
|
+
return {
|
|
67552
|
+
best,
|
|
67553
|
+
candidates: candidates.length,
|
|
67554
|
+
rejected: candidates.length - viable.length
|
|
67555
|
+
};
|
|
67556
|
+
}
|
|
66634
67557
|
var RANK_TO_DERIVATION = ["direct", "quoted", "derived"];
|
|
66635
67558
|
function derivationOfRank(rank) {
|
|
66636
67559
|
return RANK_TO_DERIVATION[rank] ?? "derived";
|
|
@@ -67069,7 +67992,7 @@ var composeVaultDisplayName = (brand, curatorName, asset, fallbackName) => {
|
|
|
67069
67992
|
|
|
67070
67993
|
// src/vaults/fluid/publicCallParse.ts
|
|
67071
67994
|
var FLUID_EEE_LOWER4 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
67072
|
-
var normalizeUnderlying5 = (
|
|
67995
|
+
var normalizeUnderlying5 = (addr5) => addr5 === FLUID_EEE_LOWER4 ? zeroAddress : addr5;
|
|
67073
67996
|
var FLUID_RATE_SCALE2 = 100;
|
|
67074
67997
|
var scaleFluidRate2 = (raw) => {
|
|
67075
67998
|
if (raw === void 0 || raw === null) return 0;
|
|
@@ -67310,8 +68233,8 @@ function deriveConvertToAssets(totalAssetsRaw, totalSupplyRaw, shareDecimals) {
|
|
|
67310
68233
|
|
|
67311
68234
|
// src/vaults/gearbox/publicCallParse.ts
|
|
67312
68235
|
var WETH_MAINNET = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
67313
|
-
var normalizeUnderlying6 = (
|
|
67314
|
-
const lower4 =
|
|
68236
|
+
var normalizeUnderlying6 = (addr5, chainId) => {
|
|
68237
|
+
const lower4 = addr5.toLowerCase();
|
|
67315
68238
|
if (chainId === "1" && lower4 === WETH_MAINNET) return zeroAddress;
|
|
67316
68239
|
return lower4;
|
|
67317
68240
|
};
|
|
@@ -67940,9 +68863,9 @@ var VAULT_V2_ADAPTER_ABI = parseAbi([
|
|
|
67940
68863
|
]);
|
|
67941
68864
|
var PHASE1_ABI = [...MetaMorphoAbi, ...VAULT_V2_PHASE1_ABI];
|
|
67942
68865
|
var FEE_SCALE = 1e18;
|
|
67943
|
-
var isHex40 = (
|
|
68866
|
+
var isHex40 = (addr5) => typeof addr5 === "string" && /^0x[0-9a-f]{40}$/i.test(addr5);
|
|
67944
68867
|
var isHex64 = (v) => typeof v === "string" && /^0x[0-9a-f]{64}$/i.test(v);
|
|
67945
|
-
var lcOrUndefined = (
|
|
68868
|
+
var lcOrUndefined = (addr5) => isHex40(addr5) ? addr5.toLowerCase() : void 0;
|
|
67946
68869
|
var toNumberSafe = (raw, fallback = 0) => {
|
|
67947
68870
|
if (raw === void 0 || raw === null) return fallback;
|
|
67948
68871
|
const n = Number(raw);
|
|
@@ -68430,10 +69353,10 @@ var PHASE1_CALLS2 = [
|
|
|
68430
69353
|
var PHASE1_PER_VAULT2 = PHASE1_CALLS2.length;
|
|
68431
69354
|
var WITHDRAW_QUEUE_LENGTH_INDEX2 = 8;
|
|
68432
69355
|
var FEE_SCALE2 = 1e18;
|
|
68433
|
-
var isHex402 = (
|
|
68434
|
-
var lcOrUndefined2 = (
|
|
68435
|
-
if (!isHex402(
|
|
68436
|
-
const lower4 =
|
|
69356
|
+
var isHex402 = (addr5) => typeof addr5 === "string" && /^0x[0-9a-f]{40}$/i.test(addr5);
|
|
69357
|
+
var lcOrUndefined2 = (addr5) => {
|
|
69358
|
+
if (!isHex402(addr5)) return void 0;
|
|
69359
|
+
const lower4 = addr5.toLowerCase();
|
|
68437
69360
|
return lower4 === zeroAddress ? void 0 : lower4;
|
|
68438
69361
|
};
|
|
68439
69362
|
var isHex642 = (val) => typeof val === "string" && /^0x[0-9a-f]{64}$/i.test(val);
|
|
@@ -69100,7 +70023,7 @@ var fetchSiloVaults = async (chainId, prices = {}, tokenList = {}, options) => {
|
|
|
69100
70023
|
var LABELS_BASE = "https://raw.githubusercontent.com/euler-xyz/euler-labels/master";
|
|
69101
70024
|
var TTL_MS4 = 30 * 60 * 1e3;
|
|
69102
70025
|
var cache4 = /* @__PURE__ */ new Map();
|
|
69103
|
-
var
|
|
70026
|
+
var inflight6 = /* @__PURE__ */ new Map();
|
|
69104
70027
|
async function fetchChainEntities(chainId) {
|
|
69105
70028
|
const res = await fetch(`${LABELS_BASE}/${chainId}/entities.json`);
|
|
69106
70029
|
if (!res.ok) throw new Error(`euler-labels ${chainId}: HTTP ${res.status}`);
|
|
@@ -69109,23 +70032,23 @@ async function fetchChainEntities(chainId) {
|
|
|
69109
70032
|
for (const entity of Object.values(json ?? {})) {
|
|
69110
70033
|
const name = String(entity?.name ?? "").trim();
|
|
69111
70034
|
if (!name) continue;
|
|
69112
|
-
for (const
|
|
69113
|
-
const lower4 =
|
|
70035
|
+
for (const addr5 of Object.keys(entity?.addresses ?? {})) {
|
|
70036
|
+
const lower4 = addr5.toLowerCase();
|
|
69114
70037
|
if (!/^0x[0-9a-f]{40}$/.test(lower4)) continue;
|
|
69115
70038
|
if (!byAddress.has(lower4)) byAddress.set(lower4, /* @__PURE__ */ new Set());
|
|
69116
70039
|
byAddress.get(lower4).add(name);
|
|
69117
70040
|
}
|
|
69118
70041
|
}
|
|
69119
70042
|
const map = /* @__PURE__ */ new Map();
|
|
69120
|
-
for (const [
|
|
69121
|
-
if (names.size === 1) map.set(
|
|
70043
|
+
for (const [addr5, names] of byAddress) {
|
|
70044
|
+
if (names.size === 1) map.set(addr5, [...names][0]);
|
|
69122
70045
|
}
|
|
69123
70046
|
return map;
|
|
69124
70047
|
}
|
|
69125
70048
|
async function fetchEulerEntityNames(chainId) {
|
|
69126
70049
|
const hit = cache4.get(chainId);
|
|
69127
70050
|
if (hit && Date.now() - hit.at <= TTL_MS4) return hit.map;
|
|
69128
|
-
const running =
|
|
70051
|
+
const running = inflight6.get(chainId);
|
|
69129
70052
|
if (running) return running;
|
|
69130
70053
|
const p = fetchChainEntities(chainId).then((map) => {
|
|
69131
70054
|
cache4.set(chainId, { at: Date.now(), map });
|
|
@@ -69133,9 +70056,9 @@ async function fetchEulerEntityNames(chainId) {
|
|
|
69133
70056
|
}).catch(() => {
|
|
69134
70057
|
return hit?.map ?? /* @__PURE__ */ new Map();
|
|
69135
70058
|
}).finally(() => {
|
|
69136
|
-
|
|
70059
|
+
inflight6.delete(chainId);
|
|
69137
70060
|
});
|
|
69138
|
-
|
|
70061
|
+
inflight6.set(chainId, p);
|
|
69139
70062
|
return p;
|
|
69140
70063
|
}
|
|
69141
70064
|
function eulerEntityCuratorName(entityNames, curator, owner) {
|
|
@@ -72460,6 +73383,20 @@ var BeetsStSWithdrawalAbi = [
|
|
|
72460
73383
|
}
|
|
72461
73384
|
]
|
|
72462
73385
|
},
|
|
73386
|
+
{
|
|
73387
|
+
// `userWithdraws[user][i]` — the GLOBAL withdraw id of the user's i-th
|
|
73388
|
+
// request, the argument `withdraw(withdrawId, emergency)` takes.
|
|
73389
|
+
// `getUserWithdraws(user, 0, n, false)` returns the requests in this same
|
|
73390
|
+
// order (no swap-and-pop: claimed requests stay with `isWithdrawn`).
|
|
73391
|
+
name: "userWithdraws",
|
|
73392
|
+
type: "function",
|
|
73393
|
+
stateMutability: "view",
|
|
73394
|
+
inputs: [
|
|
73395
|
+
{ type: "address", name: "user" },
|
|
73396
|
+
{ type: "uint256", name: "index" }
|
|
73397
|
+
],
|
|
73398
|
+
outputs: [{ type: "uint256" }]
|
|
73399
|
+
},
|
|
72463
73400
|
{
|
|
72464
73401
|
name: "withdrawDelay",
|
|
72465
73402
|
type: "function",
|
|
@@ -72519,20 +73456,38 @@ var readerBeets = {
|
|
|
72519
73456
|
const reqs = stage1[0];
|
|
72520
73457
|
const delay = toNumber(stage1[1]) ?? 14 * 86400;
|
|
72521
73458
|
if (!Array.isArray(reqs)) return [];
|
|
73459
|
+
let ids = [];
|
|
73460
|
+
if (reqs.length > 0) {
|
|
73461
|
+
try {
|
|
73462
|
+
ids = await multicallRetry({
|
|
73463
|
+
chain: chainId,
|
|
73464
|
+
calls: reqs.map((_3, i) => ({
|
|
73465
|
+
address: entry.withdrawalContract,
|
|
73466
|
+
name: "userWithdraws",
|
|
73467
|
+
params: [user, BigInt(i)]
|
|
73468
|
+
})),
|
|
73469
|
+
abi: reqs.map(() => BeetsStSWithdrawalAbi)
|
|
73470
|
+
});
|
|
73471
|
+
} catch {
|
|
73472
|
+
ids = [];
|
|
73473
|
+
}
|
|
73474
|
+
}
|
|
72522
73475
|
const out = [];
|
|
72523
73476
|
for (let i = 0; i < reqs.length; i++) {
|
|
72524
73477
|
const r = reqs[i];
|
|
72525
|
-
const
|
|
73478
|
+
const amount5 = toBigInt15(r.assetAmount);
|
|
72526
73479
|
const ts = toNumber(r.requestTimestamp);
|
|
72527
73480
|
const isWithdrawn = Boolean(r.isWithdrawn);
|
|
72528
|
-
if (
|
|
73481
|
+
if (amount5 === void 0 || ts === void 0) continue;
|
|
73482
|
+
const withdrawId = toBigInt15(ids[i]);
|
|
73483
|
+
if (withdrawId === void 0) continue;
|
|
72529
73484
|
const readyAt = ts + delay;
|
|
72530
73485
|
out.push({
|
|
72531
73486
|
lst: entry.lst,
|
|
72532
73487
|
brand: entry.brand,
|
|
72533
73488
|
symbol: entry.symbol,
|
|
72534
|
-
requestId:
|
|
72535
|
-
amountUnderlying:
|
|
73489
|
+
requestId: withdrawId.toString(),
|
|
73490
|
+
amountUnderlying: amount5.toString(),
|
|
72536
73491
|
status: isWithdrawn ? "claimed" : computeStatus(readyAt),
|
|
72537
73492
|
readyAt: isWithdrawn ? void 0 : readyAt
|
|
72538
73493
|
});
|
|
@@ -72983,8 +73938,8 @@ var readerIbera = {
|
|
|
72983
73938
|
const r = stage2[k];
|
|
72984
73939
|
if (!r) continue;
|
|
72985
73940
|
const receiver = Array.isArray(r) ? r[2] : r.receiver;
|
|
72986
|
-
const
|
|
72987
|
-
if (typeof receiver !== "string" || receiver.toLowerCase() !== target ||
|
|
73941
|
+
const amount5 = Array.isArray(r) ? toBigInt15(r[3]) : toBigInt15(r.amount);
|
|
73942
|
+
if (typeof receiver !== "string" || receiver.toLowerCase() !== target || amount5 === void 0 || amount5 === 0n) {
|
|
72988
73943
|
continue;
|
|
72989
73944
|
}
|
|
72990
73945
|
const id = BigInt(ids[k]);
|
|
@@ -72993,7 +73948,7 @@ var readerIbera = {
|
|
|
72993
73948
|
brand: entry.brand,
|
|
72994
73949
|
symbol: entry.symbol,
|
|
72995
73950
|
requestId: String(ids[k]),
|
|
72996
|
-
amountUnderlying:
|
|
73951
|
+
amountUnderlying: amount5.toString(),
|
|
72997
73952
|
status: id < frontier ? "claimable" : "pending"
|
|
72998
73953
|
});
|
|
72999
73954
|
}
|
|
@@ -73166,13 +74121,13 @@ var readerErc7540 = {
|
|
|
73166
74121
|
],
|
|
73167
74122
|
abi: [Erc7540Abi]
|
|
73168
74123
|
});
|
|
73169
|
-
const
|
|
74124
|
+
const amount5 = toBigInt15(stage2[0]) ?? claimable;
|
|
73170
74125
|
out.push({
|
|
73171
74126
|
lst: entry.lst,
|
|
73172
74127
|
brand: entry.brand,
|
|
73173
74128
|
symbol: entry.symbol,
|
|
73174
74129
|
requestId: "0",
|
|
73175
|
-
amountUnderlying:
|
|
74130
|
+
amountUnderlying: amount5.toString(),
|
|
73176
74131
|
// The 7540 claim (`redeem`) takes the share amount.
|
|
73177
74132
|
shares: claimable.toString(),
|
|
73178
74133
|
status: "claimable"
|
|
@@ -73221,15 +74176,15 @@ var readerEthenaCooldown = {
|
|
|
73221
74176
|
});
|
|
73222
74177
|
const cell = res[0];
|
|
73223
74178
|
let cooldownEnd;
|
|
73224
|
-
let
|
|
74179
|
+
let amount5;
|
|
73225
74180
|
if (Array.isArray(cell)) {
|
|
73226
74181
|
cooldownEnd = toBigInt15(cell[0]);
|
|
73227
|
-
|
|
74182
|
+
amount5 = toBigInt15(cell[1]);
|
|
73228
74183
|
} else if (cell && typeof cell === "object") {
|
|
73229
74184
|
cooldownEnd = toBigInt15(cell.cooldownEnd);
|
|
73230
|
-
|
|
74185
|
+
amount5 = toBigInt15(cell.underlyingAmount);
|
|
73231
74186
|
}
|
|
73232
|
-
if (!
|
|
74187
|
+
if (!amount5 || amount5 === 0n) return [];
|
|
73233
74188
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
73234
74189
|
const out = [
|
|
73235
74190
|
{
|
|
@@ -73237,7 +74192,7 @@ var readerEthenaCooldown = {
|
|
|
73237
74192
|
brand: entry.brand,
|
|
73238
74193
|
symbol: entry.symbol,
|
|
73239
74194
|
requestId: "0",
|
|
73240
|
-
amountUnderlying:
|
|
74195
|
+
amountUnderlying: amount5.toString(),
|
|
73241
74196
|
status: computeStatus(readyAt),
|
|
73242
74197
|
readyAt
|
|
73243
74198
|
}
|
|
@@ -73292,7 +74247,7 @@ var readerSusd3Cooldown = {
|
|
|
73292
74247
|
shares = toBigInt15(cell.shares);
|
|
73293
74248
|
}
|
|
73294
74249
|
if (!shares || shares === 0n) return [];
|
|
73295
|
-
let
|
|
74250
|
+
let amount5 = shares;
|
|
73296
74251
|
try {
|
|
73297
74252
|
const stage2 = await multicallRetry({
|
|
73298
74253
|
chain: chainId,
|
|
@@ -73301,7 +74256,7 @@ var readerSusd3Cooldown = {
|
|
|
73301
74256
|
],
|
|
73302
74257
|
abi: [Susd3CooldownStatusAbi]
|
|
73303
74258
|
});
|
|
73304
|
-
|
|
74259
|
+
amount5 = toBigInt15(stage2[0]) ?? shares;
|
|
73305
74260
|
} catch {
|
|
73306
74261
|
}
|
|
73307
74262
|
const readyAt = Number(cooldownEnd ?? 0n);
|
|
@@ -73312,7 +74267,7 @@ var readerSusd3Cooldown = {
|
|
|
73312
74267
|
brand: entry.brand,
|
|
73313
74268
|
symbol: entry.symbol,
|
|
73314
74269
|
requestId: "0",
|
|
73315
|
-
amountUnderlying:
|
|
74270
|
+
amountUnderlying: amount5.toString(),
|
|
73316
74271
|
shares: shares.toString(),
|
|
73317
74272
|
status: computeStatus(readyAt, expiresAt),
|
|
73318
74273
|
readyAt,
|
|
@@ -73508,14 +74463,14 @@ var readerEtherFi = {
|
|
|
73508
74463
|
const isValid = Boolean(stage3[i * 3 + 2]);
|
|
73509
74464
|
if (!req) continue;
|
|
73510
74465
|
if (!isValid) continue;
|
|
73511
|
-
const
|
|
73512
|
-
if (
|
|
74466
|
+
const amount5 = toBigInt15(req.amountOfEEth);
|
|
74467
|
+
if (amount5 === void 0) continue;
|
|
73513
74468
|
out.push({
|
|
73514
74469
|
lst: entry.lst,
|
|
73515
74470
|
brand: entry.brand,
|
|
73516
74471
|
symbol: entry.symbol,
|
|
73517
74472
|
requestId: id.toString(),
|
|
73518
|
-
amountUnderlying:
|
|
74473
|
+
amountUnderlying: amount5.toString(),
|
|
73519
74474
|
status: isFinalized ? "claimable" : "pending"
|
|
73520
74475
|
});
|
|
73521
74476
|
}
|
|
@@ -73845,15 +74800,19 @@ var readerLista = {
|
|
|
73845
74800
|
const isClaimable = Array.isArray(status) ? Boolean(status[0]) : Boolean(status._isClaimable);
|
|
73846
74801
|
const bnbAmount = Array.isArray(status) ? toBigInt15(status[1]) : toBigInt15(status._amount);
|
|
73847
74802
|
const snbnbAmount = Array.isArray(req) ? toBigInt15(req[1]) : toBigInt15(req?.amountInSnBnb);
|
|
73848
|
-
const
|
|
73849
|
-
if (
|
|
73850
|
-
const uuid = Array.isArray(req) ? toBigInt15(req[0]) : toBigInt15(req?.uuid);
|
|
74803
|
+
const amount5 = bnbAmount ?? snbnbAmount;
|
|
74804
|
+
if (amount5 === void 0) continue;
|
|
73851
74805
|
out.push({
|
|
73852
74806
|
lst: entry.lst,
|
|
73853
74807
|
brand: entry.brand,
|
|
73854
74808
|
symbol: entry.symbol,
|
|
73855
|
-
|
|
73856
|
-
|
|
74809
|
+
// The CLAIM HANDLE, not the request's `uuid`: `claimWithdraw(_idx)`
|
|
74810
|
+
// takes the position in `getUserWithdrawalRequests(user)` (it reverts
|
|
74811
|
+
// `Invalid index` past the end) and swap-and-pops on claim. Publishing
|
|
74812
|
+
// the uuid (≈ 239,600 in 2026-10) made every claim built from this id
|
|
74813
|
+
// revert. Re-read after each claim — positions move.
|
|
74814
|
+
requestId: String(i),
|
|
74815
|
+
amountUnderlying: amount5.toString(),
|
|
73857
74816
|
status: isClaimable ? "claimable" : "pending"
|
|
73858
74817
|
});
|
|
73859
74818
|
}
|
|
@@ -74108,7 +75067,7 @@ var readerStaderMaticX2 = {
|
|
|
74108
75067
|
const out = [];
|
|
74109
75068
|
for (let i = 0; i < arr.length; i++) {
|
|
74110
75069
|
const r = arr[i];
|
|
74111
|
-
const
|
|
75070
|
+
const amount5 = toBigInt15(r.amount) ?? 0n;
|
|
74112
75071
|
const requestEpoch = toBigInt15(r.requestEpoch);
|
|
74113
75072
|
if (requestEpoch === void 0) continue;
|
|
74114
75073
|
const ready = stakeManager ? currentEpoch >= requestEpoch + delay : false;
|
|
@@ -74119,7 +75078,7 @@ var readerStaderMaticX2 = {
|
|
|
74119
75078
|
// Use array index as the request id (consistent with
|
|
74120
75079
|
// `claimWithdrawal(uint256 _idx)`).
|
|
74121
75080
|
requestId: String(i),
|
|
74122
|
-
amountUnderlying:
|
|
75081
|
+
amountUnderlying: amount5.toString(),
|
|
74123
75082
|
status: ready ? "claimable" : "pending"
|
|
74124
75083
|
});
|
|
74125
75084
|
}
|
|
@@ -74520,7 +75479,7 @@ var readerStakeWise = {
|
|
|
74520
75479
|
const out = [];
|
|
74521
75480
|
for (let i = 0; i < requests.length; i++) {
|
|
74522
75481
|
const r = requests[i];
|
|
74523
|
-
const
|
|
75482
|
+
const amount5 = toBigInt15(r.totalAssets) ?? 0n;
|
|
74524
75483
|
const onChainClaimed = claimedByIdx.get(i);
|
|
74525
75484
|
const claimable = onChainClaimed !== void 0 || r.isClaimable;
|
|
74526
75485
|
out.push({
|
|
@@ -74528,7 +75487,7 @@ var readerStakeWise = {
|
|
|
74528
75487
|
brand: entry.brand,
|
|
74529
75488
|
symbol: entry.symbol,
|
|
74530
75489
|
requestId: r.positionTicket,
|
|
74531
|
-
amountUnderlying: (onChainClaimed ??
|
|
75490
|
+
amountUnderlying: (onChainClaimed ?? amount5).toString(),
|
|
74532
75491
|
status: claimable ? "claimable" : "pending"
|
|
74533
75492
|
});
|
|
74534
75493
|
}
|
|
@@ -74577,15 +75536,15 @@ var readerStCelo2 = {
|
|
|
74577
75536
|
const timestamps = cell[1] ?? [];
|
|
74578
75537
|
const out = [];
|
|
74579
75538
|
for (let i = 0; i < values.length; i++) {
|
|
74580
|
-
const
|
|
75539
|
+
const amount5 = toBigInt15(values[i]);
|
|
74581
75540
|
const readyAt = toNumber(timestamps[i]);
|
|
74582
|
-
if (
|
|
75541
|
+
if (amount5 === void 0 || readyAt === void 0) continue;
|
|
74583
75542
|
out.push({
|
|
74584
75543
|
lst: entry.lst,
|
|
74585
75544
|
brand: entry.brand,
|
|
74586
75545
|
symbol: entry.symbol,
|
|
74587
75546
|
requestId: String(i),
|
|
74588
|
-
amountUnderlying:
|
|
75547
|
+
amountUnderlying: amount5.toString(),
|
|
74589
75548
|
status: computeStatus(readyAt),
|
|
74590
75549
|
readyAt
|
|
74591
75550
|
});
|
|
@@ -74686,15 +75645,15 @@ var readerSwell = {
|
|
|
74686
75645
|
const id = ids[i];
|
|
74687
75646
|
const r = stage3[i];
|
|
74688
75647
|
if (!r) continue;
|
|
74689
|
-
const
|
|
74690
|
-
if (
|
|
75648
|
+
const amount5 = toBigInt15(r.amount);
|
|
75649
|
+
if (amount5 === void 0) continue;
|
|
74691
75650
|
const claimable = id <= lastProcessed;
|
|
74692
75651
|
out.push({
|
|
74693
75652
|
lst: entry.lst,
|
|
74694
75653
|
brand: entry.brand,
|
|
74695
75654
|
symbol: entry.symbol,
|
|
74696
75655
|
requestId: id.toString(),
|
|
74697
|
-
amountUnderlying:
|
|
75656
|
+
amountUnderlying: amount5.toString(),
|
|
74698
75657
|
status: claimable ? "claimable" : "pending"
|
|
74699
75658
|
});
|
|
74700
75659
|
}
|
|
@@ -74760,15 +75719,15 @@ var readerValantis = {
|
|
|
74760
75719
|
for (let i = 0; i < burns.length; i++) {
|
|
74761
75720
|
const b = burns[i];
|
|
74762
75721
|
if (!b) continue;
|
|
74763
|
-
const
|
|
75722
|
+
const amount5 = Array.isArray(b) ? toBigInt15(b[0]) : toBigInt15(b.amount);
|
|
74764
75723
|
const completed = Array.isArray(b) ? Boolean(b[2]) : Boolean(b.completed);
|
|
74765
|
-
if (
|
|
75724
|
+
if (amount5 === void 0 || completed) continue;
|
|
74766
75725
|
out.push({
|
|
74767
75726
|
lst: entry.lst,
|
|
74768
75727
|
brand: entry.brand,
|
|
74769
75728
|
symbol: entry.symbol,
|
|
74770
75729
|
requestId: String(toBigInt15(ids[i]) ?? i),
|
|
74771
|
-
amountUnderlying:
|
|
75730
|
+
amountUnderlying: amount5.toString(),
|
|
74772
75731
|
status: redeemable[i] ? "claimable" : "pending"
|
|
74773
75732
|
});
|
|
74774
75733
|
}
|
|
@@ -74918,15 +75877,15 @@ var readerTruFin = {
|
|
|
74918
75877
|
if (typeof recipient === "string" && recipient.toLowerCase() !== lcUser) {
|
|
74919
75878
|
continue;
|
|
74920
75879
|
}
|
|
74921
|
-
const
|
|
74922
|
-
if (
|
|
75880
|
+
const amount5 = Array.isArray(w) ? toBigInt15(w[1]) : toBigInt15(w.amount);
|
|
75881
|
+
if (amount5 === void 0 || amount5 === 0n) continue;
|
|
74923
75882
|
out.push({
|
|
74924
75883
|
lst: entry.lst,
|
|
74925
75884
|
brand: entry.brand,
|
|
74926
75885
|
symbol: entry.symbol,
|
|
74927
75886
|
// Composite id — same shape as the input.
|
|
74928
75887
|
requestId: `${pairs[i].validator}:${pairs[i].nonce.toString()}`,
|
|
74929
|
-
amountUnderlying:
|
|
75888
|
+
amountUnderlying: amount5.toString(),
|
|
74930
75889
|
status: claimable ? "claimable" : "pending"
|
|
74931
75890
|
});
|
|
74932
75891
|
}
|
|
@@ -75033,17 +75992,17 @@ var readerYieldNest = {
|
|
|
75033
75992
|
const id = ids[i];
|
|
75034
75993
|
const r = stage3[i];
|
|
75035
75994
|
if (!r) continue;
|
|
75036
|
-
const
|
|
75995
|
+
const amount5 = toBigInt15(r.amount);
|
|
75037
75996
|
const created = toNumber(r.creationTimestamp);
|
|
75038
75997
|
const processed = Boolean(r.processed);
|
|
75039
|
-
if (
|
|
75998
|
+
if (amount5 === void 0 || created === void 0) continue;
|
|
75040
75999
|
const readyAt = created + finalizationSeconds;
|
|
75041
76000
|
out.push({
|
|
75042
76001
|
lst: entry.lst,
|
|
75043
76002
|
brand: entry.brand,
|
|
75044
76003
|
symbol: entry.symbol,
|
|
75045
76004
|
requestId: id.toString(),
|
|
75046
|
-
amountUnderlying:
|
|
76005
|
+
amountUnderlying: amount5.toString(),
|
|
75047
76006
|
status: processed ? "claimed" : computeStatus(readyAt),
|
|
75048
76007
|
readyAt: processed ? void 0 : readyAt
|
|
75049
76008
|
});
|
|
@@ -79631,9 +80590,9 @@ async function fetchAaveEarnApiVaults(chainId, targets) {
|
|
|
79631
80590
|
const target = Number(chainId);
|
|
79632
80591
|
const byAddress = /* @__PURE__ */ new Map();
|
|
79633
80592
|
const keep = (it) => {
|
|
79634
|
-
const
|
|
79635
|
-
if (!
|
|
79636
|
-
if (!byAddress.has(
|
|
80593
|
+
const addr5 = it?.address?.toLowerCase();
|
|
80594
|
+
if (!addr5 || Number(it.chainId) !== target) return;
|
|
80595
|
+
if (!byAddress.has(addr5)) byAddress.set(addr5, it);
|
|
79637
80596
|
};
|
|
79638
80597
|
for (const owner of targets.owners) {
|
|
79639
80598
|
let cursor = null;
|
|
@@ -79814,6 +80773,399 @@ var fetchAaveEarnVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
79814
80773
|
return out;
|
|
79815
80774
|
};
|
|
79816
80775
|
|
|
80776
|
+
// src/vaults/upshift/onchain.ts
|
|
80777
|
+
var UPSHIFT_VAULT_ABI = [
|
|
80778
|
+
...["asset", "lpTokenAddress", "assetsWhitelistAddress"].map((name) => ({
|
|
80779
|
+
type: "function",
|
|
80780
|
+
name,
|
|
80781
|
+
stateMutability: "view",
|
|
80782
|
+
inputs: [],
|
|
80783
|
+
outputs: [{ name: "", type: "address" }]
|
|
80784
|
+
})),
|
|
80785
|
+
...[
|
|
80786
|
+
"getTotalAssets",
|
|
80787
|
+
"totalAssets",
|
|
80788
|
+
"totalSupply",
|
|
80789
|
+
"maxSupply",
|
|
80790
|
+
"lagDuration",
|
|
80791
|
+
"depositCap",
|
|
80792
|
+
"maxDepositAmount"
|
|
80793
|
+
].map((name) => ({
|
|
80794
|
+
type: "function",
|
|
80795
|
+
name,
|
|
80796
|
+
stateMutability: "view",
|
|
80797
|
+
inputs: [],
|
|
80798
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
80799
|
+
})),
|
|
80800
|
+
...["depositsPaused", "withdrawalsPaused"].map((name) => ({
|
|
80801
|
+
type: "function",
|
|
80802
|
+
name,
|
|
80803
|
+
stateMutability: "view",
|
|
80804
|
+
inputs: [],
|
|
80805
|
+
outputs: [{ name: "", type: "bool" }]
|
|
80806
|
+
})),
|
|
80807
|
+
{
|
|
80808
|
+
type: "function",
|
|
80809
|
+
name: "decimals",
|
|
80810
|
+
stateMutability: "view",
|
|
80811
|
+
inputs: [],
|
|
80812
|
+
outputs: [{ name: "", type: "uint8" }]
|
|
80813
|
+
},
|
|
80814
|
+
{
|
|
80815
|
+
type: "function",
|
|
80816
|
+
name: "getWhitelistedAssets",
|
|
80817
|
+
stateMutability: "view",
|
|
80818
|
+
inputs: [],
|
|
80819
|
+
outputs: [{ name: "", type: "address[]" }]
|
|
80820
|
+
}
|
|
80821
|
+
];
|
|
80822
|
+
var V1_CALLS = [
|
|
80823
|
+
"asset",
|
|
80824
|
+
"decimals",
|
|
80825
|
+
"totalAssets",
|
|
80826
|
+
"totalSupply",
|
|
80827
|
+
"maxSupply",
|
|
80828
|
+
"lagDuration",
|
|
80829
|
+
"depositsPaused",
|
|
80830
|
+
"withdrawalsPaused",
|
|
80831
|
+
"maxDepositAmount"
|
|
80832
|
+
];
|
|
80833
|
+
var V2_CALLS = [
|
|
80834
|
+
"asset",
|
|
80835
|
+
"lpTokenAddress",
|
|
80836
|
+
"assetsWhitelistAddress",
|
|
80837
|
+
"getTotalAssets",
|
|
80838
|
+
"lagDuration",
|
|
80839
|
+
"depositsPaused",
|
|
80840
|
+
"withdrawalsPaused",
|
|
80841
|
+
"depositCap",
|
|
80842
|
+
"maxDepositAmount"
|
|
80843
|
+
];
|
|
80844
|
+
var FAILED = "0x";
|
|
80845
|
+
var ok3 = (v) => v !== void 0 && v !== null && v !== FAILED;
|
|
80846
|
+
var big26 = (v) => {
|
|
80847
|
+
if (!ok3(v)) return void 0;
|
|
80848
|
+
try {
|
|
80849
|
+
return BigInt(v).toString();
|
|
80850
|
+
} catch {
|
|
80851
|
+
return void 0;
|
|
80852
|
+
}
|
|
80853
|
+
};
|
|
80854
|
+
var addr2 = (v) => ok3(v) && /^0x[0-9a-fA-F]{40}$/.test(String(v)) ? String(v).toLowerCase() : void 0;
|
|
80855
|
+
var bool2 = (v) => typeof v === "boolean" ? v : void 0;
|
|
80856
|
+
var ZERO9 = "0x0000000000000000000000000000000000000000";
|
|
80857
|
+
async function readUpshiftVaultsOnChain(chainId, vaults, multicallRetry) {
|
|
80858
|
+
const reads = /* @__PURE__ */ new Map();
|
|
80859
|
+
const failed = [];
|
|
80860
|
+
if (vaults.length === 0) return { reads, failed };
|
|
80861
|
+
const plan = vaults.map((v) => ({
|
|
80862
|
+
...v,
|
|
80863
|
+
names: v.version === "evm-2" ? V2_CALLS : V1_CALLS
|
|
80864
|
+
}));
|
|
80865
|
+
const r1Calls = plan.flatMap(
|
|
80866
|
+
(v) => v.names.map((name) => ({ address: v.address, name, params: [] }))
|
|
80867
|
+
);
|
|
80868
|
+
const r1 = await multicallRetry({
|
|
80869
|
+
chain: chainId,
|
|
80870
|
+
calls: r1Calls,
|
|
80871
|
+
abi: UPSHIFT_VAULT_ABI,
|
|
80872
|
+
allowFailure: true,
|
|
80873
|
+
maxRetries: 3
|
|
80874
|
+
});
|
|
80875
|
+
if (r1.length !== r1Calls.length)
|
|
80876
|
+
throw new Error(
|
|
80877
|
+
`Upshift on-chain read (chain ${chainId}): ${r1.length} of ${r1Calls.length} results`
|
|
80878
|
+
);
|
|
80879
|
+
let i = 0;
|
|
80880
|
+
const named = plan.map((v) => {
|
|
80881
|
+
const out = {};
|
|
80882
|
+
for (const n of v.names) out[n] = r1[i++];
|
|
80883
|
+
return { ...v, out };
|
|
80884
|
+
});
|
|
80885
|
+
const r2Asks = [];
|
|
80886
|
+
for (const v of named) {
|
|
80887
|
+
const asset = addr2(v.out.asset);
|
|
80888
|
+
if (asset)
|
|
80889
|
+
r2Asks.push({
|
|
80890
|
+
address: asset,
|
|
80891
|
+
name: "decimals",
|
|
80892
|
+
key: `${v.address}:assetDecimals`
|
|
80893
|
+
});
|
|
80894
|
+
if (v.version !== "evm-2") continue;
|
|
80895
|
+
const receipt = addr2(v.out.lpTokenAddress);
|
|
80896
|
+
if (receipt) {
|
|
80897
|
+
r2Asks.push({
|
|
80898
|
+
address: receipt,
|
|
80899
|
+
name: "decimals",
|
|
80900
|
+
key: `${v.address}:receiptDecimals`
|
|
80901
|
+
});
|
|
80902
|
+
r2Asks.push({
|
|
80903
|
+
address: receipt,
|
|
80904
|
+
name: "totalSupply",
|
|
80905
|
+
key: `${v.address}:receiptSupply`
|
|
80906
|
+
});
|
|
80907
|
+
}
|
|
80908
|
+
const wl = addr2(v.out.assetsWhitelistAddress);
|
|
80909
|
+
if (wl && wl !== ZERO9)
|
|
80910
|
+
r2Asks.push({
|
|
80911
|
+
address: wl,
|
|
80912
|
+
name: "getWhitelistedAssets",
|
|
80913
|
+
key: `${v.address}:whitelist`
|
|
80914
|
+
});
|
|
80915
|
+
}
|
|
80916
|
+
const r2 = r2Asks.length ? await multicallRetry({
|
|
80917
|
+
chain: chainId,
|
|
80918
|
+
calls: r2Asks.map((a) => ({
|
|
80919
|
+
address: a.address,
|
|
80920
|
+
name: a.name,
|
|
80921
|
+
params: []
|
|
80922
|
+
})),
|
|
80923
|
+
abi: UPSHIFT_VAULT_ABI,
|
|
80924
|
+
allowFailure: true,
|
|
80925
|
+
maxRetries: 3
|
|
80926
|
+
}) : [];
|
|
80927
|
+
const r2By = /* @__PURE__ */ new Map();
|
|
80928
|
+
r2Asks.forEach((a, j) => r2By.set(a.key, r2[j]));
|
|
80929
|
+
for (const v of named) {
|
|
80930
|
+
const o = v.out;
|
|
80931
|
+
const asset = addr2(o.asset);
|
|
80932
|
+
const assetDecimals = Number(big26(r2By.get(`${v.address}:assetDecimals`)));
|
|
80933
|
+
const isV2 = v.version === "evm-2";
|
|
80934
|
+
const receipt = isV2 ? addr2(o.lpTokenAddress) : v.address.toLowerCase();
|
|
80935
|
+
const receiptDecimals = isV2 ? Number(big26(r2By.get(`${v.address}:receiptDecimals`))) : Number(big26(o.decimals));
|
|
80936
|
+
const totalAssets = big26(isV2 ? o.getTotalAssets : o.totalAssets);
|
|
80937
|
+
const totalSupply = isV2 ? big26(r2By.get(`${v.address}:receiptSupply`)) : big26(o.totalSupply);
|
|
80938
|
+
if (!asset || !receipt || !Number.isFinite(assetDecimals) || !Number.isFinite(receiptDecimals) || totalAssets === void 0 || totalSupply === void 0) {
|
|
80939
|
+
failed.push(v.address);
|
|
80940
|
+
continue;
|
|
80941
|
+
}
|
|
80942
|
+
const extras = r2By.get(`${v.address}:whitelist`);
|
|
80943
|
+
const depositAssets = [
|
|
80944
|
+
asset,
|
|
80945
|
+
...(Array.isArray(extras) ? extras : []).map((a) => addr2(a)).filter((a) => !!a && a !== asset)
|
|
80946
|
+
];
|
|
80947
|
+
reads.set(v.address.toLowerCase(), {
|
|
80948
|
+
vault: v.address.toLowerCase(),
|
|
80949
|
+
version: v.version,
|
|
80950
|
+
receipt,
|
|
80951
|
+
receiptDecimals,
|
|
80952
|
+
asset,
|
|
80953
|
+
assetDecimals,
|
|
80954
|
+
depositAssets: [...new Set(depositAssets)],
|
|
80955
|
+
totalAssets,
|
|
80956
|
+
totalSupply,
|
|
80957
|
+
lagDuration: Number(big26(o.lagDuration) ?? 0),
|
|
80958
|
+
depositsPaused: bool2(o.depositsPaused),
|
|
80959
|
+
withdrawalsPaused: bool2(o.withdrawalsPaused),
|
|
80960
|
+
depositCap: isV2 ? big26(o.depositCap) : void 0,
|
|
80961
|
+
maxSupply: isV2 ? void 0 : big26(o.maxSupply),
|
|
80962
|
+
maxDepositAmount: big26(o.maxDepositAmount)
|
|
80963
|
+
});
|
|
80964
|
+
}
|
|
80965
|
+
return { reads, failed };
|
|
80966
|
+
}
|
|
80967
|
+
|
|
80968
|
+
// src/vaults/upshift/api.ts
|
|
80969
|
+
var UPSHIFT_VAULTS_URL = "https://app.upshift.finance/api/proxy/vaults";
|
|
80970
|
+
var UPSHIFT_CHAIN_IDS = /* @__PURE__ */ new Set([
|
|
80971
|
+
"1",
|
|
80972
|
+
// Ethereum
|
|
80973
|
+
"14",
|
|
80974
|
+
// Flare
|
|
80975
|
+
"56",
|
|
80976
|
+
// BNB Chain
|
|
80977
|
+
"143",
|
|
80978
|
+
// Monad
|
|
80979
|
+
"43114",
|
|
80980
|
+
// Avalanche
|
|
80981
|
+
"8453",
|
|
80982
|
+
// Base
|
|
80983
|
+
"9745",
|
|
80984
|
+
// Plasma
|
|
80985
|
+
"57073",
|
|
80986
|
+
// Ink
|
|
80987
|
+
"999",
|
|
80988
|
+
// HyperEVM
|
|
80989
|
+
// Citrea. Added 2026-08-19: the listing carries a live, visible $2.56M
|
|
80990
|
+
// RockawayX vault there (`Earn ctUSD`) that this gate was short-circuiting
|
|
80991
|
+
// away — the fetch itself is HTTP-only and chain-agnostic, so a chain
|
|
80992
|
+
// missing from this set is the only thing that can hide one.
|
|
80993
|
+
"4114"
|
|
80994
|
+
]);
|
|
80995
|
+
var hasUpshiftVaults = (chainId) => UPSHIFT_CHAIN_IDS.has(String(chainId));
|
|
80996
|
+
function isListedUpshiftEvmVault(v) {
|
|
80997
|
+
if (!augustEvmVersion(v)) return false;
|
|
80998
|
+
if (v.status === "closed" && v.is_visible !== true) return false;
|
|
80999
|
+
return v.is_visible === true || v.withdrawal_only === true;
|
|
81000
|
+
}
|
|
81001
|
+
var amount = (raw, decimals) => {
|
|
81002
|
+
if (raw === void 0) return null;
|
|
81003
|
+
const n = Number(raw) / 10 ** decimals;
|
|
81004
|
+
return { raw, normalized: Number.isFinite(n) ? String(n) : null };
|
|
81005
|
+
};
|
|
81006
|
+
function upshiftApiVaultFromAugust(v, c, now = /* @__PURE__ */ new Date()) {
|
|
81007
|
+
const toggle = v.platform_fee_override?.is_fee_waived;
|
|
81008
|
+
const instant = v.instant_redeem_config;
|
|
81009
|
+
return {
|
|
81010
|
+
chainId: v.chain,
|
|
81011
|
+
address: v.address,
|
|
81012
|
+
name: v.vault_name ?? null,
|
|
81013
|
+
decimals: c.receiptDecimals,
|
|
81014
|
+
status: v.status ?? null,
|
|
81015
|
+
isVisible: v.is_visible === true,
|
|
81016
|
+
isDepositPaused: c.depositsPaused === true || UPSHIFT_DEPOSIT_DENY_LIST.has(c.vault.toLowerCase()),
|
|
81017
|
+
isWithdrawalPaused: c.withdrawalsPaused === true,
|
|
81018
|
+
apy: {
|
|
81019
|
+
apy: augustTargetApy(v) ?? null,
|
|
81020
|
+
campaignApy: v.campaign_apy ?? null,
|
|
81021
|
+
pointsApy: v.reported_apy?.points_apy ?? null,
|
|
81022
|
+
underlyingApy: v.reported_apy?.underlying_apy ?? null
|
|
81023
|
+
},
|
|
81024
|
+
historicalApy: v.historical_apy ?? null,
|
|
81025
|
+
defaultApyHorizon: v.default_apy_horizon ?? null,
|
|
81026
|
+
startDatetime: augustUtc(v.start_datetime) ?? null,
|
|
81027
|
+
depositAssets: c.depositAssets.map((a) => ({
|
|
81028
|
+
address: a,
|
|
81029
|
+
symbol: null,
|
|
81030
|
+
decimals: a === c.asset ? c.assetDecimals : null
|
|
81031
|
+
})),
|
|
81032
|
+
totalAssets: amount(c.totalAssets, c.assetDecimals),
|
|
81033
|
+
totalSupply: amount(c.totalSupply, c.receiptDecimals),
|
|
81034
|
+
receipt: {
|
|
81035
|
+
symbol: v.receipt_token_symbol ?? null,
|
|
81036
|
+
address: c.receipt,
|
|
81037
|
+
decimals: c.receiptDecimals
|
|
81038
|
+
},
|
|
81039
|
+
latest_reported_tvl: v.latest_reported_tvl ?? v.tvl ?? null,
|
|
81040
|
+
strategists: augustStrategists(v).map((s) => ({
|
|
81041
|
+
...s,
|
|
81042
|
+
address: "0x",
|
|
81043
|
+
type: "subaccount"
|
|
81044
|
+
})),
|
|
81045
|
+
fees: {
|
|
81046
|
+
performance: v.weekly_performance_fee_bps ?? null,
|
|
81047
|
+
management: v.platform_fee_override?.management_fee ?? null,
|
|
81048
|
+
isPerformanceWaived: augustFeeWaived(
|
|
81049
|
+
toggle,
|
|
81050
|
+
v.performance_fee_waived_until_date,
|
|
81051
|
+
v.performance_fee_waived_until_tvl,
|
|
81052
|
+
now
|
|
81053
|
+
),
|
|
81054
|
+
isManagementWaived: augustFeeWaived(
|
|
81055
|
+
toggle,
|
|
81056
|
+
v.management_fee_waived_until_date,
|
|
81057
|
+
v.management_fee_waived_until_tvl,
|
|
81058
|
+
now
|
|
81059
|
+
),
|
|
81060
|
+
performanceFeeWaivedUntilDate: v.performance_fee_waived_until_date ?? null,
|
|
81061
|
+
performanceFeeWaivedUntilTvl: v.performance_fee_waived_until_tvl ?? null,
|
|
81062
|
+
managementFeeWaivedUntilDate: v.management_fee_waived_until_date ?? null,
|
|
81063
|
+
managementFeeWaivedUntilTvl: v.management_fee_waived_until_tvl ?? null
|
|
81064
|
+
},
|
|
81065
|
+
lagDuration: c.lagDuration,
|
|
81066
|
+
withdrawalOnly: v.withdrawal_only === true,
|
|
81067
|
+
depositCap: amount(c.depositCap, c.assetDecimals),
|
|
81068
|
+
maxDepositAmount: amount(c.maxDepositAmount, c.assetDecimals),
|
|
81069
|
+
maxSupply: amount(c.maxSupply, c.receiptDecimals),
|
|
81070
|
+
instant_redeem_config: instant ? {
|
|
81071
|
+
subaccountAddress: instant.subaccount_address ?? null,
|
|
81072
|
+
outputAssetSymbol: instant.output_asset_symbol ?? null,
|
|
81073
|
+
redeemableAssets: (instant.redeemable_assets ?? []).map(
|
|
81074
|
+
(a) => a ? { symbol: a.symbol ?? null, spreadBps: a.spread_bps ?? null } : null
|
|
81075
|
+
),
|
|
81076
|
+
isPaused: instant.is_paused ?? null,
|
|
81077
|
+
availableLiquidity: instant.available_liquidity ?? null
|
|
81078
|
+
} : null,
|
|
81079
|
+
version: c.version,
|
|
81080
|
+
description: v.description ?? null,
|
|
81081
|
+
source: "august"
|
|
81082
|
+
};
|
|
81083
|
+
}
|
|
81084
|
+
var message = (e) => e instanceof Error ? e.message : String(e);
|
|
81085
|
+
async function assembleChain(chainId, catalogue, multicallRetry) {
|
|
81086
|
+
const rows = catalogue.filter(
|
|
81087
|
+
(v) => Number(v?.chain) === Number(chainId) && isListedUpshiftEvmVault(v)
|
|
81088
|
+
);
|
|
81089
|
+
if (rows.length === 0) return [];
|
|
81090
|
+
const { reads, failed } = await readUpshiftVaultsOnChain(
|
|
81091
|
+
chainId,
|
|
81092
|
+
rows.map((v) => ({ address: v.address, version: augustEvmVersion(v) })),
|
|
81093
|
+
multicallRetry
|
|
81094
|
+
);
|
|
81095
|
+
if (reads.size === 0)
|
|
81096
|
+
throw new Error(
|
|
81097
|
+
`Upshift chain ${chainId}: none of ${rows.length} listed vaults confirmed on-chain`
|
|
81098
|
+
);
|
|
81099
|
+
if (failed.length)
|
|
81100
|
+
console.warn(
|
|
81101
|
+
`[upshift] chain ${chainId}: dropped ${failed.length} vault(s) whose contract reads failed: ${failed.join(", ")}`
|
|
81102
|
+
);
|
|
81103
|
+
const now = /* @__PURE__ */ new Date();
|
|
81104
|
+
return rows.flatMap((v) => {
|
|
81105
|
+
const c = reads.get(v.address.toLowerCase());
|
|
81106
|
+
return c ? [upshiftApiVaultFromAugust(v, c, now)] : [];
|
|
81107
|
+
});
|
|
81108
|
+
}
|
|
81109
|
+
async function fetchUpshiftLegacyProxyVaults() {
|
|
81110
|
+
const ctrl = new AbortController();
|
|
81111
|
+
const timer = setTimeout(() => ctrl.abort(), 2e4);
|
|
81112
|
+
try {
|
|
81113
|
+
const res = await fetch(UPSHIFT_VAULTS_URL, {
|
|
81114
|
+
headers: { Accept: "application/json" },
|
|
81115
|
+
redirect: "manual",
|
|
81116
|
+
signal: ctrl.signal
|
|
81117
|
+
});
|
|
81118
|
+
if (!res.ok)
|
|
81119
|
+
throw new Error(
|
|
81120
|
+
`Upshift legacy proxy failed: ${res.status} ${res.statusText}`.trim()
|
|
81121
|
+
);
|
|
81122
|
+
const json = await res.json();
|
|
81123
|
+
const rows = Array.isArray(json?.data) ? json.data : [];
|
|
81124
|
+
if (rows.length === 0)
|
|
81125
|
+
throw new Error("Upshift legacy proxy: empty listing");
|
|
81126
|
+
const div = (x) => typeof x === "number" && Number.isFinite(x) ? x / 100 : null;
|
|
81127
|
+
return rows.map((r) => ({
|
|
81128
|
+
...r,
|
|
81129
|
+
apy: r?.apy ? {
|
|
81130
|
+
...r.apy,
|
|
81131
|
+
campaignApy: div(r.apy.campaignApy),
|
|
81132
|
+
underlyingApy: div(r.apy.underlyingApy)
|
|
81133
|
+
} : null,
|
|
81134
|
+
historicalApy: r?.historical_apy ?? r?.historicalApy ?? null,
|
|
81135
|
+
defaultApyHorizon: r?.defaultApyHorizon ?? null,
|
|
81136
|
+
startDatetime: r?.startDatetime ?? null,
|
|
81137
|
+
source: "proxy"
|
|
81138
|
+
}));
|
|
81139
|
+
} finally {
|
|
81140
|
+
clearTimeout(timer);
|
|
81141
|
+
}
|
|
81142
|
+
}
|
|
81143
|
+
async function fetchUpshiftApiVaults(chainId, multicallRetry = multicallRetryUniversal) {
|
|
81144
|
+
const chains = chainId !== void 0 ? [String(chainId)] : [...UPSHIFT_CHAIN_IDS];
|
|
81145
|
+
let primary;
|
|
81146
|
+
try {
|
|
81147
|
+
const catalogue = await fetchAugustTokenizedVaults();
|
|
81148
|
+
const perChain = await Promise.all(
|
|
81149
|
+
chains.map((c) => assembleChain(c, catalogue, multicallRetry))
|
|
81150
|
+
);
|
|
81151
|
+
return perChain.flat();
|
|
81152
|
+
} catch (e) {
|
|
81153
|
+
primary = e;
|
|
81154
|
+
}
|
|
81155
|
+
try {
|
|
81156
|
+
const rows = await fetchUpshiftLegacyProxyVaults();
|
|
81157
|
+
console.warn(
|
|
81158
|
+
`[upshift] August catalogue path failed (${message(primary)}); serving the legacy proxy`
|
|
81159
|
+
);
|
|
81160
|
+
const want = new Set(chains.map(Number));
|
|
81161
|
+
return rows.filter((r) => want.has(Number(r?.chainId)));
|
|
81162
|
+
} catch (fallback) {
|
|
81163
|
+
throw new Error(
|
|
81164
|
+
`Upshift listing unavailable \u2014 August catalogue: ${message(primary)}; legacy proxy: ${message(fallback)}`
|
|
81165
|
+
);
|
|
81166
|
+
}
|
|
81167
|
+
}
|
|
81168
|
+
|
|
79817
81169
|
// src/vaults/upshift/fetchPublic.ts
|
|
79818
81170
|
var num9 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
79819
81171
|
var isEvmAddress = (a) => /^0x[0-9a-fA-F]{40}$/.test(a);
|
|
@@ -79860,15 +81212,19 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
79860
81212
|
const totalAssetsFormatted = Number(
|
|
79861
81213
|
parseRawAmount(totalAssetsRaw, assetDecimals)
|
|
79862
81214
|
);
|
|
79863
|
-
const
|
|
81215
|
+
const realized = augustRealizedRate(v);
|
|
81216
|
+
const supplyRate = realized.rate ?? 0;
|
|
79864
81217
|
const campaign = num9(v.apy?.campaignApy);
|
|
79865
|
-
const supplyRate = apyToAprPercent(base);
|
|
79866
81218
|
const rewardsRate = campaign != null ? apyToAprPercent(campaign) : 0;
|
|
81219
|
+
const targetApy = num9(v.apy?.apy) ?? void 0;
|
|
79867
81220
|
const oracleKey = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(assetAddr, chainId);
|
|
79868
81221
|
const apiTvlUsd = num9(v.latest_reported_tvl) ?? 0;
|
|
79869
81222
|
const impliedPriceUsd = totalAssetsFormatted > 0 ? apiTvlUsd / totalAssetsFormatted : 0;
|
|
79870
|
-
const
|
|
79871
|
-
const
|
|
81223
|
+
const ownPrice = num9(prices[oracleKey]) ?? num9(prices[assetAddr]);
|
|
81224
|
+
const priceUsd = ownPrice ?? impliedPriceUsd;
|
|
81225
|
+
const totalAssetsUsd = ownPrice !== null ? totalAssetsFormatted * ownPrice : apiTvlUsd || totalAssetsFormatted * priceUsd;
|
|
81226
|
+
const totalSupplyFormatted = Number(parseRawAmount(totalSupplyRaw, decimals));
|
|
81227
|
+
const sharePrice = totalSupplyFormatted > 0 ? totalAssetsFormatted / totalSupplyFormatted : 1;
|
|
79872
81228
|
const name = (v.name ?? "").trim();
|
|
79873
81229
|
const symbol = (v.receipt?.symbol ?? "").trim();
|
|
79874
81230
|
const strategist = (v.strategists ?? []).find((s) => str4(s?.name));
|
|
@@ -79900,8 +81256,12 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
79900
81256
|
decimals
|
|
79901
81257
|
),
|
|
79902
81258
|
supplyRate,
|
|
81259
|
+
rateSource: realized.source,
|
|
81260
|
+
...realized.source === "realized-7d" ? { aprWindow: "weekly" } : realized.source === "realized-30d" ? { aprWindow: "monthly" } : {},
|
|
81261
|
+
...targetApy !== void 0 ? { targetApy } : {},
|
|
79903
81262
|
rewardsRate,
|
|
79904
81263
|
depositRate: supplyRate + rewardsRate,
|
|
81264
|
+
sharePrice,
|
|
79905
81265
|
apy: {
|
|
79906
81266
|
base: num9(v.apy?.apy),
|
|
79907
81267
|
campaign,
|
|
@@ -79910,7 +81270,11 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
79910
81270
|
},
|
|
79911
81271
|
curatorName,
|
|
79912
81272
|
curatorLogoURI: str4(strategist?.logo),
|
|
79913
|
-
description:
|
|
81273
|
+
description: describeUpshiftVault(
|
|
81274
|
+
str4(v.description),
|
|
81275
|
+
sharePrice,
|
|
81276
|
+
assetMeta?.symbol ?? asset0?.symbol
|
|
81277
|
+
),
|
|
79914
81278
|
version: str4(v.version),
|
|
79915
81279
|
fee: performanceWaived ? 0 : performanceStanding,
|
|
79916
81280
|
managementFee: managementWaived ? 0 : managementStanding,
|
|
@@ -79938,10 +81302,22 @@ function parseVault8(v, chainId, prices, tokenList) {
|
|
|
79938
81302
|
totalAssetsUsd
|
|
79939
81303
|
};
|
|
79940
81304
|
}
|
|
81305
|
+
var BELOW_PAR_SHARE_PRICE = 0.98;
|
|
81306
|
+
function describeUpshiftVault(curated, sharePrice, assetSymbol) {
|
|
81307
|
+
const parts = curated ? [curated] : [];
|
|
81308
|
+
if (Number.isFinite(sharePrice) && sharePrice > 0 && sharePrice < BELOW_PAR_SHARE_PRICE) {
|
|
81309
|
+
const unit = assetSymbol ? ` ${assetSymbol}` : "";
|
|
81310
|
+
const loss = ((1 - sharePrice) * 100).toFixed(1);
|
|
81311
|
+
parts.push(
|
|
81312
|
+
`Each share is worth ${sharePrice.toFixed(4)}${unit}, ${loss} % below the 1.0 the vault started at: its holders have lost value in${unit || " underlying"} terms.`
|
|
81313
|
+
);
|
|
81314
|
+
}
|
|
81315
|
+
return parts.length ? parts.join(" ") : void 0;
|
|
81316
|
+
}
|
|
79941
81317
|
var isServable = (v) => v?.isVisible !== false || v?.withdrawalOnly === true;
|
|
79942
|
-
var fetchUpshiftVaults = async (chainId, prices = {}, tokenList = {}) => {
|
|
81318
|
+
var fetchUpshiftVaults = async (chainId, prices = {}, tokenList = {}, multicallRetry = multicallRetryUniversal) => {
|
|
79943
81319
|
if (!hasUpshiftVaults(chainId)) return {};
|
|
79944
|
-
const items = await fetchUpshiftApiVaults();
|
|
81320
|
+
const items = await fetchUpshiftApiVaults(chainId, multicallRetry);
|
|
79945
81321
|
const want = Number(chainId);
|
|
79946
81322
|
const out = {};
|
|
79947
81323
|
for (const item of items) {
|
|
@@ -80375,6 +81751,18 @@ var classifyRedemption = (provider, v) => {
|
|
|
80375
81751
|
};
|
|
80376
81752
|
var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
|
|
80377
81753
|
// '1-0x…', // <chain>-<address> of a known volatile strategy vault
|
|
81754
|
+
// Neutrl sNUSD and Strata's NUSD tranches — DISTRESSED, not yield-bearing.
|
|
81755
|
+
// NUSD's reserves were impaired in August 2026 and it redeems at 0.51 USDC;
|
|
81756
|
+
// the share prices measured in NUSD froze (sNUSD) or collapsed (jrNUSD
|
|
81757
|
+
// 1.024 → 3.6e-6, srNUSD marked to ~$0.63), and none of them accrues. A
|
|
81758
|
+
// `yield-bearing` badge on any of them would state the opposite of what
|
|
81759
|
+
// happened. See `prices/oracle-prices/fetchers/distressed.ts`.
|
|
81760
|
+
"1-0x08efcc2f3e61185d0ea7f8830b3fec9bfa2ee313",
|
|
81761
|
+
// sNUSD
|
|
81762
|
+
"1-0x65a44528e8868166401ea08b549e19552af589db",
|
|
81763
|
+
// srNUSD
|
|
81764
|
+
"1-0xfc807058a352b61aeef6a38e2d0fc3990225e772",
|
|
81765
|
+
// jrNUSD
|
|
80378
81766
|
// Yield Basis yb-<ASSET> — 2×-leveraged Curve Cryptoswap LP positions
|
|
80379
81767
|
// with impermanent loss cancelled, registered under the `savings`
|
|
80380
81768
|
// provider. They live here because the share/asset ratio is NOT
|
|
@@ -81150,23 +82538,23 @@ var priceGmMarkets = async (chainId, multicallRetry, markets, prices) => {
|
|
|
81150
82538
|
const indexMax = price(prices, m.indexToken)?.max;
|
|
81151
82539
|
if (Array.isArray(dsRes) && longMax != null && shortMax != null) {
|
|
81152
82540
|
const base = i * SLOTS;
|
|
81153
|
-
const
|
|
82541
|
+
const big27 = (j) => typeof dsRes[base + j] === "bigint" ? dsRes[base + j] : 0n;
|
|
81154
82542
|
const cap = computeDepositCapacityUsd(
|
|
81155
|
-
[info?.longTokenAmount, longMax,
|
|
81156
|
-
[info?.shortTokenAmount, shortMax,
|
|
82543
|
+
[info?.longTokenAmount, longMax, big27(0), big27(2)],
|
|
82544
|
+
[info?.shortTokenAmount, shortMax, big27(1), big27(3)]
|
|
81157
82545
|
);
|
|
81158
82546
|
if (cap != null) value.depositCapacityUsd = cap;
|
|
81159
82547
|
if (indexMax != null) {
|
|
81160
82548
|
const divisor = m.longToken.toLowerCase() === m.shortToken.toLowerCase() ? 2n : 1n;
|
|
81161
|
-
const reservedUsdLong = (
|
|
81162
|
-
const reservedUsdShort = (
|
|
82549
|
+
const reservedUsdLong = (big27(4) + big27(5)) / divisor * indexMax;
|
|
82550
|
+
const reservedUsdShort = (big27(6) + big27(7)) / divisor;
|
|
81163
82551
|
const liq = computeLiquidityUsd(
|
|
81164
82552
|
info?.longTokenUsd,
|
|
81165
82553
|
info?.shortTokenUsd,
|
|
81166
82554
|
reservedUsdLong,
|
|
81167
82555
|
reservedUsdShort,
|
|
81168
|
-
|
|
81169
|
-
|
|
82556
|
+
big27(8),
|
|
82557
|
+
big27(9)
|
|
81170
82558
|
);
|
|
81171
82559
|
if (liq != null)
|
|
81172
82560
|
value.liquidityUsd = Math.max(0, Math.min(liq, value.tvlUsd));
|
|
@@ -81245,17 +82633,17 @@ var priceGlvVaults = async (chainId, multicallRetry, glvTokens, prices, marketIn
|
|
|
81245
82633
|
const sp = price(prices, short);
|
|
81246
82634
|
if (!lp || !sp) return;
|
|
81247
82635
|
const indexPrices = [];
|
|
81248
|
-
let
|
|
82636
|
+
let ok4 = true;
|
|
81249
82637
|
for (const m of markets) {
|
|
81250
82638
|
const idx = marketIndexToken.get(m.toLowerCase());
|
|
81251
82639
|
const ip = idx ? price(prices, idx) : void 0;
|
|
81252
82640
|
if (!ip) {
|
|
81253
|
-
|
|
82641
|
+
ok4 = false;
|
|
81254
82642
|
break;
|
|
81255
82643
|
}
|
|
81256
82644
|
indexPrices.push(ip);
|
|
81257
82645
|
}
|
|
81258
|
-
if (!
|
|
82646
|
+
if (!ok4) return;
|
|
81259
82647
|
calls.push({
|
|
81260
82648
|
address: c.glvReader,
|
|
81261
82649
|
name: "getGlvTokenPrice",
|
|
@@ -81365,21 +82753,21 @@ var fetchGmxExecutionFees = async (chainId, multicallRetry, gasPriceWei) => {
|
|
|
81365
82753
|
} catch {
|
|
81366
82754
|
return void 0;
|
|
81367
82755
|
}
|
|
81368
|
-
const
|
|
81369
|
-
const base =
|
|
81370
|
-
const mult =
|
|
82756
|
+
const big27 = (i) => typeof res[i] === "bigint" ? res[i] : 0n;
|
|
82757
|
+
const base = big27(0);
|
|
82758
|
+
const mult = big27(1);
|
|
81371
82759
|
if (base === 0n && mult === 0n) return void 0;
|
|
81372
82760
|
const PRECISION = 10n ** 30n;
|
|
81373
82761
|
const adjusted = (opGas) => base + opGas * mult / PRECISION;
|
|
81374
82762
|
const fee = (opGas) => (adjusted(opGas) * gasPriceWei).toString();
|
|
81375
|
-
const glvExtra =
|
|
82763
|
+
const glvExtra = big27(6) * GLV_NOMINAL_MARKET_COUNT;
|
|
81376
82764
|
return {
|
|
81377
82765
|
chainId,
|
|
81378
82766
|
gasPriceWei: gasPriceWei.toString(),
|
|
81379
|
-
deposit: fee(
|
|
81380
|
-
withdrawal: fee(
|
|
81381
|
-
glvDeposit: fee(
|
|
81382
|
-
glvWithdrawal: fee(
|
|
82767
|
+
deposit: fee(big27(2)),
|
|
82768
|
+
withdrawal: fee(big27(3)),
|
|
82769
|
+
glvDeposit: fee(big27(4) + glvExtra),
|
|
82770
|
+
glvWithdrawal: fee(big27(5) + glvExtra)
|
|
81383
82771
|
};
|
|
81384
82772
|
};
|
|
81385
82773
|
|
|
@@ -81480,8 +82868,8 @@ var fetchGmxVaults = async (chainId, multicallRetry, options) => {
|
|
|
81480
82868
|
marketIndexToken
|
|
81481
82869
|
)
|
|
81482
82870
|
]);
|
|
81483
|
-
for (const [
|
|
81484
|
-
const e = out[
|
|
82871
|
+
for (const [addr5, v] of gmValues) {
|
|
82872
|
+
const e = out[addr5];
|
|
81485
82873
|
if (e) {
|
|
81486
82874
|
e.priceUsd = v.priceUsd;
|
|
81487
82875
|
e.tvlUsd = v.tvlUsd;
|
|
@@ -81489,12 +82877,12 @@ var fetchGmxVaults = async (chainId, multicallRetry, options) => {
|
|
|
81489
82877
|
e.depositCapacityUsd = v.depositCapacityUsd;
|
|
81490
82878
|
}
|
|
81491
82879
|
}
|
|
81492
|
-
for (const [
|
|
81493
|
-
const e = out[
|
|
82880
|
+
for (const [addr5, v] of glv.values) {
|
|
82881
|
+
const e = out[addr5];
|
|
81494
82882
|
if (!e) continue;
|
|
81495
82883
|
e.priceUsd = v.priceUsd;
|
|
81496
82884
|
e.tvlUsd = v.tvlUsd;
|
|
81497
|
-
const markets2 = glv.glvMarkets.get(
|
|
82885
|
+
const markets2 = glv.glvMarkets.get(addr5) ?? [];
|
|
81498
82886
|
let liqSum = 0;
|
|
81499
82887
|
let tvlSum = 0;
|
|
81500
82888
|
for (const m of markets2) {
|
|
@@ -81506,7 +82894,7 @@ var fetchGmxVaults = async (chainId, multicallRetry, options) => {
|
|
|
81506
82894
|
}
|
|
81507
82895
|
if (tvlSum > 0 && v.tvlUsd != null)
|
|
81508
82896
|
e.liquidityUsd = v.tvlUsd * (liqSum / tvlSum);
|
|
81509
|
-
const caps = glv.glvCaps.get(
|
|
82897
|
+
const caps = glv.glvCaps.get(addr5) ?? [];
|
|
81510
82898
|
let capacity = 0;
|
|
81511
82899
|
let known = false;
|
|
81512
82900
|
for (const cap of caps) {
|
|
@@ -82031,8 +83419,8 @@ var SPECTRA_NETWORKS = {
|
|
|
82031
83419
|
var spectraNetwork = (chainId) => SPECTRA_NETWORKS[String(chainId)];
|
|
82032
83420
|
var hasSpectraMarkets = (chainId) => spectraNetwork(chainId) !== void 0;
|
|
82033
83421
|
var spectraPoolsUrl = (network) => `https://app.spectra.finance/api/v1/${network}/pools`;
|
|
82034
|
-
var
|
|
82035
|
-
var spectraAddress =
|
|
83422
|
+
var addr3 = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{40}$/.test(v) ? v.toLowerCase() : void 0;
|
|
83423
|
+
var spectraAddress = addr3;
|
|
82036
83424
|
function isLiveSpectraMarket(market, nowSecs = Math.floor(Date.now() / 1e3)) {
|
|
82037
83425
|
const maturity = market?.maturity;
|
|
82038
83426
|
if (typeof maturity !== "number" || !Number.isFinite(maturity)) return false;
|
|
@@ -82306,7 +83694,7 @@ var readVaultSharePrices = async (chainId, addresses, multicallRetry) => {
|
|
|
82306
83694
|
|
|
82307
83695
|
// src/vaults/yield/annualize.ts
|
|
82308
83696
|
var YEAR_SECONDS15 = 365 * 24 * 60 * 60;
|
|
82309
|
-
var
|
|
83697
|
+
var SCALE2 = 10n ** 18n;
|
|
82310
83698
|
var appendSnapshot = (points, snap, options) => {
|
|
82311
83699
|
const maxPoints = options?.maxPoints ?? 90;
|
|
82312
83700
|
const minInterval = options?.minIntervalSeconds ?? 0;
|
|
@@ -82332,7 +83720,7 @@ var computeVaultApr = (points, options) => {
|
|
|
82332
83720
|
if (windowSeconds < minWindow) return void 0;
|
|
82333
83721
|
const pThen = BigInt(then.p);
|
|
82334
83722
|
if (pThen === 0n) return void 0;
|
|
82335
|
-
const ratioScaled = BigInt(now.p) *
|
|
83723
|
+
const ratioScaled = BigInt(now.p) * SCALE2 / pThen;
|
|
82336
83724
|
const ratio = Number(ratioScaled) / 1e18;
|
|
82337
83725
|
const apr = (ratio - 1) * (YEAR_SECONDS15 / windowSeconds);
|
|
82338
83726
|
return {
|
|
@@ -82351,11 +83739,11 @@ function buildVaultLookup(data) {
|
|
|
82351
83739
|
const addEntries = (bag, provider) => {
|
|
82352
83740
|
if (!bag) return;
|
|
82353
83741
|
for (const v of Object.values(bag)) {
|
|
82354
|
-
const
|
|
82355
|
-
if (map.has(
|
|
82356
|
-
map.set(
|
|
83742
|
+
const addr5 = v.address.toLowerCase();
|
|
83743
|
+
if (map.has(addr5)) continue;
|
|
83744
|
+
map.set(addr5, {
|
|
82357
83745
|
provider,
|
|
82358
|
-
address:
|
|
83746
|
+
address: addr5,
|
|
82359
83747
|
underlying: v.underlying.toLowerCase(),
|
|
82360
83748
|
symbol: v.symbol,
|
|
82361
83749
|
name: v.name,
|
|
@@ -82605,24 +83993,24 @@ function shortDate(unixSecs) {
|
|
|
82605
83993
|
}
|
|
82606
83994
|
function feePhrase(fee) {
|
|
82607
83995
|
const magnitude = Math.abs(fee.value);
|
|
82608
|
-
let
|
|
83996
|
+
let amount5;
|
|
82609
83997
|
switch (fee.unit) {
|
|
82610
83998
|
case "bps":
|
|
82611
|
-
|
|
83999
|
+
amount5 = `${magnitude} bps`;
|
|
82612
84000
|
break;
|
|
82613
84001
|
case "apr-percent":
|
|
82614
|
-
|
|
84002
|
+
amount5 = `${pct(magnitude)}/yr`;
|
|
82615
84003
|
break;
|
|
82616
84004
|
case "percent":
|
|
82617
|
-
|
|
84005
|
+
amount5 = pct(magnitude);
|
|
82618
84006
|
break;
|
|
82619
84007
|
default:
|
|
82620
|
-
|
|
84008
|
+
amount5 = String(magnitude);
|
|
82621
84009
|
}
|
|
82622
84010
|
const rebate = fee.value < 0 ? " rebate" : "";
|
|
82623
84011
|
const qualifier = fee.indicative ? " (estimated, resolved at execution)" : "";
|
|
82624
84012
|
const bound = fee.mutable && fee.cap != null ? `, governance-set up to a maximum of ${fee.unit === "bps" ? `${fee.cap} bps` : pct(fee.cap)}` : fee.mutable ? ", governance-set" : "";
|
|
82625
|
-
return `${fee.label}: ${
|
|
84013
|
+
return `${fee.label}: ${amount5}${rebate}${bound}${qualifier}`;
|
|
82626
84014
|
}
|
|
82627
84015
|
function hasMatured(m, nowSecs) {
|
|
82628
84016
|
if (m.kind !== "fixed-date" || !m.maturity) return false;
|
|
@@ -82767,8 +84155,8 @@ function provenance(rate) {
|
|
|
82767
84155
|
function routePhrase(r, symbol) {
|
|
82768
84156
|
const when = r.kind === "instant" ? "instantly" : r.waitSeconds ? `after ${duration(r.waitSeconds)}` : r.kind === "market" ? "by selling it" : "after a wait";
|
|
82769
84157
|
const cost = r.feeBps === 0 ? " free" : r.feeBps != null ? ` for ${(r.feeBps / 100).toFixed(2)} %` : r.feeUnknown ? " for a fee" : "";
|
|
82770
|
-
const floor = r.minAmountFormatted != null && r.minAmountFormatted > 0 ? ` (min ${
|
|
82771
|
-
const cap = r.kind !== "instant" || r.capacityFormatted == null ? "" : r.capacityFormatted <= 0 ? ", though nothing is available right now" : `, up to ${
|
|
84158
|
+
const floor = r.minAmountFormatted != null && r.minAmountFormatted > 0 ? ` (min ${amount2(r.minAmountFormatted)}${symbol ? ` ${symbol}` : ""})` : "";
|
|
84159
|
+
const cap = r.kind !== "instant" || r.capacityFormatted == null ? "" : r.capacityFormatted <= 0 ? ", though nothing is available right now" : `, up to ${amount2(r.capacityFormatted)}${symbol ? ` ${symbol}` : ""} right now`;
|
|
82772
84160
|
return `${when}${cost}${floor}${cap}`;
|
|
82773
84161
|
}
|
|
82774
84162
|
function routesSentence(routes2, symbol) {
|
|
@@ -82776,7 +84164,7 @@ function routesSentence(routes2, symbol) {
|
|
|
82776
84164
|
const body = legs.length === 1 ? legs[0] : `${legs.slice(0, -1).join(", ")}, or ${legs[legs.length - 1]}`;
|
|
82777
84165
|
return `You can leave ${body}.`;
|
|
82778
84166
|
}
|
|
82779
|
-
function
|
|
84167
|
+
function amount2(v) {
|
|
82780
84168
|
if (v >= 1e3) return v.toLocaleString("en-US", { maximumFractionDigits: 0 });
|
|
82781
84169
|
if (v >= 1) return v.toFixed(2).replace(/\.?0+$/, "");
|
|
82782
84170
|
return v.toPrecision(3);
|
|
@@ -82788,7 +84176,7 @@ function headlineExitFromRoutes(routes2, symbol) {
|
|
|
82788
84176
|
if (!fast || !slow) return void 0;
|
|
82789
84177
|
const fastPart = fast.feeBps == null ? "instant exit" : fast.feeBps === 0 ? "free instant exit" : `instant exit for ${(fast.feeBps / 100).toFixed(2)} %`;
|
|
82790
84178
|
const slowCost = slow.feeBps === 0 ? "free" : slow.feeBps != null ? `${(slow.feeBps / 100).toFixed(2)} %` : void 0;
|
|
82791
|
-
const floor = slow.minAmountFormatted != null && slow.minAmountFormatted > 0 ? ` above ${
|
|
84179
|
+
const floor = slow.minAmountFormatted != null && slow.minAmountFormatted > 0 ? ` above ${amount2(slow.minAmountFormatted)}${symbol ? ` ${symbol}` : ""}` : "";
|
|
82792
84180
|
if (slow.id === "maturity") return `${fastPart}, or par at maturity`;
|
|
82793
84181
|
const slowPart = slowCost ? `queue${floor} for ${slowCost}` : `queue${floor}`;
|
|
82794
84182
|
return `${fastPart}, or ${slowPart}`;
|
|
@@ -85612,7 +87000,7 @@ function str6(v) {
|
|
|
85612
87000
|
if (typeof v === "number" && Number.isFinite(v)) return String(v);
|
|
85613
87001
|
return void 0;
|
|
85614
87002
|
}
|
|
85615
|
-
function
|
|
87003
|
+
function addr4(v, chainId) {
|
|
85616
87004
|
const s = str6(v);
|
|
85617
87005
|
if (s === void 0) return void 0;
|
|
85618
87006
|
return chainId === void 0 || isEvmChainId(chainId) ? s.toLowerCase() : s;
|
|
@@ -85691,7 +87079,8 @@ var RATE_KIND = {
|
|
|
85691
87079
|
savings: "variable-managed",
|
|
85692
87080
|
lst: "variable-managed",
|
|
85693
87081
|
lagoon: "variable-managed",
|
|
85694
|
-
|
|
87082
|
+
// a trailing realized `historical_apy` since 2026-10-17 (August catalogue)
|
|
87083
|
+
upshift: "realized",
|
|
85695
87084
|
yearn: "variable-managed",
|
|
85696
87085
|
hypercore: "realized",
|
|
85697
87086
|
gmx: "realized"
|
|
@@ -85711,7 +87100,7 @@ function resolveVaultBasket(provider, meta, chainId) {
|
|
|
85711
87100
|
if (provider !== "gmx") return void 0;
|
|
85712
87101
|
const legs = [];
|
|
85713
87102
|
const push2 = (address, symbol) => {
|
|
85714
|
-
const a =
|
|
87103
|
+
const a = addr4(address, chainId);
|
|
85715
87104
|
if (a)
|
|
85716
87105
|
legs.push({ address: a, ...str6(symbol) ? { symbol: str6(symbol) } : {} });
|
|
85717
87106
|
};
|
|
@@ -85730,12 +87119,12 @@ var RATE_UNAVAILABLE_SOURCES = /* @__PURE__ */ new Set(["unavailable", "exchange
|
|
|
85730
87119
|
var isRateSourceUnavailable = (rateSource) => !!rateSource && RATE_UNAVAILABLE_SOURCES.has(rateSource);
|
|
85731
87120
|
function earnMarketFromVault(row, chainId, opts = {}) {
|
|
85732
87121
|
const provider = str6(row.provider);
|
|
85733
|
-
const address =
|
|
85734
|
-
const underlying =
|
|
87122
|
+
const address = addr4(row.vaultAddress, chainId);
|
|
87123
|
+
const underlying = addr4(row.underlying, chainId);
|
|
85735
87124
|
if (!provider || !address || !underlying) return void 0;
|
|
85736
87125
|
const meta = row.providerMeta ?? {};
|
|
85737
87126
|
const basket = resolveVaultBasket(provider, meta, chainId);
|
|
85738
|
-
const shareAddress = (provider === "kamino-kvault" ?
|
|
87127
|
+
const shareAddress = (provider === "kamino-kvault" ? addr4(meta.shareMint, chainId) : void 0) ?? address;
|
|
85739
87128
|
const info = row.vaultInfo ?? {};
|
|
85740
87129
|
const rates = row.rates ?? {};
|
|
85741
87130
|
const tvl = row.tvl ?? {};
|
|
@@ -85844,13 +87233,13 @@ function earnMarketFromVault(row, chainId, opts = {}) {
|
|
|
85844
87233
|
// The vault origin reports RAW base units + a pre-formatted convenience
|
|
85845
87234
|
// field. Carry both; fall back to formatting the raw amount ourselves so
|
|
85846
87235
|
// `formatted` — the field consumers sort on — is never silently absent.
|
|
85847
|
-
tvl:
|
|
87236
|
+
tvl: amount3(
|
|
85848
87237
|
tvl.totalAssets,
|
|
85849
87238
|
tvl.totalAssetsFormatted,
|
|
85850
87239
|
tvl.totalAssetsUsd,
|
|
85851
87240
|
assetDecimals
|
|
85852
87241
|
),
|
|
85853
|
-
liquidity: liq.liquidity != null || liq.liquidityUsd != null ?
|
|
87242
|
+
liquidity: liq.liquidity != null || liq.liquidityUsd != null ? amount3(
|
|
85854
87243
|
liq.liquidity,
|
|
85855
87244
|
liq.liquidityFormatted,
|
|
85856
87245
|
liq.liquidityUsd,
|
|
@@ -85988,7 +87377,7 @@ function earnRateAtMaturity(rate, maturity, nowSecs) {
|
|
|
85988
87377
|
// bond's rate anything but `fixed-term` would lose what it was.
|
|
85989
87378
|
};
|
|
85990
87379
|
}
|
|
85991
|
-
function
|
|
87380
|
+
function amount3(raw, formatted, usd, decimals) {
|
|
85992
87381
|
const rawStr = raw != null ? String(raw) : void 0;
|
|
85993
87382
|
return {
|
|
85994
87383
|
raw: rawStr,
|
|
@@ -86015,7 +87404,7 @@ var num15 = (v) => {
|
|
|
86015
87404
|
return void 0;
|
|
86016
87405
|
};
|
|
86017
87406
|
var str7 = (v) => typeof v === "string" && v.trim() !== "" ? v : void 0;
|
|
86018
|
-
var
|
|
87407
|
+
var bool3 = (v) => typeof v === "boolean" ? v : void 0;
|
|
86019
87408
|
var routes = (v) => {
|
|
86020
87409
|
if (!Array.isArray(v)) return void 0;
|
|
86021
87410
|
const out = v.filter(
|
|
@@ -86078,7 +87467,7 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
86078
87467
|
logoURI: str7(asset?.logoURI)
|
|
86079
87468
|
},
|
|
86080
87469
|
...sdkRates(row, provider),
|
|
86081
|
-
isForwardApr:
|
|
87470
|
+
isForwardApr: bool3(row.isForwardApr),
|
|
86082
87471
|
aprWindow: str7(row.aprWindow),
|
|
86083
87472
|
// GMX / HyperCore / Pendle report USD only and set the token-denominated
|
|
86084
87473
|
// fields to their USD figure — `totalAssetsFormatted` is the cross-provider
|
|
@@ -86098,18 +87487,18 @@ function toVaultTermInput(vault, provider, chainId) {
|
|
|
86098
87487
|
managementFee: num15(row.managementFee),
|
|
86099
87488
|
swapFeeRate: num15(row.feeRate),
|
|
86100
87489
|
redemptionDiscountBps: num15(row.redemptionDiscountBps),
|
|
86101
|
-
instantRedeemEnabled:
|
|
87490
|
+
instantRedeemEnabled: bool3(row.instantRedeemEnabled),
|
|
86102
87491
|
yieldWarmupSeconds: num15(row.yieldWarmupSeconds),
|
|
86103
87492
|
accrual: str7(row.accrual),
|
|
86104
|
-
needsDepositApproval:
|
|
86105
|
-
isMintable:
|
|
87493
|
+
needsDepositApproval: bool3(row.needsDepositApproval),
|
|
87494
|
+
isMintable: bool3(row.isMintable),
|
|
86106
87495
|
depositCapacity: str7(row.depositCapacity),
|
|
86107
87496
|
supplyCap: str7(row.supplyCap),
|
|
86108
|
-
paused:
|
|
86109
|
-
depositsPaused:
|
|
86110
|
-
withdrawalsPaused:
|
|
86111
|
-
isClosed:
|
|
86112
|
-
whitelisted:
|
|
87497
|
+
paused: bool3(row.isPaused),
|
|
87498
|
+
depositsPaused: bool3(row.isDepositPaused),
|
|
87499
|
+
withdrawalsPaused: bool3(row.isWithdrawalPaused),
|
|
87500
|
+
isClosed: bool3(row.isClosed),
|
|
87501
|
+
whitelisted: bool3(row.whitelisted),
|
|
86113
87502
|
expiry: num15(row.expiry),
|
|
86114
87503
|
timelock: num15(row.timelock),
|
|
86115
87504
|
allocators: strArray(row.allocators),
|
|
@@ -86167,7 +87556,7 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
86167
87556
|
supplyRate: m.rate.base,
|
|
86168
87557
|
rewardsRate: m.rate.rewards,
|
|
86169
87558
|
totalRate: m.rate.total,
|
|
86170
|
-
isForwardApr:
|
|
87559
|
+
isForwardApr: bool3(meta.isForwardApr),
|
|
86171
87560
|
aprWindow: str7(meta.aprWindow),
|
|
86172
87561
|
totalAssets: m.tvl.formatted,
|
|
86173
87562
|
totalAssetsUsd: m.tvl.usd,
|
|
@@ -86184,10 +87573,10 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
86184
87573
|
managementFee: num15(meta.managementFee),
|
|
86185
87574
|
swapFeeRate: num15(meta.feeRate),
|
|
86186
87575
|
redemptionDiscountBps: num15(meta.redemptionDiscountBps),
|
|
86187
|
-
instantRedeemEnabled:
|
|
87576
|
+
instantRedeemEnabled: bool3(meta.instantRedeemEnabled),
|
|
86188
87577
|
yieldWarmupSeconds: num15(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
|
|
86189
87578
|
accrual: str7(meta.accrual) ?? curated.accrual,
|
|
86190
|
-
needsDepositApproval:
|
|
87579
|
+
needsDepositApproval: bool3(meta.needsDepositApproval) ?? curated.needsDepositApproval,
|
|
86191
87580
|
// `canDeposit` already folds in the cap, the pause and the gate, so it is
|
|
86192
87581
|
// the authoritative answer — but the REASON is what a disabled CTA renders,
|
|
86193
87582
|
// and that only survives in the raw fields.
|
|
@@ -86196,8 +87585,8 @@ function vaultTermInputFromEarnMarket(m) {
|
|
|
86196
87585
|
supplyCap: str7(meta.supplyCap),
|
|
86197
87586
|
paused: m.availability.gating === "paused" ? true : void 0,
|
|
86198
87587
|
withdrawalsPaused: m.availability.canWithdraw ? void 0 : true,
|
|
86199
|
-
isClosed:
|
|
86200
|
-
whitelisted:
|
|
87588
|
+
isClosed: bool3(meta.isClosed),
|
|
87589
|
+
whitelisted: bool3(meta.whitelisted),
|
|
86201
87590
|
expiry: m.maturity?.maturity ?? curated.expiry,
|
|
86202
87591
|
timelock: num15(meta.timelock),
|
|
86203
87592
|
allocators: strArray(meta.allocators),
|
|
@@ -86251,7 +87640,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
86251
87640
|
logoURI: str7(assetInfo?.logoURI)
|
|
86252
87641
|
},
|
|
86253
87642
|
...originRates(rates),
|
|
86254
|
-
isForwardApr:
|
|
87643
|
+
isForwardApr: bool3(meta.isForwardApr),
|
|
86255
87644
|
aprWindow: str7(meta.aprWindow),
|
|
86256
87645
|
totalAssets: num15(tvl.totalAssetsFormatted) ?? fromRaw(tvl.totalAssets, assetDecimals),
|
|
86257
87646
|
totalAssetsUsd: num15(tvl.totalAssetsUsd),
|
|
@@ -86268,18 +87657,18 @@ function vaultTermInputFromSourceRow(row, chainId) {
|
|
|
86268
87657
|
managementFee: num15(meta.managementFee),
|
|
86269
87658
|
swapFeeRate: num15(meta.feeRate),
|
|
86270
87659
|
redemptionDiscountBps: num15(meta.redemptionDiscountBps),
|
|
86271
|
-
instantRedeemEnabled:
|
|
87660
|
+
instantRedeemEnabled: bool3(meta.instantRedeemEnabled),
|
|
86272
87661
|
yieldWarmupSeconds: num15(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
|
|
86273
87662
|
accrual: str7(meta.accrual) ?? curated.accrual,
|
|
86274
|
-
needsDepositApproval:
|
|
86275
|
-
isMintable:
|
|
87663
|
+
needsDepositApproval: bool3(meta.needsDepositApproval) ?? curated.needsDepositApproval,
|
|
87664
|
+
isMintable: bool3(meta.isMintable),
|
|
86276
87665
|
depositCapacity: str7(meta.depositCapacity) ?? str7(meta.maxDeposit),
|
|
86277
87666
|
supplyCap: str7(meta.supplyCap),
|
|
86278
|
-
paused:
|
|
86279
|
-
depositsPaused:
|
|
86280
|
-
withdrawalsPaused:
|
|
86281
|
-
isClosed:
|
|
86282
|
-
whitelisted:
|
|
87667
|
+
paused: bool3(meta.paused) ?? bool3(meta.isPaused),
|
|
87668
|
+
depositsPaused: bool3(meta.isDepositPaused),
|
|
87669
|
+
withdrawalsPaused: bool3(meta.isWithdrawalPaused),
|
|
87670
|
+
isClosed: bool3(meta.isClosed),
|
|
87671
|
+
whitelisted: bool3(meta.whitelisted),
|
|
86283
87672
|
expiry: num15(meta.expiry) ?? num15(meta.maturity) ?? curated.expiry,
|
|
86284
87673
|
timelock: num15(meta.timelock),
|
|
86285
87674
|
allocators: strArray(meta.allocators),
|
|
@@ -86471,7 +87860,7 @@ var getVaultPublicDataAll = async (chainId, providers, multicallRetry, prices =
|
|
|
86471
87860
|
}
|
|
86472
87861
|
if (requested.has("upshift")) {
|
|
86473
87862
|
tasks.push(
|
|
86474
|
-
fetchUpshiftVaults(chainId, prices, tokenList).then((res) => {
|
|
87863
|
+
fetchUpshiftVaults(chainId, prices, tokenList, multicallRetry).then((res) => {
|
|
86475
87864
|
out.upshift = res;
|
|
86476
87865
|
}).catch((e) => {
|
|
86477
87866
|
fail("upshift", e);
|
|
@@ -86750,10 +88139,10 @@ var ERC20_BYTES32_ABI = [
|
|
|
86750
88139
|
type: "function"
|
|
86751
88140
|
}
|
|
86752
88141
|
];
|
|
86753
|
-
var
|
|
88142
|
+
var FAILED2 = "0x";
|
|
86754
88143
|
function decodeBytes32(value) {
|
|
86755
88144
|
if (typeof value !== "string" || !value.startsWith("0x")) return void 0;
|
|
86756
|
-
if (value ===
|
|
88145
|
+
if (value === FAILED2) return void 0;
|
|
86757
88146
|
try {
|
|
86758
88147
|
const decoded = hexToString(value).replace(/\0+$/, "").trim();
|
|
86759
88148
|
return decoded.length > 0 ? decoded : void 0;
|
|
@@ -86763,7 +88152,7 @@ function decodeBytes32(value) {
|
|
|
86763
88152
|
}
|
|
86764
88153
|
function asString(value) {
|
|
86765
88154
|
if (typeof value !== "string") return void 0;
|
|
86766
|
-
if (value ===
|
|
88155
|
+
if (value === FAILED2) return void 0;
|
|
86767
88156
|
const trimmed = value.trim();
|
|
86768
88157
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
86769
88158
|
}
|
|
@@ -88641,8 +90030,8 @@ var resupplyAdapter = {
|
|
|
88641
90030
|
}
|
|
88642
90031
|
};
|
|
88643
90032
|
function minLoanInAssetUnits(minLoanUsdWad, priceUsdWad, decimals) {
|
|
88644
|
-
const floor =
|
|
88645
|
-
const price2 =
|
|
90033
|
+
const floor = toBig7(minLoanUsdWad);
|
|
90034
|
+
const price2 = toBig7(priceUsdWad);
|
|
88646
90035
|
if (floor == null || price2 == null || floor === 0n || price2 === 0n) {
|
|
88647
90036
|
return void 0;
|
|
88648
90037
|
}
|
|
@@ -88652,7 +90041,7 @@ function minLoanInAssetUnits(minLoanUsdWad, priceUsdWad, decimals) {
|
|
|
88652
90041
|
const units = (scaled + price2 - 1n) / price2;
|
|
88653
90042
|
return units > 0n ? units.toString() : void 0;
|
|
88654
90043
|
}
|
|
88655
|
-
function
|
|
90044
|
+
function toBig7(v) {
|
|
88656
90045
|
if (typeof v === "bigint") return v;
|
|
88657
90046
|
if (typeof v === "number" && Number.isFinite(v)) return BigInt(Math.trunc(v));
|
|
88658
90047
|
if (typeof v === "string" && /^\d+$/.test(v)) return BigInt(v);
|
|
@@ -89999,8 +91388,8 @@ function enrichTermSheet(sheet, index) {
|
|
|
89999
91388
|
if (!exp) continue;
|
|
90000
91389
|
for (const item of exp.items) {
|
|
90001
91390
|
const chain = item.asset.chainId;
|
|
90002
|
-
const
|
|
90003
|
-
const q = quality?.[chain]?.[
|
|
91391
|
+
const addr5 = item.asset.address;
|
|
91392
|
+
const q = quality?.[chain]?.[addr5];
|
|
90004
91393
|
if (q) {
|
|
90005
91394
|
item.quality = {
|
|
90006
91395
|
riskScore: q.riskScore,
|
|
@@ -90064,7 +91453,7 @@ var approx = (a, b, tol = 1e-6) => Math.abs(a - b) <= tol;
|
|
|
90064
91453
|
function validateTermSheet(sheet) {
|
|
90065
91454
|
const v = [];
|
|
90066
91455
|
const uid = sheet.marketUid;
|
|
90067
|
-
const fail = (rule,
|
|
91456
|
+
const fail = (rule, message2) => v.push({ rule, message: message2, marketUid: uid });
|
|
90068
91457
|
if (sheet.schemaVersion !== TERM_SHEET_SCHEMA_VERSION)
|
|
90069
91458
|
fail("schema-version", `unexpected schemaVersion ${sheet.schemaVersion}`);
|
|
90070
91459
|
if (!sheet.profileId) fail("profile-id", "missing profileId");
|
|
@@ -90285,7 +91674,7 @@ function resolveBasket(row, chainId = row.chainId) {
|
|
|
90285
91674
|
str6(row.params?.market?.collateralProvider)
|
|
90286
91675
|
);
|
|
90287
91676
|
if (provider?.kind === "smart-lp" && provider.coins) {
|
|
90288
|
-
const rowAsset =
|
|
91677
|
+
const rowAsset = addr4(row.underlying) ?? addr4(row.asset?.address);
|
|
90289
91678
|
if (rowAsset && rowAsset === provider.collateralToken.toLowerCase()) {
|
|
90290
91679
|
return {
|
|
90291
91680
|
// The row's asset IS the receipt — one row for the whole position,
|
|
@@ -90313,9 +91702,9 @@ function resolveBasket(row, chainId = row.chainId) {
|
|
|
90313
91702
|
if (row.autoBalanced !== true) return void 0;
|
|
90314
91703
|
const f = row.fluid;
|
|
90315
91704
|
if (f && f.isSmartCol !== true) return void 0;
|
|
90316
|
-
const legs = (f?.collateralPair ?? []).map((a) =>
|
|
91705
|
+
const legs = (f?.collateralPair ?? []).map((a) => addr4(a, chainId)).filter((a) => !!a).map((address) => ({ address }));
|
|
90317
91706
|
if (legs.length > 0) {
|
|
90318
|
-
const rowAsset =
|
|
91707
|
+
const rowAsset = addr4(row.underlying, chainId) ?? addr4(row.asset?.address, chainId);
|
|
90319
91708
|
if (!rowAsset || !legs.some((l) => l.address === rowAsset)) return void 0;
|
|
90320
91709
|
}
|
|
90321
91710
|
return {
|
|
@@ -90342,7 +91731,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
90342
91731
|
if (!chainId || !venue) return void 0;
|
|
90343
91732
|
const flags = row.flags ?? {};
|
|
90344
91733
|
const assetInfo = row.underlyingInfo?.asset ?? row.asset ?? {};
|
|
90345
|
-
const underlying =
|
|
91734
|
+
const underlying = addr4(assetInfo.address, chainId) ?? addr4(row.underlying, chainId) ?? addr4(row.poolId, chainId);
|
|
90346
91735
|
if (!underlying) return void 0;
|
|
90347
91736
|
const decimals = num14(assetInfo.decimals) ?? num14(row.decimals) ?? 18;
|
|
90348
91737
|
const priceUsd = num14(row.underlyingInfo?.prices?.priceUsd) ?? num14(row.price);
|
|
@@ -90413,11 +91802,11 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
90413
91802
|
// so `formatted` is populated and `raw` is genuinely absent. Do NOT
|
|
90414
91803
|
// back-fill `raw` by re-scaling — the round-trip loses precision and would
|
|
90415
91804
|
// fabricate base units the origin never sent.
|
|
90416
|
-
tvl:
|
|
91805
|
+
tvl: amount4(
|
|
90417
91806
|
row.totalDeposits,
|
|
90418
91807
|
row.totalDepositsUSD ?? row.totalDepositsUsd
|
|
90419
91808
|
),
|
|
90420
|
-
liquidity:
|
|
91809
|
+
liquidity: amount4(
|
|
90421
91810
|
row.totalLiquidity,
|
|
90422
91811
|
row.totalLiquidityUSD ?? row.totalLiquidityUsd
|
|
90423
91812
|
),
|
|
@@ -90446,7 +91835,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
90446
91835
|
// reads them — two markets on the same pair at the same LLTV differ by
|
|
90447
91836
|
// nothing else, and one may price its collateral off a feed that ignores
|
|
90448
91837
|
// a depeg in it.
|
|
90449
|
-
oracle:
|
|
91838
|
+
oracle: addr4(
|
|
90450
91839
|
row.oracleInfo?.feeds?.find((f) => f?.oracle)?.oracle,
|
|
90451
91840
|
chainId
|
|
90452
91841
|
),
|
|
@@ -90520,7 +91909,7 @@ function sumRewardAprs(rewards) {
|
|
|
90520
91909
|
}
|
|
90521
91910
|
return seen ? total : void 0;
|
|
90522
91911
|
}
|
|
90523
|
-
function
|
|
91912
|
+
function amount4(formatted, usd) {
|
|
90524
91913
|
return { formatted: num14(formatted), usd: num14(usd) };
|
|
90525
91914
|
}
|
|
90526
91915
|
function sum2(...parts) {
|
|
@@ -90588,6 +91977,12 @@ function isSyntheticQuoteUnit(mint) {
|
|
|
90588
91977
|
return !!mint && mint !== WSOL && /1{16,}/.test(mint);
|
|
90589
91978
|
}
|
|
90590
91979
|
var EXPONENT_MATURED_REASON = "This PT has matured \u2014 it is redeemed at par through the Exponent vault (merge / redeem), which is not built in this API yet";
|
|
91980
|
+
var SPL_STAKE_POOL_OPEN = {
|
|
91981
|
+
verbs: ["deposit", "withdraw", "request-withdraw", "claim"],
|
|
91982
|
+
nativeDeposit: true,
|
|
91983
|
+
nativeWithdraw: true,
|
|
91984
|
+
requires: { withdraw: SHARES, "request-withdraw": SHARES }
|
|
91985
|
+
};
|
|
90591
91986
|
var SVM_EARN_VAULT_BUILDERS = {
|
|
90592
91987
|
// jl tokens: a pay-asset conversion on deposit, none on withdraw; the
|
|
90593
91988
|
// withdraw takes assets (or shares with isShares)
|
|
@@ -90737,6 +92132,21 @@ var SVM_EARN_VAULT_BUILDERS = {
|
|
|
90737
92132
|
],
|
|
90738
92133
|
nativeDeposit: true,
|
|
90739
92134
|
requires: { "request-withdraw": SHARES }
|
|
92135
|
+
},
|
|
92136
|
+
// SPL stake-pool LSTs (calldata-sdk-sol `ComposerStakePoolActions`): SOL /
|
|
92137
|
+
// wSOL in through the pool's own DepositSol, at NAV. Out: the instant
|
|
92138
|
+
// WithdrawSol from the reserve (by SHARES, capped by it) where the pool
|
|
92139
|
+
// lets holders take it, and on EVERY pool the unstake — WithdrawStake into
|
|
92140
|
+
// a wallet-owned stake account, deactivating (`request-withdraw`, by
|
|
92141
|
+
// SHARES) — then `claim` once the epoch has turned (pays SOL).
|
|
92142
|
+
"lst:Jito": SPL_STAKE_POOL_OPEN,
|
|
92143
|
+
"lst:SolBlaze": SPL_STAKE_POOL_OPEN,
|
|
92144
|
+
// BNSOL: the pool's SOL withdraw authority is its manager (a Binance key),
|
|
92145
|
+
// so the instant leg is closed to holders — the unstake is the pool-side exit
|
|
92146
|
+
"lst:Binance": {
|
|
92147
|
+
verbs: ["deposit", "request-withdraw", "claim"],
|
|
92148
|
+
nativeDeposit: true,
|
|
92149
|
+
requires: { "request-withdraw": SHARES }
|
|
90740
92150
|
}
|
|
90741
92151
|
};
|
|
90742
92152
|
var SVM_EARN_MINT_BUILDERS = {
|
|
@@ -90756,7 +92166,11 @@ var SVM_EARN_MINT_BUILDERS = {
|
|
|
90756
92166
|
// Sanctum INF
|
|
90757
92167
|
"5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm": "savings:Sanctum",
|
|
90758
92168
|
// Renzo ezSOL (Jito Restaking VRT)
|
|
90759
|
-
ezSoL6fY1PVdJcJsUpe5CM3xkfmy3zoVCABybm5WtiC: "lst:Renzo"
|
|
92169
|
+
ezSoL6fY1PVdJcJsUpe5CM3xkfmy3zoVCABybm5WtiC: "lst:Renzo",
|
|
92170
|
+
// SPL stake-pool LSTs (margin-fetcher-sol `SPL_STAKE_POOL_LSTS`)
|
|
92171
|
+
J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn: "lst:Jito",
|
|
92172
|
+
bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1: "lst:SolBlaze",
|
|
92173
|
+
BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85: "lst:Binance"
|
|
90760
92174
|
};
|
|
90761
92175
|
var ROSTER_BRAND_BUILDERS = /* @__PURE__ */ new Set([
|
|
90762
92176
|
"savings:Nest",
|