Unlock the power of your collateral with the Borrower Operations contract. This crucial component of the Roots protocol empowers users to manage their financial positions (Troves) with precision. Explore functions for opening new Troves, adjusting existing collateral and debt levels, claiming rewards, and more. Key events will keep you informed of every significant operation.

Functions

CCR()

Returns the Collateralization Ratio of the system. (View)

function CCR() -> uint256 [view]

DEBT_GAS_COMPENSATION()

Returns the gas compensation amount for debt-related operations. (View)

function DEBT_GAS_COMPENSATION() -> uint256 [view]

DECIMAL_PRECISION()

Returns the decimal precision used in calculations. (View)

function DECIMAL_PRECISION() -> uint256 [view]

PERCENT_DIVISOR()

Returns the divisor used 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]

addColl

Adds collateral to a user’s Trove.

function addColl(troveManager: address (contract ITroveManager), account: address, _collateralAmount: uint256, _upperHint: address, _lowerHint: address) [nonpayable]

adjustTrove

Adjusts a user’s Trove by depositing/withdrawing collateral and/or increasing/decreasing debt.

function adjustTrove(troveManager: address (contract ITroveManager), account: address, _maxFeePercentage: uint256, _collDeposit: uint256, _collWithdrawal: uint256, _debtChange: uint256, _isDebtIncrease: bool, _upperHint: address, _lowerHint: address) [nonpayable]

checkRecoveryMode

Checks if the system is in recovery mode based on the provided Total Collateralization Ratio (TCR). (Pure)

function checkRecoveryMode(TCR: uint256) -> bool [pure]

claimRewards

Claims rewards for a user from specified Trove Managers.

function claimRewards(_to: address, _troveManagerIndexes: uint256[]) [nonpayable]

closeTrove

Closes a user’s Trove.

function closeTrove(troveManager: address (contract ITroveManager), account: address) [nonpayable]

configureCollateral

Configures a collateral token for a specific Trove Manager.

function configureCollateral(troveManager: address (contract ITroveManager), collateralToken: address (contract IERC20)) [nonpayable]

debtToken()

Returns the address of the IDebtToken contract. (View)

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

factory()

Returns the factory address. (View)

function factory() -> address [view]

fetchBalances()

Fetches system balances. (Nonpayable)

function fetchBalances() -> tuple (struct IBorrowerOperations.SystemBalances) [nonpayable]

getCompositeDebt

Calculates the composite debt including fees. (View)

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

getGlobalSystemBalances()

Gets the global system balances. (Nonpayable)

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

getTCR()

Gets the Total Collateralization Ratio of the system. (Nonpayable)

function getTCR() -> uint256 [nonpayable]

guardian()

Returns the guardian address. (View)

function guardian() -> address [view]

initialize

Initializes the BorrowerOperations contract.

function initialize(_debtTokenAddress: address, _factory: address) [nonpayable]

isApprovedDelegate

Checks if a caller is an approved delegate for an owner. (View)

function isApprovedDelegate(owner: address, caller: address) -> bool [view]

minNetDebt()

Returns the minimum net debt required for a Trove. (View)

function minNetDebt() -> uint256 [view]

openTrove

Opens a new Trove for a user with specified collateral and debt amounts.

function openTrove(troveManager: address (contract ITroveManager), account: address, _maxFeePercentage: uint256, _collateralAmount: uint256, _debtAmount: uint256, _upperHint: address, _lowerHint: address) [nonpayable]

owner()

Returns the owner address of the contract. (View)

function owner() -> address [view]

removeTroveManager

Removes a Trove Manager from the system.

function removeTroveManager(troveManager: address (contract ITroveManager)) [nonpayable]

repayDebt

Repays a specified amount of debt for a user’s Trove.

function repayDebt(troveManager: address (contract ITroveManager), account: address, _debtAmount: uint256, _upperHint: address, _lowerHint: address) [nonpayable]

setDelegateApproval

Sets or revokes delegate approval for an address.

function setDelegateApproval(_delegate: address, _isApproved: bool) [nonpayable]

setMinNetDebt

Sets the minimum net debt for Troves.

function setMinNetDebt(_minNetDebt: uint256) [nonpayable]

troveManagersData

Returns data for a specific Trove Manager, including its collateral token and other parameters. (View)

function troveManagersData(troveManager: address (contract ITroveManager)) -> (address (contract IERC20), uint16) [view]

withdrawColl

Withdraws collateral from a user’s Trove.

function withdrawColl(troveManager: address (contract ITroveManager), account: address, _collWithdrawal: uint256, _upperHint: address, _lowerHint: address) [nonpayable]

withdrawDebt

Withdraws (borrows) a specified amount of debt from a user’s Trove.

function withdrawDebt(troveManager: address (contract ITroveManager), account: address, _maxFeePercentage: uint256, _debtAmount: uint256, _upperHint: address, _lowerHint: address) [nonpayable]

Events

BorrowingFeePaid (Version 1)

Emitted when a borrowing fee is paid, specifying the collateral token.

event BorrowingFeePaid(borrower: address, collateralToken: address (contract IERC20), amount: uint256)

BorrowingFeePaid (Version 2)

Emitted when a borrowing fee is paid.

event BorrowingFeePaid(borrower: address, amount: uint256)

CollateralConfigured

Emitted when a collateral token is configured for a Trove Manager.

event CollateralConfigured(troveManager: address (contract ITroveManager), collateralToken: address (contract IERC20))

DelegateApprovalSet

Emitted when delegate approval status is changed for a caller.

event DelegateApprovalSet(caller: address, delegate: address, isApproved: bool)

TroveCreated

Emitted when a new Trove is created.

event TroveCreated(_borrower: address, arrayIndex: uint256)

TroveManagerRemoved

Emitted when a Trove Manager is removed.

event TroveManagerRemoved(troveManager: address (contract ITroveManager))

TroveUpdated

Emitted when a Trove is updated.

event TroveUpdated(_borrower: address, _debt: uint256, _coll: uint256, stake: uint256, operation: uint8)