Operator

Inherits: OperatorStorage, ImTokenOperationTypes, OwnableUpgradeable

Note: oz-upgrades-unsafe-allow: constructor

constructor();

function initialize(address _rolesOperator, address _rewardDistributor, address _admin) public initializer;

modifier onlyAllowedUser(address user);

Sets user whitelist status

function setWhitelistedUser(address user, bool state) external onlyOwner;

Parameters

Name
Type
Description

user

address

The user address

state

bool

The new staate

Enable user whitelist

Disable user whitelist

Sets a new Operator for the market

Admin function to set a new operator

Sets a new price oracle

Admin function to set a new price oracle

Sets the closeFactor used when liquidating borrows

Admin function to set closeFactor

Parameters

Name
Type
Description

newCloseFactorMantissa

uint256

New close factor, scaled by 1e18

Sets the collateralFactor for a market

Admin function to set per-market collateralFactor

Parameters

Name
Type
Description

mToken

address

The market to set the factor on

newCollateralFactorMantissa

uint256

The new collateral factor, scaled by 1e18

Sets liquidationIncentive

Admin function to set liquidationIncentive

Parameters

Name
Type
Description

market

address

newLiquidationIncentiveMantissa

uint256

New liquidationIncentive scaled by 1e18

Add the market to the markets mapping and set it as listed

Admin function to set isListed and add support for the market

Parameters

Name
Type
Description

mToken

address

The address of the market (token) to list

Sets outflow volume time window

Parameters

Name
Type
Description

newTimeWindow

uint256

The new reset time window

Sets outflow volume limit

when 0, it means there's no limit

Parameters

Name
Type
Description

amount

uint256

The new limit

Resets outflow volume

Verifies outflow volule limit

Parameters

Name
Type
Description

amount

uint256

The new limit

Set the given borrow caps for the given mToken markets. Borrowing that brings total borrows to or above borrow cap will revert.

Parameters

Name
Type
Description

mTokens

address[]

The addresses of the markets (tokens) to change the borrow caps for

newBorrowCaps

uint256[]

The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing.

Set the given supply caps for the given mToken markets. Supplying that brings total supply to or above supply cap will revert.

Parameters

Name
Type
Description

mTokens

address[]

The addresses of the markets (tokens) to change the supply caps for

newSupplyCaps

uint256[]

The new supply cap values in underlying to be set. A value of 0 corresponds to unlimited supplying.

Set pause for a specific operation

Parameters

Name
Type
Description

mToken

address

The market token address

_type

ImTokenOperationTypes.OperationType

The pause operation type

state

bool

The pause operation status

Admin function to change the Reward Distributor

Parameters

Name
Type
Description

newRewardDistributor

address

The address of the new Reward Distributor

Should return true

Returns if operation is paused

Parameters

Name
Type
Description

mToken

address

The mToken to check

_type

ImTokenOperationTypes.OperationType

the operation type

Returns the assets an account has entered

Parameters

Name
Type
Description

_user

address

The address of the account to pull assets for

Returns

Name
Type
Description

mTokens

address[]

A dynamic list with the assets the account has entered

Returns whether the given account is entered in the given asset

Parameters

Name
Type
Description

account

address

The address of the account to check

mToken

address

The mToken to check

Returns

Name
Type
Description

<none>

bool

True if the account is in the asset, otherwise false.

A list of all markets

Returns true if the given mToken market has been deprecated

All borrows in a deprecated mToken market can be immediately liquidated

Parameters

Name
Type
Description

mToken

address

The market to check if deprecated

Returns true/false

Determine the current account liquidity wrt collateral requirements

Returns

Name
Type
Description

<none>

uint256

account liquidity in excess of collateral requirements, account shortfall below collateral requirements)

<none>

uint256

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

Parameters

Name
Type
Description

account

address

The account to determine liquidity for

mTokenModify

address

The market to hypothetically redeem/borrow in

redeemTokens

uint256

The number of tokens to hypothetically redeem

borrowAmount

uint256

The amount of underlying to hypothetically borrow

Returns

Name
Type
Description

<none>

uint256

hypothetical account liquidity in excess of collateral requirements, hypothetical account shortfall below collateral requirements)

<none>

uint256

Calculate number of tokens of collateral asset to seize given an underlying amount

Used in liquidation (called in mTokenBorrowed.liquidate)

Parameters

Name
Type
Description

mTokenBorrowed

address

The address of the borrowed mToken

mTokenCollateral

address

The address of the collateral mToken

actualRepayAmount

uint256

The amount of mTokenBorrowed underlying to convert into mTokenCollateral tokens

Returns

Name
Type
Description

<none>

uint256

number of mTokenCollateral tokens to be seized in a liquidation

Add assets to be included in account liquidity calculation

Parameters

Name
Type
Description

_mTokens

address[]

The list of addresses of the mToken markets to be enabled

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

Parameters

Name
Type
Description

_account

address

The account to add for

Removes asset from sender's account liquidity calculation

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

Parameters

Name
Type
Description

_mToken

address

The address of the asset to be removed

Claim all the MALDA accrued by holder in all markets

Parameters

Name
Type
Description

