@1delta/margin-fetcher 0.0.322 → 0.0.324
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 +43 -6
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/aave-v4-type/fetcher/normalize.d.ts +13 -4
- package/dist/lending/public-data/aave-v4-type/fetcher/normalize.d.ts.map +1 -1
- package/dist/lending/public-data/gearbox/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/lista/getMarketsFromChain.d.ts.map +1 -1
- package/dist/lending/public-data/midnight/convertPublic.d.ts.map +1 -1
- package/dist/types/apiReturnType.d.ts +9 -0
- package/dist/types/apiReturnType.d.ts.map +1 -1
- package/dist/types/lenderTypes.d.ts +16 -0
- package/dist/types/lenderTypes.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13457,7 +13457,11 @@ function getListaMarketDataConverter(lender, chainId, prices, additionalYields =
|
|
|
13457
13457
|
model: "lista",
|
|
13458
13458
|
maturity: void 0,
|
|
13459
13459
|
fees: {},
|
|
13460
|
-
earlyRepay: { kind: "penalty" }
|
|
13460
|
+
earlyRepay: { kind: "penalty" },
|
|
13461
|
+
// A Lista fixed term is fronted by a single LendingBroker proxy —
|
|
13462
|
+
// the concrete counterparty offering the rate. Expose it as the
|
|
13463
|
+
// term provider (omit when this isn't a brokered market).
|
|
13464
|
+
provider: broker && broker !== zeroAddress ? { kind: "broker", address: broker } : void 0
|
|
13461
13465
|
}
|
|
13462
13466
|
}
|
|
13463
13467
|
};
|
|
@@ -19013,7 +19017,15 @@ function normalizeAaveV4(spokeDataList, chainId, spokeLenderKeyArg, prices, addi
|
|
|
19013
19017
|
const hubTotalOwed = toTokenNumber(hubTotalOwedRaw, hubDecimals);
|
|
19014
19018
|
const hubDepositsUSD = hubTotalSupply * price2;
|
|
19015
19019
|
const hubBorrowsUSD = hubTotalOwed * price2;
|
|
19016
|
-
const
|
|
19020
|
+
const drawnRaw = (reserve.hubAsset.drawnShares ?? 0n) * (reserve.hubAsset.drawnIndex ?? 0n) / RAY_BIGINT;
|
|
19021
|
+
const irmDenominatorRaw = (reserve.hubAsset.liquidity ?? 0n) + drawnRaw + (reserve.hubAsset.swept ?? 0n);
|
|
19022
|
+
let irmTotalDebt = toTokenNumber(drawnRaw, hubDecimals);
|
|
19023
|
+
let irmTotalDeposits = toTokenNumber(irmDenominatorRaw, hubDecimals);
|
|
19024
|
+
if (drawnRaw === 0n && hubTotalOwed > 0) {
|
|
19025
|
+
irmTotalDebt = hubTotalOwed;
|
|
19026
|
+
irmTotalDeposits = hubTotalSupply;
|
|
19027
|
+
}
|
|
19028
|
+
const hubUtilization = irmTotalDeposits > 0 ? irmTotalDebt / irmTotalDeposits : 0;
|
|
19017
19029
|
const feeRate = reserve.hubAsset.liquidityFee ? reserve.hubAsset.liquidityFee / BPS : 0;
|
|
19018
19030
|
const depositRate = variableBorrowRate * hubUtilization * (1 - feeRate);
|
|
19019
19031
|
const collateralRiskBps = reserve.config.collateralRisk || reserve.reserve.collateralRisk || 0;
|
|
@@ -19095,6 +19107,10 @@ function normalizeAaveV4(spokeDataList, chainId, spokeLenderKeyArg, prices, addi
|
|
|
19095
19107
|
variableBorrowRate,
|
|
19096
19108
|
stableBorrowRate: 0,
|
|
19097
19109
|
utilization: hubUtilization,
|
|
19110
|
+
// Totals in the hub IRM's own utilization basis — rate-impact
|
|
19111
|
+
// simulations must shift these, not the spoke-local totals.
|
|
19112
|
+
irmTotalDeposits,
|
|
19113
|
+
irmTotalDebt,
|
|
19098
19114
|
intrinsicYield: additionalYields?.intrinsicYields?.[oracleKey] ?? 0,
|
|
19099
19115
|
rewards: [],
|
|
19100
19116
|
decimals,
|
|
@@ -20013,6 +20029,10 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
20013
20029
|
const borrowRate = scaleFluidRate(rates.borrowRateVault);
|
|
20014
20030
|
const collateralLiquidity = liquidityByToken[collateralAddress];
|
|
20015
20031
|
const loanLiquidity = liquidityByToken[loanAddress];
|
|
20032
|
+
const irmTotals = (state, decimals) => state ? {
|
|
20033
|
+
irmTotalDeposits: Number(parseRawAmount(state.totalSupply, decimals)),
|
|
20034
|
+
irmTotalDebt: Number(parseRawAmount(state.totalBorrow, decimals))
|
|
20035
|
+
} : {};
|
|
20016
20036
|
const data = {};
|
|
20017
20037
|
const collateralMarketUid = createMarketUid(
|
|
20018
20038
|
chainId,
|
|
@@ -20038,6 +20058,7 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
20038
20058
|
// IRM x-coordinate: the collateral token's Liquidity-layer utilization —
|
|
20039
20059
|
// it drives the supply rate (borrowRate × utilization × (1 - fee)).
|
|
20040
20060
|
utilization: collateralLiquidity?.utilization ?? 0,
|
|
20061
|
+
...irmTotals(collateralLiquidity, colDecimals),
|
|
20041
20062
|
// Share of this vault's collateral currently locked below the LL
|
|
20042
20063
|
// withdrawal limit (withdrawLimit / totalSupplyVault).
|
|
20043
20064
|
lockupRatio,
|
|
@@ -20089,6 +20110,7 @@ function parseVault(vault, chainId, prices, additionalYields, tokenList, liquidi
|
|
|
20089
20110
|
// IRM x-coordinate: the loan token's Liquidity-layer utilization — the
|
|
20090
20111
|
// exact input the current borrow rate was computed from.
|
|
20091
20112
|
utilization: loanLiquidity?.utilization ?? 0,
|
|
20113
|
+
...irmTotals(loanLiquidity, borrowDecimals),
|
|
20092
20114
|
depositRate: 0,
|
|
20093
20115
|
variableBorrowRate: borrowRate,
|
|
20094
20116
|
stableBorrowRate: 0,
|
|
@@ -20413,10 +20435,17 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
20413
20435
|
underlyingDecimals
|
|
20414
20436
|
)
|
|
20415
20437
|
);
|
|
20416
|
-
const
|
|
20417
|
-
parseRawAmount(
|
|
20438
|
+
const poolAvailableLiquidity = Number(
|
|
20439
|
+
parseRawAmount(
|
|
20440
|
+
pool.availableLiquidity?.toString(),
|
|
20441
|
+
underlyingDecimals
|
|
20442
|
+
)
|
|
20443
|
+
);
|
|
20444
|
+
const poolIrmDebt = Math.max(
|
|
20445
|
+
poolExpectedLiquidity - poolAvailableLiquidity,
|
|
20446
|
+
0
|
|
20418
20447
|
);
|
|
20419
|
-
const poolUtilization = poolExpectedLiquidity > 0 ?
|
|
20448
|
+
const poolUtilization = poolExpectedLiquidity > 0 ? poolIrmDebt / poolExpectedLiquidity : 0;
|
|
20420
20449
|
for (const cm of m.creditManagers ?? []) {
|
|
20421
20450
|
const facade = cm?.creditFacade;
|
|
20422
20451
|
const manager = cm?.creditManager;
|
|
@@ -20468,6 +20497,10 @@ var getGearboxV3PublicDataConverter = (_lender, chainId, prices, additionalYield
|
|
|
20468
20497
|
totalLiquidityUSD: availableToBorrow * underlyingPrice,
|
|
20469
20498
|
borrowLiquidityUSD: availableToBorrow * underlyingPrice,
|
|
20470
20499
|
utilization: poolUtilization,
|
|
20500
|
+
// Pool-level totals — the basis the IRM's utilization is defined
|
|
20501
|
+
// over (shared across all credit managers on this pool).
|
|
20502
|
+
irmTotalDeposits: poolExpectedLiquidity,
|
|
20503
|
+
irmTotalDebt: poolIrmDebt,
|
|
20471
20504
|
depositRate: supplyRate,
|
|
20472
20505
|
variableBorrowRate: borrowRate,
|
|
20473
20506
|
stableBorrowRate: 0,
|
|
@@ -21197,7 +21230,11 @@ function convertMidnightMarketsToResponse(raw, chainId, prices = {}, _additional
|
|
|
21197
21230
|
continuousFeeApr: continuousFeeAprPct,
|
|
21198
21231
|
settlementFee
|
|
21199
21232
|
},
|
|
21200
|
-
earlyRepay: { kind: "none" }
|
|
21233
|
+
earlyRepay: { kind: "none" },
|
|
21234
|
+
// Midnight terms are an aggregate of many signed maker offers — there
|
|
21235
|
+
// is no single provider at the market level (the concrete maker(s) are
|
|
21236
|
+
// per-offer, surfaced at quote time), so mark it an order book.
|
|
21237
|
+
provider: { kind: "orderbook" }
|
|
21201
21238
|
},
|
|
21202
21239
|
enterGate: config.enterGate,
|
|
21203
21240
|
liquidatorGate: config.liquidatorGate,
|