Step into the heart of individual collateralized debt positions with the Trove Manager. This contract is the central hub for all operations related to a specific collateral type, managing its Troves, associated fees, rates, and overall system health for that asset. Explore its comprehensive suite of functions for opening Troves, managing debt and collateral, processing redemptions, and handling liquidations, along with events that track every critical state change.

Functions

BOOTSTRAP_PERIOD()

Returns the duration of the bootstrap period. (View)

function BOOTSTRAP_PERIOD() -> uint256 [view]

CCR()

Returns the Collateralization Ratio of this Trove Manager. (View)

function CCR() -> uint256 [view]

DEBT_GAS_COMPENSATION()

Returns the gas compensation for debt operations. (View)

function DEBT_GAS_COMPENSATION() -> uint256 [view]

DECIMAL_PRECISION()

Returns the decimal precision used. (View)

function DECIMAL_PRECISION() -> uint256 [view]

L_collateral()

Returns the L_collateral term for reward calculations. (View)

function L_collateral() -> uint256 [view]

L_debt()

Returns the L_debt term for reward calculations. (View)

function L_debt() -> uint256 [view]

MAX_INTEREST_RATE_IN_BPS()

Returns the maximum interest rate in basis points. (View)

function MAX_INTEREST_RATE_IN_BPS() -> uint256 [view]

MCR()

Returns the Minimum Collateralization Ratio for Troves in this manager. (View)

function MCR() -> uint256 [view]

PERCENT_DIVISOR()

Returns the divisor for percentage calculations. (View)

function PERCENT_DIVISOR() -> uint256 [view]

ROOTS_CORE()

Returns the address of the IRootsCore contract. (View)

function ROOTS_CORE() -> address (contract IRootsCore) [view]

SUNSETTING_INTEREST_RATE()

Returns the interest rate applied during the sunsetting period. (View)

function SUNSETTING_INTEREST_RATE() -> uint256 [view]

Troves

Returns details of a specific Trove. (View)

function Troves(_account: address) -> (uint256, uint256, uint256, uint8 (enum ITroveManager.Status), uint128, uint256) [view]

activeInterestIndex()

Returns the current active interest index. (View)

function activeInterestIndex() -> uint256 [view]

addCollateralSurplus

Adds collateral surplus to a borrower’s account (typically after liquidation).

function addCollateralSurplus(borrower: address, collSurplus: uint256) [nonpayable]

applyPendingRewards

Applies pending rewards to a borrower’s Trove.

function applyPendingRewards(_borrower: address) -> (uint256, uint256) [nonpayable]

baseRate()

Returns the current base rate for borrowing fees. (View)

function baseRate() -> uint256 [view]

borrowerOperationsAddress()

Returns the address of the Borrower Operations contract. (View)

function borrowerOperationsAddress() -> address [view]

borrowingFeeFloor()

Returns the floor for borrowing fees. (View)

function borrowingFeeFloor() -> uint256 [view]

claimCollateral

Allows a user to claim their collateral surplus.

function claimCollateral(_receiver: address) [nonpayable]

claimReward (Version 1)

Claims rewards for a specified ‘from’ address to a ‘receiver’.

function claimReward(_from: address, _receiver: address) -> uint256 [nonpayable]

claimReward (Version 2)

Claims rewards for the message sender.

function claimReward() -> uint256 [nonpayable]

claimReward (Version 3)

Claims rewards for the message sender to a specified ‘receiver’.

function claimReward(_receiver: address) -> uint256 [nonpayable]

claimableReward

Returns the amount of reward a borrower can claim.

function claimableReward(_borrower: address) -> uint256 [nonpayable]

closeTrove

Closes a borrower’s Trove.

function closeTrove(_borrower: address, _receiver: address, collAmount: uint256, debtAmount: uint256) [nonpayable]

closeTroveByLiquidation

Closes a Trove due to liquidation.

function closeTroveByLiquidation(_borrower: address) [nonpayable]

collateralToken()

Returns the address of the collateral token for this Trove Manager. (View)

function collateralToken() -> address (contract IERC20) [view]

collectInterests

Collects accrued interest, updating relevant system parameters.

