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:
LEVEL1_ROLE
High impact changes like upgrades or other critical operations.
LEVEL2_ROLE
Mid-impact changes like changing some parameters.
RESOLVER_ROLE
Resolves policies.
POLICY_CREATOR_ROLE
Creates new policies.
PRICER_ROLE
Prices 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
IMPORTANT: See Note on risk module roles
External Methods
newPolicy
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}
payout
uint256
The exposure (maximum payout) of the policy
premium
uint256
The premium that will be paid by the payer
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
policyData
bytes32
A hash of the private details of the policy. The last 96 bits will be used as internalId
bucketId
uint256
Identifies the group to which the policy belongs (that defines the RM parameters applicable to it)
quoteSignatureR
bytes32
The signature of the quote. R component (EIP-2098 signature)
quoteSignatureVS
bytes32
The signature of the quote. VS component (EIP-2098 signature)
quoteValidUntil
uint40
The expiration of the quote
[0]
uint256
Returns the id of the created policy
newPolicyFull
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}
payout
uint256
The exposure (maximum payout) of the policy
premium
uint256
The premium that will be paid by the payer
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
policyData
bytes32
A hash of the private details of the policy. The last 96 bits will be used as internalId
bucketId
uint256
Identifies the group to which the policy belongs (that defines the RM parameters applicable to it)
quoteSignatureR
bytes32
The signature of the quote. R component (EIP-2098 signature)
quoteSignatureVS
bytes32
The signature of the quote. VS component (EIP-2098 signature)
quoteValidUntil
uint40
The expiration of the quote
createdPolicy
struct Policy.PolicyData
Returns the created policy
newPolicyPaidByHolder
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}
payout
uint256
The exposure (maximum payout) of the policy
premium
uint256
The premium that will be paid by the payer
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
policyData
bytes32
A hash of the private details of the policy. The last 96 bits will be used as internalId
bucketId
uint256
Identifies the group to which the policy belongs (that defines the RM parameters applicable to it)
quoteSignatureR
bytes32
The signature of the quote. R component (EIP-2098 signature)
quoteSignatureVS
bytes32
The signature of the quote. VS component (EIP-2098 signature)
quoteValidUntil
uint40
The expiration of the quote
[0]
uint256
Returns the id of the created policy
resolvePolicy
Resolves a policy with a given payout. Requires RESOLVER_ROLE.
resolvePolicyFullPayout
setBucketParams
Sets the parameters for a risk bucket.
bucketId
uint256
The id of the pricing bucket to be set.
params_
struct Params
deleteBucket
Deletes a pricing bucket.
bucketId
uint256
The id of the pricing bucket to be deleted.
Last updated