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)
Note: Make sure
foundryandyarnare installed before proceeding
CI is preconfigured to:
- check formatting and linting
- build smart contracts
- run tests
- check test coverage percentage
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.