function collectInterests() [nonpayable]

debtToken()

Returns the address of the IDebtToken contract. (View)

function debtToken() -> address (contract IDebtToken) [view]

decayBaseRateAndGetBorrowingFee

Decays the base rate and returns the current borrowing fee for a given debt amount.

function decayBaseRateAndGetBorrowingFee(_debt: uint256) -> uint256 [nonpayable]

decreaseDebtAndSendCollateral

Decreases debt and sends collateral, typically during redemptions.

function decreaseDebtAndSendCollateral(account: address, debt: uint256, coll: uint256) [nonpayable]

defaultedCollateral()

Returns the amount of collateral defaulted in this Trove Manager. (View)

function defaultedCollateral() -> uint256 [view]

defaultedDebt()

Returns the amount of debt defaulted in this Trove Manager. (View)

function defaultedDebt() -> uint256 [view]

emissionId()

Returns emission IDs related to this Trove Manager. (View)

function emissionId() -> (uint16, uint16) [view]

fetchPrice()

Fetches the current price of the collateral token from the price feed.

function fetchPrice() -> uint256 [nonpayable]

finalizeLiquidation

Finalizes a liquidation process, distributing collateral and gas compensation.

function finalizeLiquidation(_liquidator: address, _debt: uint256, _coll: uint256, _collSurplus: uint256, _debtGasComp: uint256, _collGasComp: uint256) [nonpayable]

getBorrowingFee

Calculates the current borrowing fee for a given debt amount without decaying the base rate. (View)

function getBorrowingFee(_debt: uint256) -> uint256 [view]

getBorrowingFeeWithDecay

Calculates the current borrowing fee for a given debt amount after decaying the base rate. (View)

function getBorrowingFeeWithDecay(_debt: uint256) -> uint256 [view]

getBorrowingRate()

Returns the current borrowing rate without decaying. (View)

function getBorrowingRate() -> uint256 [view]

getBorrowingRateWithDecay()

Returns the current borrowing rate after decaying. (View)

function getBorrowingRateWithDecay() -> uint256 [view]

getCurrentICR

Calculates the Individual Collateralization Ratio (ICR) of a borrower’s Trove at a given price. (View)

function getCurrentICR(_borrower: address, _price: uint256) -> uint256 [view]

getEntireDebtAndColl

Returns the entire debt and collateral details for a borrower. (View)

function getEntireDebtAndColl(_borrower: address) -> (uint256, uint256, uint256, uint256) [view]

getEntireSystemBalances()

Returns the entire system balances for this Trove Manager.

function getEntireSystemBalances() -> (uint256, uint256, uint256) [nonpayable]

getEntireSystemColl()

Returns the total collateral in the system for this Trove Manager. (View)

function getEntireSystemColl() -> uint256 [view]

getEntireSystemDebt()

Returns the total debt in the system for this Trove Manager. (View)

function getEntireSystemDebt() -> uint256 [view]

getNominalICR

Calculates the nominal ICR of a borrower’s Trove (ICR at a price of 1). (View)

function getNominalICR(_borrower: address) -> uint256 [view]

getPendingCollAndDebtRewards

Returns the pending collateral and debt rewards for a borrower. (View)

function getPendingCollAndDebtRewards(_borrower: address) -> (uint256, uint256) [view]

getRedemptionFeeWithDecay

Calculates the redemption fee for a given amount of collateral drawn, after decaying the base rate. (View)

function getRedemptionFeeWithDecay(_collateralDrawn: uint256) -> uint256 [view]

getRedemptionRate()

Returns the current redemption rate without decaying. (View)

function getRedemptionRate() -> uint256 [view]

getRedemptionRateWithDecay()

Returns the current redemption rate after decaying. (View)

function getRedemptionRateWithDecay() -> uint256 [view]

getTotalActiveCollateral()

Returns the total active collateral in this Trove Manager. (View)

function getTotalActiveCollateral() -> uint256 [view]

getTotalActiveDebt()

Returns the total active debt in this Trove Manager. (View)

function getTotalActiveDebt() -> uint256 [view]

getTroveCollAndDebt

Returns the collateral and debt of a specific Trove. (View)

