Components:
forge
: CLI tool to tests, builds, and deploys your smart contracts.cast
: to interact with the EVM chain & performing Ethereum RPC callsanvil
: to run a local node like Truffle's Ganache, Hardhat localnode.chisel
: REPL for Solidity. It allows to open a console and interact with the EVM chain (simulated) like$ npx hardhat console
Following are the steps:
- Install
foundryup
❯ curl -L https://foundry.paradigm.xyz | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1765 100 1765 0 0 2236 0 --:--:-- --:--:-- --:--:-- 2236
Installing foundryup...
######################################################################## 100.0%
Detected your preferred shell is zsh and added foundryup to PATH. Run 'source /Users/abhi3700/.zshrc' or start a new terminal session to use foundryup.
Then, simply run 'foundryup' to install Foundry.
- Install
foundryup
tools:forge
,cast
andanvil
,chisel
❯ foundryup
foundryup: installing foundry (version nightly, tag nightly-92f8951409034fd597ad08a386474af8d2d8868a)
foundryup: downloading latest forge, cast and anvil
######################################################################### 100.0%
foundryup: downloading manpages
######################################################################### 100.0%
foundryup: installed - forge 0.2.0 (92f8951 2022-08-06T00:05:51.433929Z)
foundryup: installed - cast 0.2.0 (92f8951 2022-08-06T00:05:51.433929Z)
foundryup: installed - anvil 0.1.0 (92f8951 2022-08-06T00:05:51.822342Z)
foundryup: done
- Update tools (if already installed)
❯ foundryup
foundryup: installing foundry (version nightly, tag nightly-4a0c8dc4bb068839def6d230ebc38e0354fe7112)
foundryup: downloading latest forge, cast, anvil, and chisel
######################################################################### 100.0%
foundryup: downloading manpages
######################################################################### 100.0%
foundryup: installed - forge 0.2.0 (4a0c8dc 2023-04-15T00:04:40.457382000Z)
foundryup: installed - cast 0.2.0 (4a0c8dc 2023-04-15T00:04:40.457382000Z)
foundryup: installed - anvil 0.1.0 (4a0c8dc 2023-04-15T00:04:41.416294000Z)
foundryup: installed - chisel 0.1.1 (4a0c8dc 2023-04-15T00:04:41.578991000Z)
foundryup: done
CLI command autocompletions:
forge completions zsh > /usr/local/share/zsh/site-functions/_forge
cast completions zsh > /usr/local/share/zsh/site-functions/_cast
anvil completions zsh > /usr/local/share/zsh/site-functions/_anvil
Use tab to view the next option.
Use VSCode
Additionally, set the contracts
folder as src/
& package dependencies as lib/
for Foundry.
Format the Solidity files using $ forge fmt
.
Refer this
I have maintained the work here.