Staking
A staking vault allowing owners of an ERC721 or ERC4907 collection to stake their NFTs and earn ERC20 tokens distributed based on the length of the lock up.
Getting Started Module Methods Smart Contract Methods
Getting Started
To begin we'll import the FrostySDK, chain configurations, and the Staking module.
Then we'll setup our signer (via wagmi/ethers) and create a new instance of the FrostySDK.
Module Methods
deploy Deploy a minimal proxy clone of the Staking implementation contract.
getContract Get an ethers contract instance of a previously deployed Staking contract.
deploy
Deploy a minimal proxy clone of the Staking implementation contract.
sdk (SDK) An instance of the FrostySDK, configured with a chain and signer.
nft (string) The address of the ERC721 that will be locked for staking rewards.
token (string) The address of the ERC20 token that will be earned by staking ERC721 tokens.
vaultDuration (number) The duration in days over which staking rewards may be earned.
totalSupply (number) The total supply of the ERC721 collection that may earn staking rewards.
onTxPending (Function) - optional A callback function executed upon submission of the deploy transaction.
onTxReceipt (Function) - optional A callback function executed upon receipt of the deploy transaction.
getContract
Get an ethers contract instance of a previously deployed Staking contract.
sdk (SDK) An instance of the FrostySDK, configured with a chain and signer.
address (string) The contract address of a previously deployed Rentable contract.
Smart Contract Methods
stake Allows owners of the ERC721 collection to lock up their tokens for staking rewards.
claim Allows owners of the ERC721 collection to claim and withdraw earned staking rewards.
claimForAddress Distributes staking rewards on behalf of a specified account address.
unstake Allows owners to claim earned staking rewards and unstake their tokens.
earningInfo Returns the current staking rewards for the specified account address and tokens.
balanceOf Returns the number of tokens staked by the specified account address.
tokensOfOwner Returns the tokens currently staked by the specified account address.
stake
Allows owners of the ERC721 collection to lock up their tokens for staking rewards.
tokenIds (uint256[]) An array of tokens to lock in the staking vault.
claim
Allows owners of the ERC721 collection to claim and withdraw earned staking rewards.
tokenIds (uint256[]) An array of tokens to claim staked earning rewards against.
claimForAddress
Distributes staking rewards on behalf of a specified account address.
account (address) The address of the account to claim on behalf of.
tokenIds (uint256[]) An array of tokens to claim staked earning rewards against.
unstake
Allows owners to claim earned staking rewards and unstake their tokens.
tokenIds (uint256[]) An array of tokens to unstake and retreive from the staking vault.
earningInfo
Returns the current staking rewards for the specified account address and tokens.
account (address) The address of the account to check for earned staking rewards.
tokenIds (uint256[]) An array of tokens to check for earned staking rewards.
balanceOf
Returns the number of tokens staked by the specified account address.
account (address) The address of the account to check for total number of staked tokens.
tokensOfOwner
Returns the tokens currently staked by the specified account address.
account (address) The address of the account to check for total number of staked tokens.
Last updated