Skip to main content

For AI agents: the complete documentation index is at llms.txt. Markdown versions of pages are available by appending .md to the URL or sending Accept: text/markdown.

MorphoBlueSupplyVault

MorphoBlueSupplyVault

Minimal ERC-4626 wrapper over a single Morpho Blue supply-side position.

_One deployment per market. Deposits are supplied to Morpho; withdrawals pull directly to the receiver. Supply-only — no borrow or collateral positions.

Market parameters are stored as individual immutables rather than a storage struct so that every Morpho call avoids five SLOADs when copying them into memory._

MORPHO

contract IMorpho MORPHO

Morpho Blue singleton

MARKET_ID

Id MARKET_ID

Market id derived from the market parameters at construction

LOAN_TOKEN

address LOAN_TOKEN

Loan token of the Morpho market (= ERC-4626 underlying asset)

COLLATERAL_TOKEN

address COLLATERAL_TOKEN

Collateral token of the Morpho market

ORACLE

address ORACLE

Price oracle of the Morpho market

IRM

address IRM

Interest rate model of the Morpho market

LLTV

uint256 LLTV

Liquidation loan-to-value ratio of the Morpho market (scaled by 1e18)

constructor

constructor(address morpho_, struct MarketParams marketParams_, string name_, string symbol_) public

Constructor

Parameters

NameTypeDescription
morpho_addressMorpho Blue singleton
marketParams_struct MarketParamsMarket parameters (loanToken, collateralToken, oracle, irm, lltv)
name_stringERC-20 name for vault shares
symbol_stringERC-20 symbol for vault shares

totalAssets

function totalAssets() public view returns (uint256)

maxWithdraw

function maxWithdraw(address owner) public view returns (uint256)

Caps the owner's withdrawable assets by Morpho market liquidity so this function never returns a value that would cause withdraw() to revert, as required by ERC-4626.

maxRedeem

function maxRedeem(address owner) public view returns (uint256)

Computed directly in shares to avoid the double floor rounding that would occur if derived from maxWithdraw: convertToShares(convertToAssets(shares)) can return shares - 1.

_deposit

function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal

Supplies assets to Morpho and mints shares to receiver.

Parameters

NameTypeDescription
calleraddressAddress that initiated the deposit
receiveraddressAddress that receives the vault shares
assetsuint256Amount of loanToken to supply
sharesuint256Amount of vault shares to mint

_withdraw

function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares) internal

Burns shares from owner and withdraws assets from Morpho directly to receiver.

Parameters

NameTypeDescription
calleraddressAddress that initiated the withdrawal
receiveraddressAddress that receives the loanToken
owneraddressAddress whose shares are burned
assetsuint256Amount of loanToken to withdraw from Morpho
sharesuint256Amount of vault shares to burn