🍭Contract Design

Overview of the vault and strategy implementation

  1. deposit - A user deposits stablecoins into the vault and receives back tokenised shares of the vault representing their share of the vault.

  2. harvest - Only a Manager may call this function. This is the function that puts funds to work, determines profit/loss of the strategy and distributes funds to the buffer position, short position and long position. It also handles vault updates and protocol fee collection.

  3. remargin - Only a Manager may call this function. It first completes a harvest. Then runs some calculations to determine what assets must be swapped in order to return the buffer position to the correct amount and to return the leverage of the margin account to 1. This is a risk management function and keeps the strategy safe from liquidation risk.

  4. withdraw - A user deposits their shares of the vault, which are then burnt and the user is returned stablecoins according to the value of the shares of the vault at the point of withdrawal. Withdrawals involve selling off strategy positions so that withdrawals from the vault can happen freely.

  5. unwind - Only a Manager may call this function. It first completes a harvest. Then it will convert all longPositions to the stable asset, close all short positions and withdraw all funds from the margin account back to the strategy. This is a risk management function and keeps the strategy safe from prolonged negative funding rates and liquidation risk.

  6. setParameters (Manager) - Only a Manager may call these functions. These functions set various parameters in the strategy.

  7. emergencyExit - Only a Manager may call this function. It first completes an unwind. Then all funds are transferred to the governance multisig. This is a risk management function and protects funds from extreme conditions such as an exploit risk.

  8. setParameters(Governance) - Only Governance may call these functions. These functions set various parameters in the vault and strategy.

Last updated