Skip to main content

MorphoCompounderStrategy

Git Source

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:

  1. Deposits assets into Morpho compounder vault
  2. Vault compounds yield automatically via Morpho markets
  3. 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

NameTypeDescription
_compounderVaultaddressAddress of the Morpho compounder vault to deposit into
_assetaddressAddress of the underlying asset (must match compounder vault's asset)
_namestringStrategy display name (e.g., "Octant Morpho USDC Strategy")
_symbolstringStrategy symbol (e.g., "osMorphoUSDC")
_managementaddressAddress with management permissions
_keeperaddressAddress authorized to call report() and tend()
_emergencyAdminaddressAddress authorized for emergency shutdown
_donationAddressaddressAddress receiving minted profit shares
_enableBurningboolTrue to enable loss protection via share burning
_tokenizedStrategyAddressaddressAddress 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

NameTypeDescription
<none>uint256limit 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

NameTypeDescription
<none>uint256limit Maximum withdrawal amount in asset base units

_deployFunds

Deposits idle assets into Morpho compounder vault

function _deployFunds(uint256 _amount) internal override;

Parameters

NameTypeDescription
_amountuint256Amount 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

NameTypeDescription
_amountuint256Amount of assets to withdraw in asset base units

_emergencyWithdraw

Emergency withdrawal after strategy shutdown

function _emergencyWithdraw(uint256 _amount) internal override;

Parameters

NameTypeDescription
_amountuint256Amount of assets to withdraw in asset base units

_harvestAndReport

Reports current total assets under management

function _harvestAndReport() internal view override returns (uint256 _totalAssets);

Returns

NameTypeDescription
_totalAssetsuint256Sum of compounder vault value and idle assets in asset base units