Liquidation

Cover

A position's cover is the value of its collateral at the oracle price, minus its exit cost, divided by its debt.

  • Long: coins * price * (1 - exit) / usdcDebt
  • Short: usdc / (coinDebt * price * (1 + exit))

The exit cost is fixed when the position opens: the pool fee, the 0.30% route fee and the price impact of the position's size at that time.

A position is liquidatable when its cover is under 105%. health(positionId) returns the debt, the collateral value, the cover in basis points and the flag.

Running a liquidation

liquidate(positionId) is open to anyone. It pokes the oracle, checks the cover, then closes the position through the pools within the 15% liquidation band. From what is left after the debt is repaid, the caller receives 3% of the position's size, and the owner receives the rest.

The keeper scans every open position each minute and liquidates those under 105%. Any wallet can do the same and earn the same reward.

Shortfall

If a position's collateral no longer covers its debt when it is closed, the difference is written off against the lenders of that asset in that coin's market only. Nothing in another market is touched.