Deploy Morpho Instance
To deploy Morpho on a new chain, follow these steps using the Morpho Blue Deployment repository.
Important: Morpho is licensed under a dual license (BUSL-1.1 and GPLv2). Before deploying a Morpho instance, please ensure you comply with the license conditions.
List of scripts:
Morpho Deployment
1. Deploy Morpho Blue
Prerequisites
-
Ensure you have
yarn
installed. -
Clone the Morpho Deployment repository.
git clone git@github.com:morpho-org/morpho-blue-deployment.git
-
Copy the example environment file:
cp .env.example .env
-
Fill the
.env
file with the correct values.
Installation
-
Run
yarn
to install dependencies:yarn
Deployment
-
Add the desired network key and its corresponding RPC URL to
foundry.toml
. -
Deploy Morpho Blue using the following command, replacing
{component}
,{network}
, and{sender}
with your specific details:yarn deploy:{component} {network} --broadcast --sender {sender}
A private key is required for the sender when deploying contracts. For secure key management options—including using a hardware wallet, environment variables, or interactive prompts, please refer to the Foundry Wallet Options documentation.
For example, to deploy on the Goerli test network using a ledger wallet:
yarn deploy:morpho goerli --broadcast --ledger --sender 0x7Ef4174aFdF4514F556439fa2822212278151Db6
If the provided network's RPC URL uses a variable environment (such as
ALCHEMY_KEY
), it should be defined in your.env
. -
Ensure that all deployments requiring an instance of Morpho have been previously deployed on the same network using:
yarn deploy:morpho {network} --broadcast
This ensures Morpho's address is saved and committed to the repository in the broadcast logs.
Broadcast run logs are to be committed to this repository for future reference.
2. Verify Contracts on Etherscan
Your
.env
should contain a validETHERSCAN_API_KEY
.
-
After deploying each contract, a verification command is automatically added to the verify script associated with the deployed component.
-
To verify all contracts deployed for a component, use:
yarn verify:{component}
For example:
yarn verify:morpho
Verify scripts are NOT to be committed to this repository because they are expected to be run only once.
3. Push the json config files
Open a Pull Request to push the ***.json files that has been created.
Oracle Factory Deployment
Follow the same tutorial as Morpho Blue Deployment, but for the oracle-factory
folder.
Morpho Vaults Deployment
Follow the same tutorial as Morpho Blue Deployment, but for the metamorpho-factory
folder.
Bundlers Deployment
Follow the same tutorial as Morpho Blue Deployment, but for the bundlers
folder.
Public Allocator Deployment
Follow the same tutorial as Morpho Blue Deployment, but for the public-allocator
folder.
URD Factory Deployment
Follow the same tutorial as Morpho Blue Deployment, but for the urd-factory
folder.