-
Notifications
You must be signed in to change notification settings - Fork 48
Commands
This is a list of the most frequently needed commands.
Build the contracts using the default profile:
$ forge build
Build the contracts using the optimized profile:
$ bun build:optimized
This will compile the contracts with the --via-ir
flag enabled.
Build the contracts with the SMTChecker enabled, while ignoring any warnings due to the use of assembly blocks:
$ bun build:smt
This will attempt to formally prove the correctness of the contracts by trying to break invariants (e.g. by finding
failing assert
statements).
Delete the build artifacts and cache directories:
$ forge clean
Format the code:
$ forge fmt
Get a gas report:
$ bun gas:report
Get a gas report for the optimized version of the contracts:
$ bun gas:report:optimized
Take a gas snapshot:
$ bun gas:snapshot
Take a gas snapshot against the optimized version of the contracts:
$ bun gas:snapshot:optimized
Lint the entire code base (Solidity + other files):
$ bun lint
Lint the contracts:
$ bun lint:sol
Run the tests:
$ bun test
Run the tests against the optimized version of the contracts:
$ bun test:optimized
There are many other commands available in Foundry. Check out the Foundry Book!