Skip to content

Added MorphoBlueMarket to integrate USDC ARM to Morpho markets - #329

Open
naddison36 wants to merge 11 commits into
mainfrom
nicka/morpho-blue-lending
Open

naddison36 wants to merge 11 commits into
mainfrom
nicka/morpho-blue-lending

Conversation

@naddison36

@naddison36 naddison36 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds direct Morpho Blue lending-market support for the USDC ARM.

  • Adds an ERC-4626-compatible MorphoBlueMarket wrapper around a single Morpho Blue market.
  • Uses one shared implementation with a separately configured proxy for each market.
  • Projects pending interest and protocol-fee dilution when valuing Morpho supply shares.
  • Limits withdrawals and redemptions based on available market liquidity.
  • Restricts position movement to the linked ARM.
  • Supports token-agnostic reward collection:
    • USDC rewards return to the ARM.
    • Other reward tokens are sent to the harvester.

End-to-End ARM Allocation Costs

This benchmark compares:

  • Direct Morpho Blue: MorphoBlueMarket supplies directly to one Morpho Blue market.
  • Currently deployed path: the deployed WETH ARM uses MorphoMarket to supply through the WETH ARM MetaMorpho V1.1 vault.
ARM operation Direct Morpho Blue Currently deployed path Gas saved Reduction
Allocate deposit 264,483 532,244 267,761 50.3%
Allocate withdrawal 276,788 679,828 403,040 59.3%

Morpho market gas comparison

Added isolated mainnet-fork benchmarks comparing:

  • MorphoBlueMarket, supplying directly to Morpho Blue.
  • The existing MorphoMarket path through the WETH ARM MetaMorpho V1.1 vault.

Both paths use the same underlying weETH/WETH 94.5% LLTV Morpho Blue market, so the results isolate the overhead of the MetaMorpho vault layer.

The benchmark is pinned to mainnet block 25,873,533 and measures steady-state operations with existing positions.

Results

Operation Direct Morpho Blue MetaMorpho V1.1 Direct saving
Deposit 97,448 282,913 65.6%
Withdraw 72,077 264,803 72.8%
Redeem 71,945 264,804 72.8%
convertToAssets 16,745 169,384 90.1%
maxWithdraw 22,779 187,472 87.8%
maxRedeem 22,763 188,093 87.9%
balanceOf 13,763 11,391 −20.8%

The direct integration is substantially cheaper for every operation except the simple share-balance lookup.

These figures measure the market-wrapper calls themselves. Fixed ARM allocation overhead is excluded equally from both paths.

Deployment

Adds deployment 043, which deploys and registers wrappers for:

Market Market ID
OETH/USDC 86% 0xb8fef900b383db2dbbf4458c7f46acf5b140f26d603a6d1829963f241b82510e
WBTC/USDC 86% 0x3a85e619751152991742810df6ec69ce473daef99e28a64ab2340d7b7ccfee49
cbBTC/USDC 86% 0xba3ba077d9c838696b76e29a394ae9f0d1517a372e30fd9a0fc19c516fb4c5a7
cbBTC/USDC 86% 0x64d65c9a2d91c36d56fbc42d69e979335320169b3df63bf92789e2c8883fcc64

The deployment:

  • Verifies each configured parameter set against its expected Morpho market ID.
  • Uses the 5/8 multisig as wrapper owner.
  • Uses the buyback operator as harvester.
  • Registers all four wrappers with the USDC ARM.
  • Does not activate a market automatically, allowing the operator to select one later.

Testing

Adds unit coverage for:

  • Proxy initialization and market configuration.
  • Multiple proxies sharing one implementation.
  • Deposits and complete position redemption.
  • Pending interest and protocol-fee accounting.
  • Liquidity-constrained withdrawals and redemptions.
  • ARM-only position movement.
  • Token-agnostic reward routing.
  • Harvester authorization.
  • Rejection of unknown Morpho markets.

Comment thread src/contracts/markets/MorphoBlueMarket.sol Outdated
Comment thread src/contracts/markets/MorphoBlueMarket.sol Outdated
Comment thread src/contracts/markets/MorphoBlueMarket.sol Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants