issuePolicy

User begins the process by requesting an insurance quote that takes into account the risk drivers of the request. After that, the user receives a request signed by the off-chain service including the price and the Merkle proofs. The Merkle proofs help establish a trust mechanism for the off-chain and on-chain ecosystem. The user may then pass the pricing and the associated data as parameters, together with the accepted token standard, to the "Policy Manager" contract using the "Issue Policy" operation of the smart contract.

Following this, the "Policy Manager" contract will verify with the "Price Manager" contract by using Merkle proofs as a verification process. In the event that the price verification is successful, the token will be transferred from the "Policy Manager" to the "Risk Carrier Manager" in the ratio specified by the pricing parameter for the risk carrier role. The "Risk Carrier Manager" then interacts with the external service provider. Then, the claims assessor, claims validator, claims voter, and governance boards have all been compensated for their services, and the upfront fee will be distributed among them.

After all, the "Policy Manager" Contract will be updated to reflect the newly drafted policy.

The function returns a boolean value indicating whether the policy purchase was successful or not. It also emits an PolicyIssued event, which includes information about the policy that was issued.

issuePolicy

function issuePolicy( IssuePolicySignQuotedParams _ipsq_) external returns (bool)

The issuePolicy() function allows a user to issue a signed insurance policy with quoted premiums. The function takes one parameter:

  • IssuePolicySignQuotedParams: A struct that contains information about the policy being issued. This includes the policy ID, pricing reference, external reference ID, document hash, coverage start and end dates, claim expiration date, premium, sum insured, premium rate, risk carrier ratio, and other data such as the v, r, s values, and Merkle proof of the policy pricing.

The function returns a boolean value indicating whether the policy issuance was successful or not. It also emits a PolicyIssued event, which includes information about the policy that was issued.

Requirements:

  • nonReentrant The function must not be reentrant.

  • whenNotPaused The function must not be paused.

Events:

  • PolicyIssued Emitted when the policy is issued successfully.

Parameters

NameTypeDescription

ipsq

The parameters of the policy to be issued.

Return Values

NameTypeDescription

[0]

bool

True if the policy is issued successfully.

IssuePolicySignQuotedParams

struct IssuePolicySignQuotedParams {
  string policyId;
  string pricingReference;
  string externalReferenceId;
  string documentHash;
  uint40 coverageStart;
  uint40 coverageEnd;
  uint40 claimRequestUntil;
  uint256 premium;
  uint256 sumInsured;
  uint256 premiumRate;
  uint8 riskCarrierRatio;
  uint40 signatureValidUntil;
  uint8 v;
  bytes32 r;
  bytes32 s;
  bytes32[] proof;
}

The IssuePolicySignQuotedParams struct is a structure that represents the parameters required to issue a signed insurance policy with quoted premiums. The struct includes the following fields:

  • policyId: A unique identifier for the policy.

  • pricingReference: The reference used for pricing the policy.

  • externalReferenceId: An external identifier for the policy.

  • documentHash: The hash of the policy document.

  • coverageStart: The start time of the coverage period.

  • coverageEnd: The end time of the coverage period.

  • claimRequestUntil: The time until which the policy holder can request a claim.

  • premium: The premium amount of the policy.

  • sumInsured: The sum insured amount of the policy.

  • premiumRate: The premium rate of the policy.

  • riskCarrierRatio: The ratio of risk that will be transferred to the risk carrier for this policy, with a maximum value of 100.

  • signatureValidUntil: The date until which the verifier's signature is valid.

  • v: The v value from the signed message that is used for signature verification.

  • r: The r value from the signed message that is used for signature verification.

  • s: The s value from the signed message that is used for signature verification.

PolicyIssued

event PolicyIssued(
        address policyholder,
        string policyId,
        uint40 coverageStart,
        uint40 coverageEnd,
        uint40 claimclaimRequestUntil,
        uint256 sumInsured
    )

The PolicyIssued event is triggered when a new insurance policy is issued. The event includes the following parameters:

  • policyholder: The address of the user who is buying the policy.

  • policyId: The unique identifier for the policy.

  • coverageStart: The timestamp at which the policy's coverage begins.

  • coverageEnd: The timestamp at which the policy's coverage ends.

  • claimRequestUntil: The timestamp at which the policy's claims request cannot be filed.

  • sumInsured: The amount of coverage provided by the policy.

Last updated