Vault¶
Overview¶
Vaults contain the logic for interacting with yield-farming strategies on Mero. Each liquidity pool uses it’s own vault.
Vaults are single strategy vaults, i.e. only one strategy can be active per vault. The vault is responsible for harvesting strategy profits, as well as withdraw strategy funds should the strategy exceed the allowed debt limit.
Vaults do not need to be interacted with by anyone apart from the vault’s liquidity pool and the admin. Funds can only ever be withdrawn from the vault to the liquidity pool.
A vault tracks how much of the underlying has been allocated to a vault-specific strategy. When the harvest()
method is called, profits and losses are accounted for by the vault. In case a profit was made, the profit is taxed through the performanceFee()
. This fee is subsequently split between the following:
strategist
: The strategist of the current strategy. This share is paid in the respective pool’s LP tokens which are minted on behalf of the strategist.reserve
: The vault’s reserve. This is an emergency reserve fund that is drawn upon in case a loss has been made and the debt limit is exceeded.treasury
: Receiver of the remaining performance fee. This is paid out to Mero governance token holders.
In case a loss was made, the vault updates the strategy’s total debt. In case the total debt exceeds the debt limit of the vault, the vault will check if the reserve holds sufficient funds to cover the debt. If the reserve does not hold enough funds to cover the debt, the allocated funds will be withdrawn from the strategy and the strategy will be deactivated, such that no more funds will be allocated to it unless it is reactivated.
The exchange rate of a pool’s LP token is dependent on the total underlying of the pool’s vault, which is obtained through the getTotalUnderlying()
method. Note that unharvested profits are note taken into account when getting a vault’s total underlying.