MorphoCompounderStrategy
Inherits: BaseHealthCheck
Title: MorphoCompounderStrategy
Author: Golem Foundation
Yield-donating strategy that compounds rewards from a Morpho vault
Deposits assets into a Morpho compounder vault (e.g., Morpho Steakhouse) to earn yield YIELD FLOW:
- Deposits assets into Morpho compounder vault
- Vault compounds yield automatically via Morpho markets
- On report, profit is minted as shares to donation address META-VAULT INFLATION ISSUE:
- When compounderVault is a meta-vault (e.g., Morpho → SteakHouse), maxDeposit chains through multiple vaults
- If underlying vaults have duplicate markets in supply queues, maxDeposit may overstate actual capacity
- This can cause deposits to temporarily revert but is not a critical issue LOSS HANDLING:
- Accepts 100% loss on withdrawals to prevent revert cascades
- MultistrategyVault enforces actual loss limits via updateDebt
Notes:
-
security-contact: [email protected]
-
security: Morpho vault convertToAssets must be manipulation-resistant
Quick Start - What Matters Most
Morpho's compounder adapter follows the .6 ERC-4626 safety pattern: exact approvals, zero-share minted protection, previewRedeem accounting, and preserving type(uint256).max capacity sentinels.
State Variables
compounderVault
Address of the Morpho compounder vault this strategy deposits into
Must implement ITokenizedStrategy and use the same asset as this strategy
address public immutable compounderVault
Functions
constructor
Initializes the Morpho compounder strategy
Validates asset matches Morpho vault's asset. Approval is issued per-deposit inside _deployFunds and explicitly cleared after the compounder vault call, so no standing allowance against the external (upgradeable) compounder vault exists between calls.
constructor(
address _compounderVault,
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 |
|---|---|---|
_compounderVault | address | Address of the Morpho compounder vault to deposit into |
_asset | address | Address of the underlying asset (must match compounder vault's asset) |
_name | string | Strategy display name (e.g., "Octant Morpho USDC Strategy") |
_symbol | string | Strategy symbol (e.g., "osMorphoUSDC") |
_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 compounder vault's maxDeposit and subtracts idle balance META-VAULT INFLATION: When compounderVault is Morpho Steakhouse or similar meta-vault, maxDeposit may be inflated if underlying SteakHouse USDC has duplicate markets in its supplyQueue. Deposits may temporarily revert.
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 compounder 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 Morpho compounder vault
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 Morpho compounder 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.
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
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 compounder vault value and idle assets in asset base units |