this repository is for foundry setup
- Install foundry for Linux/Mac:
curl -L https://foundry.paradigm.xyz | bash
->foundryup
; - More about installation on Windows or Docker see here
- To use this project, run:
$ forge install
- If you need to create new project, run:
$ forge-init
By default,
forge-init
will also initialize a new git repository, install some submodules and create an initial commit message. If you do not want this behavior, pass--no-git
Build the contracts:
$ forge build
Delete the build artifacts and cache directories:
$ forge clean
Compile the contracts:
$ forge build
Get a test coverage report:
$ forge coverage
Deploy to local:
$ forge script script/{ContractName}.s.sol --broadcast --fork-url http://localhost:8545
For this script to work, you need to have a
MNEMONIC
environment variable set to a valid BIP39 mnemonic.
For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.
Format the contracts:
$ forge fmt
Get a gas report:
$ forge test --gas-report
Lint the contracts:
$ pnpm lint
Run the tests:
$ forge test
To run tests on fork, add
----fork-url <your_rpc_url>
. More details here