Brokex Docs
Docs/PROTOCOL MECHANICS/Liquidation Engine

Liquidation Engine

Health factor, liquidation price, and bounded-slippage execution.

Liquidation Engine — Health Factor Breach & TWAP-Bounded ExecutionLiq LTV = 80% · 0% Penalty
1. Health BreachgetLongHealth(trader)HF < 1e18 (LTV > 80%)Priced via 300s TWAP2. Recall if NeededCheck physical custodyrecallShortForLiquidationNo-op while Shorts off3. Bounded SwapSell NVDAc on AerodromeminOut ≥ 95% of TWAPBlocks sandwich attacks4. Repay DebtVault debt settled firstBad debt → LP NAV0.10% close fee on rem5. Trader SurplusRemaining USDC0% Liq PenaltyReturned to trader

Long Health (LongManager.getLongHealth)

  • healthFactorWad = Math.mulDiv(positionValueUsdc * 8000, WAD, totalDebtUsdc * 10000)
  • liquidatable = healthFactorWad < WAD (i.e., LTV > 80%).
  • liquidationPrice18 = Math.mulDiv(totalDebtUsdc * 10000, 1e20, pos.shares * 8000, Ceil) (for NVDAc 8 decimals).