holder

address

The address to claim MALDA for

Claim all the MALDA accrued by holder in the specified markets

Parameters

Name
Type
Description

holder

address

The address to claim MALDA for

mTokens

address[]

The list of markets to claim MALDA in

Claim all MALDA accrued by the holders

Parameters

Name
Type
Description

holders

address[]

The addresses to claim MALDA for

mTokens

address[]

The list of markets to claim MALDA in

borrowers

bool

Whether or not to claim MALDA earned by borrowing

suppliers

bool

Whether or not to claim MALDA earned by supplying

Returns USD value for all markets

Checks whitelist status on withdrawOnExtension

Parameters

Name
Type
Description

user

address

The user to check

Checks whitelist status on borrowOnExtension

Parameters

Name
Type
Description

user

address

The user to check

Checks if the account should be allowed to rebalance tokens

Parameters

Name
Type
Description

mToken

address

The market to verify the transfer against

Checks if the account should be allowed to transfer tokens in the given market

Parameters

Name
Type
Description

mToken

address

The market to verify the transfer against

src

address

The account which sources the tokens

dst

address

The account which receives the tokens

transferTokens

uint256

The number of mTokens to transfer

Checks if the account should be allowed to mint tokens in the given market

Parameters

Name
Type
Description

mToken

address

The market to verify the mint against

minter

address

The account which would get the minted tokens

Validates mint and reverts on rejection. May emit logs.

Parameters

Name
Type
Description

mToken

address

Asset being minted

Checks if the account should be allowed to redeem tokens in the given market

Parameters

Name
Type
Description

mToken

address

The market to verify the redeem against

redeemer

address

The account which would redeem the tokens

redeemTokens

uint256

The number of mTokens to exchange for the underlying asset in the market

Checks if the account should be allowed to borrow the underlying asset of the given market

Parameters

Name
Type
Description

mToken

address

The market to verify the borrow against

borrower

address

The account which would borrow the asset

borrowAmount

uint256

The amount of underlying the account would borrow

Checks if the account should be allowed to repay a borrow in the given market

Parameters

Name
Type
Description

mToken

address

The market to verify the repay against

borrower

address

The account which would borrowed the asset

Checks if the liquidation should be allowed to occur

Parameters

Name
Type
Description

mTokenBorrowed

address

Asset which was borrowed by the borrower

mTokenCollateral

address

Asset which was used as collateral and will be seized

borrower

address

The address of the borrower

repayAmount

uint256

The amount of underlying being repaid

Checks if the seizing of assets should be allowed to occur

Parameters

Name
Type
Description

mTokenCollateral

address

Asset which was used as collateral and will be seized

mTokenBorrowed

address

Asset which was borrowed by the borrower

liquidator

address

The address repaying the borrow and seizing the collateral

borrower

address

The address of the borrower

Notify reward distributor for supply index update

Parameters

Name
Type
Description

mToken

address

The market whose supply index to update

Notify reward distributor for borrow index update

Parameters

Name
Type
Description

mToken

address

The market whose borrow index to update

Notify reward distributor for supplier update

Parameters

Name
Type
Description

mToken

address

The market in which the supplier is interacting

supplier

address

The address of the supplier to distribute MALDA to

Notify reward distributor for borrower update

Borrowers will not begin to accrue until after the first interaction with the protocol.

Parameters

Name
Type
Description

mToken

address

The market in which the borrower is interacting

borrower

address

The address of the borrower to distribute MALDA to

Git Source

Inherits: IOperator, IOperatorDefender, ExponentialNoError

Roles manager

Oracle which gives the price of any given asset

Multiplier used to calculate the maximum repayAmount when liquidating a borrow

Multiplier representing the discount on collateral that a liquidator receives

Per-account mapping of "assets you are in", capped by maxAssets

Official mapping of mTokens -> Market metadata

Used e.g. to determine if a market is supported

A list of all markets

Borrow caps enforced by borrowAllowed for each mToken address. Defaults to zero which corresponds to unlimited borrowing.

Supply caps enforced by supplyAllowed for each mToken address. Defaults to zero which corresponds to unlimited supplying.

Reward Distributor to markets supply and borrow (including protocol token)

Should return outflow limit

Should return outflow volume

Should return last reset time for outflow check

Should return the outflow volume time window

Returns true/false for user

Emitted when user whitelist status is changed

Emitted when pause status is changed

Emitted when reward distributor is changed

Emitted when borrow cap for a mToken is changed

Emitted when supply cap for a mToken is changed

Emitted when an admin supports a market

Emitted when an account enters a market

Emitted when an account exits a market

Emitted Emitted when close factor is changed by admin

Emitted when a collateral factor is changed by admin

Emitted when liquidation incentive is changed by admin

Emitted when price oracle is changed

Event emitted when rolesOperator is changed

Event emitted when outflow limit is updated

Event emitted when outflow reset time window is updated

Event emitted when outflow volume has been reset

Local vars for avoiding stack-depth limits in calculating account liquidity. Note that mTokenBalance is the number of mTokens the account owns in the market, whereas borrowBalance is the amount of underlying that the account has borrowed.

Last updated