BaseYearnV3Strategy
The BaseYearnV3Strategy
the contract is another specialized implementation of the BaseStrategy
contract, specifically designed for interacting with Yearn V3 Vaults. Similar to the BaseSommelierStrategy
, it extends the functionality of the BaseStrategy
contract to handle the specific requirements of Yearn V3 Vaults.
This contract mainly aims to enable the maxAPY Protocol to invest funds in Yearn V3 Vaults and earn yield. It provides functions for depositing underlying assets into the Yearn Vault, withdrawing funds, and managing the strategy's position.
The BaseYearnV3Strategy
the contract includes additional functions specific to Yearn V3 Vaults, such as setting maximum and minimum trade amounts, calculating share values, and estimating total assets.
By integrating with Yearn V3 Vaults, the BaseYearnV3Strategy
the contract allows the MaxAPY Protocol to diversify its yield-generating strategies and provide users access to the benefits and opportunities offered by the Yearn ecosystem.
Functions
initialize()
Initializes the BaseYearnV3Strategy with the specified vault, keepers, strategy name, strategist, and Yearn V3 Vault.
Parameters:
_vault
: The address of the MaxApy Vault associated with the strategy
_keepers
: The addresses of the keepers to be added as valid keepers to the strategy
_strategyName
: The name of the strategy
_strategist
: The address of the strategist
_yVault
: The address of the Yearn V3 Vault that the strategy will interact with
setMaxSingleTrade()
Sets the maximum single trade amount allowed.
Parameters:
_maxSingleTrade
: The new maximum single trade value
setMinSingleTrade()
Sets the minimum single trade amount allowed.
Parameters:
_minSingleTrade
: The new minimum single trade value
_invest()
Invests amount
of underlying, depositing it in the Yearn Vault.
Parameters:
amount
: The amount of underlying to be deposited in the vault
minOutputAfterInvestment
: Minimum expected output after _invest()
(designated in Yearn receipt tokens)
Returns:
depositedAmount
: The amount of shares received, in terms of underlying
_divest()
Divests amount shares
from Yearn Vault.
Parameters:
shares
: The amount of shares to divest
Returns:
withdrawn
: The total amount divested, in terms of underlying asset
_shareValue()
Determines the current value of shares
.
Parameters:
shares
: The number of shares to calculate the value for
Returns:
_assets
: The estimated amount of underlying computed from the shares
_sharesForAmount()
Determines how many shares a depositor of amount
of underlying would receive.
Parameters:
amount
: The amount of underlying assets
Returns:
_shares
: The estimated amount of shares computed in exchange for the underlying amount
_shareBalance()
Returns the current strategy's amount of Yearn vault shares.
Returns:
_balance
: The strategy's balance of Yearn vault shares
_estimatedTotalAssets()
Returns the real-time estimation of the value in assets held by the strategy.
Returns:
The strategy's total assets (idle + investment positions)
Last updated