Commands
deploy
Deploy smart contracts to local network or Mega testnet
mega deploy
The deploy
command (also aliased as mega create
) deploys smart contracts to either a local development network or the Mega testnet.
Usage
Arguments
Argument | Description |
---|---|
contract | Path to the contract file and contract name (e.g., src/MyContract.sol:MyContract ) |
Options
Option | Description |
---|---|
--testnet | Deploy to Mega testnet instead of local network |
--broadcast | Broadcast the transaction instead of doing a dry run |
--constructor-args [args...] | The constructor arguments |
--verify | Verify contract after creation |
--account <name> | Use a keystore account from the default keystores folder |
--private-key <key> | Use the provided private key |
--gas-limit <limit> | Gas limit for the transaction |
--value <value> | Ether to send in the transaction |
--optimize | Activate the Solidity optimizer when deploying |
This command supports all options available in forge create
. See the
Forge documentation for a complete list.
Description
This command deploys Solidity smart contracts to a blockchain network. By default, it deploys to a local Anvil network, but you can use the --testnet
flag to deploy to the Mega testnet.
The command is a wrapper around Foundry’s forge create
with additional features specific to the Mega ecosystem.
Examples
Deploy to local network (dry run)
Deploy to local network and broadcast the transaction
Deploy to Mega testnet using a stored account
Deploy to Mega testnet using a private key
Deploy with constructor arguments
Related
Was this page helpful?