Policy Lifecycle
This page describes the full lifecycle of a policy on Ensuro's protocol, from its creation to its resolution, either by expiration or because of a claim.
New Policy
New Policy transactions are sent to risk modules. Each risk module has its logic related to how to validate/calculate the parameters of the policy. The input parameters for creating a policy are:
payout: the maximum amount paid for this policy to the policyholder.
premium: the amount paid as a premium.
lossProb: the estimated probability of having to do a payout equal to the maximum payout.
expiration: the expiration date of the policy (timestamp). After this date, the policy is no longer claimable.
internalId: a user-defined id that has to be unique within a risk module.
Based on the input parameters and the risk module's parameters, a Policy is created and sent to the PolicyPool.
Here you can see a sequence diagram of the process with all the contracts involved. As a final result, we should see the following effects:
A new Policy is stored, and an NFT is minted for the customer. The NFT represents the policy's ownership, and the owner of the NFT will receive the payout.
The solvency capital sourced from the liquidity pools (eTokens) is locked until the policy is triggered or expires.
The premium amount is transferred from the customer and split among the different parties:
The cost of capital is paid to the junior and senior eTokens.
The commissions are paid to Ensuro and the risk partner.
The pure premium is sent to the PremiumsAccount contract associated with the risk module.
A NewPolicy event with all the Policy fields that will be needed for upcoming operations.
Open the sequence diagram in a new window.
In the process of creation of a policy, several things are validated and can fail, reverting the operation:
Some of the policy's features, like policy duration, maximum payout per policy, and maximum exposure, exceed the risk module limits and are not validated by the risk module.
Risk module deprecated or suspended.
Lack of available funds in the eTokens to cover the required solvency capital (SCR).
Not enough funds in the customer's wallet to pay the premium or no allowance for spending given to the PolicyPool.
Repeated policyId/internalId (used to avoid repeated transactions).
Resolution - payout
The resolution of the policies when there is a payout is triggered from the risk modules. The criteria for triggering a payout change from one module to the other: some risk modules use information from oracles to define if a policy is triggered, while others rely on a trusted user (EOA) with a designated role.
Below you can see a sequence diagram of the process with all the contracts involved. As a final result, we should see the following effects:
The payout has been sent to the PolicyHolder.
The solvency capital (SCR) is unlocked.
The funds to cover the payout are taken from the premiums, the junior eToken, or the senior eToken (in this order).
Open the sequence diagram in a new window.
In the process of policy resolution, several things are validated and can fail, reverting the operation:
The policy doesn't exist. This might happen if the risk module receives a wrong input or if the policy has already been resolved. It is validated using the policy hash.
The policy has already expired.
The risk module is suspended.
Both premiums, junior eToken and senior eToken are exhausted, and not enough money for the payout. It shouldn't happen with a correct collateralization ratio.
Resolution - Expiration
Every policy, when created, has an expiration date. After that date, anyone can issue an expiration transaction. This expiration transaction is needed to unlock the solvency capital reserved for that policy since it's no longer claimable.
Here you can see a sequence diagram of the process with all the contracts involved. As a final result, we should see the following effects:
The solvency capital (SCR) is unlocked.
The PremiumsAccount earns the pure premium.
If the premiums account has outstanding loans with the Senior or Junior eTokens, it uses the pure premium earned to repay its debts (with that precedence).
The remaining pure premium is accumulated in the PremiumsAccount contract.
Open the sequence diagram in a new window.
In the process of policy resolution, several things are validated and can fail, reverting the operation:
The policy doesn't exist or is not expired (i.e., its expiration date has not come yet).
The risk module is suspended.
Last updated