@1delta/margin-fetcher 5.0.122 → 5.0.125
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 +143 -13
- package/dist/index.js +860 -242
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Chain, isEvmChainId, isRetiredChain, isSvmChainId } from '@1delta/chain
|
|
|
9
9
|
import { multicallRetryUniversal, getEvmClient, getEvmClientWithCustomRpcsUniversal, LIST_OVERRIDES, getEvmChain, createMulticallRetryUniversal, getEvmClientUniversal } from '@1delta/providers';
|
|
10
10
|
import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, CurveTricryptoOracleAbi, Erc20Abi, CoolerMonoAbi, CoolerLtvOracleAbi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, TwyneCollateralVaultAbi, MetaMorphoAbi, FluidDexResolverAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, FlyingTulipLendingLensAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, RipeMissionControlAbi, RipeLedgerAbi, RipeVaultBookAbi, RipePriceDeskAbi, RipeVaultAbi, RipeCreditEngineAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, RipeHqAbi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, TwyneVaultManagerAbi, TwyneCollateralVaultFactoryAbi, AaveV2V3Abi, TwyneATokenWrapperAbi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
|
|
11
11
|
export { MorphoLensAbi } from '@1delta/abis';
|
|
12
|
-
import { NEST_SAVINGS_VAULTS, NEST_PREDICATE_PROXY, NEST_USDC, SUPERFORM_SUPERVAULTS, ROYCO_TRANCHES, STRATA_META_TRANCHES, prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, savingsVerbRequires, savingsSupportsVerb, getCompoundV2Comptroller as getCompoundV2Comptroller$1, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, FLUID_VAULT_FACTORY, getAaveStyleLenderTokenAddress, LendingMode, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses, ignoresReceiver, buildLstWithdrawRequest, SAVINGS_RECEIVER_CAPABILITY } from '@1delta/calldata-sdk';
|
|
12
|
+
import { NEST_SAVINGS_VAULTS, NEST_PREDICATE_PROXY, NEST_USDC, SUPERFORM_SUPERVAULTS, ROYCO_TRANCHES, STRATA_META_TRANCHES, MIDAS_VAULTS, MORINI_FXARB, prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, savingsVerbRequires, savingsSupportsVerb, getCompoundV2Comptroller as getCompoundV2Comptroller$1, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, FLUID_VAULT_FACTORY, getAaveStyleLenderTokenAddress, LendingMode, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses, ignoresReceiver, buildLstWithdrawRequest, SAVINGS_RECEIVER_CAPABILITY } from '@1delta/calldata-sdk';
|
|
13
13
|
import { proxyNativeFetch } from '@1delta/proxy-fetch';
|
|
14
14
|
import { BALANCER_V2_FORKS, BALANCER_V3_FORKS, UNISWAP_V4_FORKS, isFlashLoanSourceExcluded, FLASH_LOAN_IDS } from '@1delta/dex-registry';
|
|
15
15
|
import { getNativeDecimals, getWrappedNativeAddressSafe, isNativeWrapOneToOne } from '@1delta/wnative';
|
|
@@ -23295,11 +23295,30 @@ function convertTermMarketsToResponse(raw, chainId, prices = {}, _additionalYiel
|
|
|
23295
23295
|
}
|
|
23296
23296
|
return out;
|
|
23297
23297
|
}
|
|
23298
|
-
async function fetchExactlyMarkets(chainId) {
|
|
23298
|
+
async function fetchExactlyMarkets(chainId, multicallRetry) {
|
|
23299
23299
|
const cfg = exactlyConfig()?.[chainId];
|
|
23300
23300
|
if (!cfg?.previewer || !cfg?.auditor) {
|
|
23301
23301
|
return { markets: [], liquidationIncentive: null };
|
|
23302
23302
|
}
|
|
23303
|
+
if (multicallRetry) {
|
|
23304
|
+
let res = [];
|
|
23305
|
+
try {
|
|
23306
|
+
res = await multicallRetry({
|
|
23307
|
+
chain: chainId,
|
|
23308
|
+
calls: [
|
|
23309
|
+
{ address: cfg.previewer, name: "exactly", params: [zeroAddress] },
|
|
23310
|
+
{ address: cfg.auditor, name: "liquidationIncentive", params: [] }
|
|
23311
|
+
],
|
|
23312
|
+
abi: [ExactlyPreviewerAbi, ExactlyAuditorAbi],
|
|
23313
|
+
allowFailure: true
|
|
23314
|
+
});
|
|
23315
|
+
} catch {
|
|
23316
|
+
}
|
|
23317
|
+
const markets2 = Array.isArray(res[0]) ? [...res[0]] : [];
|
|
23318
|
+
const li = res[1];
|
|
23319
|
+
const liquidationIncentive2 = Array.isArray(li) ? { liquidator: li[0], lenders: li[1] } : null;
|
|
23320
|
+
return { markets: markets2, liquidationIncentive: liquidationIncentive2 };
|
|
23321
|
+
}
|
|
23303
23322
|
const client = getEvmClient(chainId);
|
|
23304
23323
|
const [markets, liquidationIncentive] = await Promise.all([
|
|
23305
23324
|
client.readContract({
|
|
@@ -23748,7 +23767,7 @@ var LIQUITY_PUBLIC_READ_ABI = [
|
|
|
23748
23767
|
...LiquityPriceFeedAbi,
|
|
23749
23768
|
...LiquitySortedTrovesAbi
|
|
23750
23769
|
];
|
|
23751
|
-
async function fetchLiquityMarkets(lender, chainId) {
|
|
23770
|
+
async function fetchLiquityMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
23752
23771
|
const config = liquityConfigFor(lender, chainId);
|
|
23753
23772
|
const branches = liquityBranchesByChain(lender, chainId);
|
|
23754
23773
|
if (!config || branches.length === 0) {
|
|
@@ -23766,7 +23785,7 @@ async function fetchLiquityMarkets(lender, chainId) {
|
|
|
23766
23785
|
]);
|
|
23767
23786
|
let results = [];
|
|
23768
23787
|
try {
|
|
23769
|
-
results = await
|
|
23788
|
+
results = await multicallRetry({
|
|
23770
23789
|
chain: chainId,
|
|
23771
23790
|
calls,
|
|
23772
23791
|
abi: LIQUITY_PUBLIC_READ_ABI,
|
|
@@ -24052,7 +24071,7 @@ var RIVER_PUBLIC_READ_ABI = [
|
|
|
24052
24071
|
...RiverTroveManagerAbi,
|
|
24053
24072
|
...RiverStabilityPoolAbi
|
|
24054
24073
|
];
|
|
24055
|
-
async function fetchRiverMarkets(lender, chainId) {
|
|
24074
|
+
async function fetchRiverMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
24056
24075
|
const config = riverConfigFor(lender, chainId);
|
|
24057
24076
|
const chainData = riverChainData(lender, chainId);
|
|
24058
24077
|
const markets = chainData?.markets ?? [];
|
|
@@ -24077,7 +24096,7 @@ async function fetchRiverMarkets(lender, chainId) {
|
|
|
24077
24096
|
];
|
|
24078
24097
|
let results = [];
|
|
24079
24098
|
try {
|
|
24080
|
-
results = await
|
|
24099
|
+
results = await multicallRetry({
|
|
24081
24100
|
chain: chainId,
|
|
24082
24101
|
calls,
|
|
24083
24102
|
abi: RIVER_PUBLIC_READ_ABI,
|
|
@@ -24318,7 +24337,7 @@ function convertRiverMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
24318
24337
|
var READS_PER_POOL = 7;
|
|
24319
24338
|
var READS_PER_MARKET = 4;
|
|
24320
24339
|
var MARKET_PHASE_ABI = [...TellerMarketRegistryAbi, ...TellerV2Abi];
|
|
24321
|
-
async function fetchTellerMarkets(chainId) {
|
|
24340
|
+
async function fetchTellerMarkets(chainId, multicallRetry = multicallRetryUniversal) {
|
|
24322
24341
|
const pools = tellerPoolsByChain(chainId);
|
|
24323
24342
|
if (pools.length === 0) return { chainId, pools: [] };
|
|
24324
24343
|
const marketRegistry = tellerConfigByChain(chainId)?.marketRegistry;
|
|
@@ -24344,7 +24363,7 @@ async function fetchTellerMarkets(chainId) {
|
|
|
24344
24363
|
});
|
|
24345
24364
|
let results = [];
|
|
24346
24365
|
try {
|
|
24347
|
-
results = await
|
|
24366
|
+
results = await multicallRetry({
|
|
24348
24367
|
chain: chainId,
|
|
24349
24368
|
calls,
|
|
24350
24369
|
abi: LenderCommitmentGroupAbi,
|
|
@@ -24411,7 +24430,7 @@ async function fetchTellerMarkets(chainId) {
|
|
|
24411
24430
|
])
|
|
24412
24431
|
];
|
|
24413
24432
|
try {
|
|
24414
|
-
const mRes = await
|
|
24433
|
+
const mRes = await multicallRetry({
|
|
24415
24434
|
chain: chainId,
|
|
24416
24435
|
calls: mCalls,
|
|
24417
24436
|
abi: MARKET_PHASE_ABI,
|
|
@@ -25482,7 +25501,7 @@ var toNum3 = (v) => {
|
|
|
25482
25501
|
if (typeof v === "bigint") return Number(v);
|
|
25483
25502
|
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
25484
25503
|
};
|
|
25485
|
-
var fetchInverseChainWide = async (chainId, config) => {
|
|
25504
|
+
var fetchInverseChainWide = async (chainId, config, multicallRetry) => {
|
|
25486
25505
|
const pool = config.dbrPricePool;
|
|
25487
25506
|
const calls = [
|
|
25488
25507
|
{ address: config.dbr, name: "replenishmentPriceBps", params: [] }
|
|
@@ -25495,7 +25514,7 @@ var fetchInverseChainWide = async (chainId, config) => {
|
|
|
25495
25514
|
);
|
|
25496
25515
|
}
|
|
25497
25516
|
try {
|
|
25498
|
-
const r = await
|
|
25517
|
+
const r = await multicallRetry({
|
|
25499
25518
|
chain: chainId,
|
|
25500
25519
|
calls,
|
|
25501
25520
|
abi: INVERSE_PUBLIC_READ_ABI,
|
|
@@ -25525,7 +25544,7 @@ var resolveDbrPriceDola = async (onChain, snapshot) => {
|
|
|
25525
25544
|
const snap = Number(snapshot);
|
|
25526
25545
|
return Number.isFinite(snap) && snap > 0 ? snap : null;
|
|
25527
25546
|
};
|
|
25528
|
-
async function fetchInverseMarkets(lender, chainId) {
|
|
25547
|
+
async function fetchInverseMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
25529
25548
|
const config = inverseConfigFor(lender, chainId);
|
|
25530
25549
|
const chainData = inverseChainData(lender, chainId);
|
|
25531
25550
|
const markets = chainData?.markets ?? [];
|
|
@@ -25539,7 +25558,11 @@ async function fetchInverseMarkets(lender, chainId) {
|
|
|
25539
25558
|
source: "none"
|
|
25540
25559
|
};
|
|
25541
25560
|
if (!config || markets.length === 0) return empty2;
|
|
25542
|
-
const chainWidePromise = fetchInverseChainWide(
|
|
25561
|
+
const chainWidePromise = fetchInverseChainWide(
|
|
25562
|
+
chainId,
|
|
25563
|
+
config,
|
|
25564
|
+
multicallRetry
|
|
25565
|
+
);
|
|
25543
25566
|
const dbrPricePromise = chainWidePromise.then(
|
|
25544
25567
|
(c) => resolveDbrPriceDola(c.dbrPriceDola, config.dbrPriceDolaSnapshot)
|
|
25545
25568
|
);
|
|
@@ -25601,7 +25624,7 @@ async function fetchInverseMarkets(lender, chainId) {
|
|
|
25601
25624
|
])
|
|
25602
25625
|
];
|
|
25603
25626
|
try {
|
|
25604
|
-
const results = await
|
|
25627
|
+
const results = await multicallRetry({
|
|
25605
25628
|
chain: chainId,
|
|
25606
25629
|
calls,
|
|
25607
25630
|
abi: INVERSE_PUBLIC_READ_ABI,
|
|
@@ -25684,7 +25707,7 @@ var big2 = (v) => {
|
|
|
25684
25707
|
}
|
|
25685
25708
|
return null;
|
|
25686
25709
|
};
|
|
25687
|
-
async function fetchCoolerMarkets(lender, chainId) {
|
|
25710
|
+
async function fetchCoolerMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
25688
25711
|
const config = coolerConfigFor(lender, chainId);
|
|
25689
25712
|
const empty2 = {
|
|
25690
25713
|
lender,
|
|
@@ -25721,7 +25744,7 @@ async function fetchCoolerMarkets(lender, chainId) {
|
|
|
25721
25744
|
{ address: config.susds, name: "maxWithdraw", params: [config.treasury] }
|
|
25722
25745
|
];
|
|
25723
25746
|
try {
|
|
25724
|
-
const results = await
|
|
25747
|
+
const results = await multicallRetry({
|
|
25725
25748
|
chain: chainId,
|
|
25726
25749
|
calls,
|
|
25727
25750
|
abi: COOLER_PUBLIC_READ_ABI,
|
|
@@ -26059,12 +26082,12 @@ var big3 = (v) => {
|
|
|
26059
26082
|
if (typeof v === "number") return BigInt(v);
|
|
26060
26083
|
return null;
|
|
26061
26084
|
};
|
|
26062
|
-
async function fetchResupplyMarkets(lender, chainId) {
|
|
26085
|
+
async function fetchResupplyMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
26063
26086
|
const config = resupplyConfigFor(lender, chainId);
|
|
26064
26087
|
if (!config?.registry) return { lender, config, pairs: [] };
|
|
26065
26088
|
let discovered = [];
|
|
26066
26089
|
try {
|
|
26067
|
-
const [addresses] = await
|
|
26090
|
+
const [addresses] = await multicallRetry({
|
|
26068
26091
|
chain: chainId,
|
|
26069
26092
|
calls: [
|
|
26070
26093
|
{ address: config.registry, name: "getAllPairAddresses", params: [] }
|
|
@@ -26097,7 +26120,7 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26097
26120
|
]);
|
|
26098
26121
|
let res = [];
|
|
26099
26122
|
try {
|
|
26100
|
-
res = await
|
|
26123
|
+
res = await multicallRetry({
|
|
26101
26124
|
chain: chainId,
|
|
26102
26125
|
calls: calls2,
|
|
26103
26126
|
abi: unknown.flatMap(() => [
|
|
@@ -26129,7 +26152,7 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26129
26152
|
if (pending.length > 0) {
|
|
26130
26153
|
let dec2 = [];
|
|
26131
26154
|
try {
|
|
26132
|
-
dec2 = await
|
|
26155
|
+
dec2 = await multicallRetry({
|
|
26133
26156
|
chain: chainId,
|
|
26134
26157
|
calls: pending.flatMap((p) => [
|
|
26135
26158
|
{ address: p.collateral, name: "decimals", params: [] },
|
|
@@ -26179,7 +26202,8 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26179
26202
|
const { rsup, pairEmissions, convexPoolUtil } = await readRewardContext(
|
|
26180
26203
|
chainId,
|
|
26181
26204
|
config.registry,
|
|
26182
|
-
config.utilities
|
|
26205
|
+
config.utilities,
|
|
26206
|
+
multicallRetry
|
|
26183
26207
|
);
|
|
26184
26208
|
const utilities = config.utilities;
|
|
26185
26209
|
const calls = [];
|
|
@@ -26247,7 +26271,7 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26247
26271
|
const from = i * STATE_READS;
|
|
26248
26272
|
const to = Math.min(i + PAIRS_PER_BATCH, identities.length) * STATE_READS;
|
|
26249
26273
|
try {
|
|
26250
|
-
const chunk7 = await
|
|
26274
|
+
const chunk7 = await multicallRetry({
|
|
26251
26275
|
chain: chainId,
|
|
26252
26276
|
calls: calls.slice(from, to),
|
|
26253
26277
|
abi: abis.slice(from, to),
|
|
@@ -26288,7 +26312,7 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26288
26312
|
collateralRewards: []
|
|
26289
26313
|
};
|
|
26290
26314
|
});
|
|
26291
|
-
await attachCollateralRewards(chainId, convexPoolUtil, pairs);
|
|
26315
|
+
await attachCollateralRewards(chainId, convexPoolUtil, pairs, multicallRetry);
|
|
26292
26316
|
setResupplyPairRoster(
|
|
26293
26317
|
chainId,
|
|
26294
26318
|
lender,
|
|
@@ -26299,10 +26323,10 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
26299
26323
|
);
|
|
26300
26324
|
return { lender, config, pairs, rsup };
|
|
26301
26325
|
}
|
|
26302
|
-
async function readRewardContext(chainId, registry, utilities) {
|
|
26326
|
+
async function readRewardContext(chainId, registry, utilities, multicallRetry) {
|
|
26303
26327
|
const addr5 = (v) => typeof v === "string" && v.startsWith("0x") && !/^0x0+$/.test(v) ? v : void 0;
|
|
26304
26328
|
try {
|
|
26305
|
-
const first = await
|
|
26329
|
+
const first = await multicallRetry({
|
|
26306
26330
|
chain: chainId,
|
|
26307
26331
|
calls: [
|
|
26308
26332
|
{ address: registry, name: "rewardHandler", params: [] },
|
|
@@ -26320,7 +26344,7 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
26320
26344
|
const govToken = addr5(first[1]);
|
|
26321
26345
|
const convexPoolUtil = utilities ? addr5(first[2]) : void 0;
|
|
26322
26346
|
if (!rewardHandler || !govToken) return { convexPoolUtil };
|
|
26323
|
-
const [emissions] = await
|
|
26347
|
+
const [emissions] = await multicallRetry({
|
|
26324
26348
|
chain: chainId,
|
|
26325
26349
|
calls: [{ address: rewardHandler, name: "pairEmissions", params: [] }],
|
|
26326
26350
|
abi: ResupplyRewardHandlerAbi,
|
|
@@ -26328,7 +26352,7 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
26328
26352
|
});
|
|
26329
26353
|
const pairEmissions = addr5(emissions);
|
|
26330
26354
|
if (!pairEmissions) return { convexPoolUtil };
|
|
26331
|
-
const stream = await
|
|
26355
|
+
const stream = await multicallRetry({
|
|
26332
26356
|
chain: chainId,
|
|
26333
26357
|
calls: [
|
|
26334
26358
|
{ address: pairEmissions, name: "periodFinish", params: [] },
|
|
@@ -26360,13 +26384,13 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
26360
26384
|
return {};
|
|
26361
26385
|
}
|
|
26362
26386
|
}
|
|
26363
|
-
async function attachCollateralRewards(chainId, convexPoolUtil, pairs) {
|
|
26387
|
+
async function attachCollateralRewards(chainId, convexPoolUtil, pairs, multicallRetry) {
|
|
26364
26388
|
if (!convexPoolUtil) return;
|
|
26365
26389
|
const staked = pairs.filter((p) => (p.convexPid ?? 0n) > 0n);
|
|
26366
26390
|
if (staked.length === 0) return;
|
|
26367
26391
|
let res = [];
|
|
26368
26392
|
try {
|
|
26369
|
-
res = await
|
|
26393
|
+
res = await multicallRetry({
|
|
26370
26394
|
chain: chainId,
|
|
26371
26395
|
calls: staked.map((p) => ({
|
|
26372
26396
|
address: convexPoolUtil,
|
|
@@ -26429,15 +26453,15 @@ var num3 = (v, fallback) => {
|
|
|
26429
26453
|
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
26430
26454
|
};
|
|
26431
26455
|
var str = (v, fallback) => typeof v === "string" && v.length > 0 ? v : fallback;
|
|
26432
|
-
async function fetchCurvanceMarkets(lender, chainId) {
|
|
26456
|
+
async function fetchCurvanceMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
26433
26457
|
const config = curvanceConfigFor(lender, chainId);
|
|
26434
26458
|
if (!config?.centralRegistry) return { lender, config, markets: [] };
|
|
26435
26459
|
let result = { lender, config, markets: [] };
|
|
26436
26460
|
if (config.protocolReader) {
|
|
26437
|
-
result = await fetchViaReader(lender, chainId, config);
|
|
26461
|
+
result = await fetchViaReader(lender, chainId, config, multicallRetry);
|
|
26438
26462
|
}
|
|
26439
26463
|
if (result.markets.length === 0) {
|
|
26440
|
-
result = await fetchViaMulticall(lender, chainId, config);
|
|
26464
|
+
result = await fetchViaMulticall(lender, chainId, config, multicallRetry);
|
|
26441
26465
|
}
|
|
26442
26466
|
setCurvanceAssetRoster(
|
|
26443
26467
|
chainId,
|
|
@@ -26449,11 +26473,11 @@ async function fetchCurvanceMarkets(lender, chainId) {
|
|
|
26449
26473
|
);
|
|
26450
26474
|
return result;
|
|
26451
26475
|
}
|
|
26452
|
-
async function fetchMinLoanSizes(chainId, marketManagers) {
|
|
26476
|
+
async function fetchMinLoanSizes(chainId, marketManagers, multicallRetry) {
|
|
26453
26477
|
const out = /* @__PURE__ */ new Map();
|
|
26454
26478
|
if (marketManagers.length === 0) return out;
|
|
26455
26479
|
try {
|
|
26456
|
-
const res = await
|
|
26480
|
+
const res = await multicallRetry({
|
|
26457
26481
|
chain: chainId,
|
|
26458
26482
|
calls: marketManagers.map((mm) => ({
|
|
26459
26483
|
address: mm,
|
|
@@ -26473,7 +26497,7 @@ async function fetchMinLoanSizes(chainId, marketManagers) {
|
|
|
26473
26497
|
}
|
|
26474
26498
|
return out;
|
|
26475
26499
|
}
|
|
26476
|
-
async function fetchViaReader(lender, chainId, config) {
|
|
26500
|
+
async function fetchViaReader(lender, chainId, config, multicallRetry) {
|
|
26477
26501
|
const reader = config.protocolReader;
|
|
26478
26502
|
let staticData = [];
|
|
26479
26503
|
let dynamicData = [];
|
|
@@ -26570,17 +26594,18 @@ async function fetchViaReader(lender, chainId, config) {
|
|
|
26570
26594
|
}
|
|
26571
26595
|
const minLoans = await fetchMinLoanSizes(
|
|
26572
26596
|
chainId,
|
|
26573
|
-
markets.map((mk) => mk.marketManager)
|
|
26597
|
+
markets.map((mk) => mk.marketManager),
|
|
26598
|
+
multicallRetry
|
|
26574
26599
|
);
|
|
26575
26600
|
for (const mk of markets) {
|
|
26576
26601
|
mk.minLoanSizeUsdWad = minLoans.get(mk.marketManager.toLowerCase()) ?? 0n;
|
|
26577
26602
|
}
|
|
26578
26603
|
return { lender, config, markets };
|
|
26579
26604
|
}
|
|
26580
|
-
async function fetchViaMulticall(lender, chainId, config) {
|
|
26605
|
+
async function fetchViaMulticall(lender, chainId, config, multicallRetry) {
|
|
26581
26606
|
let managers = [];
|
|
26582
26607
|
try {
|
|
26583
|
-
const [res] = await
|
|
26608
|
+
const [res] = await multicallRetry({
|
|
26584
26609
|
chain: chainId,
|
|
26585
26610
|
calls: [
|
|
26586
26611
|
{
|
|
@@ -26605,7 +26630,7 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
26605
26630
|
if (managers.length === 0) return { lender, config, markets: [] };
|
|
26606
26631
|
let listed = [];
|
|
26607
26632
|
try {
|
|
26608
|
-
listed = await
|
|
26633
|
+
listed = await multicallRetry({
|
|
26609
26634
|
chain: chainId,
|
|
26610
26635
|
calls: managers.flatMap((mm) => [
|
|
26611
26636
|
{ address: mm, name: "queryTokensListed", params: [] },
|
|
@@ -26670,7 +26695,7 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
26670
26695
|
const from = i * FALLBACK_TOKEN_READS;
|
|
26671
26696
|
const to = Math.min(i + TOKENS_PER_BATCH, pairs.length) * FALLBACK_TOKEN_READS;
|
|
26672
26697
|
try {
|
|
26673
|
-
const chunk7 = await
|
|
26698
|
+
const chunk7 = await multicallRetry({
|
|
26674
26699
|
chain: chainId,
|
|
26675
26700
|
calls: calls.slice(from, to),
|
|
26676
26701
|
abi: abis.slice(from, to),
|
|
@@ -26684,7 +26709,7 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
26684
26709
|
const assets = pairs.map((_3, i) => results[i * FALLBACK_TOKEN_READS + 7]);
|
|
26685
26710
|
let assetMeta = [];
|
|
26686
26711
|
try {
|
|
26687
|
-
assetMeta = await
|
|
26712
|
+
assetMeta = await multicallRetry({
|
|
26688
26713
|
chain: chainId,
|
|
26689
26714
|
calls: assets.flatMap((a) => [
|
|
26690
26715
|
{ address: a ?? zero, name: "symbol", params: [] },
|
|
@@ -26768,7 +26793,8 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
26768
26793
|
const out = [...byManager.values()];
|
|
26769
26794
|
const minLoans = await fetchMinLoanSizes(
|
|
26770
26795
|
chainId,
|
|
26771
|
-
out.map((mk) => mk.marketManager)
|
|
26796
|
+
out.map((mk) => mk.marketManager),
|
|
26797
|
+
multicallRetry
|
|
26772
26798
|
);
|
|
26773
26799
|
for (const mk of out) {
|
|
26774
26800
|
mk.minLoanSizeUsdWad = minLoans.get(mk.marketManager.toLowerCase()) ?? 0n;
|
|
@@ -26841,7 +26867,7 @@ var big5 = (v) => {
|
|
|
26841
26867
|
if (typeof v === "string" && /^(0x[0-9a-fA-F]+|\d+)$/.test(v)) return BigInt(v);
|
|
26842
26868
|
return void 0;
|
|
26843
26869
|
};
|
|
26844
|
-
async function fetchTwyneMarkets(lender, chainId) {
|
|
26870
|
+
async function fetchTwyneMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
26845
26871
|
const config = twyneConfigFor(lender, chainId);
|
|
26846
26872
|
const markets = twyneChainData(lender, chainId)?.markets ?? [];
|
|
26847
26873
|
if (!config?.collateralVaultFactory || markets.length === 0) return void 0;
|
|
@@ -26858,13 +26884,13 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26858
26884
|
// permission, and there is no per-account gate on these vaults.
|
|
26859
26885
|
{ address: m.intermediateVault, name: "maxDeposit", args: ["0x000000000000000000000000000000000000dEaD"] }
|
|
26860
26886
|
]);
|
|
26861
|
-
const creditReads = await
|
|
26887
|
+
const creditReads = await multicallRetry({
|
|
26862
26888
|
chain: chainId,
|
|
26863
26889
|
calls: perMarket,
|
|
26864
26890
|
abi: EVK_ABI,
|
|
26865
26891
|
allowFailure: true
|
|
26866
26892
|
});
|
|
26867
|
-
const bounds = await
|
|
26893
|
+
const bounds = await multicallRetry({
|
|
26868
26894
|
chain: chainId,
|
|
26869
26895
|
calls: markets.flatMap((m) => [
|
|
26870
26896
|
{ address: config.vaultManager, name: "maxTwyneLTVs", args: [m.intermediateVault] },
|
|
@@ -26873,7 +26899,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26873
26899
|
abi: TwyneVaultManagerAbi,
|
|
26874
26900
|
allowFailure: true
|
|
26875
26901
|
});
|
|
26876
|
-
const [pausedRaw] = await
|
|
26902
|
+
const [pausedRaw] = await multicallRetry({
|
|
26877
26903
|
chain: chainId,
|
|
26878
26904
|
calls: [{ address: config.collateralVaultFactory, name: "paused", args: [] }],
|
|
26879
26905
|
abi: TwyneCollateralVaultFactoryAbi,
|
|
@@ -26882,7 +26908,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26882
26908
|
const paused = Boolean(pausedRaw);
|
|
26883
26909
|
const aaveMarkets = markets.filter((m) => m.vaultType === "AAVE_V3");
|
|
26884
26910
|
const eulerMarkets = markets.filter((m) => m.vaultType === "EULER_V2");
|
|
26885
|
-
const aaveEmode = aaveMarkets.length ? await
|
|
26911
|
+
const aaveEmode = aaveMarkets.length ? await multicallRetry({
|
|
26886
26912
|
chain: chainId,
|
|
26887
26913
|
calls: aaveMarkets.map((m) => ({
|
|
26888
26914
|
address: m.targetVault,
|
|
@@ -26892,7 +26918,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26892
26918
|
abi: AAVE_EMODE_ABI,
|
|
26893
26919
|
allowFailure: true
|
|
26894
26920
|
}) : [];
|
|
26895
|
-
const aaveReserves6 = aaveMarkets.length ? await
|
|
26921
|
+
const aaveReserves6 = aaveMarkets.length ? await multicallRetry({
|
|
26896
26922
|
chain: chainId,
|
|
26897
26923
|
calls: aaveMarkets.flatMap((m) => [
|
|
26898
26924
|
{ address: m.targetVault, name: "getReserveData", args: [m.underlyingAsset] },
|
|
@@ -26901,7 +26927,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26901
26927
|
abi: AaveV2V3Abi,
|
|
26902
26928
|
allowFailure: true
|
|
26903
26929
|
}) : [];
|
|
26904
|
-
const eulerReads = eulerMarkets.length ? await
|
|
26930
|
+
const eulerReads = eulerMarkets.length ? await multicallRetry({
|
|
26905
26931
|
chain: chainId,
|
|
26906
26932
|
calls: eulerMarkets.flatMap((m) => [
|
|
26907
26933
|
{ address: m.targetVault, name: "LTVLiquidation", args: [m.collateralAsset] },
|
|
@@ -26918,7 +26944,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26918
26944
|
abi: EVK_ABI,
|
|
26919
26945
|
allowFailure: true
|
|
26920
26946
|
}) : [];
|
|
26921
|
-
const scaleReads = await
|
|
26947
|
+
const scaleReads = await multicallRetry({
|
|
26922
26948
|
chain: chainId,
|
|
26923
26949
|
calls: markets.flatMap((m) => [
|
|
26924
26950
|
{ address: m.underlyingAsset, name: "decimals", args: [] },
|
|
@@ -26929,7 +26955,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
26929
26955
|
abi: ERC20_ABI,
|
|
26930
26956
|
allowFailure: true
|
|
26931
26957
|
});
|
|
26932
|
-
const wrapperReads = await
|
|
26958
|
+
const wrapperReads = await multicallRetry({
|
|
26933
26959
|
chain: chainId,
|
|
26934
26960
|
calls: markets.map((m) => ({
|
|
26935
26961
|
address: m.collateralAsset,
|
|
@@ -27016,7 +27042,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
27016
27042
|
});
|
|
27017
27043
|
});
|
|
27018
27044
|
if (pendingDebtBalances.length > 0) {
|
|
27019
|
-
const balances = await
|
|
27045
|
+
const balances = await multicallRetry({
|
|
27020
27046
|
chain: chainId,
|
|
27021
27047
|
calls: pendingDebtBalances.map((p) => ({
|
|
27022
27048
|
address: p.token,
|
|
@@ -27052,7 +27078,7 @@ var dec = (v, fallback = 18) => {
|
|
|
27052
27078
|
const n = Number(v);
|
|
27053
27079
|
return Number.isFinite(n) && n >= 0 && n <= 36 ? n : fallback;
|
|
27054
27080
|
};
|
|
27055
|
-
async function fetchFraxlendPairs(lender, chainId) {
|
|
27081
|
+
async function fetchFraxlendPairs(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
27056
27082
|
const config = fraxlendConfigFor(lender, chainId);
|
|
27057
27083
|
const roster = (config?.pairs ?? []).filter((p) => !!p?.address);
|
|
27058
27084
|
if (roster.length === 0) return { lender, config, pairs: [] };
|
|
@@ -27086,7 +27112,7 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
27086
27112
|
params: [swapper ?? "0x0000000000000000000000000000000000000000"]
|
|
27087
27113
|
}
|
|
27088
27114
|
]);
|
|
27089
|
-
const res = await
|
|
27115
|
+
const res = await multicallRetry({
|
|
27090
27116
|
chain: chainId,
|
|
27091
27117
|
calls,
|
|
27092
27118
|
abi: calls.map(() => FraxlendPairAbi),
|
|
@@ -27101,7 +27127,7 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
27101
27127
|
if (swapper) {
|
|
27102
27128
|
pauseCalls.push({ address: swapper, name: "shutoff", params: [] });
|
|
27103
27129
|
}
|
|
27104
|
-
const pauseRes = await
|
|
27130
|
+
const pauseRes = await multicallRetry({
|
|
27105
27131
|
chain: chainId,
|
|
27106
27132
|
calls: pauseCalls,
|
|
27107
27133
|
abi: pauseCalls.map(
|
|
@@ -27199,7 +27225,7 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
27199
27225
|
{ address: t, name: "name", params: [] },
|
|
27200
27226
|
{ address: t, name: "decimals", params: [] }
|
|
27201
27227
|
]);
|
|
27202
|
-
const metaRes = await
|
|
27228
|
+
const metaRes = await multicallRetry({
|
|
27203
27229
|
chain: chainId,
|
|
27204
27230
|
calls: metaCalls,
|
|
27205
27231
|
abi: metaCalls.map(() => erc20Abi),
|
|
@@ -27722,11 +27748,11 @@ async function resolveRipeAddresses(lender, chainId, multicall = multicallRetryU
|
|
|
27722
27748
|
savingsGreen: pick3(7, seed.savingsGreen)
|
|
27723
27749
|
};
|
|
27724
27750
|
}
|
|
27725
|
-
async function fetchRipeMarkets(lender, chainId) {
|
|
27726
|
-
const addrs = await resolveRipeAddresses(lender, chainId);
|
|
27751
|
+
async function fetchRipeMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
27752
|
+
const addrs = await resolveRipeAddresses(lender, chainId, multicallRetry);
|
|
27727
27753
|
if (!addrs) return empty(lender);
|
|
27728
27754
|
try {
|
|
27729
|
-
const r2 = await
|
|
27755
|
+
const r2 = await multicallRetry({
|
|
27730
27756
|
chain: chainId,
|
|
27731
27757
|
calls: [
|
|
27732
27758
|
{ address: addrs.missionControl, name: "getNumAssets", params: [] },
|
|
@@ -27757,7 +27783,7 @@ async function fetchRipeMarkets(lender, chainId) {
|
|
|
27757
27783
|
if (numAssets === 0 || !genDebtConfig) return empty(lender);
|
|
27758
27784
|
const assetIdx = Array.from({ length: numAssets }, (_3, i) => i + 1);
|
|
27759
27785
|
const vaultIdx = Array.from({ length: numVaults }, (_3, i) => i + 1);
|
|
27760
|
-
const r3 = await
|
|
27786
|
+
const r3 = await multicallRetry({
|
|
27761
27787
|
chain: chainId,
|
|
27762
27788
|
calls: [
|
|
27763
27789
|
...assetIdx.map((i) => ({
|
|
@@ -27785,7 +27811,7 @@ async function fetchRipeMarkets(lender, chainId) {
|
|
|
27785
27811
|
});
|
|
27786
27812
|
if (assetAddrs.length === 0) return empty(lender);
|
|
27787
27813
|
const PER_ASSET = 4;
|
|
27788
|
-
const r4 = await
|
|
27814
|
+
const r4 = await multicallRetry({
|
|
27789
27815
|
chain: chainId,
|
|
27790
27816
|
calls: assetAddrs.flatMap((a) => [
|
|
27791
27817
|
{ address: addrs.missionControl, name: "assetConfig", params: [a] },
|
|
@@ -27839,7 +27865,7 @@ async function fetchRipeMarkets(lender, chainId) {
|
|
|
27839
27865
|
assets.map((a) => a.debtTerms.borrowRate).filter((r) => r > 0)
|
|
27840
27866
|
)
|
|
27841
27867
|
];
|
|
27842
|
-
const r5 = await
|
|
27868
|
+
const r5 = await multicallRetry({
|
|
27843
27869
|
chain: chainId,
|
|
27844
27870
|
calls: [
|
|
27845
27871
|
...totalCalls.map((t) => ({
|
|
@@ -29513,7 +29539,7 @@ function convertFraxlendPairsToResponse(raw, chainId, prices = {}, _additionalYi
|
|
|
29513
29539
|
var CORE_READS_PER_ILK = 3;
|
|
29514
29540
|
var DSS_CORE_ABI_PER_READ = [UsddVatAbi, UsddJugAbi, UsddSpotAbi];
|
|
29515
29541
|
var dssIlkBytes32 = (ilk) => stringToHex(ilk, { size: 32 });
|
|
29516
|
-
async function fetchDssMarkets(lender, chainId) {
|
|
29542
|
+
async function fetchDssMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
29517
29543
|
const config = dssConfigFor(lender, chainId);
|
|
29518
29544
|
const chainData = dssChainData(lender, chainId);
|
|
29519
29545
|
const markets = chainData?.markets ?? [];
|
|
@@ -29545,7 +29571,7 @@ async function fetchDssMarkets(lender, chainId) {
|
|
|
29545
29571
|
}
|
|
29546
29572
|
let results = [];
|
|
29547
29573
|
try {
|
|
29548
|
-
results = await
|
|
29574
|
+
results = await multicallRetry({
|
|
29549
29575
|
chain: chainId,
|
|
29550
29576
|
calls,
|
|
29551
29577
|
abi,
|
|
@@ -29816,7 +29842,7 @@ var FRANKENCOIN_ABI_PER_READ = [
|
|
|
29816
29842
|
FrankencoinPositionAbi,
|
|
29817
29843
|
erc20Abi
|
|
29818
29844
|
];
|
|
29819
|
-
async function fetchFrankencoinMarkets(lender, chainId) {
|
|
29845
|
+
async function fetchFrankencoinMarkets(lender, chainId, multicallRetry = multicallRetryUniversal) {
|
|
29820
29846
|
const config = frankencoinConfigFor(lender, chainId);
|
|
29821
29847
|
const chainData = frankencoinChainData(lender, chainId);
|
|
29822
29848
|
const markets = chainData?.markets ?? [];
|
|
@@ -29841,7 +29867,7 @@ async function fetchFrankencoinMarkets(lender, chainId) {
|
|
|
29841
29867
|
]);
|
|
29842
29868
|
let results = [];
|
|
29843
29869
|
try {
|
|
29844
|
-
results = await
|
|
29870
|
+
results = await multicallRetry({
|
|
29845
29871
|
chain: chainId,
|
|
29846
29872
|
calls,
|
|
29847
29873
|
abi: markets.flatMap(() => FRANKENCOIN_ABI_PER_READ),
|
|
@@ -30213,6 +30239,42 @@ query GetSilos {
|
|
|
30213
30239
|
}
|
|
30214
30240
|
}
|
|
30215
30241
|
`;
|
|
30242
|
+
var SILO_API_CACHE_TTL_MS = 6e4;
|
|
30243
|
+
var siloItemsCache = /* @__PURE__ */ new Map();
|
|
30244
|
+
function cachedSiloItems(key4, load) {
|
|
30245
|
+
const hit = siloItemsCache.get(key4);
|
|
30246
|
+
if (hit && Date.now() - hit.at < SILO_API_CACHE_TTL_MS) return hit.promise;
|
|
30247
|
+
const promise = load();
|
|
30248
|
+
const entry = { at: Date.now(), promise };
|
|
30249
|
+
siloItemsCache.set(key4, entry);
|
|
30250
|
+
promise.catch(() => {
|
|
30251
|
+
if (siloItemsCache.get(key4) === entry) siloItemsCache.delete(key4);
|
|
30252
|
+
});
|
|
30253
|
+
return promise;
|
|
30254
|
+
}
|
|
30255
|
+
async function postSiloQuery(body) {
|
|
30256
|
+
const response = await fetch(BASE_URL3, {
|
|
30257
|
+
method: "POST",
|
|
30258
|
+
headers: { "Content-Type": "application/json" },
|
|
30259
|
+
body: JSON.stringify({ query: body })
|
|
30260
|
+
});
|
|
30261
|
+
if (!response.ok) {
|
|
30262
|
+
throw new Error(
|
|
30263
|
+
`[silo-api] Network error: ${response.status} - ${response.statusText}`
|
|
30264
|
+
);
|
|
30265
|
+
}
|
|
30266
|
+
const payload = await response.json();
|
|
30267
|
+
if (payload?.errors?.length) {
|
|
30268
|
+
throw new Error(
|
|
30269
|
+
`[silo-api] GraphQL error: ${payload.errors.map((e) => e?.message).join("; ")}`
|
|
30270
|
+
);
|
|
30271
|
+
}
|
|
30272
|
+
return payload?.data?.silos?.items ?? [];
|
|
30273
|
+
}
|
|
30274
|
+
function filterByVersion(items, protocolVersion) {
|
|
30275
|
+
if (!protocolVersion) return items.slice();
|
|
30276
|
+
return items.filter((s) => s.protocol?.protocolVersion === protocolVersion);
|
|
30277
|
+
}
|
|
30216
30278
|
var liteQuery = (chainId, limit) => `
|
|
30217
30279
|
query GetSilosLite {
|
|
30218
30280
|
silos(where: {chainId_in: [${chainId}]}, limit: ${limit}) {
|
|
@@ -30246,52 +30308,20 @@ query GetSilosLite {
|
|
|
30246
30308
|
async function fetchSiloMarketsLite(chainId, options) {
|
|
30247
30309
|
if (!SILO_API_SUPPORTED_CHAIN_IDS.has(chainId)) return [];
|
|
30248
30310
|
const limit = options?.limit ?? 500;
|
|
30249
|
-
const
|
|
30250
|
-
|
|
30251
|
-
|
|
30252
|
-
body: JSON.stringify({ query: liteQuery(chainId, limit) })
|
|
30253
|
-
});
|
|
30254
|
-
if (!response.ok) {
|
|
30255
|
-
throw new Error(
|
|
30256
|
-
`[silo-api] Network error: ${response.status} - ${response.statusText}`
|
|
30257
|
-
);
|
|
30258
|
-
}
|
|
30259
|
-
const payload = await response.json();
|
|
30260
|
-
if (payload?.errors?.length) {
|
|
30261
|
-
throw new Error(
|
|
30262
|
-
`[silo-api] GraphQL error: ${payload.errors.map((e) => e?.message).join("; ")}`
|
|
30263
|
-
);
|
|
30264
|
-
}
|
|
30265
|
-
const items = payload?.data?.silos?.items ?? [];
|
|
30266
|
-
if (!options?.protocolVersion) return items;
|
|
30267
|
-
return items.filter(
|
|
30268
|
-
(s) => s.protocol?.protocolVersion === options.protocolVersion
|
|
30311
|
+
const items = await cachedSiloItems(
|
|
30312
|
+
`lite:${chainId}:${limit}`,
|
|
30313
|
+
() => postSiloQuery(liteQuery(chainId, limit))
|
|
30269
30314
|
);
|
|
30315
|
+
return filterByVersion(items, options?.protocolVersion);
|
|
30270
30316
|
}
|
|
30271
30317
|
async function fetchSiloMarkets(chainId, options) {
|
|
30272
30318
|
if (!SILO_API_SUPPORTED_CHAIN_IDS.has(chainId)) return [];
|
|
30273
30319
|
const limit = options?.limit ?? 500;
|
|
30274
|
-
const
|
|
30275
|
-
|
|
30276
|
-
|
|
30277
|
-
body: JSON.stringify({ query: query2(chainId, limit) })
|
|
30278
|
-
});
|
|
30279
|
-
if (!response.ok) {
|
|
30280
|
-
throw new Error(
|
|
30281
|
-
`[silo-api] Network error: ${response.status} - ${response.statusText}`
|
|
30282
|
-
);
|
|
30283
|
-
}
|
|
30284
|
-
const payload = await response.json();
|
|
30285
|
-
if (payload?.errors?.length) {
|
|
30286
|
-
throw new Error(
|
|
30287
|
-
`[silo-api] GraphQL error: ${payload.errors.map((e) => e?.message).join("; ")}`
|
|
30288
|
-
);
|
|
30289
|
-
}
|
|
30290
|
-
const items = payload?.data?.silos?.items ?? [];
|
|
30291
|
-
if (!options?.protocolVersion) return items;
|
|
30292
|
-
return items.filter(
|
|
30293
|
-
(s) => s.protocol?.protocolVersion === options.protocolVersion
|
|
30320
|
+
const items = await cachedSiloItems(
|
|
30321
|
+
`full:${chainId}:${limit}`,
|
|
30322
|
+
() => postSiloQuery(query2(chainId, limit))
|
|
30294
30323
|
);
|
|
30324
|
+
return filterByVersion(items, options?.protocolVersion);
|
|
30295
30325
|
}
|
|
30296
30326
|
function convertSiloMarketsToPublicResponse(apiItems, chainId, prices, additionalYields = {
|
|
30297
30327
|
intrinsicYields: {},
|
|
@@ -30723,31 +30753,42 @@ function convertDolomiteSubgraphMarkets(raw, chainId, prices, additionalYields,
|
|
|
30723
30753
|
}
|
|
30724
30754
|
var warn4 = (...args) => {
|
|
30725
30755
|
};
|
|
30726
|
-
async function getLenderDataFromApi(lender, chainId, prices, additionalYields, includeUnlisted = false) {
|
|
30756
|
+
async function getLenderDataFromApi(lender, chainId, prices, additionalYields, includeUnlisted = false, multicallRetry) {
|
|
30727
30757
|
if (isMorphoType(lender))
|
|
30728
30758
|
return await fetchMorphoMarkets(chainId, includeUnlisted);
|
|
30729
30759
|
if (isMidnight(lender)) return await fetchMidnightMarkets(chainId);
|
|
30730
30760
|
if (isTerm(lender)) return await fetchTermMarkets(chainId);
|
|
30731
|
-
if (isExactly(lender))
|
|
30761
|
+
if (isExactly(lender))
|
|
30762
|
+
return await fetchExactlyMarkets(chainId, multicallRetry);
|
|
30732
30763
|
if (isFlyingTulip(lender)) return await fetchFlyingTulipMarkets(chainId);
|
|
30733
|
-
if (isLiquityFamily(lender))
|
|
30734
|
-
|
|
30735
|
-
if (
|
|
30736
|
-
|
|
30737
|
-
if (
|
|
30738
|
-
if (
|
|
30764
|
+
if (isLiquityFamily(lender))
|
|
30765
|
+
return await fetchLiquityMarkets(lender, chainId, multicallRetry);
|
|
30766
|
+
if (isRiver(lender))
|
|
30767
|
+
return await fetchRiverMarkets(lender, chainId, multicallRetry);
|
|
30768
|
+
if (isTeller(lender)) return await fetchTellerMarkets(chainId, multicallRetry);
|
|
30769
|
+
if (isInverse(lender))
|
|
30770
|
+
return await fetchInverseMarkets(lender, chainId, multicallRetry);
|
|
30771
|
+
if (isCooler(lender))
|
|
30772
|
+
return await fetchCoolerMarkets(lender, chainId, multicallRetry);
|
|
30773
|
+
if (isRipe(lender))
|
|
30774
|
+
return await fetchRipeMarkets(lender, chainId, multicallRetry);
|
|
30739
30775
|
if (isLlamaLend(lender)) return await fetchLlamaLendMarkets(lender, chainId);
|
|
30740
|
-
if (isResupply(lender))
|
|
30741
|
-
|
|
30742
|
-
if (
|
|
30743
|
-
|
|
30776
|
+
if (isResupply(lender))
|
|
30777
|
+
return await fetchResupplyMarkets(lender, chainId, multicallRetry);
|
|
30778
|
+
if (isCurvance(lender))
|
|
30779
|
+
return await fetchCurvanceMarkets(lender, chainId, multicallRetry);
|
|
30780
|
+
if (isTwyne(lender))
|
|
30781
|
+
return await fetchTwyneMarkets(lender, chainId, multicallRetry);
|
|
30782
|
+
if (isFraxlend(lender))
|
|
30783
|
+
return await fetchFraxlendPairs(lender, chainId, multicallRetry);
|
|
30744
30784
|
if (isTermMax(lender))
|
|
30745
30785
|
return await fetchTermMaxMarkets(chainId, void 0, {
|
|
30746
30786
|
includeMatured: true
|
|
30747
30787
|
});
|
|
30748
|
-
if (isDssType(lender))
|
|
30788
|
+
if (isDssType(lender))
|
|
30789
|
+
return await fetchDssMarkets(lender, chainId, multicallRetry);
|
|
30749
30790
|
if (isFrankencoin(lender))
|
|
30750
|
-
return await fetchFrankencoinMarkets(lender, chainId);
|
|
30791
|
+
return await fetchFrankencoinMarkets(lender, chainId, multicallRetry);
|
|
30751
30792
|
return {};
|
|
30752
30793
|
}
|
|
30753
30794
|
function convertLenderDataFromApi(lender, chainId, data, prices, additionalYields, list = {}) {
|
|
@@ -30901,7 +30942,7 @@ function convertLenderDataFromApi(lender, chainId, data, prices, additionalYield
|
|
|
30901
30942
|
}
|
|
30902
30943
|
var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYields, tokenList = async () => {
|
|
30903
30944
|
return {};
|
|
30904
|
-
}, includeUnlisted = false) => {
|
|
30945
|
+
}, includeUnlisted = false, multicallRetry) => {
|
|
30905
30946
|
const siloV2Lenders = lenders.filter((l) => isSiloV2Type(l));
|
|
30906
30947
|
const siloV3Lenders = lenders.filter((l) => isSiloV3Type(l));
|
|
30907
30948
|
const dolomiteLenders = lenders.filter((l) => isDolomite(l));
|
|
@@ -30922,7 +30963,8 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
|
|
|
30922
30963
|
chainId,
|
|
30923
30964
|
prices,
|
|
30924
30965
|
additionalYields,
|
|
30925
|
-
includeUnlisted
|
|
30966
|
+
includeUnlisted,
|
|
30967
|
+
multicallRetry
|
|
30926
30968
|
)
|
|
30927
30969
|
);
|
|
30928
30970
|
}
|
|
@@ -31226,7 +31268,8 @@ var getLenderPublicDataAll = async (chainId, lenders, prices, additionalYields,
|
|
|
31226
31268
|
prices,
|
|
31227
31269
|
additionalYields,
|
|
31228
31270
|
tokenList,
|
|
31229
|
-
includeUnlisted
|
|
31271
|
+
includeUnlisted,
|
|
31272
|
+
multicallRetry
|
|
31230
31273
|
);
|
|
31231
31274
|
} catch (e) {
|
|
31232
31275
|
warn5(
|
|
@@ -38056,9 +38099,9 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
38056
38099
|
const loanMeta = metaMap[loanUid];
|
|
38057
38100
|
const collDecimals = collMeta?.asset?.decimals ?? market.collateralDecimals;
|
|
38058
38101
|
const loanDecimals = loanMeta?.asset?.decimals ?? market.borrowedDecimals;
|
|
38059
|
-
const collDisplay = collMeta ? getDisplayPrice(collMeta) : 0;
|
|
38060
38102
|
const collOracle = collMeta ? getOraclePrice(collMeta) : 0;
|
|
38061
|
-
const
|
|
38103
|
+
const collDisplay = collOracle;
|
|
38104
|
+
const collHist = collDisplay;
|
|
38062
38105
|
const loanDisplay = loanMeta ? getDisplayPrice(loanMeta) : 0;
|
|
38063
38106
|
const loanOracle = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
38064
38107
|
const loanHist = loanMeta?.price?.priceUsd24h ?? loanDisplay;
|
|
@@ -55322,6 +55365,316 @@ var ETH_SAVINGS_B_ENTRIES = {
|
|
|
55322
55365
|
}
|
|
55323
55366
|
]
|
|
55324
55367
|
};
|
|
55368
|
+
var CHAIN_ID19 = "1";
|
|
55369
|
+
var WINDOW_SECONDS12 = 30 * 24 * 60 * 60;
|
|
55370
|
+
var ROUND_LOOKBACK = 60;
|
|
55371
|
+
var MORINI_CARRY_FEED = "0xc69731b51c6dbb2fb818d8db1f4116fb8a379288";
|
|
55372
|
+
var MORINI_STOCK_FEED = "0x1c7bec0281080c0a4f85e55151191af27ec69940";
|
|
55373
|
+
var FXARB_LOAN_ID = 605201359;
|
|
55374
|
+
var ACCOUNTABLE_LIST_URL = "https://yield.accountable.capital/api/loan";
|
|
55375
|
+
var MORINI_CARRY_KEY = "MORINI_CARRYTRADEUSDTRYLEVERAGE";
|
|
55376
|
+
var MORINI_STOCK_KEY = "MORINI_STOCKMARKETTRBASISTRADE";
|
|
55377
|
+
var MORINI_FXARB_KEY = "MORINI_FXARBUSDTRY";
|
|
55378
|
+
var MORINI_GROUPS = {
|
|
55379
|
+
[MORINI_CARRY_KEY]: [
|
|
55380
|
+
"Morini CarryTradeUSDTRYLeverage Vault::CarryTradeUSDTRYLeverage",
|
|
55381
|
+
"Morini CarryTradeUSDTRYLeverage Vault::CARRYTRADEUSDTRYLEVE"
|
|
55382
|
+
],
|
|
55383
|
+
[MORINI_STOCK_KEY]: [
|
|
55384
|
+
"Morini StockMarketTRBasisTrade Vault::StockMarketTRBasisTrade",
|
|
55385
|
+
"Morini StockMarketTRBasisTrade Vault::STOCKMARKETTRBASISTR"
|
|
55386
|
+
],
|
|
55387
|
+
[MORINI_FXARB_KEY]: [
|
|
55388
|
+
"Morini FXArbUSDTRY::aFXArbUSDTRY",
|
|
55389
|
+
"Morini FXArbUSDTRY::AFXARBUSDTRY"
|
|
55390
|
+
]
|
|
55391
|
+
};
|
|
55392
|
+
var ROUND_ABI = [
|
|
55393
|
+
{
|
|
55394
|
+
name: "latestRoundData",
|
|
55395
|
+
type: "function",
|
|
55396
|
+
stateMutability: "view",
|
|
55397
|
+
inputs: [],
|
|
55398
|
+
outputs: [
|
|
55399
|
+
{ name: "roundId", type: "uint80" },
|
|
55400
|
+
{ name: "answer", type: "int256" },
|
|
55401
|
+
{ name: "startedAt", type: "uint256" },
|
|
55402
|
+
{ name: "updatedAt", type: "uint256" },
|
|
55403
|
+
{ name: "answeredInRound", type: "uint80" }
|
|
55404
|
+
]
|
|
55405
|
+
},
|
|
55406
|
+
{
|
|
55407
|
+
name: "getRoundData",
|
|
55408
|
+
type: "function",
|
|
55409
|
+
stateMutability: "view",
|
|
55410
|
+
inputs: [{ name: "roundId", type: "uint80" }],
|
|
55411
|
+
outputs: [
|
|
55412
|
+
{ name: "roundId", type: "uint80" },
|
|
55413
|
+
{ name: "answer", type: "int256" },
|
|
55414
|
+
{ name: "startedAt", type: "uint256" },
|
|
55415
|
+
{ name: "updatedAt", type: "uint256" },
|
|
55416
|
+
{ name: "answeredInRound", type: "uint80" }
|
|
55417
|
+
]
|
|
55418
|
+
}
|
|
55419
|
+
];
|
|
55420
|
+
var asRound = (r) => {
|
|
55421
|
+
if (!r) return void 0;
|
|
55422
|
+
const t = r;
|
|
55423
|
+
const answer = t.answer ?? t[1];
|
|
55424
|
+
const updatedAt = t.updatedAt ?? t[3];
|
|
55425
|
+
if (typeof answer !== "bigint" || answer <= 0n) return void 0;
|
|
55426
|
+
const ts = Number(updatedAt);
|
|
55427
|
+
if (!Number.isFinite(ts) || ts <= 0) return void 0;
|
|
55428
|
+
return { answer, updatedAt: ts };
|
|
55429
|
+
};
|
|
55430
|
+
var realizedFeedApr = (latest, history, window = WINDOW_SECONDS12) => {
|
|
55431
|
+
const older = history.filter((r) => r.updatedAt < latest.updatedAt).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
55432
|
+
if (older.length === 0) return void 0;
|
|
55433
|
+
const cutoff = latest.updatedAt - window;
|
|
55434
|
+
const base = older.find((r) => r.updatedAt <= cutoff) ?? older.at(-1);
|
|
55435
|
+
const elapsed = latest.updatedAt - base.updatedAt;
|
|
55436
|
+
if (elapsed <= 0) return void 0;
|
|
55437
|
+
return annualizeRateDeltaPercent(latest.answer, base.answer, elapsed);
|
|
55438
|
+
};
|
|
55439
|
+
var fetchMidasFeedApr = async (feed) => {
|
|
55440
|
+
const [latestRaw] = await multicallRetryUniversal({
|
|
55441
|
+
chain: CHAIN_ID19,
|
|
55442
|
+
abi: ROUND_ABI,
|
|
55443
|
+
calls: [{ address: feed, name: "latestRoundData", params: [] }],
|
|
55444
|
+
maxRetries: 3
|
|
55445
|
+
});
|
|
55446
|
+
const latest = asRound(latestRaw);
|
|
55447
|
+
const latestId = latestRaw?.[0];
|
|
55448
|
+
if (!latest || typeof latestId !== "bigint") {
|
|
55449
|
+
throw new Error(`Morini feed ${feed}: no latest round`);
|
|
55450
|
+
}
|
|
55451
|
+
const ids = [];
|
|
55452
|
+
for (let k = 1n; k <= BigInt(ROUND_LOOKBACK) && latestId - k >= 1n; k++) {
|
|
55453
|
+
ids.push(latestId - k);
|
|
55454
|
+
}
|
|
55455
|
+
const raw = ids.length ? await multicallRetryUniversal({
|
|
55456
|
+
chain: CHAIN_ID19,
|
|
55457
|
+
abi: ROUND_ABI,
|
|
55458
|
+
calls: ids.map((id) => ({
|
|
55459
|
+
address: feed,
|
|
55460
|
+
name: "getRoundData",
|
|
55461
|
+
params: [id]
|
|
55462
|
+
})),
|
|
55463
|
+
allowFailure: true,
|
|
55464
|
+
maxRetries: 3
|
|
55465
|
+
}) : [];
|
|
55466
|
+
const history = raw.map(asRound).filter((r) => !!r);
|
|
55467
|
+
const apr = realizedFeedApr(latest, history);
|
|
55468
|
+
if (apr === void 0 || !Number.isFinite(apr)) {
|
|
55469
|
+
throw new Error(`Morini feed ${feed}: no usable history`);
|
|
55470
|
+
}
|
|
55471
|
+
return apr;
|
|
55472
|
+
};
|
|
55473
|
+
var fetchFxArbApr = async () => {
|
|
55474
|
+
const res = await fetch(ACCOUNTABLE_LIST_URL, {
|
|
55475
|
+
headers: { Accept: "application/json" },
|
|
55476
|
+
signal: AbortSignal.timeout(8e3)
|
|
55477
|
+
});
|
|
55478
|
+
if (!res.ok) throw new Error(`Accountable HTTP ${res.status}`);
|
|
55479
|
+
const items = (await res.json())?.items ?? [];
|
|
55480
|
+
const loan = items.find((l) => l?.id === FXARB_LOAN_ID);
|
|
55481
|
+
const apy = loan?.apy_30d ?? loan?.apy_7d;
|
|
55482
|
+
if (typeof apy !== "number" || !Number.isFinite(apy)) {
|
|
55483
|
+
throw new Error("Accountable: no FXArb realized rate");
|
|
55484
|
+
}
|
|
55485
|
+
return apyToAprPercent(apy);
|
|
55486
|
+
};
|
|
55487
|
+
var moriniFetcher = {
|
|
55488
|
+
label: "MORINI",
|
|
55489
|
+
fetch: async () => {
|
|
55490
|
+
const jobs = [
|
|
55491
|
+
[MORINI_CARRY_KEY, fetchMidasFeedApr(MORINI_CARRY_FEED)],
|
|
55492
|
+
[MORINI_STOCK_KEY, fetchMidasFeedApr(MORINI_STOCK_FEED)],
|
|
55493
|
+
[MORINI_FXARB_KEY, fetchFxArbApr()]
|
|
55494
|
+
];
|
|
55495
|
+
const settled = await Promise.allSettled(jobs.map(([, p]) => p));
|
|
55496
|
+
const out = {};
|
|
55497
|
+
settled.forEach((r, i) => {
|
|
55498
|
+
const key4 = jobs[i][0];
|
|
55499
|
+
if (r.status !== "fulfilled" || !Number.isFinite(r.value)) return;
|
|
55500
|
+
out[key4] = r.value;
|
|
55501
|
+
for (const group of MORINI_GROUPS[key4] ?? []) out[group] = r.value;
|
|
55502
|
+
});
|
|
55503
|
+
return out;
|
|
55504
|
+
}
|
|
55505
|
+
};
|
|
55506
|
+
|
|
55507
|
+
// src/vaults/savings/registryMorini.ts
|
|
55508
|
+
var carry = MIDAS_VAULTS.find((v) => v.symbol === "CarryTradeUSDTRYLeverage");
|
|
55509
|
+
var stock2 = MIDAS_VAULTS.find((v) => v.symbol === "StockMarketTRBasisTrade");
|
|
55510
|
+
var midasEntry = (v, description, yieldKey) => ({
|
|
55511
|
+
reader: "nav-oracle",
|
|
55512
|
+
address: v.mToken,
|
|
55513
|
+
underlying: v.paymentToken,
|
|
55514
|
+
symbol: v.symbol,
|
|
55515
|
+
brand: "Morini Capital",
|
|
55516
|
+
description,
|
|
55517
|
+
decimals: 18,
|
|
55518
|
+
underlyingDecimals: v.paymentTokenDecimals,
|
|
55519
|
+
isRebasing: false,
|
|
55520
|
+
isMintable: true,
|
|
55521
|
+
mintContract: v.depositVault,
|
|
55522
|
+
withdrawalMode: "request-based",
|
|
55523
|
+
withdrawQueue: v.redemptionVault,
|
|
55524
|
+
priceOracle: v.priceFeed,
|
|
55525
|
+
priceOracleDecimals: 8,
|
|
55526
|
+
// Off-chain book, NAV restated by the manager through Midas's feed.
|
|
55527
|
+
solvency: "nav-attested",
|
|
55528
|
+
yieldFetcher: moriniFetcher,
|
|
55529
|
+
yieldKey
|
|
55530
|
+
});
|
|
55531
|
+
var MORINI_ENTRIES = {
|
|
55532
|
+
"1": [
|
|
55533
|
+
midasEntry(
|
|
55534
|
+
carry,
|
|
55535
|
+
"Morini Capital's leveraged Turkish-lira carry trade, issued through Midas over a Turkish regulated fund (CMB, ISIN TRYVVGS00206): USDC is put into leveraged lira positions earning Turkey's overnight rate, and Morini restates the dollar value about daily. The fund is NOT hedged against the lira: the rate is high because lira rates are high, and a sharp fall of the lira against the dollar marks the vault down, amplified by the leverage. Deposits mint at the published price; a withdrawal is a redemption request that Midas settles about every three Turkish business days.",
|
|
55536
|
+
MORINI_CARRY_KEY
|
|
55537
|
+
),
|
|
55538
|
+
midasEntry(
|
|
55539
|
+
stock2,
|
|
55540
|
+
"Morini Capital's Borsa Istanbul basis trade, issued through Midas over a Turkish regulated fund (CMB, ISIN TRYVVGS00891): each single-stock future is matched with the opposite cash-equity position to capture the spread between them, with the lira hedged, and Morini restates the dollar value about daily. The book is market-neutral by design but runs entirely in Turkish markets, so a hedge that fails in a lira shock can still mark it down. Deposits mint at the published price; a withdrawal is a redemption request that Midas settles about every two Turkish business days.",
|
|
55541
|
+
MORINI_STOCK_KEY
|
|
55542
|
+
),
|
|
55543
|
+
{
|
|
55544
|
+
reader: "accountable-vault",
|
|
55545
|
+
address: MORINI_FXARB.vault,
|
|
55546
|
+
underlying: MORINI_FXARB.underlying,
|
|
55547
|
+
symbol: "aFXArbUSDTRY",
|
|
55548
|
+
brand: "Morini Capital",
|
|
55549
|
+
description: "Morini Capital's delta-neutral USD/TRY arbitrage, run on Accountable: deposited USDC goes to Morini's trading account, which captures the spread between USD/TRY prices on Turkish crypto exchanges and the banking rails with the lira hedged, and the share price rises with the profits after a 3% performance fee. It is a lira-market strategy marked in dollars, so a dislocation it cannot hedge can cost money. A withdrawal is a redemption request, paid at once while the vault holds enough idle USDC and otherwise on the next Turkish business day.",
|
|
55550
|
+
decimals: 6,
|
|
55551
|
+
underlyingDecimals: 6,
|
|
55552
|
+
isRebasing: false,
|
|
55553
|
+
isMintable: true,
|
|
55554
|
+
withdrawalMode: "request-based",
|
|
55555
|
+
solvency: "nav-attested",
|
|
55556
|
+
yieldFetcher: moriniFetcher,
|
|
55557
|
+
yieldKey: MORINI_FXARB_KEY
|
|
55558
|
+
}
|
|
55559
|
+
]
|
|
55560
|
+
};
|
|
55561
|
+
|
|
55562
|
+
// src/yields/intrinsic/fetchers/midas.ts
|
|
55563
|
+
var MIDAS_APY_URL = "https://api-prod.midas.app/api/data/apys";
|
|
55564
|
+
var MGLOEURO_KEY = "Midas Fasanara Global Euro::MGLOEURO";
|
|
55565
|
+
var MIDAS_TOKENS = [
|
|
55566
|
+
{ apyKey: "mtbill", keys: ["Midas mTBILL::MTBILL"] },
|
|
55567
|
+
{
|
|
55568
|
+
apyKey: "mbasis",
|
|
55569
|
+
keys: ["Midas mBASIS::MBASIS", "Midas mBASIS::mBASIS"]
|
|
55570
|
+
},
|
|
55571
|
+
{
|
|
55572
|
+
apyKey: "mbtc",
|
|
55573
|
+
keys: ["Midas mBTC::MBTC", "Midas BTC Yield Token::mBTC"]
|
|
55574
|
+
},
|
|
55575
|
+
{ apyKey: "medge", keys: ["Midas mEDGE::MEDGE", "Midas mEDGE::mEDGE"] },
|
|
55576
|
+
{
|
|
55577
|
+
apyKey: "mre7",
|
|
55578
|
+
keys: ["Midas mRe7YIELD::MRE7YIELD", "Midas Re7 Yield::mRe7YIELD"]
|
|
55579
|
+
},
|
|
55580
|
+
{ apyKey: "mre7sol", keys: ["Midas mRe7SOL::MRE7SOL"] },
|
|
55581
|
+
{ apyKey: "mre7eth", keys: ["Midas Re7 Ethereum::mRe7ETH"] },
|
|
55582
|
+
{ apyKey: "mmev", keys: ["Midas mMEV::MMEV"] },
|
|
55583
|
+
{ apyKey: "mfone", keys: ["Midas Fasanara ONE::mF-ONE"] },
|
|
55584
|
+
{
|
|
55585
|
+
apyKey: "mhyper",
|
|
55586
|
+
keys: ["Midas Hyperithm::mHYPER", "mHYPER::Midas Hyperithm"]
|
|
55587
|
+
},
|
|
55588
|
+
{ apyKey: "mapollo", keys: ["Midas mAPOLLO::MAPOLLO"] },
|
|
55589
|
+
// NB Avalanche carries a `MEV BTC::mevBTC` row (0x1f8e769b…) that MAY be
|
|
55590
|
+
// this asset, but the issuer is unverifiable (Midas's docs/API are
|
|
55591
|
+
// Cloudflare-walled) — deliberately not keyed, same rule as bondusd.
|
|
55592
|
+
{ apyKey: "mevbtc", keys: ["Midas mevBTC::MEVBTC"] },
|
|
55593
|
+
{ apyKey: "mfarm", keys: ["Midas mFARM::MFARM"] },
|
|
55594
|
+
{ apyKey: "msyrupusd", keys: ["Midas msyrupUSD::MSYRUPUSD"] },
|
|
55595
|
+
{ apyKey: "msyrupusdp", keys: ["Midas msyrupUSDp::MSYRUPUSDP"] },
|
|
55596
|
+
{ apyKey: "mre7btc", keys: ["Midas mRe7BTC::MRE7BTC"] },
|
|
55597
|
+
{ apyKey: "mxrp", keys: ["Midas XRP::mXRP"] },
|
|
55598
|
+
{ apyKey: "mevusd", keys: ["Midas Everstake USD::MEVUSD"] },
|
|
55599
|
+
{ apyKey: "mhypereth", keys: ["Midas Hyperithm ETH::mHyperETH"] },
|
|
55600
|
+
{
|
|
55601
|
+
apyKey: "mhyperbtc",
|
|
55602
|
+
keys: ["Midas Hyperithm BTC::mHyperBTC", "Midas Hyperithm BTC::MHYPERBTC"]
|
|
55603
|
+
},
|
|
55604
|
+
{ apyKey: "mm1usd", keys: ["Midas M1 USD Market Neutral::mM1-USD"] },
|
|
55605
|
+
// 2026-08 sweep additions
|
|
55606
|
+
{ apyKey: "mrox", keys: ["Midas Rockaway Market Neutral::MROX"] },
|
|
55607
|
+
{ apyKey: "mglobal", keys: ["Midas Fasanara Global::MGLOBAL"] },
|
|
55608
|
+
{ apyKey: "mglo", keys: ["Midas Fasanara Global Open::MGLO"] },
|
|
55609
|
+
// The EUR twin of mGLO (Ethereum `0x2f8bae12…`). Its rate is in EUR. Midas
|
|
55610
|
+
// answered `mgloeuro: 0` on 2026-10-19 with a NAV flat at 100,000 EUR since
|
|
55611
|
+
// 2026-08-04, so nothing is emitted until Midas restates it.
|
|
55612
|
+
{
|
|
55613
|
+
apyKey: "mgloeuro",
|
|
55614
|
+
keys: [MGLOEURO_KEY]
|
|
55615
|
+
},
|
|
55616
|
+
{ apyKey: "weeur", keys: ["Liquid Euro::weEUR"] },
|
|
55617
|
+
{ apyKey: "plusd", keys: ["Plasma USD::plUSD"] },
|
|
55618
|
+
{ apyKey: "splusd", keys: ["Staked Plasma USD::splUSD"] }
|
|
55619
|
+
];
|
|
55620
|
+
var MAX_DECIMAL_APY = 5;
|
|
55621
|
+
var midasFetcher = {
|
|
55622
|
+
label: "MIDAS",
|
|
55623
|
+
fetch: async () => {
|
|
55624
|
+
const res = await fetch(MIDAS_APY_URL, {
|
|
55625
|
+
headers: {
|
|
55626
|
+
accept: "application/json",
|
|
55627
|
+
// WAF: bare fetches get 403 + `{}` — see header note.
|
|
55628
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",
|
|
55629
|
+
origin: "https://midas.app",
|
|
55630
|
+
referer: "https://midas.app/"
|
|
55631
|
+
},
|
|
55632
|
+
signal: AbortSignal.timeout(8e3)
|
|
55633
|
+
});
|
|
55634
|
+
if (!res.ok) throw new Error(`Midas APY HTTP ${res.status}`);
|
|
55635
|
+
const apys = await res.json();
|
|
55636
|
+
if (!apys || Object.keys(apys).length === 0) {
|
|
55637
|
+
throw new Error("Midas APY payload empty (WAF block?)");
|
|
55638
|
+
}
|
|
55639
|
+
const result = {};
|
|
55640
|
+
for (const { apyKey, keys } of MIDAS_TOKENS) {
|
|
55641
|
+
const apy = apys[apyKey];
|
|
55642
|
+
if (typeof apy === "number" && apy > 0 && apy <= MAX_DECIMAL_APY) {
|
|
55643
|
+
const apr = apyToAprPercent(apy * 100);
|
|
55644
|
+
for (const key4 of keys) result[key4] = apr;
|
|
55645
|
+
}
|
|
55646
|
+
}
|
|
55647
|
+
return result;
|
|
55648
|
+
}
|
|
55649
|
+
};
|
|
55650
|
+
|
|
55651
|
+
// src/vaults/savings/registryMidas.ts
|
|
55652
|
+
var MIDAS_ENTRIES = {
|
|
55653
|
+
"1": [
|
|
55654
|
+
{
|
|
55655
|
+
reader: "nav-oracle",
|
|
55656
|
+
address: "0x2f8bae126b8d416c009b82ccd60e4f9cabbd7702",
|
|
55657
|
+
underlying: "0x5f7827fdeb7c20b443265fc2f40845b715385ff2",
|
|
55658
|
+
// EURCV
|
|
55659
|
+
symbol: "mGLOeuro",
|
|
55660
|
+
brand: "Fasanara",
|
|
55661
|
+
description: "mGLOeuro is the euro version of Fasanara's Midas note over its trade-receivables book: the fund buys short-dated invoices of small and mid-sized companies, unlevered, and Midas restates the token's EUR price from the fund's NAV. Rate and value are in EUR, not dollars. Minting and redemption are limited to Midas-greenlisted holders (minting is currently paused), they cost about 2 % each way against the published price, and there is no DEX market.",
|
|
55662
|
+
decimals: 18,
|
|
55663
|
+
underlyingDecimals: 18,
|
|
55664
|
+
isRebasing: false,
|
|
55665
|
+
isMintable: false,
|
|
55666
|
+
mintContract: "0xe0dcf20b0460e1f9222528f3997f9d71ad6375c5",
|
|
55667
|
+
withdrawalMode: "request-based",
|
|
55668
|
+
withdrawQueue: "0x1e9f04408ff38d1fb70ce939fc87d26d61f6f758",
|
|
55669
|
+
priceOracle: "0x8b7b1689396ef4468df1c0fab181d29b47089609",
|
|
55670
|
+
priceOracleDecimals: 8,
|
|
55671
|
+
// Operator-restated NAV over an off-chain receivables book.
|
|
55672
|
+
solvency: "nav-attested",
|
|
55673
|
+
yieldFetcher: midasFetcher,
|
|
55674
|
+
yieldKey: MGLOEURO_KEY
|
|
55675
|
+
}
|
|
55676
|
+
]
|
|
55677
|
+
};
|
|
55325
55678
|
|
|
55326
55679
|
// src/vaults/savings/registry.ts
|
|
55327
55680
|
var stUsdGroup = {
|
|
@@ -57602,6 +57955,14 @@ var SAVINGS_REGISTRY = (() => {
|
|
|
57602
57955
|
if (!out[chainId]) out[chainId] = [];
|
|
57603
57956
|
out[chainId].push(...entries);
|
|
57604
57957
|
}
|
|
57958
|
+
for (const [chainId, entries] of Object.entries(MORINI_ENTRIES)) {
|
|
57959
|
+
if (!out[chainId]) out[chainId] = [];
|
|
57960
|
+
out[chainId].push(...entries);
|
|
57961
|
+
}
|
|
57962
|
+
for (const [chainId, entries] of Object.entries(MIDAS_ENTRIES)) {
|
|
57963
|
+
if (!out[chainId]) out[chainId] = [];
|
|
57964
|
+
out[chainId].push(...entries);
|
|
57965
|
+
}
|
|
57605
57966
|
return out;
|
|
57606
57967
|
})();
|
|
57607
57968
|
var savingsBalanceKind = (chainId, address) => {
|
|
@@ -60781,88 +61142,7 @@ var syzusdFetcher = {
|
|
|
60781
61142
|
return { [syzUSD]: apyToAprPercent(res?.data?.syzusd_apy ?? 0) };
|
|
60782
61143
|
}
|
|
60783
61144
|
};
|
|
60784
|
-
|
|
60785
|
-
// src/yields/intrinsic/fetchers/midas.ts
|
|
60786
|
-
var MIDAS_APY_URL = "https://api-prod.midas.app/api/data/apys";
|
|
60787
|
-
var MIDAS_TOKENS = [
|
|
60788
|
-
{ apyKey: "mtbill", keys: ["Midas mTBILL::MTBILL"] },
|
|
60789
|
-
{
|
|
60790
|
-
apyKey: "mbasis",
|
|
60791
|
-
keys: ["Midas mBASIS::MBASIS", "Midas mBASIS::mBASIS"]
|
|
60792
|
-
},
|
|
60793
|
-
{
|
|
60794
|
-
apyKey: "mbtc",
|
|
60795
|
-
keys: ["Midas mBTC::MBTC", "Midas BTC Yield Token::mBTC"]
|
|
60796
|
-
},
|
|
60797
|
-
{ apyKey: "medge", keys: ["Midas mEDGE::MEDGE", "Midas mEDGE::mEDGE"] },
|
|
60798
|
-
{
|
|
60799
|
-
apyKey: "mre7",
|
|
60800
|
-
keys: ["Midas mRe7YIELD::MRE7YIELD", "Midas Re7 Yield::mRe7YIELD"]
|
|
60801
|
-
},
|
|
60802
|
-
{ apyKey: "mre7sol", keys: ["Midas mRe7SOL::MRE7SOL"] },
|
|
60803
|
-
{ apyKey: "mre7eth", keys: ["Midas Re7 Ethereum::mRe7ETH"] },
|
|
60804
|
-
{ apyKey: "mmev", keys: ["Midas mMEV::MMEV"] },
|
|
60805
|
-
{ apyKey: "mfone", keys: ["Midas Fasanara ONE::mF-ONE"] },
|
|
60806
|
-
{
|
|
60807
|
-
apyKey: "mhyper",
|
|
60808
|
-
keys: ["Midas Hyperithm::mHYPER", "mHYPER::Midas Hyperithm"]
|
|
60809
|
-
},
|
|
60810
|
-
{ apyKey: "mapollo", keys: ["Midas mAPOLLO::MAPOLLO"] },
|
|
60811
|
-
// NB Avalanche carries a `MEV BTC::mevBTC` row (0x1f8e769b…) that MAY be
|
|
60812
|
-
// this asset, but the issuer is unverifiable (Midas's docs/API are
|
|
60813
|
-
// Cloudflare-walled) — deliberately not keyed, same rule as bondusd.
|
|
60814
|
-
{ apyKey: "mevbtc", keys: ["Midas mevBTC::MEVBTC"] },
|
|
60815
|
-
{ apyKey: "mfarm", keys: ["Midas mFARM::MFARM"] },
|
|
60816
|
-
{ apyKey: "msyrupusd", keys: ["Midas msyrupUSD::MSYRUPUSD"] },
|
|
60817
|
-
{ apyKey: "msyrupusdp", keys: ["Midas msyrupUSDp::MSYRUPUSDP"] },
|
|
60818
|
-
{ apyKey: "mre7btc", keys: ["Midas mRe7BTC::MRE7BTC"] },
|
|
60819
|
-
{ apyKey: "mxrp", keys: ["Midas XRP::mXRP"] },
|
|
60820
|
-
{ apyKey: "mevusd", keys: ["Midas Everstake USD::MEVUSD"] },
|
|
60821
|
-
{ apyKey: "mhypereth", keys: ["Midas Hyperithm ETH::mHyperETH"] },
|
|
60822
|
-
{
|
|
60823
|
-
apyKey: "mhyperbtc",
|
|
60824
|
-
keys: ["Midas Hyperithm BTC::mHyperBTC", "Midas Hyperithm BTC::MHYPERBTC"]
|
|
60825
|
-
},
|
|
60826
|
-
{ apyKey: "mm1usd", keys: ["Midas M1 USD Market Neutral::mM1-USD"] },
|
|
60827
|
-
// 2026-08 sweep additions
|
|
60828
|
-
{ apyKey: "mrox", keys: ["Midas Rockaway Market Neutral::MROX"] },
|
|
60829
|
-
{ apyKey: "mglobal", keys: ["Midas Fasanara Global::MGLOBAL"] },
|
|
60830
|
-
{ apyKey: "mglo", keys: ["Midas Fasanara Global Open::MGLO"] },
|
|
60831
|
-
{ apyKey: "weeur", keys: ["Liquid Euro::weEUR"] },
|
|
60832
|
-
{ apyKey: "plusd", keys: ["Plasma USD::plUSD"] },
|
|
60833
|
-
{ apyKey: "splusd", keys: ["Staked Plasma USD::splUSD"] }
|
|
60834
|
-
];
|
|
60835
|
-
var MAX_DECIMAL_APY = 5;
|
|
60836
|
-
var midasFetcher = {
|
|
60837
|
-
label: "MIDAS",
|
|
60838
|
-
fetch: async () => {
|
|
60839
|
-
const res = await fetch(MIDAS_APY_URL, {
|
|
60840
|
-
headers: {
|
|
60841
|
-
accept: "application/json",
|
|
60842
|
-
// WAF: bare fetches get 403 + `{}` — see header note.
|
|
60843
|
-
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",
|
|
60844
|
-
origin: "https://midas.app",
|
|
60845
|
-
referer: "https://midas.app/"
|
|
60846
|
-
},
|
|
60847
|
-
signal: AbortSignal.timeout(8e3)
|
|
60848
|
-
});
|
|
60849
|
-
if (!res.ok) throw new Error(`Midas APY HTTP ${res.status}`);
|
|
60850
|
-
const apys = await res.json();
|
|
60851
|
-
if (!apys || Object.keys(apys).length === 0) {
|
|
60852
|
-
throw new Error("Midas APY payload empty (WAF block?)");
|
|
60853
|
-
}
|
|
60854
|
-
const result = {};
|
|
60855
|
-
for (const { apyKey, keys } of MIDAS_TOKENS) {
|
|
60856
|
-
const apy = apys[apyKey];
|
|
60857
|
-
if (typeof apy === "number" && apy > 0 && apy <= MAX_DECIMAL_APY) {
|
|
60858
|
-
const apr = apyToAprPercent(apy * 100);
|
|
60859
|
-
for (const key4 of keys) result[key4] = apr;
|
|
60860
|
-
}
|
|
60861
|
-
}
|
|
60862
|
-
return result;
|
|
60863
|
-
}
|
|
60864
|
-
};
|
|
60865
|
-
var ACCOUNTABLE_LIST_URL = "https://yield.accountable.capital/api/loan";
|
|
61145
|
+
var ACCOUNTABLE_LIST_URL2 = "https://yield.accountable.capital/api/loan";
|
|
60866
61146
|
async function symbolToAssetGroup(chainId) {
|
|
60867
61147
|
const list = await fetchTokenList(chainId);
|
|
60868
61148
|
const bySymbol = /* @__PURE__ */ new Map();
|
|
@@ -60884,7 +61164,7 @@ async function symbolToAssetGroup(chainId) {
|
|
|
60884
61164
|
var accountableFetcher = {
|
|
60885
61165
|
label: "ACCOUNTABLE",
|
|
60886
61166
|
fetch: async () => {
|
|
60887
|
-
const res = await fetch(
|
|
61167
|
+
const res = await fetch(ACCOUNTABLE_LIST_URL2, {
|
|
60888
61168
|
headers: { Accept: "application/json" }
|
|
60889
61169
|
}).then((r) => r.json());
|
|
60890
61170
|
const loans = res?.items ?? [];
|
|
@@ -60909,7 +61189,9 @@ var accountableFetcher = {
|
|
|
60909
61189
|
if (!chainId || !symbol) continue;
|
|
60910
61190
|
const assetGroup = maps.get(chainId)?.get(symbol);
|
|
60911
61191
|
if (!assetGroup) continue;
|
|
60912
|
-
const
|
|
61192
|
+
const raw = loan.apy_30d ?? loan.apy_7d ?? loan.net_apy;
|
|
61193
|
+
if (raw === null || raw === void 0) continue;
|
|
61194
|
+
const apy = Number(raw);
|
|
60913
61195
|
if (!Number.isFinite(apy)) continue;
|
|
60914
61196
|
out[assetGroup] = apyToAprPercent(apy);
|
|
60915
61197
|
}
|
|
@@ -61158,11 +61440,11 @@ var susdzFetcher = {
|
|
|
61158
61440
|
return Object.fromEntries(KEYS2.map((k) => [k, apr]));
|
|
61159
61441
|
}
|
|
61160
61442
|
};
|
|
61161
|
-
var
|
|
61443
|
+
var CHAIN_ID20 = "747474";
|
|
61162
61444
|
var AVKAT = "0x7231dbacdfc968e07656d12389ab20de82fbfceb";
|
|
61163
61445
|
var AVKAT_YIELD_KEY = "Autocompounding vKAT::avKAT";
|
|
61164
61446
|
var ONE_E1820 = 10n ** 18n;
|
|
61165
|
-
var
|
|
61447
|
+
var WINDOW_SECONDS13 = 30 * 86400;
|
|
61166
61448
|
var BLOCK_TIME_SAMPLE6 = 100000n;
|
|
61167
61449
|
var MAX_RPC_TRIES13 = 3;
|
|
61168
61450
|
var PER_REQUEST_TIMEOUT_MS6 = 6e3;
|
|
@@ -61179,7 +61461,7 @@ var computeAvkatApr = async () => {
|
|
|
61179
61461
|
let lastErr;
|
|
61180
61462
|
for (let rpcId = 0; rpcId < MAX_RPC_TRIES13; rpcId++) {
|
|
61181
61463
|
try {
|
|
61182
|
-
const client = getEvmClient(
|
|
61464
|
+
const client = getEvmClient(CHAIN_ID20, rpcId, {
|
|
61183
61465
|
timeoutMs: PER_REQUEST_TIMEOUT_MS6
|
|
61184
61466
|
});
|
|
61185
61467
|
const head = await client.getBlock();
|
|
@@ -61188,7 +61470,7 @@ var computeAvkatApr = async () => {
|
|
|
61188
61470
|
});
|
|
61189
61471
|
const blockTime = Number(head.timestamp - sample.timestamp) / Number(BLOCK_TIME_SAMPLE6);
|
|
61190
61472
|
if (!(blockTime > 0)) throw new Error("bad block-time sample");
|
|
61191
|
-
const pastBlock = head.number - BigInt(Math.floor(
|
|
61473
|
+
const pastBlock = head.number - BigInt(Math.floor(WINDOW_SECONDS13 / blockTime));
|
|
61192
61474
|
const read = (blockNumber) => client.readContract({
|
|
61193
61475
|
address: AVKAT,
|
|
61194
61476
|
abi: ABI,
|
|
@@ -62509,6 +62791,14 @@ var fetchGeneralYieldsByMarketUid = async () => {
|
|
|
62509
62791
|
rewardsByReserveToken
|
|
62510
62792
|
};
|
|
62511
62793
|
};
|
|
62794
|
+
var fetchLenderRewardsByMarketUid = async () => {
|
|
62795
|
+
const { byLender, byReserveToken } = await fetchLenderRewards();
|
|
62796
|
+
return {
|
|
62797
|
+
lenderRewards: flattenLenderRewards(byLender),
|
|
62798
|
+
rewardsByLenderAsset: byLender,
|
|
62799
|
+
rewardsByReserveToken: byReserveToken
|
|
62800
|
+
};
|
|
62801
|
+
};
|
|
62512
62802
|
var flattenLenderRewards = (input) => {
|
|
62513
62803
|
const result = {};
|
|
62514
62804
|
for (const chainId in input) {
|
|
@@ -65280,7 +65570,7 @@ function lookupUSD3(context, asset) {
|
|
|
65280
65570
|
return context.usdPrices[groupKey] ?? context.usdPrices[lc2] ?? 0;
|
|
65281
65571
|
}
|
|
65282
65572
|
function parseSiloV2GraphQLResults(items, context) {
|
|
65283
|
-
const
|
|
65573
|
+
const ZERO_ADDRESS13 = "0x0000000000000000000000000000000000000000";
|
|
65284
65574
|
const out = [];
|
|
65285
65575
|
const seen = /* @__PURE__ */ new Set();
|
|
65286
65576
|
for (const item of items) {
|
|
@@ -65303,8 +65593,8 @@ function parseSiloV2GraphQLResults(items, context) {
|
|
|
65303
65593
|
const partnerTokenLc = other.token.toLowerCase();
|
|
65304
65594
|
const dedupKey = `${lenderKey}:${tokenLc}`;
|
|
65305
65595
|
if (seen.has(dedupKey)) continue;
|
|
65306
|
-
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ??
|
|
65307
|
-
const isStatic = !oracleAddr || oracleAddr ===
|
|
65596
|
+
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS13).toLowerCase();
|
|
65597
|
+
const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS13;
|
|
65308
65598
|
const siloAddrLc = self.silo.toLowerCase();
|
|
65309
65599
|
try {
|
|
65310
65600
|
let priceUSD = 0;
|
|
@@ -65424,7 +65714,7 @@ function lookupUSD4(context, asset) {
|
|
|
65424
65714
|
return context.usdPrices[groupKey] ?? context.usdPrices[lc2] ?? 0;
|
|
65425
65715
|
}
|
|
65426
65716
|
function parseSiloV3GraphQLResults(items, context) {
|
|
65427
|
-
const
|
|
65717
|
+
const ZERO_ADDRESS13 = "0x0000000000000000000000000000000000000000";
|
|
65428
65718
|
const out = [];
|
|
65429
65719
|
const seen = /* @__PURE__ */ new Set();
|
|
65430
65720
|
for (const item of items) {
|
|
@@ -65447,8 +65737,8 @@ function parseSiloV3GraphQLResults(items, context) {
|
|
|
65447
65737
|
const partnerTokenLc = other.token.toLowerCase();
|
|
65448
65738
|
const dedupKey = `${lenderKey}:${tokenLc}`;
|
|
65449
65739
|
if (seen.has(dedupKey)) continue;
|
|
65450
|
-
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ??
|
|
65451
|
-
const isStatic = !oracleAddr || oracleAddr ===
|
|
65740
|
+
const oracleAddr = (side.solvencyOracleAddress ?? side.solvencyOracle?.id ?? self.solvencyOracle ?? ZERO_ADDRESS13).toLowerCase();
|
|
65741
|
+
const isStatic = !oracleAddr || oracleAddr === ZERO_ADDRESS13;
|
|
65452
65742
|
const siloAddrLc = self.silo.toLowerCase();
|
|
65453
65743
|
try {
|
|
65454
65744
|
let priceUSD = 0;
|
|
@@ -65625,9 +65915,43 @@ var MELLOW_SHARE_RATE_PRICE_SPECS = [
|
|
|
65625
65915
|
}
|
|
65626
65916
|
}
|
|
65627
65917
|
];
|
|
65918
|
+
var ERC4626_ONE_SHARE = 10n ** 18n;
|
|
65919
|
+
var ERC4626_SHARE_RATE_PRICE_SPECS = [
|
|
65920
|
+
{
|
|
65921
|
+
tag: "sfrxUSD",
|
|
65922
|
+
chainId: "1",
|
|
65923
|
+
share: "0xcf62f905562626cfcdd2261162a51fd02fc9c5b6",
|
|
65924
|
+
shareDecimals: 18,
|
|
65925
|
+
underlying: "0xcacd6fd266af91b8aed52accc382b4e165586e29",
|
|
65926
|
+
// frxUSD
|
|
65927
|
+
underlyingDecimals: 18,
|
|
65928
|
+
read: {
|
|
65929
|
+
kind: "assets",
|
|
65930
|
+
address: "0xcf62f905562626cfcdd2261162a51fd02fc9c5b6",
|
|
65931
|
+
fn: "convertToAssets",
|
|
65932
|
+
arg: ERC4626_ONE_SHARE
|
|
65933
|
+
}
|
|
65934
|
+
},
|
|
65935
|
+
{
|
|
65936
|
+
tag: "sDAI",
|
|
65937
|
+
chainId: "1",
|
|
65938
|
+
share: "0x83f20f44975d03b1b09e64809b757c47f942beea",
|
|
65939
|
+
shareDecimals: 18,
|
|
65940
|
+
underlying: "0x6b175474e89094c44da98b954eedeac495271d0f",
|
|
65941
|
+
// DAI
|
|
65942
|
+
underlyingDecimals: 18,
|
|
65943
|
+
read: {
|
|
65944
|
+
kind: "assets",
|
|
65945
|
+
address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
|
|
65946
|
+
fn: "convertToAssets",
|
|
65947
|
+
arg: ERC4626_ONE_SHARE
|
|
65948
|
+
}
|
|
65949
|
+
}
|
|
65950
|
+
];
|
|
65628
65951
|
var SHARE_RATE_PRICE_SPECS = [
|
|
65629
65952
|
...[...VAULT_SHARE_RATE_SPECS, ...EXPIRED_W_SAVINGS_SPECS].filter((s) => !(s.tag in NOT_PRICED)).map(priceSpecFromRateSpec),
|
|
65630
|
-
...MELLOW_SHARE_RATE_PRICE_SPECS
|
|
65953
|
+
...MELLOW_SHARE_RATE_PRICE_SPECS,
|
|
65954
|
+
...ERC4626_SHARE_RATE_PRICE_SPECS
|
|
65631
65955
|
];
|
|
65632
65956
|
var ABI3 = parseAbi([
|
|
65633
65957
|
"function getReport(address asset) view returns (uint224 priceD18, uint32 timestamp, bool isSuspicious)"
|
|
@@ -65968,11 +66292,27 @@ function buildGroup(fetcherName, results, parse, abi, derivation, getCallsErrors
|
|
|
65968
66292
|
function isFailed2(r) {
|
|
65969
66293
|
return r === "0x" || r === void 0;
|
|
65970
66294
|
}
|
|
66295
|
+
var ORACLE_REVERT_COOLDOWN_MS = 30 * 6e4;
|
|
66296
|
+
var REVERT_COOLDOWN_MAX = 2e4;
|
|
66297
|
+
var revertCooldown = /* @__PURE__ */ new Map();
|
|
66298
|
+
var slotKey = (chainId, fetcherName, call) => `${chainId}|${fetcherName}|${String(call?.address ?? "").toLowerCase()}|${call?.name ?? ""}|${JSON.stringify(
|
|
66299
|
+
call?.args ?? call?.params ?? [],
|
|
66300
|
+
(_k, v) => typeof v === "bigint" ? v.toString() : v
|
|
66301
|
+
)}`;
|
|
66302
|
+
function noteRevertCooldown(key4, now) {
|
|
66303
|
+
if (revertCooldown.size >= REVERT_COOLDOWN_MAX) {
|
|
66304
|
+
for (const [k, until] of revertCooldown)
|
|
66305
|
+
if (until <= now) revertCooldown.delete(k);
|
|
66306
|
+
if (revertCooldown.size >= REVERT_COOLDOWN_MAX) revertCooldown.clear();
|
|
66307
|
+
}
|
|
66308
|
+
revertCooldown.set(key4, now + ORACLE_REVERT_COOLDOWN_MS);
|
|
66309
|
+
}
|
|
65971
66310
|
async function executeGroup(group, chainId, chainBatchSize, retries, allowFailure, rpcOverrides, failRetries = 2) {
|
|
65972
66311
|
if (group.calls.length === 0) {
|
|
65973
66312
|
return { results: [] };
|
|
65974
66313
|
}
|
|
65975
66314
|
try {
|
|
66315
|
+
const firstReverts = /* @__PURE__ */ new Set();
|
|
65976
66316
|
const results = await multicallRetryUniversal({
|
|
65977
66317
|
chain: chainId,
|
|
65978
66318
|
calls: group.calls,
|
|
@@ -65982,11 +66322,29 @@ async function executeGroup(group, chainId, chainBatchSize, retries, allowFailur
|
|
|
65982
66322
|
providerId: void 0,
|
|
65983
66323
|
allowFailure,
|
|
65984
66324
|
overrdies: rpcOverrides,
|
|
65985
|
-
logErrors: true
|
|
66325
|
+
logErrors: true,
|
|
66326
|
+
revertedSlots: firstReverts
|
|
65986
66327
|
});
|
|
65987
|
-
|
|
66328
|
+
const now = Date.now();
|
|
66329
|
+
const keyOf = (i) => slotKey(chainId, group.fetcherName, group.calls[i]);
|
|
66330
|
+
const lastFailWasRevert = /* @__PURE__ */ new Map();
|
|
66331
|
+
let failedIndices = [];
|
|
66332
|
+
for (let i = 0; i < results.length; i++) {
|
|
66333
|
+
if (!isFailed2(results[i])) {
|
|
66334
|
+
if (revertCooldown.size > 0) revertCooldown.delete(keyOf(i));
|
|
66335
|
+
continue;
|
|
66336
|
+
}
|
|
66337
|
+
const reverted = firstReverts.has(i);
|
|
66338
|
+
lastFailWasRevert.set(i, reverted);
|
|
66339
|
+
if (reverted) {
|
|
66340
|
+
const until = revertCooldown.get(keyOf(i));
|
|
66341
|
+
if (until !== void 0 && until > now) continue;
|
|
66342
|
+
}
|
|
66343
|
+
failedIndices.push(i);
|
|
66344
|
+
}
|
|
65988
66345
|
for (let round = 0; round < failRetries && failedIndices.length > 0; round++) {
|
|
65989
66346
|
const retryCalls = failedIndices.map((i) => group.calls[i]);
|
|
66347
|
+
const roundReverts = /* @__PURE__ */ new Set();
|
|
65990
66348
|
try {
|
|
65991
66349
|
const retryResults = await multicallRetryUniversal({
|
|
65992
66350
|
chain: chainId,
|
|
@@ -65998,21 +66356,33 @@ async function executeGroup(group, chainId, chainBatchSize, retries, allowFailur
|
|
|
65998
66356
|
// rotate to next RPC provider
|
|
65999
66357
|
allowFailure,
|
|
66000
66358
|
overrdies: rpcOverrides,
|
|
66001
|
-
logErrors: true
|
|
66359
|
+
logErrors: true,
|
|
66360
|
+
revertedSlots: roundReverts
|
|
66002
66361
|
});
|
|
66003
66362
|
const stillFailed = [];
|
|
66004
66363
|
for (let j = 0; j < failedIndices.length; j++) {
|
|
66364
|
+
const idx = failedIndices[j];
|
|
66005
66365
|
if (!isFailed2(retryResults[j])) {
|
|
66006
|
-
results[
|
|
66366
|
+
results[idx] = retryResults[j];
|
|
66367
|
+
lastFailWasRevert.delete(idx);
|
|
66368
|
+
if (revertCooldown.size > 0) revertCooldown.delete(keyOf(idx));
|
|
66007
66369
|
} else {
|
|
66008
|
-
|
|
66370
|
+
lastFailWasRevert.set(
|
|
66371
|
+
idx,
|
|
66372
|
+
(lastFailWasRevert.get(idx) ?? false) && roundReverts.has(j)
|
|
66373
|
+
);
|
|
66374
|
+
stillFailed.push(idx);
|
|
66009
66375
|
}
|
|
66010
66376
|
}
|
|
66011
66377
|
failedIndices = stillFailed;
|
|
66012
66378
|
} catch {
|
|
66379
|
+
for (const idx of failedIndices) lastFailWasRevert.set(idx, false);
|
|
66013
66380
|
break;
|
|
66014
66381
|
}
|
|
66015
66382
|
}
|
|
66383
|
+
for (const idx of failedIndices) {
|
|
66384
|
+
if (lastFailWasRevert.get(idx)) noteRevertCooldown(keyOf(idx), now);
|
|
66385
|
+
}
|
|
66016
66386
|
const failCount = results.filter((r) => isFailed2(r)).length;
|
|
66017
66387
|
const allFailed = failCount === results.length && results.length > 0;
|
|
66018
66388
|
return {
|
|
@@ -67145,6 +67515,35 @@ function rejectOutliers(candidates, guard = DEFAULT_OUTLIER_GUARD) {
|
|
|
67145
67515
|
);
|
|
67146
67516
|
return kept.length > 0 ? kept : candidates;
|
|
67147
67517
|
}
|
|
67518
|
+
var DEFAULT_CONSENSUS_DEMOTION = {
|
|
67519
|
+
minProtocols: 3,
|
|
67520
|
+
agreementTolerance: 0.01,
|
|
67521
|
+
demoteDeviation: 0.03
|
|
67522
|
+
};
|
|
67523
|
+
function protocolOf(lender) {
|
|
67524
|
+
return lenderFamily(lender).split("_")[0].toUpperCase();
|
|
67525
|
+
}
|
|
67526
|
+
function protocolConsensus(candidates, cfg = DEFAULT_CONSENSUS_DEMOTION) {
|
|
67527
|
+
const byProtocol = /* @__PURE__ */ new Map();
|
|
67528
|
+
for (const c of candidates) {
|
|
67529
|
+
if (!(c.priceUSD > 0) || !Number.isFinite(c.priceUSD)) continue;
|
|
67530
|
+
const p = protocolOf(c.lender);
|
|
67531
|
+
const bucket = byProtocol.get(p);
|
|
67532
|
+
if (bucket) bucket.push(c.priceUSD);
|
|
67533
|
+
else byProtocol.set(p, [c.priceUSD]);
|
|
67534
|
+
}
|
|
67535
|
+
if (byProtocol.size < cfg.minProtocols) return void 0;
|
|
67536
|
+
const votes = [...byProtocol.values()].map(median);
|
|
67537
|
+
const reference = median(votes);
|
|
67538
|
+
if (!(reference > 0)) return void 0;
|
|
67539
|
+
const agreeing = votes.filter(
|
|
67540
|
+
(v) => Math.abs(v / reference - 1) <= cfg.agreementTolerance
|
|
67541
|
+
).length;
|
|
67542
|
+
return agreeing >= cfg.minProtocols ? reference : void 0;
|
|
67543
|
+
}
|
|
67544
|
+
function disagreesWith(priceUSD, reference, cfg = DEFAULT_CONSENSUS_DEMOTION) {
|
|
67545
|
+
return Math.abs(priceUSD / reference - 1) > cfg.demoteDeviation;
|
|
67546
|
+
}
|
|
67148
67547
|
|
|
67149
67548
|
// src/prices/oracle-prices/feedStats.ts
|
|
67150
67549
|
var EWMA_ALPHA = 0.1;
|
|
@@ -67378,7 +67777,8 @@ var DEFAULT_PRIORITY = {
|
|
|
67378
67777
|
lowPriorityLendersPerChain: {},
|
|
67379
67778
|
excludedLendersPerChain: {},
|
|
67380
67779
|
staleRejectSeconds: DEFAULT_STALE_REJECT_SECONDS,
|
|
67381
|
-
outlierGuard: DEFAULT_OUTLIER_GUARD
|
|
67780
|
+
outlierGuard: DEFAULT_OUTLIER_GUARD,
|
|
67781
|
+
consensusDemotion: DEFAULT_CONSENSUS_DEMOTION
|
|
67382
67782
|
};
|
|
67383
67783
|
var SOURCE_RANK = { shareRate: 0, oracle: 1, fallback: 2 };
|
|
67384
67784
|
var LENDER_RANK_UNLISTED = 1e3;
|
|
@@ -67406,7 +67806,7 @@ function depthOf(entryMarketUid, lender, depth) {
|
|
|
67406
67806
|
return typeof perLender === "number" ? perLender : 0;
|
|
67407
67807
|
}
|
|
67408
67808
|
function compareCandidates(a, b) {
|
|
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
|
|
67809
|
+
return a.sourceRank - b.sourceRank || a.consensusRank - b.consensusRank || 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
|
|
67410
67810
|
// token in every vault that lists it), so lender+chain is NOT a unique
|
|
67411
67811
|
// identity. Without these last two the winner among them fell out of
|
|
67412
67812
|
// enumeration order and the flat price moved between runs.
|
|
@@ -67419,6 +67819,7 @@ var SHARE_RATE_ROUNDS = 3;
|
|
|
67419
67819
|
function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, priorityCfg = DEFAULT_PRIORITY, options = {}) {
|
|
67420
67820
|
const staleRejectSeconds = priorityCfg.staleRejectSeconds ?? DEFAULT_STALE_REJECT_SECONDS;
|
|
67421
67821
|
const guard = priorityCfg.outlierGuard === void 0 ? DEFAULT_OUTLIER_GUARD : priorityCfg.outlierGuard;
|
|
67822
|
+
const demotion = priorityCfg.consensusDemotion === void 0 ? DEFAULT_CONSENSUS_DEMOTION : priorityCfg.consensusDemotion;
|
|
67422
67823
|
const depth = options.depth ?? depthOrTvl;
|
|
67423
67824
|
const feedStats = options.feedStats;
|
|
67424
67825
|
const nowSeconds2 = options.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
@@ -67454,6 +67855,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
67454
67855
|
// last resort too (a registry-wide sweep of vault rates), and is
|
|
67455
67856
|
// then resolved the same way but ranked as a fallback
|
|
67456
67857
|
sourceRank: entry.fallbackOnly ? SOURCE_RANK.fallback : shareRate ? SOURCE_RANK.shareRate : SOURCE_RANK.oracle,
|
|
67858
|
+
consensusRank: 0,
|
|
67457
67859
|
oracleKey,
|
|
67458
67860
|
priceUSD: entry.priceUSD,
|
|
67459
67861
|
chainId,
|
|
@@ -67488,7 +67890,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
67488
67890
|
const flatPrices = {};
|
|
67489
67891
|
const chosen = /* @__PURE__ */ new Map();
|
|
67490
67892
|
for (const [oracleKey, all] of byKey) {
|
|
67491
|
-
const pick3 = pickBest(all, guard);
|
|
67893
|
+
const pick3 = pickBest(all, guard, demotion);
|
|
67492
67894
|
if (!pick3) continue;
|
|
67493
67895
|
chosen.set(oracleKey, pick3);
|
|
67494
67896
|
flatPrices[oracleKey] = pick3.best.priceUSD;
|
|
@@ -67515,7 +67917,7 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
67515
67917
|
touched.add(key4);
|
|
67516
67918
|
}
|
|
67517
67919
|
for (const key4 of touched) {
|
|
67518
|
-
const pick3 = pickBest(byKey.get(key4), guard);
|
|
67920
|
+
const pick3 = pickBest(byKey.get(key4), guard, demotion);
|
|
67519
67921
|
if (!pick3) continue;
|
|
67520
67922
|
chosen.set(key4, pick3);
|
|
67521
67923
|
flatPrices[key4] = pick3.best.priceUSD;
|
|
@@ -67523,7 +67925,10 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
67523
67925
|
pending = waiting;
|
|
67524
67926
|
}
|
|
67525
67927
|
if (options.onSelection) {
|
|
67526
|
-
for (const [
|
|
67928
|
+
for (const [
|
|
67929
|
+
oracleKey,
|
|
67930
|
+
{ best, candidates, rejected, demoted, consensusUSD }
|
|
67931
|
+
] of chosen) {
|
|
67527
67932
|
options.onSelection({
|
|
67528
67933
|
assetGroup: oracleKey,
|
|
67529
67934
|
priceUSD: best.priceUSD,
|
|
@@ -67532,17 +67937,28 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
67532
67937
|
feedKey: best.feedKey,
|
|
67533
67938
|
derivation: derivationOfRank(best.derivationRank),
|
|
67534
67939
|
candidates,
|
|
67535
|
-
rejected
|
|
67940
|
+
rejected,
|
|
67941
|
+
...demoted ? { demoted, consensusUSD } : {}
|
|
67536
67942
|
});
|
|
67537
67943
|
}
|
|
67538
67944
|
}
|
|
67539
67945
|
return flatPrices;
|
|
67540
67946
|
}
|
|
67541
|
-
function pickBest(all, guard) {
|
|
67947
|
+
function pickBest(all, guard, demotion = DEFAULT_CONSENSUS_DEMOTION) {
|
|
67542
67948
|
const authoritative = all.filter((c) => c.authoritative);
|
|
67543
67949
|
const real = all.filter((c) => c.sourceRank < SOURCE_RANK.fallback);
|
|
67544
67950
|
const candidates = authoritative.length ? authoritative : real.length ? real : all;
|
|
67545
|
-
const
|
|
67951
|
+
const guarded = guard ? rejectOutliers(candidates, guard) : candidates;
|
|
67952
|
+
const voters = guarded.filter(
|
|
67953
|
+
(c) => c.sourceRank === SOURCE_RANK.oracle && !c.authoritative
|
|
67954
|
+
);
|
|
67955
|
+
const consensusUSD = demotion ? protocolConsensus(voters, demotion) : void 0;
|
|
67956
|
+
let demoted = 0;
|
|
67957
|
+
const viable = consensusUSD === void 0 || !demotion ? guarded : guarded.map((c) => {
|
|
67958
|
+
const off = c.sourceRank === SOURCE_RANK.oracle && !c.authoritative && disagreesWith(c.priceUSD, consensusUSD, demotion);
|
|
67959
|
+
if (off) demoted++;
|
|
67960
|
+
return off ? { ...c, consensusRank: 1 } : c;
|
|
67961
|
+
});
|
|
67546
67962
|
let best = viable[0];
|
|
67547
67963
|
for (const c of viable) {
|
|
67548
67964
|
if (compareCandidates(c, best) < 0) best = c;
|
|
@@ -67551,7 +67967,9 @@ function pickBest(all, guard) {
|
|
|
67551
67967
|
return {
|
|
67552
67968
|
best,
|
|
67553
67969
|
candidates: candidates.length,
|
|
67554
|
-
rejected: candidates.length -
|
|
67970
|
+
rejected: candidates.length - guarded.length,
|
|
67971
|
+
demoted,
|
|
67972
|
+
consensusUSD
|
|
67555
67973
|
};
|
|
67556
67974
|
}
|
|
67557
67975
|
var RANK_TO_DERIVATION = ["direct", "quoted", "derived"];
|
|
@@ -68619,6 +69037,117 @@ function parseVault2(v, chainId, prices, tokenList) {
|
|
|
68619
69037
|
liquidityUsd: liquidityUsd || liquidityFormatted * resolvedPriceUsd
|
|
68620
69038
|
};
|
|
68621
69039
|
}
|
|
69040
|
+
var vaultV2sQuery = (first, skip, chainId) => `
|
|
69041
|
+
query GetVaultV2s {
|
|
69042
|
+
vaultV2s(
|
|
69043
|
+
first: ${first},
|
|
69044
|
+
skip: ${skip},
|
|
69045
|
+
where: { chainId_in: [${chainId}], totalAssetsUsd_gte: ${MIN_TOTAL_ASSETS_USD} },
|
|
69046
|
+
orderBy: TotalAssetsUsd,
|
|
69047
|
+
orderDirection: Desc
|
|
69048
|
+
) {
|
|
69049
|
+
items {
|
|
69050
|
+
address
|
|
69051
|
+
symbol
|
|
69052
|
+
name
|
|
69053
|
+
whitelisted: listed
|
|
69054
|
+
asset {
|
|
69055
|
+
address
|
|
69056
|
+
name
|
|
69057
|
+
symbol
|
|
69058
|
+
decimals
|
|
69059
|
+
priceUsd
|
|
69060
|
+
}
|
|
69061
|
+
totalAssets
|
|
69062
|
+
totalAssetsUsd
|
|
69063
|
+
totalSupply
|
|
69064
|
+
liquidity
|
|
69065
|
+
liquidityUsd
|
|
69066
|
+
apy
|
|
69067
|
+
netApy
|
|
69068
|
+
netApyExcludingRewards
|
|
69069
|
+
performanceFee
|
|
69070
|
+
managementFee
|
|
69071
|
+
owner { address }
|
|
69072
|
+
curator { address }
|
|
69073
|
+
curators { items { id name image verified } }
|
|
69074
|
+
rewards { supplyApr asset { address } }
|
|
69075
|
+
gatesConfig {
|
|
69076
|
+
sendSharesGate { address }
|
|
69077
|
+
receiveSharesGate { address }
|
|
69078
|
+
sendAssetsGate { address }
|
|
69079
|
+
receiveAssetsGate { address }
|
|
69080
|
+
}
|
|
69081
|
+
}
|
|
69082
|
+
}
|
|
69083
|
+
}
|
|
69084
|
+
`;
|
|
69085
|
+
var ZERO_ADDRESS12 = "0x0000000000000000000000000000000000000000";
|
|
69086
|
+
var V2_PAGE_SIZE = 100;
|
|
69087
|
+
var isGatedVaultV2 = (gates) => Object.values(gates ?? {}).some((g) => {
|
|
69088
|
+
const a = g?.address?.toLowerCase();
|
|
69089
|
+
return !!a && a !== ZERO_ADDRESS12;
|
|
69090
|
+
});
|
|
69091
|
+
var bigIntString = (v) => {
|
|
69092
|
+
if (v === null || v === void 0) return "0";
|
|
69093
|
+
if (typeof v === "string") return v;
|
|
69094
|
+
return Number.isFinite(v) ? BigInt(Math.trunc(v)).toString() : "0";
|
|
69095
|
+
};
|
|
69096
|
+
function parseVaultV2(v, chainId, prices, tokenList) {
|
|
69097
|
+
if (isGatedVaultV2(v?.gatesConfig)) return null;
|
|
69098
|
+
const netApy = v.netApyExcludingRewards ?? v.netApy ?? v.apy;
|
|
69099
|
+
if (Number(netApy ?? 0) < 0) return null;
|
|
69100
|
+
const parsed = parseVault2(
|
|
69101
|
+
{
|
|
69102
|
+
address: v.address,
|
|
69103
|
+
symbol: v.symbol,
|
|
69104
|
+
name: v.name,
|
|
69105
|
+
whitelisted: v.whitelisted,
|
|
69106
|
+
asset: v.asset,
|
|
69107
|
+
liquidity: {
|
|
69108
|
+
underlying: bigIntString(v.liquidity),
|
|
69109
|
+
usd: v.liquidityUsd
|
|
69110
|
+
},
|
|
69111
|
+
state: {
|
|
69112
|
+
totalAssets: bigIntString(v.totalAssets),
|
|
69113
|
+
totalAssetsUsd: v.totalAssetsUsd,
|
|
69114
|
+
totalSupply: bigIntString(v.totalSupply),
|
|
69115
|
+
apy: v.apy,
|
|
69116
|
+
netApy,
|
|
69117
|
+
fee: v.performanceFee,
|
|
69118
|
+
timelock: 0,
|
|
69119
|
+
owner: v.owner?.address ?? null,
|
|
69120
|
+
curator: v.curator?.address ?? null,
|
|
69121
|
+
guardian: null,
|
|
69122
|
+
curators: v.curators?.items ?? null,
|
|
69123
|
+
rewards: v.rewards
|
|
69124
|
+
}
|
|
69125
|
+
},
|
|
69126
|
+
chainId,
|
|
69127
|
+
prices,
|
|
69128
|
+
tokenList
|
|
69129
|
+
);
|
|
69130
|
+
return parsed ? { ...parsed, version: 2 } : null;
|
|
69131
|
+
}
|
|
69132
|
+
async function fetchVaultV2Page(chainId, first, skip) {
|
|
69133
|
+
const response = await fetch(MORPHO_API_URL, {
|
|
69134
|
+
method: "POST",
|
|
69135
|
+
headers: { "Content-Type": "application/json" },
|
|
69136
|
+
body: JSON.stringify({ query: vaultV2sQuery(first, skip, chainId) })
|
|
69137
|
+
});
|
|
69138
|
+
if (!response.ok) {
|
|
69139
|
+
throw new Error(
|
|
69140
|
+
`Morpho vaultV2s API failed: ${response.status} - ${response.statusText}`
|
|
69141
|
+
);
|
|
69142
|
+
}
|
|
69143
|
+
const json = await response.json();
|
|
69144
|
+
if (json?.errors?.length) {
|
|
69145
|
+
throw new Error(
|
|
69146
|
+
`Morpho vaultV2s API GraphQL error: ${json.errors.map((e) => e?.message).join("; ")}`
|
|
69147
|
+
);
|
|
69148
|
+
}
|
|
69149
|
+
return json?.data?.vaultV2s?.items ?? [];
|
|
69150
|
+
}
|
|
68622
69151
|
async function fetchMorphoVaultsFromApi(chainId, prices = {}, tokenList = {}, maxItems = 1e3) {
|
|
68623
69152
|
const out = {};
|
|
68624
69153
|
let skip = 0;
|
|
@@ -68632,6 +69161,23 @@ async function fetchMorphoVaultsFromApi(chainId, prices = {}, tokenList = {}, ma
|
|
|
68632
69161
|
if (page.length < PAGE_SIZE2) break;
|
|
68633
69162
|
skip += PAGE_SIZE2;
|
|
68634
69163
|
}
|
|
69164
|
+
try {
|
|
69165
|
+
let skipV2 = 0;
|
|
69166
|
+
while (skipV2 < maxItems) {
|
|
69167
|
+
const page = await fetchVaultV2Page(chainId, V2_PAGE_SIZE, skipV2);
|
|
69168
|
+
if (page.length === 0) break;
|
|
69169
|
+
for (const v of page) {
|
|
69170
|
+
const parsed = parseVaultV2(v, chainId, prices, tokenList);
|
|
69171
|
+
if (parsed && !out[parsed.address]) out[parsed.address] = parsed;
|
|
69172
|
+
}
|
|
69173
|
+
if (page.length < V2_PAGE_SIZE) break;
|
|
69174
|
+
skipV2 += V2_PAGE_SIZE;
|
|
69175
|
+
}
|
|
69176
|
+
} catch (e) {
|
|
69177
|
+
console.warn(
|
|
69178
|
+
`[morpho-vaults] Vault V2 fetch failed on chain ${chainId}, serving V1 only: ${e?.message ?? e}`
|
|
69179
|
+
);
|
|
69180
|
+
}
|
|
68635
69181
|
return out;
|
|
68636
69182
|
}
|
|
68637
69183
|
var marketUidFor = (ctx, marketId) => {
|
|
@@ -70075,24 +70621,36 @@ var DECIMALS_ABI = [
|
|
|
70075
70621
|
outputs: [{ type: "uint8" }]
|
|
70076
70622
|
}
|
|
70077
70623
|
];
|
|
70624
|
+
var shareDecimalsCache = /* @__PURE__ */ new Map();
|
|
70078
70625
|
async function fetchShareDecimals(chainId, vaultAddrs, multicallRetry) {
|
|
70079
70626
|
const out = /* @__PURE__ */ new Map();
|
|
70080
|
-
|
|
70627
|
+
const missing = [];
|
|
70628
|
+
for (const a of vaultAddrs) {
|
|
70629
|
+
const lower4 = a.toLowerCase();
|
|
70630
|
+
const hit = shareDecimalsCache.get(`${chainId}:${lower4}`);
|
|
70631
|
+
if (hit !== void 0) out.set(lower4, hit);
|
|
70632
|
+
else missing.push(a);
|
|
70633
|
+
}
|
|
70634
|
+
if (!multicallRetry || missing.length === 0) return out;
|
|
70081
70635
|
try {
|
|
70082
70636
|
const res = await multicallRetry({
|
|
70083
70637
|
chain: chainId,
|
|
70084
|
-
calls:
|
|
70638
|
+
calls: missing.map((address) => ({
|
|
70085
70639
|
address,
|
|
70086
70640
|
name: "decimals",
|
|
70087
70641
|
params: []
|
|
70088
70642
|
})),
|
|
70089
|
-
abi:
|
|
70643
|
+
abi: missing.map(() => DECIMALS_ABI),
|
|
70090
70644
|
allowFailure: true,
|
|
70091
70645
|
maxRetries: 2
|
|
70092
70646
|
});
|
|
70093
|
-
|
|
70647
|
+
missing.forEach((a, i) => {
|
|
70094
70648
|
const d = Number(res?.[i]);
|
|
70095
|
-
if (Number.
|
|
70649
|
+
if (Number.isInteger(d) && d >= 0 && d <= 255) {
|
|
70650
|
+
const lower4 = a.toLowerCase();
|
|
70651
|
+
out.set(lower4, d);
|
|
70652
|
+
shareDecimalsCache.set(`${chainId}:${lower4}`, d);
|
|
70653
|
+
}
|
|
70096
70654
|
});
|
|
70097
70655
|
} catch {
|
|
70098
70656
|
}
|
|
@@ -70386,7 +70944,24 @@ function rescaleExchangeRate(exchangeRate, shareDecimals) {
|
|
|
70386
70944
|
const dec2 = Math.max(0, Math.round(Number(shareDecimals) || 0));
|
|
70387
70945
|
return (r * 10n ** BigInt(dec2) / 10n ** 18n).toString();
|
|
70388
70946
|
}
|
|
70389
|
-
|
|
70947
|
+
var EULER_API_CACHE_TTL_MS = 6e4;
|
|
70948
|
+
var jsonCache = /* @__PURE__ */ new Map();
|
|
70949
|
+
function getJson6(url) {
|
|
70950
|
+
const hit = jsonCache.get(url);
|
|
70951
|
+
if (hit && Date.now() - hit.at < EULER_API_CACHE_TTL_MS) return hit.promise;
|
|
70952
|
+
const entry = { at: Date.now(), promise: fetchJsonOnce(url) };
|
|
70953
|
+
jsonCache.set(url, entry);
|
|
70954
|
+
entry.promise.then((v) => {
|
|
70955
|
+
if (v === void 0 && jsonCache.get(url) === entry) jsonCache.delete(url);
|
|
70956
|
+
});
|
|
70957
|
+
if (jsonCache.size > 5e3) {
|
|
70958
|
+
const now = Date.now();
|
|
70959
|
+
for (const [k, e] of jsonCache)
|
|
70960
|
+
if (now - e.at >= EULER_API_CACHE_TTL_MS) jsonCache.delete(k);
|
|
70961
|
+
}
|
|
70962
|
+
return entry.promise;
|
|
70963
|
+
}
|
|
70964
|
+
async function fetchJsonOnce(url) {
|
|
70390
70965
|
const controller = new AbortController();
|
|
70391
70966
|
const timer = setTimeout(() => controller.abort(), API_TIMEOUT_MS2);
|
|
70392
70967
|
try {
|
|
@@ -79768,6 +80343,35 @@ var readerMorphoVaultV2 = (entry) => {
|
|
|
79768
80343
|
};
|
|
79769
80344
|
};
|
|
79770
80345
|
|
|
80346
|
+
// src/vaults/savings/readers/accountableVault.ts
|
|
80347
|
+
var readerAccountableVault = (entry) => {
|
|
80348
|
+
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
80349
|
+
const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
|
|
80350
|
+
return {
|
|
80351
|
+
calls: [
|
|
80352
|
+
{ address: entry.address, name: "totalSupply", params: [] },
|
|
80353
|
+
{
|
|
80354
|
+
address: entry.address,
|
|
80355
|
+
name: "convertToAssets",
|
|
80356
|
+
params: [shareUnit]
|
|
80357
|
+
}
|
|
80358
|
+
],
|
|
80359
|
+
abis: [TotalSupplyAbi2, Erc4626ReadAbi2],
|
|
80360
|
+
parse: ([supply, rate]) => {
|
|
80361
|
+
const totalSupply = toBigInt16(supply);
|
|
80362
|
+
const assetsPerShare = toBigInt16(rate);
|
|
80363
|
+
if (totalSupply === void 0 || assetsPerShare === void 0) {
|
|
80364
|
+
return void 0;
|
|
80365
|
+
}
|
|
80366
|
+
return {
|
|
80367
|
+
totalAssets: totalSupply * assetsPerShare / shareUnit,
|
|
80368
|
+
totalSupply,
|
|
80369
|
+
exchangeRate: assetsPerShare * ONE_E1823 / underlyingUnit
|
|
80370
|
+
};
|
|
80371
|
+
}
|
|
80372
|
+
};
|
|
80373
|
+
};
|
|
80374
|
+
|
|
79771
80375
|
// src/vaults/savings/readers/index.ts
|
|
79772
80376
|
var buildReader2 = (entry) => {
|
|
79773
80377
|
switch (entry.reader) {
|
|
@@ -79821,6 +80425,8 @@ var buildReader2 = (entry) => {
|
|
|
79821
80425
|
return readerUnitasXgld(entry);
|
|
79822
80426
|
case "sbold":
|
|
79823
80427
|
return readerSBold(entry);
|
|
80428
|
+
case "accountable-vault":
|
|
80429
|
+
return readerAccountableVault(entry);
|
|
79824
80430
|
case "morpho-vault-v2":
|
|
79825
80431
|
return readerMorphoVaultV2(entry);
|
|
79826
80432
|
case "erc4626-cooldown":
|
|
@@ -81806,8 +82412,20 @@ var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
|
|
|
81806
82412
|
// Piku USP — a USD NAV token whose book holds Turkish-lira carry and FX
|
|
81807
82413
|
// arbitrage; the Inverter oracle restates it in steps and a lira move can
|
|
81808
82414
|
// mark it DOWN in dollars. Its realized rate is a NAV delta, not a coupon.
|
|
81809
|
-
"1-0x098697ba3fee4ea76294c5d6a466a4e3b3e95fe6"
|
|
82415
|
+
"1-0x098697ba3fee4ea76294c5d6a466a4e3b3e95fe6",
|
|
81810
82416
|
// USP
|
|
82417
|
+
// Morini Capital's single-strategy vaults behind USP (registryMorini.ts) —
|
|
82418
|
+
// the same call for the same reason: USD NAVs over Turkish-market books.
|
|
82419
|
+
// CarryTradeUSDTRYLeverage is UNHEDGED leveraged lira carry (37 % since
|
|
82420
|
+
// launch to 2026-10-19 because lira rates are high, and a lira fall marks
|
|
82421
|
+
// it down with leverage); the basis and FX-arbitrage books are hedged but
|
|
82422
|
+
// their price is a restated mark, not a coupon.
|
|
82423
|
+
"1-0x2bf11d2e04bc40daa95c24b8b90ec4f5c57dd326",
|
|
82424
|
+
// CarryTradeUSDTRYLeverage
|
|
82425
|
+
"1-0x827ce7e8e35861d9ac7fe002755767b695a5594a",
|
|
82426
|
+
// StockMarketTRBasisTrade
|
|
82427
|
+
"1-0x99351baed3d8ab544ccb08af96a105910fda71e7"
|
|
82428
|
+
// aFXArbUSDTRY
|
|
81811
82429
|
]);
|
|
81812
82430
|
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
81813
82431
|
// USD majors
|
|
@@ -92757,6 +93375,6 @@ function earnPositionTotals(items) {
|
|
|
92757
93375
|
};
|
|
92758
93376
|
}
|
|
92759
93377
|
|
|
92760
|
-
export { ApiBookSource, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, DEFAULT_TERM_ORDER_STORE, DOLOMITE_ISO_ID_PREFIX, EARN_DESCRIPTIONS, EARN_LABELS, EARN_RATE_SOURCE_BY_PROVIDER, EMPTY_BALANCE, EXACTLY_LENDER_KEY, EXPONENT_MATURED_REASON, FLYING_TULIP_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, NON_EVM_VAULT_PROVIDERS, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL2 as PENDLE_MARKETS_URL, PREFIX_LENDERS, RIPE_LENDER_KEY, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, SVM_EARN_MINT_BUILDERS, SVM_EARN_VAULT_BUILDERS, SVM_VAULT_PROVIDERS, TELLER_CALLS_PER_BID, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_MARKETS_PER_CALL, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyEarnSanity, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, blockNumberFromTag, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildQueriesFromMeta, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertCoolerMarketsToResponse, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFlyingTulipMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRipeMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMultiAccountTypeUserState, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, dolomiteVaultAddress, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRateAtMaturity, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, emitterCoverage, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, enumerateEmitters, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchCoolerMarkets, fetchDolomiteAccountNumbers, fetchDolomiteSubAccounts, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidDexState, fetchFluidFTokens, fetchFlyingTulipMarkets, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRipeMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTermStoreOrders, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchUsualRewardsClaimData, fetchYearnApiVaults, fetchYearnVaults, fillableRemaining, filterActiveLenders, filterLenderMeta, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getResolvedDolomiteSubAccounts, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, injectLenderInfoIntoEntries, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLenderVenueKey, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isMaturedTerm, isSecondaryMarketOnly, isStablecoinSymbol, isSyntheticQuoteUnit, isUnearnableEarnRate, isUnrealizableEarnRate, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, marketKeysOf, meetsLiquidityFloor, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, organizeUserQueries, parseBalanceFetcherResult, parseDolomiteSubAccountId, parseEarnUid, parseLenderKey, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, pruneFeedStats, rankFindings, ratePercent, readUserPositions, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, repairImpossibleTvl, resolveAdapter, resolveDerivation, resolveDolomiteRowIdentity, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, selectUsualRewardEntry, setMysticApiKey, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, subAccountsOf, supplyDescription, supplyFindings, supplyHeadline, svmEarnBuildability, svmEarnBuilderKey, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termApiBaseUrl, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, termOfferRateToAprPct, termOrderStoreBaseUrl, tickToAprNumber, tickToPrice, toDigest, toDolomiteSubAccountId, toTermFillNow, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
|
|
93378
|
+
export { ApiBookSource, DEFAULT_CONSENSUS_DEMOTION, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, DEFAULT_TERM_ORDER_STORE, DOLOMITE_ISO_ID_PREFIX, EARN_DESCRIPTIONS, EARN_LABELS, EARN_RATE_SOURCE_BY_PROVIDER, EMPTY_BALANCE, EXACTLY_LENDER_KEY, EXPONENT_MATURED_REASON, FLYING_TULIP_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, NON_EVM_VAULT_PROVIDERS, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL2 as PENDLE_MARKETS_URL, PREFIX_LENDERS, RIPE_LENDER_KEY, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, SVM_EARN_MINT_BUILDERS, SVM_EARN_VAULT_BUILDERS, SVM_VAULT_PROVIDERS, TELLER_CALLS_PER_BID, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_MARKETS_PER_CALL, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyEarnSanity, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, blockNumberFromTag, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildQueriesFromMeta, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertCoolerMarketsToResponse, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFlyingTulipMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRipeMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMultiAccountTypeUserState, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, dolomiteVaultAddress, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRateAtMaturity, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, emitterCoverage, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, enumerateEmitters, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchCoolerMarkets, fetchDolomiteAccountNumbers, fetchDolomiteSubAccounts, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidDexState, fetchFluidFTokens, fetchFlyingTulipMarkets, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLenderRewards, fetchLenderRewardsByMarketUid, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRipeMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTermStoreOrders, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchUsualRewardsClaimData, fetchYearnApiVaults, fetchYearnVaults, fillableRemaining, filterActiveLenders, filterLenderMeta, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getResolvedDolomiteSubAccounts, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, injectLenderInfoIntoEntries, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLenderVenueKey, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isMaturedTerm, isSecondaryMarketOnly, isStablecoinSymbol, isSyntheticQuoteUnit, isUnearnableEarnRate, isUnrealizableEarnRate, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, marketKeysOf, meetsLiquidityFloor, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, organizeUserQueries, parseBalanceFetcherResult, parseDolomiteSubAccountId, parseEarnUid, parseLenderKey, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, protocolConsensus, protocolOf, pruneFeedStats, rankFindings, ratePercent, readUserPositions, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, repairImpossibleTvl, resolveAdapter, resolveDerivation, resolveDolomiteRowIdentity, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, selectUsualRewardEntry, setMysticApiKey, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, subAccountsOf, supplyDescription, supplyFindings, supplyHeadline, svmEarnBuildability, svmEarnBuilderKey, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termApiBaseUrl, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, termOfferRateToAprPct, termOrderStoreBaseUrl, tickToAprNumber, tickToPrice, toDigest, toDolomiteSubAccountId, toTermFillNow, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
|
|
92761
93379
|
//# sourceMappingURL=index.js.map
|
|
92762
93380
|
//# sourceMappingURL=index.js.map
|