Liquidation & cleanup
The callable surface for clearing under-MCR troves and cleaning up troves with almost no debt left. Concept: Liquidations & Recovery Mode. Mechanics: Liquidation paths.
Liquidate
Per branch, on Liquidations. The threshold is always ICR < MCR, in every mode; troves with and without Redemption Shield are liquidated by the same rules.
Liquidations.liquidate(address _borrower) // one-off
Liquidations.liquidateTroves(uint _n) // walk both lists, clear up to _n lowest-ICR under-MCR troves
Liquidations.liquidateTrovesLiquidator(uint _n, address _liquidator) // same, gas compensation paid to _liquidator
Liquidations.batchLiquidate(address[] _borrowers) // caller-supplied list (may include troves with Redemption Shield enabled)
Liquidations.scanAndBatchLiquidateTroves(uint _n) // scan both lists for under-MCR troves, then batchLiquidate
Liquidations.scanAndBatchLiquidateTrovesCohort(uint _n, bool _shielded) // same, one list only
The scan variants are a fallback for when the bottom of a sorted list is out of order; they never collect the last active trove. All of them require the branch oracle to be healthy: they revert "Liquidations: Branch oracle is shutdown" or "Liquidations: Branch oracle can be shutdown" otherwise, and the branch should be shut down via BorrowerOperations.shutdown() instead. Liquidation keeps working on a shut-down branch as long as its oracle is healthy. With nothing to liquidate they revert "Liquidations: nothing to liquidate". The gas-compensation receiver cannot be one of the branch's own collateral pools.
Liquidator compensation: 200 RD from the branch GasPool plus a collateral kicker of entireColl / 200 (0.5% of the trove's collateral).
Events: Liquidation(uint _liquidatedDebt, uint _liquidatedColl, uint _collGasCompensation, uint _RDGasCompensation) per call; per trove, TroveLiquidated(address indexed _borrower, uint _debt, uint _coll, TroveManagerOperation _operation) and TroveLiquidationDetails(address indexed _borrower, uint _actualDebtToOffset, uint _collToSendToSP, uint _debtToRedistribute, uint _collToRedistribute, uint _collSurplus, uint _collGasCompensation, bool _shielded); Offset(...) and Redistribute(uint baseDebt, uint baseColl, uint sDebt, uint sColl) for the batch split.
Undersized troves ("dwarfs")
A trove whose actual debt is between 200 RD and 2,000 RD (after a partial redemption or negative base interest) has no dedicated cleanup path. It stays an ordinary trove: it can be liquidated below MCR and redeemed against, and its owner can add collateral, toggle Redemption Shield, close it, or borrow it back up to at least 2,000 RD. See Borrowing operations.
Cleanup: mini-dwarf sweep
A trove whose actualDebt ≤ 200 RD (at or below the gas reserve) has no redeemable debt left. Anyone can close it:
TroveManager.sweepCloseTrove(address _borrower) // one-off; returns (actualDebt, coll)
TroveManager.sweepMiniDwarves(uint256 maxCount) // scans both lists from the low-ICR end; returns sweptCount
The trove's remaining debt is burned from the GasPool, the caller receives the rest of the 200 RD reserve (200 − actualDebt) as a bounty, and all of the trove's collateral is returned to the borrower via CollSurplusPool (claim with BorrowerOperations.claimCollateral()) — nothing is seized. sweepCloseTrove reverts "Not mini" for a trove above 200 RD; both revert "Undercoll" while the branch is flagged under-collateralized. Each sweep emits TroveSwept(address indexed borrower, uint256 normDebt, uint256 actualDebt, uint256 coll, bool shielded). Mini-dwarfs are skipped by redemption walks, so sweeping keeps the sorted-list tail clean.