Skip to content

C-Mierez/Foundry-Starter-Template

Repository files navigation

Foundry Starter Template

A starter template built from common needs I've encountered regularly while working with Foundry.

Features

Foundry Configuration foundry.toml

EVM Variable Keys for:

  • RPC Endpoints for Mainnet, Polygon, Arbitrum; and their respective testnets.
  • Etherscan API Keys for Mainnet, Polygon, Arbitrum; and their respective testnets.

Test Configuration:

  • Default Verbosity set to -vvv
  • Block timestamp set to 1680318000 (April 1st, 2023) instead of the unrealistic 1 default value.
  • Increased amount of runs for Fuzz and Invariant Tests to 500.

Dependencies

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

Makefile

File with different make shortcuts for commonly used and custom commands in Foundry.

Requirements

  • yarn For installing dependencies.
  • make For running command shortcuts.
  • Foundry ... 😄

Quickstart

  • 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

Scripts

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.


Acknowledgement

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 🔥

About

Personal Foundry starter template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published