Comment on page
Time Vault Interface
On a technical level, a Time Vault consists of a smart contract inheriting the Time Vault interface. It uses one or more DeFi protocols (e.g. AAVE, Convex, etc) to stake a specific token (e.g. DAI, ETH, etc). The Flash Protocol uses the strategy to instantly mint TBTs when staking.
In accordance with the Flashstake Protocol, all strategies utilized must adhere to the Time Vault Interface as defined.
Time Vaults can be created, deployed, and registered by any individual or entity, resulting in varying code sources. The source code for Time Vaults developed by the Flashstake DAO can be accessed by navigating to the corresponding Time Vault on the sidebar.
function depositPrincipal(uint256 _tokenAmount) external returns (uint256);
This function will be called whenever a user stakes via the Flashstake Protocol. The Time Vault owner can choose to implement a fee but the resulting “locked” principal the user should expect after the stake has ended must be returned.
This function should be protected such that only the Flashstake Protocol can execute this. This is to ensure users do not accidentally call this function and lose their funds.
function withdrawPrincipal(uint256 _tokenAmount) external;
This function should withdraw principal from the underlying strategy (eg AAVE).
This function should be protected such that only the Flash Protocol can execute this. Keeping this unprotected would of course mean anyone would withdraw principal tokens from your strategy.
) external returns (uint256);
function getPrincipalBalance() external view returns (uint256);
This must return the current total of all principal accepted by the contract.
function getYieldBalance() external view returns (uint256);
This function must report the total yield balance.
function getPrincipalAddress() external view returns (address);
This must return the principal token address (eg DAI).
function quoteMintFToken(uint256 _tokenAmount, uint256 duration) external view returns (uint256);
This function will be called by the Flash Protocol (and frontends) to determine how many fTokens should be minted for a given _tokenAmount and _duration (in seconds).
function quoteBurnFToken(uint256 _tokenAmount) external view returns (uint256);
This function must return the yield a user should expect when burning _tokenAmount fTokens.
function setFTokenAddress(address _fTokenAddress) external;
The function to set the fERC20 address within the strategy.
This function should be protected such that only the Flash Protocol can execute this.
function getMaxStakeDuration() external view returns (uint256);
This function must report the maximum duration a user can stake for. This can either be hardcoded or be a function of on-chain metrics.
event BurnedFToken(address indexed _address, uint256 _tokenAmount, uint256 _yieldReturned);
- _address: the address of the user who burned fTokens.
- _tokenAmount: the number of fTokens burned.
- _yieldReturned: the number of yield tokens returned to the user.