Controller
The Controller is the risk management portal of the dForce Lending & Synthetic Protocol, it determines how much collateral a user is required to maintain, whether (and how much) a user can be liquidated, and control the protocol risk by adjusting supply/borrow capacity and risk parameters.

Methods

enterMarkets()

Enter into a list of markets. In order to supply collateral or borrow in a market, it must be entered first.
1
function enterMarkets(address[] calldata iTokens)
2
external
3
returns (bool[] memory);
Copied!

exitMarkets()

Exit a market, exited markets will not count towards account liquidity calculations.
1
function exitMarkets(address[] calldata iTokens)
2
external
3
returns (bool[] memory);
Copied!

getAlliTokens()

Get all markets already added into the protocol.
1
function getAlliTokens() external view returns (address[] memory);
Copied!

hasiToken()

Return the status whether an iToken is listed in the controller.
1
function hasiToken(address _iToken) external view returns (bool);
Copied!

getEnteredMarkets()

Get all markets already entered from one account.
1
function getEnteredMarkets(address account)
2
external
3
view
4
returns (address[] memory);
Copied!

getBorrowedAssets()

Get all assets already borrowed from one account.
1
function getBorrowedAssets(address account)
2
external
3
view
4
returns (address[] memory);
Copied!

calcAccountEquity()

Account liquidity represents the USD value with the specific asset/amount-continue-redeeming or amount-continue-borrowing before it reaches liquidation. Returns Tuple of values (equity, shortfall, collaterals, borrows). A non-zero equity value indicates the account has available borrowable value, a non-zero shortfall value indicates the account is currently below the collateral requirement and is subject to liquidation. At most one of equity or shortfall shall be non-zero. Collaterals and borrows represent the current collateral and borrow value is USD with 36 integer precision which for example, 360000000000000000000000000000000000000000 indicates 360000 in USD.
1
function calcAccountEquity(address _account)
2
public
3
view
4
override
5
returns (
6
uint256 equity,
7
uint256 shortfall,
8
uint256 collaterals,
9
uint256 borrows
10
)
Copied!

liquidateCalculateSeizeTokens()

Compute the amount of collateral iToken available to seize after repaying a specific amount of borrow asset.
1
function liquidateCalculateSeizeTokens(
2
address _iTokenBorrowed,
3
address _iTokenCollateral,
4
uint256 _actualRepayAmount
5
)
6
external
7
view
8
override
9
returns (uint256 _seizedTokenCollateral)
Copied!

Key Events

Event
Description
event MarketEntered
(address iToken, address account)
Emitted upon a successful Enter Market.
event MarketExited
(address iToken, address account)
Emitted upon a successful Exit Market.
event BorrowedAdded
(address iToken, address account)
Emitted upon a successful borrowing new asset(never borrowed before).
event BorrowedRemoved
(address iToken, address account)
Emitted upon a successful payoff an outstanding loan.
Last modified 1yr ago