IOperator

Git Source

Title: Operator interface

Author: Merge Layers Inc.

Core Operator contract surface

Functions

userWhitelisted

Returns true/false for user

function userWhitelisted(address _user) external view returns (bool);

Parameters

NameTypeDescription
_useraddressAddress to check

Returns

NameTypeDescription
<none>boolwhitelisted True if user is whitelisted

limitPerTimePeriod

Should return outflow limit

function limitPerTimePeriod() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256limit Outflow limit per period

cumulativeOutflowVolume

Should return outflow volume

function cumulativeOutflowVolume() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256volume Current outflow volume

lastOutflowResetTimestamp

Should return last reset time for outflow check

function lastOutflowResetTimestamp() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256lastReset Timestamp of last reset

outflowResetTimeWindow

Should return the outflow volume time window

function outflowResetTimeWindow() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256window Outflow window

isPaused

Returns if operation is paused

function isPaused(address mToken, ImTokenOperationTypes.OperationType _type) external view returns (bool);

Parameters

NameTypeDescription
mTokenaddressThe mToken to check
_typeImTokenOperationTypes.OperationTypethe operation type

Returns

NameTypeDescription
<none>boolpaused True if paused

rolesOperator

Roles

function rolesOperator() external view returns (IRoles);

Returns

NameTypeDescription
<none>IRolesroles Roles contract

blacklistOperator

Blacklist

function blacklistOperator() external view returns (IBlacklister);

Returns

NameTypeDescription
<none>IBlacklisterblacklister Blacklist operator

oracleOperator

Oracle which gives the price of any given asset

function oracleOperator() external view returns (address);

Returns

NameTypeDescription
<none>addressoracle Oracle address

closeFactorMantissa

Multiplier used to calculate the maximum repayAmount when liquidating a borrow

function closeFactorMantissa() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256closeFactor Close factor mantissa

liquidationIncentiveMantissa

Multiplier representing the discount on collateral that a liquidator receives

function liquidationIncentiveMantissa(address market) external view returns (uint256);

Parameters

NameTypeDescription
marketaddressMarket address

Returns

NameTypeDescription
<none>uint256incentive Discount mantissa

isMarketListed

Returns true/false

function isMarketListed(address market) external view returns (bool);

Parameters

NameTypeDescription
marketaddressMarket address

Returns

NameTypeDescription
<none>boollisted True if market is listed

getAssetsIn

Returns the assets an account has entered

function getAssetsIn(address _user) external view returns (address[] memory mTokens);

Parameters

NameTypeDescription
_useraddressThe address of the account to pull assets for

Returns

NameTypeDescription
mTokensaddress[]A dynamic list with the assets the account has entered

getAllMarkets

A list of all markets

function getAllMarkets() external view returns (address[] memory mTokens);

Returns

NameTypeDescription
mTokensaddress[]List of markets

borrowCaps

Borrow caps enforced by borrowAllowed for each mToken address.

Defaults to zero which corresponds to unlimited borrowing.

function borrowCaps(address _mToken) external view returns (uint256);

Parameters

NameTypeDescription
_mTokenaddressMarket address

Returns

NameTypeDescription
<none>uint256cap Borrow cap

supplyCaps

Supply caps enforced by supplyAllowed for each mToken address.

Defaults to zero which corresponds to unlimited supplying.

function supplyCaps(address _mToken) external view returns (uint256);

Parameters

NameTypeDescription
_mTokenaddressMarket address

Returns

NameTypeDescription
<none>uint256cap Supply cap

minBorrowSize

Supply caps enforced by supplyAllowed for each mToken address.

Defaults to zero which corresponds to unlimited borrowing.

function minBorrowSize(address _mToken) external view returns (uint256);

Parameters

NameTypeDescription
_mTokenaddressMarket address

Returns

NameTypeDescription
<none>uint256minimum Minimum borrow size

checkMembership

Returns whether the given account is entered in the given asset

function checkMembership(address account, address mToken) external view returns (bool);

Parameters

NameTypeDescription
accountaddressThe address of the account to check
mTokenaddressThe mToken to check

Returns

NameTypeDescription
<none>boolTrue if the account is in the asset, otherwise false.

getHypotheticalAccountLiquidity

Determine what the account liquidity would be if the given amounts were redeemed/borrowed

function getHypotheticalAccountLiquidity(
    address account,
    address mTokenModify,
    uint256 redeemTokens,
    uint256 borrowAmount
) external view returns (uint256 liquidity, uint256 shortfall);

Parameters

NameTypeDescription
accountaddressThe account to determine liquidity for
mTokenModifyaddressThe market to hypothetically redeem/borrow in
redeemTokensuint256The number of tokens to hypothetically redeem
borrowAmountuint256The amount of underlying to hypothetically borrow

Returns

NameTypeDescription
liquidityuint256Account liquidity in excess of collateral requirements
shortfalluint256Account shortfall below collateral requirements

getUSDValueForAllMarkets

Returns USD value for all markets

function getUSDValueForAllMarkets() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256usdValue Total USD value

isDeprecated

Returns true if the given mToken market has been deprecated

All borrows in a deprecated mToken market can be immediately liquidated

function isDeprecated(address mToken) external view returns (bool);

Parameters

NameTypeDescription
mTokenaddressThe market to check if deprecated

Returns

NameTypeDescription
<none>booldeprecated True if deprecated

setPaused

Set pause for a specific operation

function setPaused(address mToken, ImTokenOperationTypes.OperationType _type, bool state) external;

Parameters

NameTypeDescription
mTokenaddressThe market token address
_typeImTokenOperationTypes.OperationTypeThe pause operation type
stateboolThe pause operation status

enterMarkets

Add assets to be included in account liquidity calculation

function enterMarkets(address[] calldata _mTokens) external;

Parameters

NameTypeDescription
_mTokensaddress[]The list of addresses of the mToken markets to be enabled

enterMarketsWithSender

Add asset (msg.sender) to be included in account liquidity calculation

function enterMarketsWithSender(address _account) external;

Parameters

NameTypeDescription
_accountaddressThe account to add for

exitMarket

Removes asset from sender's account liquidity calculation

Sender must not have an outstanding borrow balance in the asset, and must not be providing necessary collateral for an outstanding borrow.

function exitMarket(address _mToken) external;

Parameters

NameTypeDescription
_mTokenaddressThe address of the asset to be removed