MorphoVaultV1AdapterFactory
Factory contract for deployingMorphoVaultV1Adapter instances. This factory enables VaultV2 contracts to wrap MetaMorpho (Morpho Vault V1) positions as adapters.
Overview
TheMorphoVaultV1AdapterFactory uses CREATE2 deployment with a fixed salt (bytes32(0)) to create deterministic adapter addresses. It tracks deployed adapters using a two-dimensional mapping structure that indexes by both parent vault and the underlying MetaMorpho vault.
State variables
Nested mapping that returns the adapter address for a given parent vault and MetaMorpho vault combination. Returns
address(0) if no adapter exists.Usage: morphoVaultV1Adapter[parentVault][morphoVaultV1]Returns
true if an address is a MorphoVaultV1Adapter deployed by this factory.Functions
createMorphoVaultV1Adapter
MorphoVaultV1Adapter that connects a parent VaultV2 to an underlying MetaMorpho vault.
The VaultV2 address that will use this adapter
The MetaMorpho (Vault V1) address to wrap
The address of the newly deployed adapter
Each combination of parent vault and MetaMorpho vault can only have one adapter. Attempting to create a duplicate will revert during deployment.
Events
CreateMorphoVaultV1Adapter
Usage example
Use cases
Fee wrapper vaults
The most common use case is creating “fee wrapper” vaults that add a fee layer on top of existing MetaMorpho vaults:Related contracts
- MorphoVaultV1Adapter - The adapter contract this factory deploys
- VaultV2 - Parent vault that uses these adapters
- FeeWrapperDeployer - Example deployer using this factory