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
foundry
andyarn
are 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-name
Note: OpenZeppelin Contracts is pre-installed. You can follow its example for other dependencies.
Build smart contracts:
yarn build
Clean build artifacts and cache :
yarn clean
Generate test coverage:
yarn coverage
Format files:
yarn fmt
Lint files:
yarn lint
Run tests:
yarn test
This 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.