Comptroller
Last updated
Last updated
The Comptroller is the risk management module of the JustLend DAO protocol. It determines how much collateral should users keep to avoid liquidation. The Comptroller is implemented as an upgradable contract. The entrance is ; the implementation is .
Comptroller.sol
allows users to:
Markets
Get Assets In
Get Account Liquidation
Liquidation Incentive
The source code is available on .
Calling this method enters a list of markets to supply or borrow.
Parameter description:
cTokens
: address list of the markets to enter.
Returns: for each market, returns 0 for success, otherwise an error code.
Exit Market
Calling this method exits a currently entered market.
Parameter description:
cTokenAddress
: market address to quit.
Returns: 0 on success, otherwise an error code.
Calling this method returns a list of already entered markets.
Parameter description:
account
: the markets this account enters will be returned.
Returns: markets have been entered by the specified address.
Calling this method returns the status of a market(isListed, collateralFactorMantissa, comped)
Parameter description:
cTokenAddress:
market address.
Returns:
isListed
: whether recognized by comptroller;
collateralFactorMantissa
: the value can be borrowed(scaled by 1e18);
comped
: whether suppliers & borrowers can get jst dividends.
Calling this method returns the liquidity and shortfall of a user.
Parameter description:
account:
address to be queried.
Returns:
error
: 0 for success, otherwise an error code;
liquidity
: urrent liquidity;
shortfall
: the shortfall value of the account's collateral requirement.
Calling this method gets the percentage of a liquidatable account should repay in a single liquidation. The range is 0%-100%. The calculation result of this method applies to a single asset.
Parameter description: N/A.
Returns: The close factor, scaled by 1e18.
Calling this method gets liquidators' incentives. The incentive is for underwater accounts. Part of this will be given to jToken reserves according to the seize share.
Parameter description: N/A.
Returns: The close factor, scaled by 1e18.