Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Migrate from MorphoVaultV1Adapter to MorphoMarketV1AdapterV2

Overview

This guide describes the standard deprecation flow for replacing a Vault V2's MorphoVaultV1Adapter with a MorphoMarketV1AdapterV2, giving the vault direct access to Morpho Variable Rate Markets instead of routing through a Morpho Vault V1.

The migration combines two standard curation workflows:

  1. List the new MorphoMarketV1AdapterV2 and its target markets, see (De)List Adapters and (De)List Markets.
  2. Delist the old MorphoVaultV1Adapter.

Migration Flow

1. Deploy and Add the MorphoMarketV1AdapterV2

If the Vault V2 does not already have a MorphoMarketV1AdapterV2, deploy one through the MorphoMarketV1AdapterV2Factory:

factory.createMorphoMarketV1AdapterV2(vaultV2Address)

Then enable it on the vault. This is a timelocked action:

  1. As Curator, call submit(abi.encodeCall(IVaultV2.addAdapter, (adapterAddress))).
  2. After the timelock expires, call addAdapter(adapterAddress).

See (De)List Adapters: via Etherscan for the full walkthrough, or use the Curator App V2 for a guided flow.

Outcome: The Vault V2 now has a live MorphoMarketV1AdapterV2 available for allocations.

2. Set Caps for the New Adapter and Target Markets

Before allocating assets, set the caps required by the new setup. Morpho Vault V2 enforces a three-layer cap hierarchy. All three must be non-zero for the vault to allocate to a given market:

  1. Adapter cap: ceiling for the whole MorphoMarketV1AdapterV2.
  2. Collateral token cap: ceiling across all markets sharing the same collateral asset.
  3. Market cap: ceiling for each specific MarketParams tuple.

Cap increases are timelocked: submit first via submit(bytes), then execute after the timelock elapses. All cap proposals can be batched and accepted together once the timelock passes.

Via the Curator App V2 (recommended)

On the Caps tab:

  • Click "Edit Caps" to set the adapter absolute and relative caps.
  • Click "Add collateral" to set collateral token caps for each collateral used by the target markets.
  • Click "Add market" to set market caps for each target market.
  • Use the "Timelocks" button to batch-accept all caps once the timelock has passed.

Via Etherscan

Submit and execute cap increases for each layer:

// Adapter cap
bytes memory adapterIdData = abi.encode("this", adapterAddress);
vault.submit(abi.encodeCall(IVaultV2.increaseAbsoluteCap, (adapterIdData, capAmount)));
vault.submit(abi.encodeCall(IVaultV2.increaseRelativeCap, (adapterIdData, relativeCapWad)));
 
// Collateral token cap (for each collateral)
bytes memory collateralIdData = abi.encode("collateralToken", collateralTokenAddress);
vault.submit(abi.encodeCall(IVaultV2.increaseAbsoluteCap, (collateralIdData, capAmount)));
vault.submit(abi.encodeCall(IVaultV2.increaseRelativeCap, (collateralIdData, relativeCapWad)));
 
// Market cap (for each market)
bytes memory marketIdData = abi.encode("this/marketParams", adapterAddress, marketParams);
vault.submit(abi.encodeCall(IVaultV2.increaseAbsoluteCap, (marketIdData, capAmount)));
vault.submit(abi.encodeCall(IVaultV2.increaseRelativeCap, (marketIdData, relativeCapWad)));

After the timelock, execute each function directly, for example:

vault.increaseAbsoluteCap(idData, capAmount);

See (De)List Markets for the full cap-setting walkthrough.

Outcome: The Vault V2 is allowed to allocate into the selected markets through the new adapter.

3. Allocate into the Target Markets

Once caps are accepted, the Allocator directs the vault's idle assets into the target Morpho Variable Rate Markets through the new adapter:

bytes memory data = abi.encode(marketParams);
vault.allocate(marketAdapterAddress, data, amount);

If one of these markets is intended to become the vault's liquidity market (see Step 5), seed it with enough assets before switching the liquidity adapter.

Outcome: The new MorphoMarketV1AdapterV2 holds live positions for the Vault V2.

4. Deallocate from the Old MorphoVaultV1Adapter

The Allocator (or Sentinel) calls deallocate to withdraw assets from the old MorphoVaultV1Adapter back to the vault's idle pool:

vault.deallocate(oldVaultV1Adapter, bytes(""), assets);

If full withdrawal is not immediately possible because the underlying Vault V1 is illiquid, deallocate progressively as liquidity becomes available. Set up monitoring to deallocate as assets become available.

In parallel, continue allocating into the target markets under the new MorphoMarketV1AdapterV2.

Outcome: Assets are migrated from the old adapter into the new market adapter setup.

5. Switch the Liquidity Adapter

If the old MorphoVaultV1Adapter is currently set as the vault's liquidityAdapter, switch to the new MorphoMarketV1AdapterV2 only after the intended liquidity market is funded enough to handle deposits and withdrawals.

As Allocator, call:

bytes memory liquidityData = abi.encode(marketParams);
vault.setLiquidityAdapterAndData(marketAdapterAddress, liquidityData);

Where marketParams identifies the specific Morpho Variable Rate Market that will receive deposits and serve withdrawals. See Liquidity Curation with MarketV1AdapterV2 for details on how the liquidity adapter works and best practices for dynamic reallocation.

Outcome: Deposits and withdrawals are routed through the new market adapter.

6. Delist the Old MorphoVaultV1Adapter

Once the old adapter is empty and no longer set as the liquidity adapter, follow the standard adapter soft deprecation flow.

Step 1: Set Caps to Zero

The Curator or Sentinel decreases the adapter's caps to zero. This is instant and the cap decreases are exempt from timelocks:

bytes memory adapterIdData = abi.encode("this", oldVaultV1Adapter);
vault.decreaseAbsoluteCap(adapterIdData, 0);
vault.decreaseRelativeCap(adapterIdData, 0);

Step 2: Remove the Adapter (Optional)

Once the adapter's allocation is zero and its caps are zero, the Curator can submit removeAdapter to delist it from the vault. This is a timelocked action:

vault.submit(abi.encodeCall(IVaultV2.removeAdapter, (oldVaultV1Adapter)));
 
// After timelock expires
vault.removeAdapter(oldVaultV1Adapter);

Outcome: The migration is complete and the old MorphoVaultV1Adapter is deprecated.

Checklist

  • Identify target Variable Rate Markets and their collateral tokens.
  • Deploy MorphoMarketV1AdapterV2 from factory, if needed.
  • Add the adapter and set adapter caps, collateral caps, and market caps (timelocked).
  • Allocate into target markets and seed the liquidity market if switching the liquidity adapter.
  • Deallocate from the old MorphoVaultV1Adapter, progressively if needed.
  • Switch the liquidity adapter to MorphoMarketV1AdapterV2 and verify the old adapter allocation is zero.
  • Zero out old MorphoVaultV1Adapter caps and remove the old MorphoVaultV1Adapter.

Operational Notes

  • Cap increases and adapter additions are timelocked.
  • Cap decreases are instant and can be executed by the Sentinel.
  • Deallocation from the old MorphoVaultV1Adapter may require multiple transactions if the underlying Vault V1 is illiquid.
  • The old adapter should only be removed after its allocation is zero, the liquidity adapter has been switched if relevant, and the new market adapter is fully operational.
  • See Liquidity Curation for best practices on running a reallocation bot and configuring forceDeallocatePenalty.