View Source: contracts/interfaces/IPolicy.sol
↗ Extends: IMember ↘ Derived Contracts: Policy
IPolicy
struct PurchaseCoverArgs {
address onBehalfOf,
bytes32 coverKey,
bytes32 productKey,
uint256 coverDuration,
uint256 amountToCover,
bytes32 referralCode
}
struct CoverFeeInfoType {
uint256 fee,
uint256 utilizationRatio,
uint256 totalAvailableLiquidity,
uint256 floor,
uint256 ceiling,
uint256 rate
}
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);
- purchaseCover(struct IPolicy.PurchaseCoverArgs args)
- getCoverFeeInfo(bytes32 coverKey, bytes32 productKey, uint256 coverDuration, uint256 amountToCover)
- getCoverPoolSummary(bytes32 coverKey, bytes32 productKey)
- getCxToken(bytes32 coverKey, bytes32 productKey, uint256 coverDuration)
- getCxTokenByExpiryDate(bytes32 coverKey, bytes32 productKey, uint256 expiryDate)
- getCommitment(bytes32 coverKey, bytes32 productKey)
- getAvailableLiquidity(bytes32 coverKey)
- getExpiryDate(uint256 today, uint256 coverDuration)
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);
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);
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);
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);
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);
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);
function getAvailableLiquidity(bytes32 coverKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 |
Source Code
function getAvailableLiquidity(bytes32 coverKey) external view returns (uint256);
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);
- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundStablecoinDelegator
- FakePriceOracle
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundStablecoinDelegator
- Finalization
- ForceEther
- Governance
- GovernanceUtilV1
- IAaveV2LendingPoolLike
- IAccessControl
- IBondPool
- IClaimsProcessor
- ICompoundERC20DelegatorLike
- ICover
- ICoverReassurance
- ICoverStake
- ICxToken
- ICxTokenFactory
- IERC165
- IERC20
- IERC20Detailed
- IERC20Metadata
- IERC3156FlashBorrower
- IERC3156FlashLender
- IFinalization
- IGovernance
- ILendingStrategy
- ILiquidityEngine
- IMember
- INeptuneRouterV1
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceOracle
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockLiquidityEngineUser
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NeptuneRouterV1
- NPM
- NpmDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- POT
- PriceLibV1
- Processor
- ProtoBase
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- RegistryLibV1
- Reporter
- Resolution
- Resolvable
- RoutineInvokerLibV1
- SafeERC20
- StakingPoolBase
- StakingPoolCoreLibV1
- StakingPoolInfo
- StakingPoolLibV1
- StakingPoolReward
- StakingPools
- Store
- StoreBase
- StoreKeyUtil
- StrategyLibV1
- Strings
- TimelockController
- Unstakable
- ValidationLibV1
- Vault
- VaultBase
- VaultDelegate
- VaultDelegateBase
- VaultDelegateWithFlashLoan
- VaultFactory
- VaultFactoryLibV1
- VaultLibV1
- VaultLiquidity
- VaultStrategy
- WithFlashLoan
- WithPausability
- WithRecovery
- Witness