Borrowing operations
The callable surface for troves. Concept: Open a trove and Adjust, repay, close. Mechanics: Interest model, Rates vs. utilization.
All functions are on the branch's BorrowerOperations. Approve the collateral token to that contract before any call that pulls collateral.
Open
BorrowerOperations.openTrove(
uint256 _collateralAmount, // collateral deposited (token units)
uint256 _RDAmount, // net debt minted (1,800 RD floor)
address _upperHint,
address _lowerHint,
bool _redemptionShield // true = enable Redemption Shield at open
)
Opens a trove at ≥ 2,000 RD total debt (_RDAmount net + 200 RD gas reserve). Mints _RDAmount to the caller and 200 RD to the GasPool.
Reverts:
"Resulting ICR < MCR"— ICR below the branch minimum.- Normal mode:
"BO: tcr<ccr"— the open would push branch TCR below CCR. - Recovery mode (branch TCR already < CCR):
"Resulting ICR < CCR"— a fresh open must reach ICR ≥ CCR. "Agg:issuanceQuota"— the branch issuance bucket is empty; retry after it refills (readAggregator.issuanceQuotaAvailable(tm); mechanics in Rates vs. utilization).
Adjust
BorrowerOperations.adjustTrove(
uint256 _collateralToAdd,
uint256 _collWithdrawal,
uint256 _RDChange,
bool _isDebtIncrease,
bool _toggleShield, // toggles Redemption Shield in the same tx
address _upperHint,
address _lowerHint
)
One direction per call for collateral (add or withdraw) and for debt (increase or repay). Every adjustment must end with ICR ≥ MCR, netDebt ≥ MIN_NET_DEBT (1,800 RD) unless closing, and no TCR drop into recovery.
Convenience wrappers
Thin calls into the same accounting — pick whichever matches intent.
| 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 (must keep ICR ≥ MCR) |
| Borrow more RD | withdrawRD(amount, upper, lower) | Mints more RD, increases debt |
| Repay RD | repayRD(amount, upper, lower) | Burns RD from your wallet, decreases debt |
| Enable Redemption Shield | shieldTrove(upper, lower) | Migrates the trove to the Redemption Shield cohort |
| Disable Redemption Shield | unShieldTrove(upper, lower) | Migrates the trove back to the base |
| Close trove | closeTrove() | Burns full debt, returns all collateral, refunds the 200 RD reserve |
| Claim post-redemption/liquidation surplus | claimCollateral() | Pulls any collateral surplus owed from CollSurplusPool |
closeTrove() requires the caller to hold enough RD to cover the full debt (net + accrued interest); the protocol won't close while net debt remains.
Shield toggle cooldown
The Redemption Shield setting changes through shieldTrove / unShieldTrove (or adjustTrove(..., _toggleShield: true, ...)). Read the current setting with TroveManager.shielded(borrower). BorrowerOperations enforces SHIELD_TOGGLE_WAIT = 86400 seconds (24 hours): after any setting change — including the choice made at open — another change reverts until 24 hours elapse. The clock is per borrower and resets on each change.
Also on BorrowerOperations
moveCollateralGainToTrove(_user, _coll, _upperHint, _lowerHint)— route a Stability-Pool collateral gain straight into your trove on the same branch. See Earning.forceCloseTrove(address)— clean up an undersized "dwarf" trove for a bounty. See Liquidation & cleanup.shutdown()/shutdownFromOracleFailure()— branch shutdown triggers. See Redemption.