Component: Strategies
Different strategies offer distinct approaches to managing assets and generating yields. They all inherit from the StrategyBase contract, which implements the basic functionality of a strategy. The basic implemented functions include managing the reward token and configuring the fee settings as well as fundamental interactions when a vault deposits to the strategy, withdraws from the strategy, or harvests rewards, and so on. Each strategy can overwrite functions _protocolDeposit
and _protocolWithdraw
to implement specific ways of handling the asset during deposits and withdrawals. However, there are some nongeneric functions that must be implemented by each individual strategy, such as the following:
_totalAssets
— This function allows each strategy to implement its own custom logic for retrieving the total amount of underlying assets based on its implementation._handleRewardsOnWithdraw
— This function is called during a withdrawal operation to accrue rewards before executing the function_protocolWithdraw
._getRewardsToStrategy
— This function is used to collect rewards into the strategy.
AaveV3Strategy
This strategy earns yield through the Aave V3 protocol. It supplies the deposited assets to the Aave liquidity pool, and it retrieves the assets from the pool on withdrawal. Rewards can be collected by calling the function claimAllRewards
on the aaveIncentives
.
MorphoVaultStrategy
This strategy earns yield through the Morpho Vaults. It forwards deposits to a Morpho Vault and retrieves them on withdrawal.
If the isBackgroundSwapEnabled
is true, then the underlying asset of the Morpho Vault is not the underlying asset of the strategy. So, before depositing into the Morpho Vault, the underlying asset being deposited will be swapped into the Morpho Vault's underlying asset via Uniswap V3. And the Morpho Vault's underlying asset will be swapped back into the strategy's underlying asset during withdrawal.
The function _getRewardsToStrategy
can claim rewards from Morpho Universal Rewards Distributor contracts with the vault's owner-provided data. And if the isAutoCompoundingEnabled
is true and the morphoRewardToken
balance of the strategy is not less than the minRewardAmountForCompounding
, the morphoRewardToken
will be swapped into the strategy's underlying asset, and then these assets will be deposited into the Morpho Vault via the function _protocolDeposit
. The function _handleRewardsOnWithdraw
of this strategy cannot claim rewards; it will only compound rewards if the isAutoCompoundingEnabled
is true.
MultiSigStrategy
This strategy simply forwards deposits to a multi-sig wallet and retrieves them on withdrawal. It does not generate any rewards. If the withdrawEnabled
is true, withdrawals are not allowed from this strategy.
The owner can rescue any assets held by this strategy, including the underlying asset.