YearnV3Strategy
Inherits: BaseHealthCheck
Title: YearnV3Strategy
Author: Golem Foundation
Yield-donating strategy that compounds rewards from a Yearn v3 vault
Deposits assets into a Yearn v3 vault to earn yield, which is donated via BaseHealthCheck's profit minting mechanism YIELD FLOW:
- Deposits assets into Yearn v3 vault
- Vault generates yield from its strategies
- On report, profit is minted as shares to donation address META-VAULT CONSIDERATION:
- If Yearn vault deposits into meta-vaults (e.g., Morpho → SteakHouse), maxDeposit may be inflated due to duplicate markets in supply queues
- This can cause temporary deposit DoS but doesn't affect withdrawals LOSS HANDLING:
- Accepts 100% loss on withdrawals to prevent revert cascades
- MultistrategyVault performs actual loss validation via updateDebt
Notes:
-
security-contact: [email protected]
-
security: Yearn vault convertToAssets must be manipulation-resistant
Quick Start - What Matters Most
Yearn V3 follows the .6 ERC-4626 safety pattern and uses Yearn's withdrawal maxLoss parameter internally. Review target vault liquidity and loss behavior before deployment.
State Variables
yearnVault
Address of the Yearn v3 vault this strategy deposits into
Must implement ITokenizedStrategy and use the same asset as this strategy
address public immutable yearnVault
Functions
constructor
Initializes the Yearn v3 strategy
Validates asset matches Yearn vault's asset. Approval is granted per-deposit
in _deployFunds and explicitly cleared after the Yearn vault call.
constructor(
address _yearnVault,
address _asset,
string memory _name,
string memory _symbol,
address _management,
address _keeper,
address _emergencyAdmin,
address _donationAddress,
bool _enableBurning,
address _tokenizedStrategyAddress
)
BaseHealthCheck(
_asset,
_name,
_symbol,
_management,
_keeper,
_emergencyAdmin,
_donationAddress,
_enableBurning,
_tokenizedStrategyAddress
);
Parameters
| Name | Type | Description |
|---|---|---|
_yearnVault | address | Address of the Yearn v3 vault this strategy deposits into |
_asset | address | Address of the underlying asset (must match Yearn vault's asset) |
_name | string | Strategy display name (e.g., "Octant Yearn USDC Strategy") |
_symbol | string | Strategy symbol (e.g., "osYearnUSDC") |
_management | address | Address with management permissions |
_keeper | address | Address authorized to call report() and tend() |
_emergencyAdmin | address | Address authorized for emergency shutdown |
_donationAddress | address | Address receiving minted profit shares |
_enableBurning | bool | True to enable loss protection via share burning |
_tokenizedStrategyAddress | address | Address of TokenizedStrategy implementation contract |
availableDepositLimit
Returns maximum additional assets that can be deposited
Queries Yearn vault's maxDeposit and subtracts idle balance META-VAULT WARNING: When Yearn vault points to meta-vaults (e.g., Morpho → SteakHouse), maxDeposit may be inflated if underlying vaults have duplicate markets. This can cause deposits to revert temporarily but doesn't indicate an issue.
function availableDepositLimit(
address /*_owner*/
)
public
view
override
returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | limit Maximum additional deposit amount in asset base units |
availableWithdrawLimit
Returns maximum assets withdrawable without expected loss
Sums idle balance and Yearn vault's maxWithdraw
function availableWithdrawLimit(
address /*_owner*/
)
public
view
override
returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | limit Maximum withdrawal amount in asset base units |
_deployFunds
Deposits idle assets into Yearn v3 vault
Note:
security: Approves exactly _amount and clears the allowance after
deposit, leaving no standing claim against the strategy's
idle balance even if a target vault under-pulls.
function _deployFunds(uint256 _amount) internal override;
Parameters
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Amount of assets to deploy in asset base units |
_freeFunds
Withdraws assets from Yearn v3 vault
Note:
security: Target withdraw returns shares burned, not assets received.
TokenizedStrategy._withdraw measures the post-call asset
balance and applies the caller's max-loss limit. The Yearn
call accepts 100% target-vault loss so the outer accounting
can observe and enforce the realised result.
function _freeFunds(uint256 _amount) internal override;
Parameters
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Amount of assets to withdraw in asset base units |
_emergencyWithdraw
Emergency withdrawal after strategy shutdown
Note:
security: Delegates to _freeFunds, which calls the Yearn v3 vault
with maxLoss = 10_000 BPS (100%). This preserves the
shared emergencyWithdraw(uint256) ABI; emergency admins
must assess acceptable Yearn loss off-chain before calling.
function _emergencyWithdraw(uint256 _amount) internal override;
Parameters
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Amount of assets to withdraw in asset base units |
_harvestAndReport
Reports current total assets under management
function _harvestAndReport() internal view override returns (uint256 _totalAssets);
Returns
| Name | Type | Description |
|---|---|---|
_totalAssets | uint256 | Sum of Yearn vault value and idle assets in asset base units |