Using Foundry
Foundry is a smart contract development toolchain.
Follow the Foundry documentation for general installation and overview.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: local Ethereum node, akin to Ganache, Hardhat Network.
Compile your Gnosis Contract
Compile your contract with this command:
forge build
Additional compilation options can be found here.
Deploy your Contract
Forge can only deploy one contract at a time.
Because Solidity files may contain multiple contracts, :<YourContract>
(Seen below) specifies which contract to deploy.
Deploy your contract on Gnosis with the following Forge command:
- Chiado Testnet
- Gnosis Mainnet
forge create --rpc-url https://rpc.chiadochain.net --private-key <your_private_key> src/<YourContract>.sol:<YourContract>
forge create --rpc-url https://rpc.gnosischain.com --private-key <your_private_key> src/<YourContract>.sol:<YourContract>
Deploy with constructor arguments:
Use the --constructor-args
flag to pass arguments to the constructor:
- Chiado Testnet
- Gnosis Mainnet
forge create --rpc-url https://rpc.chiadochain.net \
--constructor-args <argument-1> <argument-2...>\
--private-key <your_private_key> src/<YourToken>.sol:<YourToken> \
forge create --rpc-url https://rpc.gnosischain.com \
--constructor-args <argument-1> <argument-2...>\
--private-key <your_private_key> src/<YourToken>.sol:<YourToken> \
Verify your Contract
Verify your Gnosis contract on deployment using Etherscan:
Use the --verify
flag as shown below:
- Chiado Testnet
- Gnosis Mainnet
forge create --rpc-url https://rpc.chiadochain.net \
--private-key <your_private_key> src/<YourToken>.sol:<YourToken> \
--etherscan-api-key <your_etherscan_api_key> \
--verify
forge create --rpc-url https://rpc.gnosischain.com \
--private-key <your_private_key> src/<YourToken>.sol:<YourToken> \
--etherscan-api-key <your_etherscan_api_key> \
--verify
For information regarding pre-existing contract verification, visit the official Forge documentation.
For further Contract Verification information, visit our official page