SignedQuoteRiskModule

This is an implementation of the RiskModule that relays fully on trusted accounts to price and resolve the policies. The pricing of the policy is done off-chain and provided as a cryptographically signed quote. This signature has to be later provided by the user creating the policy.

Roles

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

( * ) 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.

Note on risk module roles

The PRICER_ROLE is normally granted to a Service EOA (i.e., an account used by a service as opposed to a human user) that produces signed quotes for a risk partner. Given that these are services exposed to the internet, they may require regular or emergency private key rotation for security reasons.

Usually, the role admin for the PRICER_ROLE is globally changed from the DEFAULT_ADMIN_ROLE to a specific PRICER_ROLE_ADMIN role that's granted to an operational Multisig with no timelocks, or to a timelock with a lower delay.

The same applies to the role admin for RESOLVER_ROLE and POLICY_CREATOR_ROL.

External Methods

newPolicy

function newPolicy(uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, address onBehalfOf, bytes32 policyData, bytes32 quoteSignatureR, bytes32 quoteSignatureVS, uint40 quoteValidUntil) external returns (uint256)

Creates a new Policy using a signed quote. The caller is the payer of the policy.

Requirements:

  • The caller approved the spending of the premium to the PolicyPool

  • The quote has been signed by an address with the component role PRICER_ROLE

Emits:

  • {PolicyPool.NewPolicy}

  • {NewSignedPolicy}

newPolicyFull

function newPolicyFull(uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, address onBehalfOf, bytes32 policyData, bytes32 quoteSignatureR, bytes32 quoteSignatureVS, uint40 quoteValidUntil) external returns (struct Policy.PolicyData createdPolicy)

Creates a new Policy using a signed quote. The caller is the payer of the policy. Returns all the struct, not just the id.

Requirements:

  • The caller approved the spending of the premium to the PolicyPool

  • The quote has been signed by an address with the component role PRICER_ROLE

Emits:

  • {PolicyPool.NewPolicy}

  • {NewSignedPolicy}

newPolicyPaidByHolder

function newPolicyPaidByHolder(uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, address onBehalfOf, bytes32 policyData, bytes32 quoteSignatureR, bytes32 quoteSignatureVS, uint40 quoteValidUntil) external returns (uint256)

Creates a new Policy using a signed quote. The payer is the policy holder

Requirements:

  • currency().allowance(onBehalfOf, _msgSender()) > 0

  • The quote has been signed by an address with the component role PRICER_ROLE

Emits:

  • {PolicyPool.NewPolicy}

  • {NewSignedPolicy}

resolvePolicy

function resolvePolicy(struct Policy.PolicyData policy, uint256 payout) external

resolvePolicyFullPayout

function resolvePolicyFullPayout(struct Policy.PolicyData policy, bool customerWon) external

Last updated