RiskModule

Risk Module is an abstract contract that needs to be implemented with specific policies for the main responsibilities of the contract: pricing and resolution.

The contract also stores several parameters that are used for the creation and validation of the policies.

Roles

The specific roles and functions of the contract are as follows:

RoleGlobal*DescriptionMethods Accessible

LEVEL1_ROLE

High impact changes like upgrades or other critical operations.

LEVEL2_ROLE

Mid-impact changes like changing some parameters.

LEVEL3_ROLE

Low-impact changes like changing some parameters up to given percentage (tweaks).

RM_PROVIDER

Manages the risk module.

  • setWallet: Sets the risk module wallet.

( * ) Global means that the role can be delegated to a user at the protocol level (for all components) or only for a specific component. Non-global roles can only be granted for a specific component.

Parameters

These parameters are managed and adjusted by the protocol governance. Some come from business decisions and others are quantitative analysis decisions.

FieldTypeDescription

moc

uint256 (wad)

Margin of Conservatism. A factor used to scale the expected losses calculated as payout * lossProb

jrCollRatio

uint256 (wad)

The collateralization ratio up to the junior eToken (see Solvency Breakdown)

collRatio

uint256 (wad)

The overall collateralization ratio (see Solvency Breakdown)

ensuroPpFee

uint256 (wad)

Percentage applied to the pure premium used to compute the Ensuro Commision.

ensuroCocFee

uint256 (wad)

Percentage applied to the cost of capital used to compute the Ensuro Commision.

jrRoc

uint256 (wad)

Annualized return expected by Junior eToken liquidity providers for the capital exposed to these risks. See more details.

srRoc

uint256 (wad)

Annualized return expected by Senior eToken liquidity providers for the capital exposed to these risks. See more details.

maxPayoutPerPolicy

uint256 (amount)

The maximum payout that's allowed as payout for each individual policy of this risk module.

exposureLimit

uint256 (amount)

The limit on the cumulative exposure of all the active policies of this module.

maxDuration

uint256(hours)

The maximum duration of the policies (in hours).

Packed parameters

To save gas, the parameters are stored in a packed struct that fits in 256bits (a word in the EVM). This is not visible externally, but put's limits on the precision of the parameters. The wad ones, have 4 decimals as precision, so 1.12345 will be truncated to 1.1234. maxPayoutPerPolicy has a precision of two decimals, and exposureLimit 0 decimals.

Internal methods

_newPolicy

function _newPolicy(uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, address payer, address onBehalfOf, uint96 internalId) internal returns (struct Policy.PolicyData)

Called from child contracts to create policies (after they validated the pricing)

NameTypeDescription

payout

uint256

The exposure (maximum payout) of the policy

premium

uint256

The premium that will be paid by the policyHolder

lossProb

uint256

The probability of having to pay the maximum payout (wad)

expiration

uint40

The expiration of the policy (timestamp)

payer

address

The account that pays for the premium

onBehalfOf

address

The policy holder

internalId

uint96

An id that's unique within this module and it will be used to identify the policy

External Methods

releaseExposure

function releaseExposure(uint256 payout) external

Called when a policy expires or is resolved to update the exposure.

Requirements:

  • Must be called by policyPool()

NameTypeDescription

payout

uint256

The exposure (maximum payout) of the policy

Setting parameters

Usually, LEVEL1_ROLE, LEVEL2_ROLE or LEVEL3_ROLE is requested for performing operations that change numerical parameters of the components. Both global and component role are accepted. If the user has LEVEL3_ROLE the changes might be restricted to small tweaks.

Last updated