Adjusting, repaying, and closing a trove
Once open, you can change your trove freely as long as the result stays above MCR (and respects recovery-mode rules, if active). All ops are on the same BorrowerOperations contract you opened on, on the same branch.
Atomic adjustments
For anything except open and close, the canonical entry point is adjustTrove:
adjustTrove(
uint256 _collateralToAdd,
uint256 _collWithdrawal,
uint256 _debtChange,
bool _isDebtIncrease,
bool _toggleShield,
address _upperHint,
address _lowerHint
)
You can change collateral and debt in the same tx. _toggleShield = true flips your shield flag in the same call. You can only do one direction for collateral and debt per call (add or withdraw, increase or repay).
Convenience wrappers
The contract also exposes one-action wrappers for the common cases:
| Op | Entry point | What it does |
|---|---|---|
| Top up collateral | addColl(amount, upper, lower) | Pulls more collateral into your trove |
| Withdraw collateral | withdrawColl(amount, upper, lower) | Sends collateral back to you (must keep ICR ≥ MCR) |
| Borrow more RD | withdrawRD(amount, upper, lower) | Mints more RD to you, increases debt |
| Repay RD | repayRD(amount, upper, lower) | Burns RD from your wallet, decreases debt |
| Enable shield | shieldTrove(upper, lower) | Migrates trove to the shielded book |
| Disable shield | unShieldTrove(upper, lower) | Migrates trove back to the base book |
| Close trove | closeTrove() | Repays all debt, returns all collateral, refunds the 200 RD gas reserve |
| Claim post-redemption surplus | claimCollateral() | Pulls any collateral surplus the protocol owes you |
Each wrapper is a thin call into the same accounting; pick whichever matches your intent.
What keeps changing the position safe
Every adjustment ends with three checks:
ICR ≥ MCR: your trove must stay above the branch minimum.Debt ≥ MIN_NET_DEBT + 200 RDunless you're closing, repays can't shrink the trove below the floor without closing it entirely.- No TCR drop into recovery: in normal mode, you can't push branch TCR below CCR with the adjustment. In recovery mode, you can only adjust in ways that don't worsen TCR.
If any of these fail, the tx reverts and nothing changes.
Closing cleanly
closeTrove():
- Burns RD from your wallet equal to your full debt (net debt + accrued interest).
- Returns all of your collateral.
- Refunds the 200 RD gas-compensation reserve to you.
- Removes your trove from the branch.
You need to hold enough RD in your wallet to cover the full debt before calling. If you don't have it, repay partially first, or buy RD from a DEX. The protocol will not let you close while you still owe net debt.
Recovery-mode adjustments
When branch TCR is below CCR:
- You can repay debt or add collateral.
- You can't withdraw collateral, borrow more, or toggle shield in a way that hurts TCR.
- An adjustment that closes the trove is allowed as long as it doesn't worsen TCR.
The exact rules live in Liquidations & Recovery Mode.
Practical notes
- Hints:
upper/lowerhints come from your front end orGlobalHintHelper. They're advisory; getting them wrong burns gas but is otherwise safe. - Shielded vs base bookkeeping: when you toggle shield, the protocol moves your collateral between
ActivePoolandActiveShieldedPoolatomically. You don't see this; your trove is conceptually one position. - Accrued interest: when you adjust, accrued interest is folded into your debt. Borrowing more or repaying part doesn't reset the clock; interest keeps accruing on the full outstanding debt.
When to act
| If you see… | Consider… |
|---|---|
| Your ICR within 5–10% of MCR | Top up collateral, or repay debt. |
| Branch TCR near CCR | Recovery mode is one bad print away. Don't add risk; consider repaying. |
| Your trove has one of the lowest ICRs on its branch and RD is below par | You'll likely be partially redeemed against. Shield, top up, or accept it. |
| Effective APR climbing past your comfort zone | Repay some debt, or close and reopen later. |
| Shield premium near its cap | Branch is over-shielded; consider unshielding if you can tolerate it. |
These are the same prompts a well-designed front end will surface. The raw numbers (par, market price, branch TCR, your ICR, your effective APR, redemption quota) are available directly on Aggregator, RateParControl, MarketOracle, and each branch's TroveManager / PriceFeed / InterestEngine if you want to read them yourself.
Next
- The shield: whether to toggle.
- Borrow rates: what you're paying.