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:
PRICER_ROLE
Creates new policies.
newPolicy: Creates a new policy.
newPolicyFull: Creates a new policy with all its details and returns the created policy data.
RESOLVER_ROLE
Resolves policies.
resolvePolicy: Resolves a policy by executing the necessary actions within the contract.
resolvePolicyFullPayout: Resolves a policy with full payout.
( * ) 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}
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
[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}
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}
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