RiskModule
Last updated
Last updated
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.
The specific roles and functions of the contract are as follows:
Role | Global* | Description | Methods Accessible |
---|---|---|---|
( * ) 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.
These parameters are managed and adjusted by the protocol governance. Some come from business decisions and others are quantitative analysis decisions.
Field | Type | Description |
---|---|---|
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.
Called from child contracts to create policies (after they validated the pricing)
Called when a policy expires or is resolved to update the exposure.
Requirements:
Must be called by policyPool()
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.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
LEVEL1_ROLE
High impact changes like upgrades or other critical operations.
setParam: Set parameters.
LEVEL2_ROLE
Mid-impact changes like changing some parameters.
setParam: Set parameters.
LEVEL3_ROLE
Low-impact changes like changing some parameters up to given percentage (tweaks).
setParam: Set parameters.
RM_PROVIDER
Manages the risk module.
setWallet: Sets the risk module wallet.
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).
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
payout
uint256
The exposure (maximum payout) of the policy