A starter template built from common needs I've encountered regularly while working with Foundry.
- RPC Endpoints for Mainnet, Polygon, Arbitrum; and their respective testnets.
- Etherscan API Keys for Mainnet, Polygon, Arbitrum; and their respective testnets.
- Default Verbosity set to
-vvv
- Block timestamp set to
1680318000
(April 1st, 2023) instead of the unrealistic1
default value. - Increased amount of runs for Fuzz and Invariant Tests to
500
.
Subdirectory | Remapping |
---|---|
Openzeppelin Contracts | @openzeppelin |
Solmate | @solmate |
Foundry-DevOps | @foundry-devops |
PRB-Test | @prb/test |
Package | Files |
---|---|
Prettier | .prettierrc .prettierignore |
Solhint | .solhint.json |
Slither | slither.config.json |
File with different make
shortcuts for commonly used and custom commands in Foundry.
-
Clone this template
forge init --template C-Mierez/Foundry-Starter-Template
or
forge init my-project --template C-Mierez/Foundry-Starter-Template
-
Install packages (Prettier, Solhint, ...)
yarn
-
Create a
.env
file and populate as per.env.example
-
Run tests
forge test
Run scripts locally with
forge script script/Counter.s.sol
Or in a network with
forge script script/Counter.s.sol --rpc-url ${GOERLI_RPC_URL} --private-key ${PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY} -vvv
👀 Shortcuts for scripts can be added to the
Makefile
for convenience.
This template is built from my own personal needs and from repos I've encountered, but its structure is heavily influenced by both foundry-starter-kit from SmartContractKit 🔥 and foundry-template from PaulRBerg 🔥