Skip to main content

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:

OpEntry pointWhat it does
Top up collateraladdColl(amount, upper, lower)Pulls more collateral into your trove
Withdraw collateralwithdrawColl(amount, upper, lower)Sends collateral back to you (must keep ICR ≥ MCR)
Borrow more RDwithdrawRD(amount, upper, lower)Mints more RD to you, increases debt
Repay RDrepayRD(amount, upper, lower)Burns RD from your wallet, decreases debt
Enable shieldshieldTrove(upper, lower)Migrates trove to the shielded book
Disable shieldunShieldTrove(upper, lower)Migrates trove back to the base book
Close trovecloseTrove()Repays all debt, returns all collateral, refunds the 200 RD gas reserve
Claim post-redemption surplusclaimCollateral()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:

  1. ICR ≥ MCR: your trove must stay above the branch minimum.
  2. Debt ≥ MIN_NET_DEBT + 200 RD unless you're closing, repays can't shrink the trove below the floor without closing it entirely.
  3. 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/lower hints come from your front end or GlobalHintHelper. 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 ActivePool and ActiveShieldedPool atomically. 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 MCRTop up collateral, or repay debt.
Branch TCR near CCRRecovery 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 parYou'll likely be partially redeemed against. Shield, top up, or accept it.
Effective APR climbing past your comfort zoneRepay some debt, or close and reopen later.
Shield premium near its capBranch 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