function getTroveCollAndDebt(_borrower: address) -> (uint256, uint256) [view]

getTroveFromTroveOwnersArray

Returns a Trove owner’s address from the array by index. (View)

function getTroveFromTroveOwnersArray(_index: uint256) -> address [view]

getTroveOwnersCount()

Returns the total number of Trove owners. (View)

function getTroveOwnersCount() -> uint256 [view]

getTroveStake

Returns the stake associated with a borrower’s Trove. (View)

function getTroveStake(_borrower: address) -> uint256 [view]

getTroveStatus

Returns the status of a borrower’s Trove. (View)

function getTroveStatus(_borrower: address) -> uint256 [view]

getWeek()

Returns the current week. (View)

function getWeek() -> uint256 [view]

getWeekAndDay()

Returns the current week and day. (View)

function getWeekAndDay() -> (uint256, uint256) [view]

guardian()

Returns the guardian address. (View)

function guardian() -> address [view]

hasPendingRewards

Checks if a borrower has pending rewards. (View)

function hasPendingRewards(_borrower: address) -> bool [view]

interestPayable()

Returns the amount of interest currently payable. (View)

function interestPayable() -> uint256 [view]

interestRate()

Returns the current interest rate. (View)

function interestRate() -> uint256 [view]

lastActiveIndexUpdate()

Returns the timestamp of the last active index update. (View)

function lastActiveIndexUpdate() -> uint256 [view]

lastCollateralError_Redistribution()

Returns the last collateral error from redistribution. (View)

function lastCollateralError_Redistribution() -> uint256 [view]

lastDebtError_Redistribution()

Returns the last debt error from redistribution. (View)

function lastDebtError_Redistribution() -> uint256 [view]

lastFeeOperationTime()

Returns the timestamp of the last fee operation. (View)

function lastFeeOperationTime() -> uint256 [view]

liquidationManager()

Returns the address of the Liquidation Manager contract. (View)

function liquidationManager() -> address [view]

maxBorrowingFee()

Returns the maximum borrowing fee. (View)

function maxBorrowingFee() -> uint256 [view]

maxRedemptionFee()

Returns the maximum redemption fee. (View)

function maxRedemptionFee() -> uint256 [view]

maxSystemDebt()

Returns the maximum system debt allowed for this Trove Manager. (View)

function maxSystemDebt() -> uint256 [view]

minuteDecayFactor()

Returns the minute decay factor for fee calculations. (View)

function minuteDecayFactor() -> uint256 [view]

movePendingTroveRewardsToActiveBalances

Moves pending Trove rewards to active balances for a given debt and collateral amount.

function movePendingTroveRewardsToActiveBalances(_debt: uint256, _collateral: uint256) [nonpayable]

openTrove

Opens a new Trove for a borrower.

function openTrove(_borrower: address, _collateralAmount: uint256, _compositeDebt: uint256, NICR: uint256, _upperHint: address, _lowerHint: address) -> (uint256, uint256) [nonpayable]

owner()

Returns the owner address of the contract. (View)

function owner() -> address [view]

paused()

Returns true if the contract is paused, false otherwise. (View)

function paused() -> bool [view]

priceFeed()

Returns the address of the IPriceFeed contract. (View)

function priceFeed() -> address (contract IPriceFeed) [view]

redeemCollateral

Processes a collateral redemption request.

function redeemCollateral(_debtAmount: uint256, _firstRedemptionHint: address, _upperPartialRedemptionHint: address, _lowerPartialRedemptionHint: address, _partialRedemptionHintNICR: uint256, _maxIterations: uint256, _maxFeePercentage: uint256) [nonpayable]

redemptionFeeFloor()

Returns the floor for redemption fees. (View)

function redemptionFeeFloor() -> uint256 [view]

rewardSnapshots

Returns reward snapshot data for a given account. (View)

function rewardSnapshots(_account: address) -> (uint256, uint256) [view]

setAddresses

Sets essential contract addresses. Note: This function signature seems to be duplicated from a general parameter configuration context and might be specific to this TroveManager’s setup if it only sets limited addresses.

function setAddresses(_priceFeedAddress: address, _sortedTrovesAddress: address, _collateralToken: address) [nonpayable]

