UNPKG

@solace-fi/sdk-nightly

Version:

Note - Unstable nightly build, documentation not up-to-date for nightly build

112 lines (111 loc) 5.38 kB
import { BigNumber as BN, providers, Wallet, Contract, utils, BigNumberish } from 'ethers'; import { GasConfiguration } from '../types'; export declare class CoverageV3 { chainID: number; walletOrProviderOrSigner: Wallet | providers.JsonRpcSigner | providers.Provider; solaceCoverProduct: Contract; constructor(chainID: number, walletOrProviderOrSigner?: Wallet | providers.JsonRpcSigner | providers.Provider); /***************************************************************** METHODS - SOLACECOVERPRODUCTV3 EXTERNAL MUTATOR FUNCTION WRAPPERS *****************************************************************/ /** * @notice Purchases policy for provided `_user`. * @param _user The policy owner. * @param _coverLimit The maximum value to cover in **USD**. * @param _token The token to deposit. * @param _amount Amount of token to deposit. * @return policyID The ID of the newly minted policy. */ purchaseWithStable(_user: string, _coverLimit: BigNumberish, _token: string, _amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Purchases policy for the user. * @param _user The policy owner. * @param _coverLimit The maximum value to cover in **USD**. * @param _token The token to deposit. * @param _amount Amount of token to deposit. * @param _price The `SOLACE` price in wei(usd). * @param _priceDeadline The `SOLACE` price in wei(usd). * @param _signature The `SOLACE` price signature. * @return policyID The ID of the newly minted policy. */ purchaseWithNonStable(_user: string, _coverLimit: BigNumberish, _token: string, _amount: BigNumberish, _price: BigNumberish, _priceDeadline: BigNumberish, _signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Activates policy for provided _user. * @param _users Array of intended policy owners. * @param _coverLimits Array of intended maximum values to cover in **USD**. * @return policyID The ID of the newly minted policy. */ purchase(_user: string, _coverLimit: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Cancels the policy for `policyholder`. * @param _premium The premium amount to verify. * @param _deadline The deadline for the signature. * @param _signature The premium data signature. */ cancel(_premium: BigNumberish, _deadline: BigNumberish, _signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /************************************************************** METHODS - SOLACECOVERPRODUCTV3 EXTERNAL VIEW FUNCTION WRAPPERS **************************************************************/ /** * @returns The active cover limit in **USD** to 18 decimal places. In other words, the total cover that has been sold at the current time. */ activeCoverLimit(): Promise<BN>; /** * @returns The amount of available remaining capacity for new cover. */ availableCoverCapacity(): Promise<BN>; /** * @returns The maximum amount of cover that can be sold in **USD** to 18 decimals places. */ maxCover(): Promise<BN>; /** * @param policyID The policy ID. * @returns True if policy is active. False if policy is inactive, or does not exist. */ policyStatus(policyID: BigNumberish): Promise<boolean>; /** * @param coverLimit Cover limit. * @returns The minimum required account balance for a given cover limit. Equals the maximum chargeable fee for one epoch. */ minRequiredAccountBalance(coverLimit: BN): Promise<BN>; /** * @notice Calculates the minimum amount of Solace Cover Dollars required by this contract for the account to hold. * @param policyholder The account to query. * @return amount The amount of SCD the account must hold. */ minScpRequired(policyholder: string): Promise<BN>; /** * @notice Returns the Uniform Resource Identifier (URI) for `policyID`. * @param policyID The policy ID. */ tokenURI(policyID: BigNumberish): Promise<string>; /********************************************** METHODS - SOLACECOVERPRODUCTV3 GETTER FUNCTION **********************************************/ /** * @returns true if paused, false otherwise */ paused(): Promise<boolean>; /** * @returns The total supply of policies (amount of policies that have been purchased, includes inactive policies). */ totalSupply(): Promise<BN>; /** * @returns Maximum epoch duration over which premiums are charged (Default is one week). */ chargeCycle(): Promise<BN>; /** * @returns The latest premium charged timestamp. */ latestChargedTime(): Promise<BN>; /** * @param policyID The policy ID. * @returns The cover limit for the given policy ID. */ coverLimitOf(policyID: BigNumberish): Promise<BN>; /** * @param policyholder The policyholder address. * @returns policyID The policy ID. */ policyOf(policyholder: string): Promise<BN>; }