Skip to main content

mega deploy

The deploy command (also aliased as mega create) deploys a smart contract with Foundry’s forge create.

Usage

Arguments

Network options

When --rpc-url is supplied, Mega CLI checks the endpoint’s chain ID against the selected --network before deployment. This prevents accidental deployment to the wrong chain.

Common options

Mega CLI passes supported deployment options to forge create. See the Forge documentation for the underlying command.

Examples

Deploy locally

The network defaults to local. If no wallet option is provided locally, Mega CLI uses Anvil’s first development account.
The explicit equivalent is:

Deploy to MegaETH testnet

Deploy to MegaETH mainnet

Use a custom RPC

A custom RPC overrides only the endpoint. --network still determines the expected chain ID.

Deploy with constructor arguments

  • compile - Compile contracts before deployment
  • verify - Verify a testnet or mainnet deployment
  • account - Manage deployment accounts
  • balance - Check balance before deployment