Template for Solidity projects with a suite of useful tools pre-installed.
- foundry: compiles, tests and deploys Solidity smart contracts
- yarn: manages project dependencies
- prettier: formats non-Solidity files
- solhint-community: lints Solidity smart contracts
- husky: runs git hooks
- lint-staged: lints only staged files (in hooks)
- codecov: coverage report and enforcing
Note: Make sure
foundryandyarnare installed before proceeding
CI is preconfigured to:
- check formatting and linting
- build smart contracts
- run tests
- check test coverage percentage and upload report to codecov
Note: You need to set a
CODECOV_TOKENrepository secret that holds your access token, see Codecov docs explaining how to generate and set your token
While Foundry typically uses Git submodules to manage dependencies, this template opts for Node.js packages for better scalability.
To install dependencies:
- Install an npm dependency:
yarn add dependency-name- Install a GitHub dependency:
yarn add github:username/repo-name#tag-branch-or-hash- Add the dependency to remappings.txt:
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
forge-std/=node_modules/forge-std/src/
dependency-name=node_modules/dependency-nameNote: OpenZeppelin Contracts is pre-installed. You can follow its example for other dependencies.
Build smart contracts:
yarn buildClean build artifacts and cache :
yarn cleanGenerate test coverage:
yarn coverageFormat files:
yarn fmtLint files:
yarn lintRun tests:
yarn testThis template is inspired by the following repositories:
- https://github.com/PaulRBerg/foundry-template
- https://github.com/OpenZeppelin/openzeppelin-contracts
- https://github.com/zkemail/email-recovery
This project is licensed under MIT.