SignedBucketRiskModule

This RiskModule implementation supports a more flexible pricing scheme by setting arbitrary pricing buckets. It has a base set of parameters, similar to other riskmodules, but also allows different sets of parameters for each policy.

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

IMPORTANT: See Note on risk module roles

External Methods

newPolicy

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

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,
    uint256 bucketId,
    bytes32 quoteSignatureR,
    bytes32 quoteSignatureVS,
    uint40 quoteValidUntil
)

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,
    uint256 bucketId,
    bytes32 quoteSignatureR,
    bytes32 quoteSignatureVS,
    uint40 quoteValidUntil
)

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

Resolves a policy with a given payout. Requires RESOLVER_ROLE.

resolvePolicyFullPayout

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

setBucketParams

function setBucketParams(uint256 bucketId, struct Params params_)

Sets the parameters for a risk bucket.

deleteBucket

Deletes a pricing bucket.

Last updated