Overview
Last updated
Last updated
forge init <project_name>
creates a new directory named after your project from the default template.
also initializes a new git
repository.
forge init --template https://github.com/foundry-rs/forge-template <project_name>
You should see 3 directories:
lib -> dependencies are stored as git submodules
src -> default directory for contracts
test -> default directory for tests
You can configure where Forge looks for both dependencies and contracts using the --lib-paths
and --contracts
flags respectively. Alternatively you can configure it in foundry.toml
For automatic Hardhat support you can also pass the --hh
flag, which sets the following flags: --lib-paths node_modules --contracts contracts.
compiles project
run all tests
creates two new directories
out -> contains contract artifacts, such as the ABI
cache -> used by forge
to only recompile what is necessary