Interactions

The Risk Engine contract provides a set of functions that enable market management, risk assessment, and user position tracking across multiple pToken markets. These methods allow users to interact with the risk framework

supportMarket

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

function supportMarket(IPToken pToken) external;

Parameters

Name

Type

Description

pToken

IPToken

The address of the market (token) to list

supportEMode

Add the e-mode and configure its status with admin access

function supportEMode(
    uint8 categoryId,
    bool isAllowed,
    address[] calldata pTokens,
    bool[] calldata collateralPermissions,
    bool[] calldata borrowPermissions
) external;

Parameters

Name

Type

Description

categoryId

uint8

Id representing e-mode identifier

isAllowed

bool

The identifier to active or deactivate e-mode

pTokens

address[]

The array of addresses to add to e-mode

collateralPermissions

bool[]

The array of collateral status for pTokens in e-mode

borrowPermissions

bool[]

The array of borrowable status for pTokens in e-mode

switchEMode

Switch caller E-Mode category

0 is the initial and default category for all markets

function switchEMode(uint8 newCategoryId) external;

Parameters

Name

Type

Description

newCategoryId

uint8

The new e-mode category that caller wants to switch

enterMarkets

Add assets to be included in account liquidity calculation

function enterMarkets(address[] memory pTokens) external returns (uint256[] memory);

Parameters

Name

Type

Description

pTokens

address[]

The list of addresses of the pToken markets to be enabled

Returns

Name

Type

Description

none

uint256[]

Success indicator for whether each corresponding market was entered

exitMarket

Removes asset from sender's account liquidity calculation

function exitMarket(address pTokenAddress) external;

Parameters

Name

Type

Description

pTokenAddress

address

The address of the asset to be removed

setOracle

  • Admin Functions

Sets the oracle engine for a the risk engine

Admin function to set oracle

functionsetOracle(address newOracle) external;

Parameters

Name
Type
Description

newOracle

address

The address of the new oracle

setReserveShares

Updates the reserve share percentages for the owner and configurator that applies to all ptokens.

needs protocol owner access to update

function setReserveShares(
    uint256 newOwnerShareMantissa,
    uint256 newConfiguratorShareMantissa
) external;

Parameters

Name
Type
Description

newOwnerShareMantissa

uint256

The new share of reserve percentage for the owner (scaled by 1e18).

newConfiguratorShareMantissa

uint256

The new share of reserve percentage for the configurator (scaled by 1e18).

setCloseFactor

Sets the closeFactor for a market used when liquidating borrows

Admin function to set closeFactor

function setCloseFactor(address pTokenAddress, uint256 newCloseFactorMantissa) external;

Parameters

Name
Type
Description

pTokenAddress

address

address of ptoken set close factor for

newCloseFactorMantissa

uint256

New close factor, scaled by 1e18

configureMarket

Sets the collateralFactor and liquidation threshold for a market

Admin function to set per-market collateralFactor


function configureMarket(IPToken pToken, BaseConfiguration calldata baseConfig)
    external;

Parameters

Name
Type
Description

pToken

IPToken

baseConfig

BaseConfiguration

The collateralFactor, liqThreshold and liqIncentive of market

supportMarket

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

Admin function to set isListed and add support for the market


function supportMarket(IPToken pToken) external;

Parameters

Name
Type
Description

pToken

IPToken

The address of the market (token) to list

supportEMode

Add the e-mode and configure its status with amdin access


function supportEMode(
    uint8 categoryId,
    bool isAllowed,
    address[] calldata pTokens,
    bool[] calldata collateralPermissions,
    bool[] calldata borrowPermissions
) external;

Parameters

Name
Type
Description

categoryId

uint8

Id representing e-mode identifier

isAllowed

bool

The identifier to active or deactivate e-mode

pTokens

address[]

The array of addresses to add to e-mode

collateralPermissions

bool[]

The array of collateral status for pTokens in e-mode

borrowPermissions

bool[]

The array of borrowable status for pTokens in e-mode

setMarketBorrowCaps

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

borrowCapGuardian function to set the borrow caps. A borrow cap of type(uint256).max corresponds to unlimited borrowing.


function setMarketBorrowCaps(IPToken[] calldata pTokens, uint256[] calldata newBorrowCaps)
    external;

Parameters

Name
Type
Description

pTokens

IPToken[]

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 type(uint256).max corresponds to unlimited borrowing.

setMarketSupplyCaps

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

supplyCapGuardian function to set the supply caps. A supply cap of type(uint256).max corresponds to unlimited supplying.


function setMarketSupplyCaps(IPToken[] calldata pTokens, uint256[] calldata newSupplyCaps)
    external;

Parameters

Name
Type
Description

pTokens

IPToken[]

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 type(uint256).max corresponds to unlimited supplying.

setMintPaused

Admin function to pause mint


function setMintPaused(IPToken pToken, bool state) external returns (bool);

setBorrowPaused

Admin function to pause borrow


function setBorrowPaused(IPToken pToken, bool state) external returns (bool);

setTransferPaused

Admin function to pause transfer


function setTransferPaused(bool state) external returns (bool);

setSeizePaused

Admin function to pause sieze


function setSeizePaused(bool state) external returns (bool);

Last updated