TrustfulRiskModule
This is an implementation of the RiskModule that relays fully on trusted accounts to price and resolve the policies.
Roles
The specific functions of the contract are as follows:
Role | Global* | Description | Methods Accessible |
---|---|---|---|
PRICER_ROLE | Creates new policies. |
| |
RESOLVER_ROLE | Resolves policies. |
|
( * ) 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.
External Methods
newPolicy
Creates a new Policy
Requirements:
The caller has been granted componentRole(PRICER_ROLE)
Emits:
{PolicyPool.NewPolicy}
Name | Type | Description |
---|---|---|
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) |
onBehalfOf | address | The policy holder |
internalId | uint96 | An id that's unique within this module and it will be used to identify the policy |
Name | Type | Description |
---|---|---|
[0] | uint256 | Returns the id of the created policy |
resolvePolicy
Resolves a policy, if payout > 0, it pays to the policy holder.
Requirements:
The caller has been granted componentRole(RESOLVER_ROLE)
payout <= policy.payout
block.timestamp >= policy.expiration
Emits:
{PolicyPool.PolicyResolved}
Name | Type | Description |
---|---|---|
policy | struct Policy.PolicyData | The policy previously created (from {NewPolicy} event) |
payout | uint256 | The payout to transfer to the policy holder |
resolvePolicyFullPayout
Resolves a policy with full payout (policy.payout) if customerWon == true
Requirements:
The caller has been granted componentRole(RESOLVER_ROLE)
block.timestamp >= policy.expiration
Emits:
{PolicyPool.PolicyResolved}
Name | Type | Description |
---|---|---|
policy | struct Policy.PolicyData | The policy previously created (from {NewPolicy} event) |
customerWon | bool | If true, policy.payout is transferred to the policy holder. If false, the policy is resolved without payout and can't be longer claimed. |
Last updated