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.

function enterMarkets(address[] calldata iTokens)
        external
        returns (bool[] memory);

exitMarkets()

Exit a market, exited markets will not count towards account liquidity calculations.

function exitMarkets(address[] calldata iTokens)
        external
        returns (bool[] memory);

getAlliTokens()

Get all markets already added into the protocol.

function getAlliTokens() external view returns (address[] memory);

hasiToken()

Return the status whether an iToken is listed in the controller.

function hasiToken(address _iToken) external view returns (bool);

getEnteredMarkets()

Get all markets already entered from one account.

function getEnteredMarkets(address account)
        external
        view
        returns (address[] memory);

getBorrowedAssets()

Get all assets already borrowed from one account.

function getBorrowedAssets(address account)
        external
        view
        returns (address[] memory);

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.

function calcAccountEquity(address _account)
        public
        view
        override
        returns (
            uint256 equity,
            uint256 shortfall,
            uint256 collaterals,
            uint256 borrows
        )

liquidateCalculateSeizeTokens()

Compute the amount of collateral iToken available to seize after repaying a specific amount of borrow asset.

function liquidateCalculateSeizeTokens(
        address _iTokenBorrowed,
        address _iTokenCollateral,
        uint256 _actualRepayAmount
    )
    external
    view
    override
    returns (uint256 _seizedTokenCollateral)

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 updated