@solace-fi/sdk-nightly
Version:
Note - Unstable nightly build, documentation not up-to-date for nightly build
164 lines (163 loc) • 9.67 kB
TypeScript
import { BigNumber as BN, Contract, providers, Wallet, utils, BigNumberish } from "ethers";
import { BondTellerType, GasConfiguration } from "../types";
export declare class Bonder {
/**************
PROPERTIES
**************/
chainID: number;
walletOrProviderOrSigner: Wallet | providers.JsonRpcSigner | providers.Provider;
bondTellerContract: Contract;
bondTellerType: BondTellerType;
/**************
CONSTRUCTOR
**************/
/**
* @param chainID The chainID for the Staker object, 1 for Ethereum Mainnet.
* @param walletOrProviderOrSigner walletOrProviderOrSigner object - a Wallet (https://docs.ethers.io/v5/api/signer/#Wallet) or a Provider (https://docs.ethers.io/v5/api/providers/) or Signer (https://docs.ethers.io/v5/api/signer/)
* @param bondTellerContractAddress string
*/
constructor(chainID: number, bondTellerContractAddress: string, walletOrProviderOrSigner?: Wallet | providers.JsonRpcSigner | providers.Provider);
/**************
MUTATING HELPER FUNCTIONS
**************/
depositNative(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
depositWrappedNative(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/********************************
Common BondTeller View Functions
********************************/
/**
* @notice Calculate the current price of a bond. Assumes 1 SOLACE payout.
* @return price_ The price of the bond measured in principal.
*/
bondPrice(): Promise<BN>;
/**
* @notice Calculate the amount of SOLACE out for an amount of principal.
* @param amountIn Amount of principal to deposit.
* @param stake True to stake, false to not stake.
* @return amountOut Amount of SOLACE out.
*/
calculateAmountOut(amountIn: BigNumberish, stake: boolean): Promise<BN>;
/**
* @notice Calculate the amount of SOLACE out for an amount of principal.
* @param amountOut Amount of SOLACE out.
* @param stake True to stake, false to not stake.
* @return amountIn Amount of principal to deposit.
*/
calculateAmountIn(amountOut: BigNumberish, stake: boolean): Promise<BN>;
/***********************************
Common BondTeller Mutator Functions
***********************************/
/**
* @notice Claim payout for a bond that the user holds.
* @dev User calling `claimPayout()` must be either the owner or approved for the entered bondID.
* @param bondID The ID of the bond to redeem.
*/
claimPayout(bondID: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/*********************************
BondTellerErc20 Mutator Functions
*********************************/
/**
* @notice Create a bond by depositing amount of principal. Principal will be transferred from msg.sender using allowance.
* @param deposit Amount of principal to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
deposit(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount of principal. Principal will be transferred from depositor using permit.
* @dev Note that not all ERC20s have a permit function, in which case this function will revert.
* @param deposit Amount of principal to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
* @param deadline Time the transaction must go through before.
* @param v secp256k1 signature
* @param r secp256k1 signature
* @param s secp256k1 signature
*/
depositSigned(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, deadline: BigNumberish, v: utils.BytesLike, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/*********************************
BondTellerEth Mutator Functions
*********************************/
/**
* @notice Create a bond by depositing ETH.
* @param deposit Amount of ETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositEth(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount of WETH. WETH will be transferred from msg.sender using allowance.
* @param deposit Amount of WETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositWeth(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount of WETH. WETH will be transferred from depositor using permit.
* @dev Note that not all WETHs have a permit function, in which case this function will revert.
* @param deposit Amount of WETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
* @param deadline Time the transaction must go through before.
* @param v secp256k1 signature
* @param r secp256k1 signature
* @param s secp256k1 signature
*/
depositWethSigned(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, deadline: BigNumberish, v: utils.BytesLike, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/*********************************
BondTellerMatic Mutator Functions
*********************************/
/**
* @notice Create a bond by depositing MATIC.
* @param deposit Amount of MATIC to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositMatic(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount wMATIC. wMATIC will be transferred from msg.sender using allowance.
* @param deposit Amount of WETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositWmatic(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount wMATIC. wMATIC will be transferred from depositor using permit.
* @dev Note that not all wMATICs have a permit function, in which case this function will revert.
* @param deposit Amount of WETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
* @param deadline Time the transaction must go through before.
* @param v secp256k1 signature
* @param r secp256k1 signature
* @param s secp256k1 signature
*/
depositWmaticSigned(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, deadline: BigNumberish, v: utils.BytesLike, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/*********************************
BondTellerFtm Mutator Functions
*********************************/
/**
* @notice Create a bond by depositing FTM.
* @param deposit Amount of FTM to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositFtm(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
/**
* @notice Create a bond by depositing amount wFTM. wFTM will be transferred from msg.sender using allowance.
* @param deposit Amount of WETH to deposit.
* @param minAmountOut The minimum SOLACE out.
* @param depositor The bond recipient, default msg.sender.
* @param stake True to stake, false to not stake.
*/
depositWftm(deposit: BigNumberish, minAmountOut: BigNumberish, depositor: string, stake: boolean, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>;
}