Ensuro Docs
  • Introduction
    • General Questions
    • Risk Management
  • Liquidity Providers
    • FAQ - Liquidity Providers
    • Onboarding process
  • Risk Partners
    • FAQ - Risk Partners
    • Onboarding process
    • Flow
  • Deployments
  • Audits
  • Smart Contracts
    • Architecture
    • Roles and permissions
    • Governance
    • Policy Lifecycle
    • Policies
    • Liquidity pools
    • Premiums Accounts
    • Reserves
    • Asset Management
    • Contracts
      • PolicyPool
      • EToken
      • RiskModule
        • TrustfulRiskModule
        • SignedQuoteRiskModule
        • SignedBucketRiskModule
        • FlightDelayRiskModule
        • PriceRiskModule
      • PremiumsAccount
      • AccessManager
      • IAssetManager
        • LiquidityThresholdAssetManager
        • ERC4626AssetManager
        • AAVEv3AssetManager
      • ILPWhitelist
        • LPManualWhitelist
      • Extensions
        • ERC4626CashFlowLender
        • ETokensBundleVault
        • MultiStrategyERC4626
  • Offchain APIs
    • Introduction
    • Callback notifications
    • API Reference
      • Pricing API
      • Offchain API
  • Frontend
    • Security and Monitoring
  • Legal & Compliance
    • Trust & Security in Ensuro's Ecosystem
  • Ensuro Risk Disclosures
  • Fees & Charges
  • Specific Responsibilities and Expectations of Retail Investors
  • Confirmation of Acceptance of Participation Agreement and Token Holder Terms & Conditions
  • Ensuro Terms of Service
  • Restricted Jurisdictions
  • Participation Agreement for Token Holders
  • Ensuro Anti-Money Laundering & Anti-Terrorism Financing Policy Statement
  • Privacy Policy
  • Ensuro Data Protection Policy
  • Cybersecurity Guide for Ensuro Protocol Investors
  • Tax Guide for Ensuro Protocol Investors
Powered by GitBook
On this page
  • Roles
  • External Methods
  • newPolicy
  • newPolicyFull
  • newPolicyPaidByHolder
  • resolvePolicy
  • resolvePolicyFullPayout
  • setBucketParams
  • deleteBucket
  1. Smart Contracts
  2. Contracts
  3. RiskModule

SignedBucketRiskModule

PreviousSignedQuoteRiskModuleNextFlightDelayRiskModule

Last updated 1 year ago

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 . 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:

Role
Global*
Description
Methods Accessible

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

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}

Name
Type
Description

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

Name
Type
Description

[0]

uint256

Returns the id of the created policy

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}

Name
Type
Description

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

Name
Type
Description

createdPolicy

struct Policy.PolicyData

Returns the created policy

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}

Name
Type
Description

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

Name
Type
Description

[0]

uint256

Returns the id of the created policy

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.

Name
Type
Description

bucketId

uint256

The id of the pricing bucket to be set.

params_

struct Params

deleteBucket

Deletes a pricing bucket.

Name
Type
Description

bucketId

uint256

The id of the pricing bucket to be deleted.

: Sets the parameters for a risk bucket.

: Deletes a risk bucket.

: Sets the parameters for a risk bucket.

: Deletes a risk bucket.

: Resolves a policy.

: Creates a policy.

: Creates a new policy.

: Creates a new policy.

: Creates a policy.

: Creates a new policy.

: Creates a new policy.

The parameters of the new bucket. See

setBucketParams
deleteBucket
setBucketParams
deleteBucket
resolvePolicy
newPolicy
newPolicyFull
newPolicyPaidByHolder
newPolicy
newPolicyFull
newPolicyPaidByHolder
cryptographically signed quote
Note on risk module roles
Parameters