Methods
Last updated
Last updated
With the registerStrategy method, you can register a custom strategy for Flashstaking. It takes as parameters:
_strategyAddress: your strategy’s smart contract address (see )
_principalTokenAddress: your strategy’s principal token (staked and received). For example, if your strategy is used to stake DAI, _principalTokenAddress would be the DAI stablecoin’s smart contract address.
_fTokenName: what the fToken minted when Flashstaking/staking shall be called.
_fTokenSymbol: which symbol should be given to the fToken minted when Flashstaking/staking.
Naming convention must be followed to be added to the official frontend.
The naming convention for _fTokenSymbol is a function of the principal token symbol and the first four letters of your strategy - eg fDAI-0123
The stake method creates a new stake with a registered strategy of your choosing. Its parameters are:
_strategyAddress: address of a registered strategy. You have to register the strategy with the above-described registerStrategy method first before passing its address here.
_tokenAmount: amount (in Wei) of staked tokens.
_stakeDuration: total duration (in seconds) of the stake.
_fTokensTo: the address the minted fTokens shall be sent to.
_issueNFT: mint stake as NFT upfront.
The flashStake method is similar to stake, which it calls before burning the minted fTokens for yield. Upon staking, the fTokens minted will be held by the Flash Protocol and then immediately burned with the resulting yield being redirected to _yieldTo.
The unstake method unstakes your Flashstake/stake, either partially or completely. Parameters:
_id: your stake’s ID.
_isNFT: true if your stake has been minted as an NFT; false otherwise.
_fTokenToBurn: amount of fTokens to be burnt to unstake your desired amount of principal for your stake.
This methods issues an NFT from a given stake. It can be called at anytime after the stake’s creation, if an NFT wasn’t initially minted.
It returns the NFT’s ID, which is different from the stake’s ID passed as parameter.
This method will return all the information for a given stake. The information returned is as follows:
_feeRecipient: the address the fees will go to
_feePercentageBasis: the percentage of fees to take upon fToken minting
It allows the Owner to set a global fToken mint fee up to a hardcoded maximum of 20%. This means if 1,000 fTokens are minted during the Stake process and the fee is set to 20%, the user will receive 800 fTokens.