UNPKG

@solace-fi/sdk-nightly

Version:

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

184 lines (183 loc) 9.64 kB
import { BigNumber as BN, Contract, providers, Wallet, utils, BigNumberish } from "ethers"; import { GasConfiguration } from "../types"; export declare class Staker { /************** PROPERTIES **************/ chainID: number; walletOrProviderOrSigner: Wallet | providers.JsonRpcSigner | providers.Provider; stakingRewards: Contract; xsLocker: Contract; /************** 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/) */ constructor(chainID: number, walletOrProviderOrSigner?: Wallet | providers.JsonRpcSigner | providers.Provider); /********************************** xsLocker Mutator Functions **********************************/ /** * Deposit SOLACE to create a new lock, assumes SOLACE already approved * @param recipient The account that will receive the lock. * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit. * @param end The timestamp the lock will unlock, use end = 0 to initialize as unlocked */ createLock(recipient: string, amount: BigNumberish, end: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * Deposit SOLACE to create a new lock, uses EIP-712 signature to perform approval in same transaction * @dev recipient = msg.sender * @param amount The amount of [**SOLACE**](./../SOLACE) to deposit. * @param end The timestamp the lock will unlock, use end = 0 to initialize as unlocked * @param deadline Time the transaction must go through before. * @param v secp256k1 signature * @param r secp256k1 signature * @param s secp256k1 signature */ createLockSigned(amount: BigNumberish, end: BigNumberish, deadline: BigNumberish, v: utils.BytesLike, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposit SOLACE to increase the value of an existing lock. * @dev SOLACE is transferred from msg.sender, assumes its already approved. * @param xsLockID The ID of the lock to update. * @param amount The amount of SOLACE to deposit. */ increaseAmount(xsLockID: BigNumberish, amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Deposit SOLACE to increase the value of an existing lock. * @dev SOLACE is transferred from msg.sender, uses EIP-712 signature to perform approval in same transaction * @param xsLockID The ID of the lock to update. * @param amount The amount of SOLACE to deposit. * @param deadline Time the transaction must go through before. * @param v secp256k1 signature * @param r secp256k1 signature * @param s secp256k1 signature */ increaseAmountSigned(xsLockID: BigNumberish, amount: BigNumberish, deadline: BigNumberish, v: utils.BytesLike, r: utils.BytesLike, s: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Extend a lock's duration. * @dev Can only be called by the lock owner or approved. * @param xsLockID The ID of the lock to update. * @param end The new time for the lock to unlock. */ extendLock(xsLockID: BigNumberish, end: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraw from a lock in full. * @dev Can only be called by the lock owner or approved. * @dev Can only be called if unlocked. * @param xsLockID The ID of the lock to withdraw from. * @param recipient The user to receive the lock's SOLACE. */ withdraw(xsLockID: BigNumberish, recipient: string, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraw from a lock in part. * @dev Can only be called by the lock owner or approved. * @dev Can only be called if unlocked. * @param xsLockID The ID of the lock to withdraw from. * @param recipient The user to receive the lock's SOLACE. * @param amount The amount of SOLACE to withdraw. */ withdrawInPart(xsLockID: BigNumberish, recipient: string, amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraw from a multiple locks in full. * @dev Can only be called by the lock owner or approved. * @dev Can only be called if unlocked. * @param xsLockIDs The ID of the locks to withdraw from. * @param recipient The user to receive the lock's SOLACE. */ withdrawMany(xsLockIDs: BigNumberish[], recipient: string, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /********************************** xsLocker View Functions **********************************/ /** * @notice Information about a lock. * @param xsLockID The ID of the lock to query. * @return lock_ Information about the lock. */ locks(xsLockID: BigNumberish): Promise<any>; /** * @notice Returns whether a lock is locked. * @param xsLockID The ID of the lock to query. * @return locked True if the lock is locked, false if unlocked. */ isLocked(xsLockID: BigNumberish): Promise<boolean>; /** * @notice Determines the time left until the lock unlocks. * @param xsLockID The ID of the lock to query. * @return time The time left in seconds, 0 if unlocked. */ timeLeft(xsLockID: BigNumberish): Promise<BN>; /** * @notice Returns the amount of [**SOLACE**](./../SOLACE) the user has staked. * @param account The account to query. * @return balance The user's balance. */ stakedBalance(account: string): Promise<BN>; /********************************** StakingRewards Mutator Functions **********************************/ /** * @notice Updates and sends a lock's rewards. * @param xsLockID The ID of the lock to process rewards for. */ harvestLock(xsLockID: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Updates and sends a lock's rewards. * @param xsLockID The ID of the lock to process rewards for. */ harvestLocks(xsLockIDs: BigNumberish[], gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraws a lock's rewards and deposits it back into the lock. * Can only be called by the owner of the lock. * @param xsLockID The ID of the lock to compound. */ compoundLock(xsLockID: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Withdraws multiple lock's rewards and deposits it into lock. * Can only be called by the owner of the locks. * @param xsLockIDs The ID of the locks to compound. * @param increasedLockID The ID of the lock to deposit into. */ compoundLocks(xsLockIDs: BigNumberish[], increasedLockID: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /********************************** StakingRewardsV2 Mutator Functions **********************************/ /** * @notice Updates and sends a lock's rewards. * @param xsLockID The ID of the lock to process rewards for. * @param price The `SOLACE` price in wei(usd). * @param priceDeadline Expiry timestamp for price quote. * @param signature The `SOLACE` price signature. */ harvestLockForScp(xsLockID: BigNumberish, price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Updates and sends multiple lock's rewards. * @param xsLockIDs The IDs of the locks to process rewards for. * @param price The `SOLACE` price in wei(usd). * @param priceDeadline The `SOLACE` price in wei(usd). * @param signature The `SOLACE` price signature. */ harvestLocksForScp(xsLockIDs: BigNumberish[], price: BigNumberish, priceDeadline: BigNumberish, signature: utils.BytesLike, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /** * @notice Adds a one time boost to rewards. * Paid in [**SOLACE**](./../../SOLACE) by `msg.sender`. * @param amount Amount of rewards to distribute. */ postRewards(amount: BigNumberish, gasConfig?: GasConfiguration): Promise<providers.TransactionResponse>; /********************************** StakingRewards View Functions **********************************/ /** * @notice Information about each lock. * @param xsLockID The ID of the lock to query. * @return StakedLockInfo */ stakedLockInfo(xsLockID: BigNumberish): Promise<any>; /** * @notice Calculates the accumulated balance of [**SOLACE**](./../SOLACE) for specified lock. * @param xsLockID The ID of the lock to query rewards for. * @return reward Total amount of withdrawable reward tokens. */ pendingRewardsOfLock(xsLockID: BigNumberish): Promise<BN>; }