setParameters

Configures various system parameters for this Trove Manager.

function setParameters(_minuteDecayFactor: uint256, _redemptionFeeFloor: uint256, _maxRedemptionFee: uint256, _borrowingFeeFloor: uint256, _maxBorrowingFee: uint256, _interestRateInBPS: uint256, _maxSystemDebt: uint256, _MCR: uint256) [nonpayable]

setPaused

Pauses or unpauses the contract.

function setPaused(_paused: bool) [nonpayable]

setPriceFeed

Sets the price feed address for this Trove Manager.

function setPriceFeed(_priceFeedAddress: address) [nonpayable]

setStaker

Sets the Staker contract address.

function setStaker(_staker: address) [nonpayable]

sortedTroves()

Returns the address of the ISortedTroves contract. (View)

function sortedTroves() -> address (contract ISortedTroves) [view]

staker()

Returns the address of the IStaker contract. (View)

function staker() -> address (contract IStaker) [view]

startSunset()

Initiates the sunset mode for this Trove Manager.

function startSunset() [nonpayable]

sunsetting()

Returns true if this Trove Manager is in sunset mode. (View)

function sunsetting() -> bool [view]

surplusBalances

Returns surplus balance for a given account. (View)

function surplusBalances(_account: address) -> uint256 [view]

systemDeploymentTime()

Returns the system deployment time. (View)

function systemDeploymentTime() -> uint256 [view]

totalCollateralSnapshot()

Returns the total collateral snapshot. (View)

function totalCollateralSnapshot() -> uint256 [view]

totalStakes()

Returns the total stakes. (View)

function totalStakes() -> uint256 [view]

totalStakesSnapshot()

Returns the total stakes snapshot. (View)

function totalStakesSnapshot() -> uint256 [view]

updateBalances()

Updates balances, likely related to rewards or interest.

function updateBalances() [nonpayable]

updateTroveFromAdjustment

Updates a Trove based on an adjustment operation.

function updateTroveFromAdjustment(_isDebtIncrease: bool, _debtChange: uint256, _netDebtChange: uint256, _isCollIncrease: bool, _collChange: uint256, _upperHint: address, _lowerHint: address, _borrower: address, _receiver: address) -> (uint256, uint256, uint256) [nonpayable]

Events

BaseRateUpdated

Emitted when the base rate for borrowing fees is updated.

event BaseRateUpdated(_baseRate: uint256)

CollateralSent

Emitted when collateral is sent from the Trove Manager.

event CollateralSent(_to: address, _amount: uint256)

LTermsUpdated

Emitted when L_collateral and L_debt terms are updated.

event LTermsUpdated(_L_collateral: uint256, _L_debt: uint256)

LastFeeOpTimeUpdated

Emitted when the last fee operation time is updated.

event LastFeeOpTimeUpdated(_lastFeeOpTime: uint256)

Redemption

Emitted upon a redemption operation processed by this Trove Manager.

event Redemption(_attemptedDebtAmount: uint256, _actualDebtAmount: uint256, _collateralSent: uint256, _collateralFee: uint256)

RewardClaimed

Emitted when rewards are claimed.

event RewardClaimed(account: address, recipient: address, claimed: uint256)

SystemSnapshotsUpdated

Emitted when system-wide snapshots are updated.

event SystemSnapshotsUpdated(_totalStakesSnapshot: uint256, _totalCollateralSnapshot: uint256)

TotalStakesUpdated

Emitted when total stakes are updated.

event TotalStakesUpdated(_newTotalStakes: uint256)

TroveIndexUpdated

Emitted when a Trove’s index in the sorted list is updated.

event TroveIndexUpdated(_borrower: address, _newIndex: uint256)

TroveSnapshotsUpdated

Emitted when a Trove’s reward snapshots are updated.

event TroveSnapshotsUpdated(_L_collateral: uint256, _L_debt: uint256)

TroveUpdated

Emitted when a Trove is updated (creation, adjustment, liquidation).

event TroveUpdated(_borrower: address, _debt: uint256, _coll: uint256, _stake: uint256, _operation: uint8 (enum ITroveManager.TroveManagerOperation))