@1delta/margin-fetcher 5.0.84 → 5.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +80 -7
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -16364,6 +16364,16 @@ function getKineticRates(info, chainId) {
|
|
|
16364
16364
|
// src/lending/public-data/compound-v2/convert/types.ts
|
|
16365
16365
|
var PRICE_DECIMALS = 18;
|
|
16366
16366
|
var RESERVE_MANTISSA_DECIMALS = 18;
|
|
16367
|
+
var resolveMarketPrice = (prices, asset, chainId) => {
|
|
16368
|
+
const group = asset?.assetGroup;
|
|
16369
|
+
if (group != null && prices[group] != null) return prices[group];
|
|
16370
|
+
const address = asset?.address?.toLowerCase();
|
|
16371
|
+
if (address != null) {
|
|
16372
|
+
const fallback = prices[`${chainId}-${address}`];
|
|
16373
|
+
if (fallback != null) return fallback;
|
|
16374
|
+
}
|
|
16375
|
+
return 0;
|
|
16376
|
+
};
|
|
16367
16377
|
|
|
16368
16378
|
// src/lending/public-data/compound-v2/convert/risk.ts
|
|
16369
16379
|
var DEFAULT_CLOSE_FACTOR = 0.5;
|
|
@@ -16429,7 +16439,7 @@ function convertSingleEntry(opts) {
|
|
|
16429
16439
|
parseRawAmount(currentEntry?.totalBorrows?.toString(), decs)
|
|
16430
16440
|
);
|
|
16431
16441
|
const liquidity = cashLiquidity(currentEntry?.totalCash ?? currentEntry?.cash, decs) ?? totalSupplyUnderlying - totalDebt;
|
|
16432
|
-
const price2 = prices
|
|
16442
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16433
16443
|
const pausedActions = { ...currentEntry.pausedActions };
|
|
16434
16444
|
if (opts.pause?.mintPaused !== void 0)
|
|
16435
16445
|
pausedActions[0 /* MINT */] = opts.pause.mintPaused;
|
|
@@ -16519,7 +16529,7 @@ function convertSumerEntry(opts) {
|
|
|
16519
16529
|
parseRawAmount(currentEntry.totalBorrows?.toString(), decs)
|
|
16520
16530
|
);
|
|
16521
16531
|
const liquidity = cashLiquidity(currentEntry?.totalCash, decs) ?? totalSupplyUnderlying - totalDebt;
|
|
16522
|
-
const price2 = prices
|
|
16532
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16523
16533
|
const poolId = asset.address;
|
|
16524
16534
|
const collateralActive = Boolean(currentEntry.isListed);
|
|
16525
16535
|
const borrowingEnabled = Boolean(currentEntry.isBorrowAllowed);
|
|
@@ -16611,7 +16621,7 @@ function convertTakaraEntry(opts) {
|
|
|
16611
16621
|
const { entryRaw, asset, chainId, lender, prices, additionalYields, cToken } = opts;
|
|
16612
16622
|
const info = parseTakaraMarketsInfo(entryRaw);
|
|
16613
16623
|
const rates = getTakaraRates(info);
|
|
16614
|
-
const price2 = prices
|
|
16624
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16615
16625
|
const collateralFactor = Number(
|
|
16616
16626
|
parseRawAmount(info.ltv.toString(), RESERVE_MANTISSA_DECIMALS)
|
|
16617
16627
|
);
|
|
@@ -16690,7 +16700,7 @@ function convertTectonicEntry(opts) {
|
|
|
16690
16700
|
const { entryRaw, asset, chainId, lender, prices, additionalYields, cToken } = opts;
|
|
16691
16701
|
const info = parseTectonicMarketData(entryRaw);
|
|
16692
16702
|
const rates = getTectonicRates(info, chainId);
|
|
16693
|
-
const price2 = prices
|
|
16703
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16694
16704
|
const decs = asset.decimals;
|
|
16695
16705
|
const collateralFactor = Number(
|
|
16696
16706
|
parseRawAmount(info.collateralFactor.toString(), RESERVE_MANTISSA_DECIMALS)
|
|
@@ -16859,7 +16869,7 @@ function getBenqiRates(info, chainId, unitSeconds) {
|
|
|
16859
16869
|
function convertBenqiEntry(opts) {
|
|
16860
16870
|
const { parsed, asset, chainId, lender, prices, additionalYields, cToken } = opts;
|
|
16861
16871
|
const rates = getBenqiRates(parsed, chainId);
|
|
16862
|
-
const price2 = prices
|
|
16872
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16863
16873
|
const decs = asset.decimals;
|
|
16864
16874
|
const collateralFactor = Number(
|
|
16865
16875
|
parseRawAmount(
|
|
@@ -16932,7 +16942,7 @@ function convertBenqiEntry(opts) {
|
|
|
16932
16942
|
function convertKineticEntry(opts) {
|
|
16933
16943
|
const { parsed, asset, chainId, lender, prices, additionalYields, cToken } = opts;
|
|
16934
16944
|
const rates = getKineticRates(parsed, chainId);
|
|
16935
|
-
const price2 = prices
|
|
16945
|
+
const price2 = resolveMarketPrice(prices, asset, chainId);
|
|
16936
16946
|
const decs = asset.decimals;
|
|
16937
16947
|
const collateralFactor = Number(
|
|
16938
16948
|
parseRawAmount(
|
|
@@ -53151,6 +53161,53 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
53151
53161
|
yieldKey: STHUSD_KEY
|
|
53152
53162
|
}
|
|
53153
53163
|
],
|
|
53164
|
+
// ---------------------------------------------------------------------
|
|
53165
|
+
// Arc (5042) — Circle's USDC-gas L1, mainnet 2026-09-16. One row: Huma's
|
|
53166
|
+
// PST, bridged in over Chainlink CCIP the same day.
|
|
53167
|
+
// ---------------------------------------------------------------------
|
|
53168
|
+
"5042": [
|
|
53169
|
+
{
|
|
53170
|
+
// Huma **PST**, bridged to Arc. Same asset and same trust story as the
|
|
53171
|
+
// chain-1 row (see it for the product); what differs is the SHAPE of
|
|
53172
|
+
// the exit. On Ethereum PST has $16M of DEX depth, so the row is
|
|
53173
|
+
// `secondaryMarketOnly`. Here it has NONE: KyberSwap answers
|
|
53174
|
+
// `route not found` for PST on Arc while routing USDC→WETH fine, and
|
|
53175
|
+
// at integration the whole bridged supply (441,548 PST, ≈ $500k) sat
|
|
53176
|
+
// inside the one listed Morpho Blue PST/USDC market — the Theo-on-
|
|
53177
|
+
// Stable shape, where a `via: 'swap'` route would advertise depth that
|
|
53178
|
+
// does not exist. So `isMintable: false` (a CCIP `BurnMintERC20` has
|
|
53179
|
+
// no mint function) and NOT `secondaryMarketOnly`: the only way in or
|
|
53180
|
+
// out is the bridge back to Solana. Flip the flag when a venue appears.
|
|
53181
|
+
//
|
|
53182
|
+
// Priced by Chainlink's **"PSTUSDC / USDC Exchange Rate"** proxy
|
|
53183
|
+
// `0x1abf15e8…` on Arc — the feed the Morpho market's oracle wraps as
|
|
53184
|
+
// `BASE_FEED_1`, so the earn row and the lending row agree. 6 decimals
|
|
53185
|
+
// TODAY; TRAP: its round history is NOT uniformly scaled — rounds 1
|
|
53186
|
+
// to ~100 (2026-06-19 → 06-23) answered at 12 decimals
|
|
53187
|
+
// (`1111266641610`) before the feed settled at 6 — so never derive a
|
|
53188
|
+
// rate from this feed's history. The rate is `humaPstFetcher`, which
|
|
53189
|
+
// measures the Ethereum feed; PST accrues identically on every chain
|
|
53190
|
+
// (1.132518 here vs 1.132511 on Ethereum at the same hour).
|
|
53191
|
+
reader: "nav-oracle",
|
|
53192
|
+
solvency: "nav-attested",
|
|
53193
|
+
address: "0xa6db07ebf438d91aa653746fc05523e435645525",
|
|
53194
|
+
underlying: "0x3600000000000000000000000000000000000000",
|
|
53195
|
+
// USDC (ERC-20)
|
|
53196
|
+
priceOracle: "0x1abf15e82566d274bf8722ac3e42fc3c79304051",
|
|
53197
|
+
priceOracleDecimals: 6,
|
|
53198
|
+
symbol: "PST",
|
|
53199
|
+
brand: "Huma",
|
|
53200
|
+
description: "Huma's PayFi Strategy Token, bridged to Arc over Chainlink CCIP: a share of Huma 2.0's USDC pool on Solana, funding short-dated cross-border payment receivables nearly all originated by Arf, a Huma affiliate; the fee is paid as a rising PST price set by Huma's oracle and relayed by Chainlink. There is no mint, no redemption and no trading venue on Arc: the only way in or out is bridging back to Solana, where redemption is an operator-settled request under a daily cap. Backing is unsecured receivables credit with a small first-loss cover.",
|
|
53201
|
+
decimals: 6,
|
|
53202
|
+
underlyingDecimals: 6,
|
|
53203
|
+
isRebasing: false,
|
|
53204
|
+
isMintable: false,
|
|
53205
|
+
withdrawalMode: "request-based",
|
|
53206
|
+
withdrawalCooldownSeconds: 7 * 86400,
|
|
53207
|
+
yieldFetcher: humaPstFetcher,
|
|
53208
|
+
yieldKey: HUMA_PST_KEY
|
|
53209
|
+
}
|
|
53210
|
+
],
|
|
53154
53211
|
"4663": [
|
|
53155
53212
|
{
|
|
53156
53213
|
// Spark Vaults V2 spUSDG on Robinhood Chain — the first V2 vault
|
|
@@ -59594,6 +59651,20 @@ function pruneFeedStats(stats, maxAgeSeconds = 30 * 24 * 3600, nowSeconds = Math
|
|
|
59594
59651
|
// src/prices/oracle-prices/selectAssetGroupPrices.ts
|
|
59595
59652
|
var DEFAULT_STALE_REJECT_SECONDS = 172800;
|
|
59596
59653
|
var AAVE_V4_PREFIX = "AAVE_V4";
|
|
59654
|
+
var PLACEHOLDER_GROUP_SEGMENTS = {
|
|
59655
|
+
undefined: true,
|
|
59656
|
+
"0x": true,
|
|
59657
|
+
unknown: true,
|
|
59658
|
+
"unknown token": true,
|
|
59659
|
+
unk: true,
|
|
59660
|
+
"n/a": true,
|
|
59661
|
+
na: true,
|
|
59662
|
+
none: true,
|
|
59663
|
+
"?": true,
|
|
59664
|
+
"-": true
|
|
59665
|
+
};
|
|
59666
|
+
var isPlaceholderSegment = (segment) => PLACEHOLDER_GROUP_SEGMENTS[segment.trim().toLowerCase()] === true;
|
|
59667
|
+
var isPlaceholderGroup = (group) => group.split("::").some(isPlaceholderSegment);
|
|
59597
59668
|
var DEFAULT_PRIORITY = {
|
|
59598
59669
|
chainPriority: [
|
|
59599
59670
|
Chain.ETHEREUM_MAINNET,
|
|
@@ -59700,7 +59771,9 @@ function selectAssetGroupPrices(structuredPrices, lists = {}, depthOrTvl = {}, p
|
|
|
59700
59771
|
staleRejectSeconds,
|
|
59701
59772
|
nowSeconds
|
|
59702
59773
|
) : "unknown";
|
|
59703
|
-
const
|
|
59774
|
+
const group = tokenList[entry.asset]?.assetGroup;
|
|
59775
|
+
if (group != null && isPlaceholderGroup(group)) continue;
|
|
59776
|
+
const oracleKey = group ?? `${chainId}-${entry.asset.toLowerCase()}`;
|
|
59704
59777
|
const candidate = {
|
|
59705
59778
|
oracleKey,
|
|
59706
59779
|
priceUSD: entry.priceUSD,
|