Skip to content

Latest commit

 

History

History
426 lines (359 loc) · 12.1 KB

IPolicy.md

File metadata and controls

426 lines (359 loc) · 12.1 KB

IPolicy.sol

View Source: contracts/interfaces/IPolicy.sol

↗ Extends: IMember ↘ Derived Contracts: Policy

IPolicy

Structs

PurchaseCoverArgs

struct PurchaseCoverArgs {
 address onBehalfOf,
 bytes32 coverKey,
 bytes32 productKey,
 uint256 coverDuration,
 uint256 amountToCover,
 bytes32 referralCode
}

CoverFeeInfoType

struct CoverFeeInfoType {
 uint256 fee,
 uint256 utilizationRatio,
 uint256 totalAvailableLiquidity,
 uint256 floor,
 uint256 ceiling,
 uint256 rate
}

CoverPoolSummaryType

struct CoverPoolSummaryType {
 uint256 totalAmountInPool,
 uint256 totalCommitment,
 uint256 reassuranceAmount,
 uint256 reassurancePoolWeight,
 uint256 productCount,
 uint256 leverage,
 uint256 productCapitalEfficiency
}

Events

event CoverPurchased(struct IPolicy.PurchaseCoverArgs  args, address indexed cxToken, uint256  fee, uint256  platformFee, uint256  expiresOn, uint256  policyId);

Functions

purchaseCover

Purchase cover for the specified amount.

When you purchase covers, you receive equal amount of cxTokens back. You need the cxTokens to claim the cover when resolution occurs. Each unit of cxTokens are fully redeemable at 1:1 ratio to the given stablecoins (like wxDai, DAI, USDC, or BUSD) based on the chain.

function purchaseCover(struct IPolicy.PurchaseCoverArgs args) external nonpayable
returns(address, uint256)

Arguments

Name Type Description
args struct IPolicy.PurchaseCoverArgs
Source Code
function purchaseCover(PurchaseCoverArgs calldata args) external returns (address, uint256);

getCoverFeeInfo

Gets the cover fee info for the given cover key, duration, and amount

function getCoverFeeInfo(bytes32 coverKey, bytes32 productKey, uint256 coverDuration, uint256 amountToCover) external view
returns(struct IPolicy.CoverFeeInfoType)

Arguments

Name Type Description
coverKey bytes32 Enter the cover key
productKey bytes32 Enter the product key
coverDuration uint256 Enter the number of months to cover. Accepted values: 1-3.
amountToCover uint256 Enter the amount of the stablecoin to cover.
Source Code
function getCoverFeeInfo(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 coverDuration,
    uint256 amountToCover
  ) external view returns (CoverFeeInfoType memory);

getCoverPoolSummary

Returns pool summary of the given cover key

function getCoverPoolSummary(bytes32 coverKey, bytes32 productKey) external view
returns(summary struct IPolicy.CoverPoolSummaryType)

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
Source Code
function getCoverPoolSummary(bytes32 coverKey, bytes32 productKey) external view returns (CoverPoolSummaryType memory summary);

getCxToken

function getCxToken(bytes32 coverKey, bytes32 productKey, uint256 coverDuration) external view
returns(cxToken address, expiryDate uint256)

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
coverDuration uint256
Source Code
function getCxToken(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 coverDuration
  ) external view returns (address cxToken, uint256 expiryDate);

getCxTokenByExpiryDate

function getCxTokenByExpiryDate(bytes32 coverKey, bytes32 productKey, uint256 expiryDate) external view
returns(cxToken address)

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
expiryDate uint256
Source Code
function getCxTokenByExpiryDate(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 expiryDate
  ) external view returns (address cxToken);

getCommitment

function getCommitment(bytes32 coverKey, bytes32 productKey) external view
returns(uint256)

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
Source Code
function getCommitment(bytes32 coverKey, bytes32 productKey) external view returns (uint256);

getAvailableLiquidity

function getAvailableLiquidity(bytes32 coverKey) external view
returns(uint256)

Arguments

Name Type Description
coverKey bytes32
Source Code
function getAvailableLiquidity(bytes32 coverKey) external view returns (uint256);

getExpiryDate

Gets the expiry date based on cover duration

function getExpiryDate(uint256 today, uint256 coverDuration) external pure
returns(uint256)

Arguments

Name Type Description
today uint256 Enter the current timestamp
coverDuration uint256 Enter the number of months to cover. Accepted values: 1-3.
Source Code
function getExpiryDate(uint256 today, uint256 coverDuration) external pure returns (uint256);

Contracts