Vaults contain the logic for interacting with yield-farming strategies on Backd. Each liquidity pool uses it’s own vault.
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 Backd 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 not taken into account when getting a vault’s total underlying.