Vault Smart Contract
A bera's gotta keep the goods secure.
The Vault is a Bera’s interface with the Autocompounder. It is where Beras deposit and withdraw their crypto.
Vault smart contracts expose two functions:
function deposit(uint256 _amount) external;
function withdraw(uint256 _shares) external;
When deposit
is called, the following will happen: _amount
of tokens is transferred from the caller to the Vault smart contract. An appropriate amount of _shares
will be given to the caller. _shares
is how the Vault keeps track of how much of the deposited token belongs to each Bera. Vault will transfer the deposited tokens to the Strategy smart contract to be staked.
When withdraw
is called, the following will happen:
_shares
are removed from the caller.The appropriate amount of tokens, based on
_shares
, will be transferred from the Vault to the caller.Tokens may be transferred from the Strategy if there are not enough funds in the Vault to cover the withdrawal.
Last updated