Section 11 of 15
TroveManager: Liquidate (Normal Mode)
Key takeaway:
liquidate(borrower)is the function that closes underwater Troves. Anyone can call it on any Trove whose ICR is below MCR (110%). The flow: apply pending rewards so the Trove's stored state is current, set aside 0.5% of collateral as ETH gas compensation for the liquidator plus the 200 LUSD held in GasPool, split the remaining debt and collateral between Stability Pool offset (if the pool has enough LUSD) and redistribution (everything the pool can't absorb), close the Trove, then pay the liquidator their compensation. In this section you build the single-Trove liquidate path with the offset side fully wired and redistribution stubbed — the running-term writes (L_ETH,L_LUSDDebt) come in section 12. By the end of this section, a Trove can be liquidated and its debt fully absorbed by the Stability Pool.
What You Are Building
Five things:
liquidate(borrower)— public entry point.batchLiquidateTroves(troves[])— public entry point for liquidating multiple Troves in one tx. In section 11 you write the wrapper; section 12 adds the loop that scans for liquidatable Troves automatically._liquidateNormalMode(...)— the internal single-Trove liquidation logic._getOffsetAndRedistributionVals(...)— the split function that decides how much of a Trove's debt is absorbed by the Stability Pool versus redistributed.- Supporting helpers:
_closeTrove,_removeStake,_removeTroveOwner,_movePendingTroveRewardsToActivePool,_sendGasCompensation.
Your Code
Requirements
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 continueAlready have an account? Log in