{"id":13792964,"url":"https://github.com/PaulRBerg/foundry-template","last_synced_at":"2025-05-12T17:31:38.966Z","repository":{"id":45837736,"uuid":"509052880","full_name":"PaulRBerg/foundry-template","owner":"PaulRBerg","description":"Foundry-based template for developing Solidity smart contracts","archived":false,"fork":false,"pushed_at":"2024-09-15T14:34:08.000Z","size":2551,"stargazers_count":561,"open_issues_count":6,"forks_count":109,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-11T22:23:17.343Z","etag":null,"topics":["blockchain","ethereum","forge","foundry","smart-contracts","solidity","template"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaulRBerg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw","github":"PaulRBerg"}},"created_at":"2022-06-30T11:30:17.000Z","updated_at":"2024-11-10T11:35:15.000Z","dependencies_parsed_at":"2023-02-14T17:01:07.357Z","dependency_job_id":"2da12430-c879-4e8a-a89a-00ab8a656254","html_url":"https://github.com/PaulRBerg/foundry-template","commit_stats":{"total_commits":168,"total_committers":14,"mean_commits":12.0,"dds":"0.48809523809523814","last_synced_commit":"7368bd34d60e93241db46b0de0f6bdc42f4f1605"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Ffoundry-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Ffoundry-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Ffoundry-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Ffoundry-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulRBerg","download_url":"https://codeload.github.com/PaulRBerg/foundry-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225144934,"owners_count":17427894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","forge","foundry","smart-contracts","solidity","template"],"created_at":"2024-08-03T22:01:19.169Z","updated_at":"2025-05-12T17:31:38.945Z","avatar_url":"https://github.com/PaulRBerg.png","language":"Solidity","readme":"# Foundry Template [![Open in Gitpod][gitpod-badge]][gitpod] [![Github Actions][gha-badge]][gha] [![Foundry][foundry-badge]][foundry] [![License: MIT][license-badge]][license]\n\n[gitpod]: https://gitpod.io/#https://github.com/PaulRBerg/foundry-template\n[gitpod-badge]: https://img.shields.io/badge/Gitpod-Open%20in%20Gitpod-FFB45B?logo=gitpod\n[gha]: https://github.com/PaulRBerg/foundry-template/actions\n[gha-badge]: https://github.com/PaulRBerg/foundry-template/actions/workflows/ci.yml/badge.svg\n[foundry]: https://getfoundry.sh/\n[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg\n[license]: https://opensource.org/licenses/MIT\n[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg\n\nA Foundry-based template for developing Solidity smart contracts, with sensible defaults.\n\n## What's Inside\n\n- [Forge](https://github.com/foundry-rs/foundry/blob/master/forge): compile, test, fuzz, format, and deploy smart\n  contracts\n- [Bun]: Foundry defaults to git submodules, but this template uses Node.js packages for managing dependencies\n- [Forge Std](https://github.com/foundry-rs/forge-std): collection of helpful contracts and utilities for testing\n- [Prettier](https://github.com/prettier/prettier): code formatter for non-Solidity files\n- [Solhint](https://github.com/protofire/solhint): linter for Solidity code\n\n## Getting Started\n\nClick the [`Use this template`](https://github.com/PaulRBerg/foundry-template/generate) button at the top of the page to\ncreate a new repository with this repo as the initial state.\n\nOr, if you prefer to install the template manually:\n\n```sh\n$ forge init --template PaulRBerg/foundry-template my-project\n$ cd my-project\n$ bun install # install Solhint, Prettier, and other Node.js deps\n```\n\nIf this is your first time with Foundry, check out the\n[installation](https://github.com/foundry-rs/foundry#installation) instructions.\n\n## Features\n\nThis template builds upon the frameworks and libraries mentioned above, so please consult their respective documentation\nfor details about their specific features.\n\nFor example, if you're interested in exploring Foundry in more detail, you should look at the\n[Foundry Book](https://book.getfoundry.sh). In particular, you may be interested in reading the\n[Writing Tests](https://book.getfoundry.sh/forge/writing-tests.html) tutorial.\n\n### Sensible Defaults\n\nThis template comes with a set of sensible default configurations for you to use. These defaults can be found in the\nfollowing files:\n\n```text\n├── .editorconfig\n├── .gitignore\n├── .prettierignore\n├── .prettierrc.yml\n├── .solhint.json\n├── foundry.toml\n└── remappings.txt\n```\n\n### VSCode Integration\n\nThis template is IDE agnostic, but for the best user experience, you may want to use it in VSCode alongside Nomic\nFoundation's [Solidity extension](https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity).\n\nFor guidance on how to integrate a Foundry project in VSCode, please refer to this\n[guide](https://book.getfoundry.sh/config/vscode).\n\n### GitHub Actions\n\nThis template comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull\nrequest made to the `main` branch.\n\nYou can edit the CI script in [.github/workflows/ci.yml](./.github/workflows/ci.yml).\n\n## Installing Dependencies\n\nFoundry typically uses git submodules to manage dependencies, but this template uses Node.js packages because\n[submodules don't scale](https://twitter.com/PaulRBerg/status/1736695487057531328).\n\nThis is how to install dependencies:\n\n1. Install the dependency using your preferred package manager, e.g. `bun install dependency-name`\n   - Use this syntax to install from GitHub: `bun install github:username/repo-name`\n2. Add a remapping for the dependency in [remappings.txt](./remappings.txt), e.g.\n   `dependency-name=node_modules/dependency-name`\n\nNote that OpenZeppelin Contracts is pre-installed, so you can follow that as an example.\n\n## Writing Tests\n\nTo write a new test contract, you start by importing `Test` from `forge-std`, and then you inherit it in your test\ncontract. Forge Std comes with a pre-instantiated [cheatcodes](https://book.getfoundry.sh/cheatcodes/) environment\naccessible via the `vm` property. If you would like to view the logs in the terminal output, you can add the `-vvv` flag\nand use [console.log](https://book.getfoundry.sh/faq?highlight=console.log#how-do-i-use-consolelog).\n\nThis template comes with an example test contract [Foo.t.sol](./tests/Foo.t.sol)\n\n## Usage\n\nThis is a list of the most frequently needed commands.\n\n### Build\n\nBuild the contracts:\n\n```sh\n$ forge build\n```\n\n### Clean\n\nDelete the build artifacts and cache directories:\n\n```sh\n$ forge clean\n```\n\n### Compile\n\nCompile the contracts:\n\n```sh\n$ forge build\n```\n\n### Coverage\n\nGet a test coverage report:\n\n```sh\n$ forge coverage\n```\n\n### Deploy\n\nDeploy to Anvil:\n\n```sh\n$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545\n```\n\nFor this script to work, you need to have a `MNEMONIC` environment variable set to a valid\n[BIP39 mnemonic](https://iancoleman.io/bip39/).\n\nFor instructions on how to deploy to a testnet or mainnet, check out the\n[Solidity Scripting](https://book.getfoundry.sh/tutorials/solidity-scripting.html) tutorial.\n\n### Format\n\nFormat the contracts:\n\n```sh\n$ forge fmt\n```\n\n### Gas Usage\n\nGet a gas report:\n\n```sh\n$ forge test --gas-report\n```\n\n### Lint\n\nLint the contracts:\n\n```sh\n$ bun run lint\n```\n\n### Test\n\nRun the tests:\n\n```sh\n$ forge test\n```\n\n### Test Coverage\n\nGenerate test coverage and output result to the terminal:\n\n```sh\n$ bun run test:coverage\n```\n\n### Test Coverage Report\n\nGenerate test coverage with lcov report (you'll have to open the `./coverage/index.html` file in your browser, to do so\nsimply copy paste the path):\n\n```sh\n$ bun run test:coverage:report\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e This command requires you to have [`lcov`](https://github.com/linux-test-project/lcov) installed on your machine. On\n\u003e macOS, you can install it with Homebrew: `brew install lcov`.\n\n## Related Efforts\n\n- [foundry-rs/forge-template](https://github.com/foundry-rs/forge-template)\n- [abigger87/femplate](https://github.com/abigger87/femplate)\n- [cleanunicorn/ethereum-smartcontract-template](https://github.com/cleanunicorn/ethereum-smartcontract-template)\n- [FrankieIsLost/forge-template](https://github.com/FrankieIsLost/forge-template)\n\n## License\n\nThis project is licensed under MIT.\n","funding_links":["https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw","https://github.com/sponsors/PaulRBerg"],"categories":["Solidity","Templates \u0026 Libraries","Templates"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRBerg%2Ffoundry-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPaulRBerg%2Ffoundry-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRBerg%2Ffoundry-template/lists"}