forge-create - Deploy a smart contract.
forge create
[options] contract
Deploy a smart contract.
The path to the contract is in the format <path>:<contract>
, e.g. src/Contract.sol:Contract
.
You can specify constructor arguments with --constructor-args
. Alternatively, you can specify a file
containing space-separated constructor arguments with --constructor-args-path
.
Dynamic linking is not supported: you should predeploy your libraries and manually specify their addresses (see --libraries
).
ℹ️ Note
The
--constructor-args
flag must be positioned last in the command, since it takes multiple values.
--constructor-args
args...
The constructor arguments.
--constructor-args-path
file
The path to a file containing the constructor arguments.
--verify
Verify contract after creation. Runs forge verify-contract
with the appropriate parameters.
{{#include ../common/verifier-options.md}}
--unlocked
Send via eth_sendTransaction
using the --from
argument or $ETH_FROM
as sender.
{{#include ../common/transaction-options.md}}
{{#include ../common/wallet-options.md}}
{{#include ../common/rpc-options.md}}
{{#include ../common/etherscan-options.md}}
{{#include core-build-options.md}}
{{#include ../common/display-options.md}}
{{#include common-options.md}}
-
Deploy a contract with no constructor arguments:
forge create src/Contract.sol:ContractWithNoConstructor
-
Deploy a contract with two constructor arguments:
forge create src/Contract.sol:MyToken --constructor-args "My Token" "MT"