UNPKG

@solace-fi/sdk-nightly

Version:

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

127 lines (126 loc) 7.28 kB
import { BigNumber as BN, providers, Wallet, Contract, utils, BigNumberish } from 'ethers'; import { GasConfiguration } from '../types'; export declare class SCP { chainID: number; walletOrProviderOrSigner: Wallet | providers.JsonRpcSigner | providers.Provider; scp: Contract; coverPaymentManager: Contract; constructor(chainID: number, walletOrProviderOrSigner?: Wallet | providers.JsonRpcSigner | providers.Provider); /************************************************************** METHODS - SCP EXTERNAL VIEW FUNCTION WRAPPERS **************************************************************/ /** * @returns The amount of tokens owned by `account`. */ balanceOf(account: string): Promise<BN>; /** * @returns The amount of tokens owned by account that cannot be withdrawn. */ balanceOfNonRefundable(account: string): Promise<BN>; /** * @returns Calculates the minimum amount of Solace Cover Points required by this contract for the account to hold. */ minScpRequired(account: string): Promise<BN>; /************************************************************** METHODS - COVERPAYMENTMANAGER EXTERNAL VIEW FUNCTION WRAPPERS **************************************************************/ /** * @notice Calculates the refundable `SOLACE` amount. * @param depositor The owner of funds. * @param price The `SOLACE` price in wei(usd). * @param priceDeadline The `SOLACE` price in wei(usd). * @param signature The `SOLACE` price signature. * @return solaceAmount * */ getRefundableSOLACEAmount(depositor: string, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike): Promise<BN>; /************************************************************** METHODS - COVERPAYMENTMANAGER MUTATOR FUNCTION WRAPPERS **************************************************************/ /** * @notice Deposits tokens from given address and credits them to recipient. * @param token The token to deposit. * @param from The depositor of the token. * @param recipient The recipient of Solace Cover Points. * @param amount Amount of token to deposit. */ depositStableFrom(token: string, from: string, recipient: string, amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposits tokens from msg.sender and credits them to recipient. * @param token The token to deposit. * @param recipient The recipient of Solace Cover Points. * @param amount Amount of token to deposit. */ depositStable(token: string, recipient: string, amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposits tokens from depositor using permit. * @param token The token to deposit. * @param depositor The depositor and recipient of Solace Cover Points. * @param amount Amount of token to deposit. * @param deadline Time the transaction must go through before. * @param v secp256k1 signature * @param r secp256k1 signature * @param s secp256k1 signature */ depositSignedStable(token: string, depositor: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposits tokens from depositor using permit. * @param token The token to deposit. * @param from The depositor of the token. * @param depositor The depositor and recipient of Solace Cover Points. * @param amount Amount of token to deposit. * @param deadline Time the transaction must go through before. * @param v secp256k1 signature * @param r secp256k1 signature * @param s secp256k1 signature */ depositSignedStableFrom(token: string, from: string, depositor: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposits tokens from 'from' and credits them to recipient. * @param token The token to deposit. * @param from The depositor of the token. * @param recipient The recipient of Solace Cover Points. * @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. */ depositNonStableFrom(token: string, from: string, recipient: string, amount: BigNumberish, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposits tokens from msg.sender and credits them to recipient. * @param token The token to deposit. * @param recipient The recipient of Solace Cover Points. * @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. */ depositNonStable(token: string, recipient: string, amount: BigNumberish, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraws some of 'msg.sender's deposit and sends it to `recipient`. * User must have deposited `SOLACE` in at least that amount in the past. * User must have sufficient Solace Cover Points to withdraw. * Token must be refundable. * Premium pool must have the tokens to return. * @param amount The amount of to withdraw. * @param recipient The receiver of funds. * @param price The `SOLACE` price in wei(usd). * @param priceDeadline The `SOLACE` price in wei(usd). * @param signature The `SOLACE` price signature. */ withdraw(amount: BigNumberish, recipient: string, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraws some of 'from' deposit and sends it to `recipient`. * User must have deposited `SOLACE` in at least that amount in the past. * User must have sufficient Solace Cover Points to withdraw. * Token must be refundable. * Premium pool must have the tokens to return. * @param from The SCP balance holder address. * @param amount The amount of to withdraw. * @param recipient The receiver of funds. * @param price The `SOLACE` price in wei(usd). * @param priceDeadline The `SOLACE` price in wei(usd). * @param signature The `SOLACE` price signature. */ withdrawFrom(from: string, amount: BigNumberish, recipient: string, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; }