all files / contracts/interfaces/products/ IProduct.sol

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184                                                                                                                                                                                                                                                                                                                                                                               
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
 
/**
 * @title IProduct
 * @author solace.fi
 * @notice Interface for product contracts
 */
interface IProduct {
 
    /***************************************
    EVENTS
    ***************************************/
 
    /// @notice Emitted when a policy is created.
    event PolicyCreated(uint256 indexed policyID);
    /// @notice Emitted when a policy is extended.
    event PolicyExtended(uint256 indexed policyID);
    /// @notice Emitted when a policy is canceled.
    event PolicyCanceled(uint256 indexed policyID);
    /// @notice Emitted when a policy is updated.
    event PolicyUpdated(uint256 indexed policyID);
    /// @notice Emitted when a claim is submitted.
    event ClaimSubmitted(uint256 indexed policyID);
    /// @notice Emitted when min period is set.
    event MinPeriodSet(uint40 minPeriod);
    /// @notice Emitted when max period is set.
    event MaxPeriodSet(uint40 maxPeriod);
    /// @notice Emitted when buying is paused or unpaused.
    event PauseSet(bool paused);
    /// @notice Emitted when PolicyManager is set.
    event PolicyManagerSet(address policyManager);
    /// @notice Emitted when Deposit into premium pool is made
    event DepositMade(uint256 depositAmount); 
    /// @notice Emitted when withdraw from premium pool is made
    event WithdrawMade(uint256 withdrawAmount); 
 
    /***************************************
    POLICYHOLDER FUNCTIONS
    ***************************************/
 
    /**
     * @notice Purchases and mints a policy on the behalf of the policyholder.
     * User will need to pay **USD**.
     * @param policyholder Holder of the position(s) to cover.
     * @param coverLimit The value to cover in **USD**.
     * @param blocks The length (in blocks) for policy.
     * @param positionDescription A byte encoded description of the position(s) to cover.
     * @param riskStrategy The risk strategy of the product to cover.
     * @return policyID The ID of newly created policy.
     */
    function buyPolicy(address policyholder, uint256 coverLimit, uint40 blocks, bytes memory positionDescription, address riskStrategy) external returns (uint256 policyID);
 
    /**
     * @notice Increase or decrease the cover limit of the policy.
     * User may need to pay **USD** for increased cover limit or receive a refund for decreased cover limit.
     * Can only be called by the policyholder.
     * @param policyID The ID of the policy.
     * @param newCoverLimit The new value to cover in **USD**.
     */
    function updateCoverLimit(uint256 policyID, uint256 newCoverLimit) external;
 
    /**
     * @notice Extend a policy.
     * User will need to pay **USD**.
     * Can only be called by the policyholder.
     * @param policyID The ID of the policy.
     * @param extension The length of extension in blocks.
     */
    function extendPolicy(uint256 policyID, uint40 extension) external;
 
    /**
     * @notice Extend a policy and update its cover limit.
     * User may need to pay **USD** for increased cover limit or receive a refund for decreased cover limit.
     * Can only be called by the policyholder.
     * @param policyID The ID of the policy.
     * @param newCoverLimit The new value to cover in **USD**.
     * @param extension The length of extension in blocks.
     */
    function updatePolicy(uint256 policyID, uint256 newCoverLimit, uint40 extension) external;
 
    /**
     * @notice Cancel and burn a policy.
     * User will receive a refund for the remaining blocks.
     * Can only be called by the policyholder.
     * @param policyID The ID of the policy.
     */
    function cancelPolicy(uint256 policyID) external;
 
    /***************************************
    QUOTE VIEW FUNCTIONS
    ***************************************/
 
    /**
     * @notice Calculate a premium quote for a policy.
     * @param coverLimit The value to cover in **USD**.
     * @param blocks The duration of the policy in blocks.
     * @param riskStrategy The risk strategy address.
     * @return premium The quote for their policy in **USD**.
     */
    function getQuote(uint256 coverLimit, uint40 blocks, address riskStrategy) external view returns (uint256 premium);
 
    /***************************************
    GLOBAL VIEW FUNCTIONS
    ***************************************/
 
    /** 
     * @notice Returns the minimum policy period in blocks.
     * @return period The minimum period value.
    */
    function minPeriod() external view returns (uint40);
 
    /**
     * @notice Returns the maximum policy period in blocks.
     * @return period The maxiumum period value.
    */
    function maxPeriod() external view returns (uint40);
 
    /**
     * @notice Returns the current amount covered (in wei).
     * @return amount The current amount.
    */
    function activeCoverLimit() external view returns (uint256 amount);
 
    /**
     * @notice Returns the current amount covered (in wei) per risk strategy.
     * @param riskStrategy The risk strategy address.
     * @return amount The current amount.
    */
    function activeCoverLimitPerStrategy(address riskStrategy) external view returns (uint256 amount);
 
    /**
     * @notice Returns whether or not product is currently in paused state.
     * @return status True if product is paused.
    */
    function paused() external view returns (bool status);
 
    /**
     * @notice Returns the address of the [`PolicyManager`](../PolicyManager).
     * @return policymanager The policy manager address.
    */
    function policyManager() external view returns (address policymanager);
 
    /**
     * @notice Returns the address of the [`Registry`](../Registry).
     * @return registry The registry address.
    */
    function registry() external view returns (address registry);
   
    /**
     * @notice Returns true if the given account is authorized to sign claims.
     * @param account Potential signer to query.
     * @return status True if is authorized signer.
     */
     function isAuthorizedSigner(address account) external view returns (bool status);
 
    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/
 
    /**
     * @notice Updates the product's book-keeping variables.
     * Can only be called by the [`PolicyManager`](../PolicyManager).
     * @param coverDiff The change in active cover limit.
     */
    function updateActiveCoverLimit(int256 coverDiff) external;
 
    /***************************************
    GOVERNANCE FUNCTIONS
    ***************************************/
 
    /**
     * @notice Sets the minimum number of blocks a policy can be purchased for.
     * @param minPeriod_ The minimum number of blocks.
     */
    function setMinPeriod(uint40 minPeriod_) external;
 
    /**
     * @notice Sets the maximum number of blocks a policy can be purchased for.
     * @param maxPeriod_ The maximum number of blocks
     */
    function setMaxPeriod(uint40 maxPeriod_) external;
}