Section 13 of 15

Build
+15 Lynx

TroveManager: Recovery Mode and CollSurplusPool

Key takeaway: Recovery Mode kicks in when the system-wide TCR drops below 150% (CCR). The liquidation rules change: Troves with ICR up to the current TCR become liquidatable, not just those below MCR. Liquidations in Recovery Mode use a three-branch logic based on the Trove's ICR — below 100% redistributes everything, 100% to 110% offsets and redistributes, 110% to TCR offsets with a capped collateral payout (only 1.1 × debt / price of collateral goes to the Stability Pool; the rest is set aside as collateral surplus for the owner to claim). The CollSurplusPool contract holds this excess collateral on behalf of liquidated owners. Recovery Mode is the protocol's mechanism to restore solvency by aggressively but fairly unwinding the riskiest Troves.

What You Are Building

Four things:

  1. _liquidateRecoveryMode(...) — the three-branch liquidation logic.
  2. _getCappedOffsetVals(...) — the capped-offset calculation used in the highest branch.
  3. _getTotalsFromLiquidateTrovesSequence_RecoveryMode(...) — the batch loop in Recovery Mode (different from Normal Mode because the system may "back to Normal" mid-loop).
  4. CollSurplusPool — the contract that holds excess collateral for owners to claim, plus BorrowerOperations.claimCollateral() to withdraw it.

Your Code

Solution.sol
Solidity
Loading editor...

Requirements

Write your implementation, then click Run Tests. Tests execute on the server.

Sign up free — keep reading + earn 15 Lynx

Zealynx Academy is free. Track your progress, earn Lynx, and climb the leaderboard.

Sign up free to continue

Already have an account? Log in