- Foundry
- Rust/Cargo
- Yarn
- Linux / MacOS / WSL 2
Initialize
yarn
Make a copy of .env.example
to .env
and set the desired parameters. This file is git ignored.
Build and Test.
yarn build
yarn test
Test a specific file
yarn test --match-path test/MyTest.t.sol
This will run each deploy the script MyScript.s.sol
inside script/
folder.
yarn deploy --network <network-name> --script <my-script-name>
yarn deploy:resume
can be used if some contracts failed at deployment or verification process
forge install <git repo name><@optionnal_tag_or_commit_hash>
yarn remappings
Update .vscode/settings.json
to add the lib to git.ignoredRepositories
list
forge update lib/<package>
Note: If pushing from vscode git, the updated libs might need to be removed from the
git.ignoredRepositories
list to be able to stage.
This will update to the latest Foundry release
foundryup
Playground is a place to make quick tests. Everything that could be inside a normal test can be used there. Use case can be to test out some gas optimisation, decoding some data, play around with solidity, etc.
yarn playground
Use deployments/MyContract.json to get the information needed for the verification
forge verify-contract --chain-id 1 --num-of-optimizations 200 --watch --constructor-args $(cast abi-encode "constructor(address,address[])" "<address>" "[<address>,address]") --compiler-version v0.8.16+commit.07a7930e <contract-address> src/MyContract.sol:MyContract -e <etherscan-api-key>
yarn task verify --deployment Avalanche_ElevatedMinterBurner_Mock --network avalanche --artifact src/periphery/ElevatedMinterBurner.sol:ElevatedMinterBurner
Where Avalanche_ElevatedMinterBurner_Mock
is the deployment json file inside deployments/
and src/periphery/ElevatedMinterBurner.sol:ElevatedMinterBurner
the <contract-path>:<contract-name>
artifact.
yarn task forge-deploy-multichain --script Create3Factory --broadcast --verify all
yarn task forge-deploy-multichain --script Create3Factory --broadcast --no-confirm --verify mainnet polygon avalanche