@1delta/margin-fetcher 5.0.147 → 5.0.149

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 CHANGED
@@ -5859,7 +5859,10 @@ declare function alchemixRedemptionPace(m: AlchemixMarketRaw, chainId: string):
5859
5859
  * USD price, so the USD totals and every health figure built on them agree
5860
5860
  * with the contract. The alAsset's MARKET price is lower (alUSD ≈ 0.955,
5861
5861
  * alETH ≈ 0.975 ETH on 2026-10-19); that discount is a borrower cost and a
5862
- * deleverage opportunity, never an input to health.
5862
+ * deleverage opportunity, never an input to health. It does enter the
5863
+ * alAsset's BORROW-CAPACITY weight (`borrowFactor` = face / market, with
5864
+ * `liquidationBorrowFactor: 1`), because a loop can only add as much
5865
+ * collateral as the sold debt buys.
5863
5866
  */
5864
5867
  declare function convertAlchemixMarketsToResponse(raw: AlchemixMarketsRaw, chainId: string, prices?: {
5865
5868
  [asset: string]: number;
@@ -16146,14 +16149,17 @@ interface EarnExclusions {
16146
16149
  /** Above the risk ceiling the rest of the API also applies. */
16147
16150
  highRisk: number;
16148
16151
  /**
16149
- * Rows whose position is a multi-token LP (`basket`), hidden by default.
16152
+ * Rows that are one LEG of an AMM inside the position (`basket.rowAsset`
16153
+ * `'leg'` — Fluid smart vaults), hidden by default.
16150
16154
  *
16151
16155
  * Excluded unasked because the row names ONE token while the position holds
16152
16156
  * several in a split the pool keeps moving — so a depositor reading it as
16153
16157
  * "USDC at 10 %" ends up carrying the other leg's price risk. Reported here
16154
- * so a UI can offer `?lp=include` rather than let the rows vanish silently.
16158
+ * so a UI can offer `?includeAMM=true` rather than let the rows vanish
16159
+ * silently. A TOKENIZED LP (`rowAsset: 'positionUnit'`, Lista SmartLP) is
16160
+ * an ordinary row whose asset is the receipt, and is not counted.
16155
16161
  */
16156
- lp: number;
16162
+ amm: number;
16157
16163
  /**
16158
16164
  * Rows removed because their RATE IS NOT A MEASUREMENT — see
16159
16165
  * `earn/rateSanity.ts`. Two mechanisms, counted together because they have
@@ -16201,8 +16207,8 @@ interface EarnAppliedDefaults {
16201
16207
  maxRiskScore: number;
16202
16208
  excludePassthrough: boolean;
16203
16209
  excludeIlliquid: boolean;
16204
- /** LP / auto-rebalancing positions are hidden unless `?lp=include`. */
16205
- excludeLp: boolean;
16210
+ /** In-position AMM legs (Fluid smart) are hidden unless `?includeAMM=true`. */
16211
+ excludeAmm: boolean;
16206
16212
  /** Matured fixed-term rows are hidden unless `?includeExpired=true`. */
16207
16213
  excludeMatured?: boolean;
16208
16214
  /** Fixed-yield order-book rows are hidden unless `?includeFixedTerm=true`. */
package/dist/index.js CHANGED
@@ -29654,6 +29654,8 @@ function convertAlchemixMarketsToResponse(raw, chainId, prices = {}, additionalY
29654
29654
  const mytRate = alchemixMytRate(m);
29655
29655
  const mytPrice = priceOfAddr(myt2) || (mytRate != null && underlyingPrice > 0 ? mytRate * underlyingPrice : 0);
29656
29656
  const debtPrice = underlyingPrice;
29657
+ const debtMarketPrice = priceOfAddr(debt);
29658
+ const debtSaleRatio = debtMarketPrice > 0 && debtPrice > 0 ? Math.min(1, debtMarketPrice / debtPrice) : 1;
29657
29659
  const ltv = 1e18 / Number(m.minimumCollateralization);
29658
29660
  const liqLtv = 1e18 / Number(m.collateralizationLowerBound);
29659
29661
  const liqPenalty = m.liquidatorFee / BPS3 * Math.max(0, 1 / liqLtv - 1);
@@ -29757,7 +29759,14 @@ function convertAlchemixMarketsToResponse(raw, chainId, prices = {}, additionalY
29757
29759
  category: 0,
29758
29760
  borrowCollateralFactor: 0,
29759
29761
  collateralFactor: 0,
29760
- borrowFactor: 1,
29762
+ // Borrow capacity weighs the debt at what it sells for (face /
29763
+ // market ≥ 1), so a loop's ceiling `1 / (1 − cf / bf)` is one that
29764
+ // can be built: at alUSD 0.956 that is 7.16×, not the 10× face LTV
29765
+ // implies (2026-11-03: a 7.8× open reverted the LTV check).
29766
+ // Liquidation weighs it at FACE, as the Alchemist does — the Venus
29767
+ // e-mode split of the two weights.
29768
+ borrowFactor: 1 / debtSaleRatio,
29769
+ liquidationBorrowFactor: 1,
29761
29770
  liquidationPenalty: liqPenalty,
29762
29771
  closeFactor: 1,
29763
29772
  collateralDisabled: true,