@1delta/margin-fetcher 0.0.332 → 0.0.333
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 +31 -6
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/exactly/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/liquity/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/midnight/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/river/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/river/fetchPublic.d.ts.map +1 -1
- package/dist/lending/public-data/river/types.d.ts +2 -0
- package/dist/lending/public-data/river/types.d.ts.map +1 -1
- package/dist/lending/public-data/term/convertPublic.d.ts.map +1 -1
- package/dist/types/lender/morpho-types.d.ts +21 -0
- package/dist/types/lender/morpho-types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -21260,6 +21260,7 @@ function convertMidnightMarketsToResponse(raw, chainId, prices = {}, _additional
|
|
|
21260
21260
|
utilization: 0,
|
|
21261
21261
|
depositRate: supplyAprPct,
|
|
21262
21262
|
variableBorrowRate: borrowAprPct,
|
|
21263
|
+
rateModel: "fixedTerm",
|
|
21263
21264
|
// Midnight is fixed-rate: expose the fixed borrow APR on stableBorrowRate
|
|
21264
21265
|
// too, so fixed-rate consumers pick it up like a term product.
|
|
21265
21266
|
stableBorrowRate: borrowAprPct,
|
|
@@ -21689,7 +21690,11 @@ function currencyFor2(address, decimals, tokens) {
|
|
|
21689
21690
|
const lower = address.toLowerCase();
|
|
21690
21691
|
return tokens[lower] ?? { address: lower, symbol: "", name: "", decimals };
|
|
21691
21692
|
}
|
|
21692
|
-
function convertTermMarketsToResponse(raw, chainId, prices = {}, _additionalYields = {
|
|
21693
|
+
function convertTermMarketsToResponse(raw, chainId, prices = {}, _additionalYields = {
|
|
21694
|
+
intrinsicYields: {},
|
|
21695
|
+
lenderRewards: {},
|
|
21696
|
+
loaded: true
|
|
21697
|
+
}, tokens = {}) {
|
|
21693
21698
|
const out = {};
|
|
21694
21699
|
const now = nowSec2();
|
|
21695
21700
|
for (const { config, top, book } of raw) {
|
|
@@ -21735,6 +21740,7 @@ function convertTermMarketsToResponse(raw, chainId, prices = {}, _additionalYiel
|
|
|
21735
21740
|
utilization: 0,
|
|
21736
21741
|
depositRate: supplyAprPct,
|
|
21737
21742
|
variableBorrowRate: borrowAprPct,
|
|
21743
|
+
rateModel: "fixedTerm",
|
|
21738
21744
|
// Term is fixed-rate: mirror the fixed borrow APR on stableBorrowRate too.
|
|
21739
21745
|
stableBorrowRate: borrowAprPct,
|
|
21740
21746
|
intrinsicYield: 0,
|
|
@@ -21994,6 +22000,7 @@ function convertExactlyMarketsToResponse(raw, chainId, prices = {}, _additionalY
|
|
|
21994
22000
|
m.floatingAssets
|
|
21995
22001
|
),
|
|
21996
22002
|
variableBorrowRate: exactlyWadRateToPercent(m.floatingBorrowRate),
|
|
22003
|
+
rateModel: "fixedTerm",
|
|
21997
22004
|
// Fixed-rate lender convention (Term/Lista): best fixed borrow APR on the
|
|
21998
22005
|
// stable slot; the full per-maturity menu is params.market.terms.
|
|
21999
22006
|
stableBorrowRate: bestFixedBorrowApr,
|
|
@@ -22296,6 +22303,11 @@ function convertLiquityMarketsToResponse(raw, chainId, prices = {}, _additionalY
|
|
|
22296
22303
|
depositRate: spApr * 100,
|
|
22297
22304
|
variableBorrowRate: avgRate * 100,
|
|
22298
22305
|
stableBorrowRate: 0,
|
|
22306
|
+
// Borrower picks the per-trove rate; the one-off upfront fee is the
|
|
22307
|
+
// branch avg rate applied over the upfront period (7d vanilla), as a
|
|
22308
|
+
// percent of the borrowed amount.
|
|
22309
|
+
rateModel: "userSet",
|
|
22310
|
+
originationFee: avgRate * (Number(cfg.upfrontInterestPeriodSeconds ?? 604800) / 31536e3) * 100,
|
|
22299
22311
|
intrinsicYield: 0,
|
|
22300
22312
|
rewards: void 0,
|
|
22301
22313
|
decimals: stableDecimals,
|
|
@@ -22378,7 +22390,7 @@ function convertLiquityMarketsToResponse(raw, chainId, prices = {}, _additionalY
|
|
|
22378
22390
|
}
|
|
22379
22391
|
return out;
|
|
22380
22392
|
}
|
|
22381
|
-
var READS_PER_TM =
|
|
22393
|
+
var READS_PER_TM = 6;
|
|
22382
22394
|
var RIVER_PUBLIC_READ_ABI = [
|
|
22383
22395
|
...RiverTroveManagerAbi,
|
|
22384
22396
|
...RiverStabilityPoolAbi
|
|
@@ -22401,6 +22413,7 @@ async function fetchRiverMarkets(lender, chainId) {
|
|
|
22401
22413
|
name: "getBorrowingRateWithDecay",
|
|
22402
22414
|
params: []
|
|
22403
22415
|
},
|
|
22416
|
+
{ address: m.troveManager, name: "interestRate", params: [] },
|
|
22404
22417
|
{ address: m.troveManager, name: "fetchPrice", params: [] },
|
|
22405
22418
|
{ address: m.troveManager, name: "getTroveOwnersCount", params: [] }
|
|
22406
22419
|
])
|
|
@@ -22429,8 +22442,9 @@ async function fetchRiverMarkets(lender, chainId) {
|
|
|
22429
22442
|
entireDebt: val(base),
|
|
22430
22443
|
entireColl: val(base + 1),
|
|
22431
22444
|
mintFeeRate: val(base + 2),
|
|
22432
|
-
|
|
22433
|
-
|
|
22445
|
+
interestRate: val(base + 3),
|
|
22446
|
+
price: val(base + 4),
|
|
22447
|
+
troveCount: val(base + 5)
|
|
22434
22448
|
};
|
|
22435
22449
|
});
|
|
22436
22450
|
return { lender, config, chainData, spDeposits: val(0), markets: out };
|
|
@@ -22563,8 +22577,18 @@ function convertRiverMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
22563
22577
|
// No interest yield while the protocol rate is 0% — SP earns
|
|
22564
22578
|
// liquidation gains + OSHI emissions only (not modeled here).
|
|
22565
22579
|
depositRate: 0,
|
|
22566
|
-
|
|
22580
|
+
// Ongoing annual borrow rate as a PERCENT (WAD → %). Live on-chain
|
|
22581
|
+
// `interestRate()` preferred, metadata snapshot as fallback. River
|
|
22582
|
+
// (Satoshi, Prisma lineage) runs at 0% everywhere today — the real
|
|
22583
|
+
// borrow cost is the one-off decaying MINT FEE, surfaced separately as
|
|
22584
|
+
// `params.market.river.mintFeeRate` (it is not an APR, so it never
|
|
22585
|
+
// belongs in this field).
|
|
22586
|
+
variableBorrowRate: Number(m.interestRate ?? market.interestRate ?? 0) / WAD7 * 100,
|
|
22567
22587
|
stableBorrowRate: 0,
|
|
22588
|
+
// River (Satoshi) has NO ongoing interest — the borrow cost is the
|
|
22589
|
+
// one-off decaying mint fee (`getBorrowingRateWithDecay`, WAD → percent).
|
|
22590
|
+
rateModel: "zeroInterest",
|
|
22591
|
+
originationFee: m.mintFeeRate !== null ? Number(m.mintFeeRate) / WAD7 * 100 : void 0,
|
|
22568
22592
|
intrinsicYield: 0,
|
|
22569
22593
|
rewards: void 0,
|
|
22570
22594
|
decimals: debtDecimals,
|
|
@@ -22613,7 +22637,8 @@ function convertRiverMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
22613
22637
|
mintFeeCap: market.maxBorrowingFee,
|
|
22614
22638
|
/** Current decayed one-off mint-fee rate (WAD string). */
|
|
22615
22639
|
mintFeeRate: m.mintFeeRate !== null ? m.mintFeeRate.toString() : void 0,
|
|
22616
|
-
|
|
22640
|
+
/** Ongoing annual interest rate (WAD string) — live on-chain, metadata fallback. */
|
|
22641
|
+
interestRate: m.interestRate !== null ? m.interestRate.toString() : market.interestRate,
|
|
22617
22642
|
maxSystemDebt: market.maxSystemDebt,
|
|
22618
22643
|
paused: !!market.paused,
|
|
22619
22644
|
sunsetting: !!market.sunsetting,
|