Policy States

This section provides information on the data structures and processes used to manage insurance policies on the platform. It covers the PolicyData struct, which contains comprehensive policy details such as the policyholder's address, policy currency, policy ID, and other important information, as well as the PolicyStatus enum that tracks the status of each policy.

PolicyData

struct PolicyData {
  address policyholder;
  address currency;
  string policyId;
  string externalReferenceId;
  string documentHash;
  uint40 coverageStart;
  uint40 coverageEnd;
  uint40 claimRequestUntil;
  uint256 premium;
  uint256 sumInsured;
  uint256 accumulatedClaimReserveAmount;
  uint256 accumulatedClaimPaidAmount;
  uint256 redeemAmount;
  bool cancelled;
}

The PolicyData struct that defines various data related to the management of insurance policies. Here is a summary of the information included in this struct:

  • policyholder: The address of the policy holder.

  • currency: The address of the currency used for the policy.

  • policyId: A unique identifier for the policy.

  • externalReferenceId: An optional external identifier for the policy.

  • documentHash: The hash of the policy document.

  • coverageStart: The start time of the policy coverage in seconds.

  • coverageEnd: The end time of the policy coverage in seconds.

  • claimRequestUntil: The deadline for policy holders to submit claims in seconds.

  • premium: The premium amount for the policy, represented as a decimal.

  • sumInsured: The total amount of insurance coverage for the policy, represented as a decimal.

  • accumulatedClaimReserveAmount: The total amount of claims for the policy that are pending approval or rejection, represented as a decimal.

  • accumulatedClaimPaidAmount: The total amount of claims for the policy that have been approved and paid, represented as a decimal.

  • redeemAmount: The amount that the policy holder has already redeemed, represented as a decimal.

  • cancelled: A boolean flag indicating whether the policy has been cancelled. If true, the policy is no longer active.

PolicyStatus

enum PolicyStatus {
  NotInsured,
  Pending,
  Active,
  Cancelled,
  Expired
}

The PolicyStatus enum defines the possible states of an insurance policy. Here is a detailed explanation of each status:

  • NotInsured: This status is assigned to a policy if the policy ID does not exist, indicating that the policy is not insured.

  • Pending: This status is assigned to a policy if the coverage start date is in the future, meaning that the policy is pending and has not yet become active.

  • Active: This status is assigned to a policy if the coverage start date is in the past and the coverage end date is in the future, indicating that the policy is active and coverage is currently in effect.

  • Cancelled: This status is assigned to a policy if the policyholder cancels the policy by redeeming it. This typically happens before the coverage end date.

  • Expired: This status is assigned to a policy if the policyholder does not redeem the policy before the coverage end date, indicating that the policy has expired and is no longer active.

Each status is assigned based on the current state of the policy, which can be determined by checking the coverage start and end dates and whether the policy has been cancelled or redeemed.

Last updated