Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foundry-rs/forge-template
Forkable template to get you started with Foundry's Forge
https://github.com/foundry-rs/forge-template
Last synced: 2 days ago
JSON representation
Forkable template to get you started with Foundry's Forge
- Host: GitHub
- URL: https://github.com/foundry-rs/forge-template
- Owner: foundry-rs
- License: unlicense
- Created: 2021-09-04T08:32:57.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T21:57:19.000Z (9 months ago)
- Last Synced: 2024-08-07T10:02:10.182Z (3 months ago)
- Language: Solidity
- Homepage:
- Size: 86.9 KB
- Stars: 376
- Watchers: 10
- Forks: 158
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-smart-contract-development - Forge Template
README
#
Forge Template
**Template repository for getting started quickly with Foundry projects**
![Github Actions](https://github.com/foundry-rs/forge-template/workflows/CI/badge.svg)
## Getting Started
Click "Use this template" on [GitHub](https://github.com/foundry-rs/forge-template) to create a new repository with this repo as the initial state.
Or, if your repo already exists, run:
```sh
forge init
forge build
forge test
```## Writing your first test
All you need is to `import forge-std/Test.sol` and then inherit it from your test contract. Forge-std's Test contract comes with a pre-instatiated [cheatcodes environment](https://book.getfoundry.sh/cheatcodes/), the `vm`. It also has support for [ds-test](https://book.getfoundry.sh/reference/ds-test.html)-style logs and assertions. Finally, it supports Hardhat's [console.log](https://github.com/brockelmore/forge-std/blob/master/src/console.sol). The logging functionalities require `-vvvv`.
```solidity
pragma solidity 0.8.10;import "forge-std/Test.sol";
contract ContractTest is Test {
function testExample() public {
vm.roll(100);
console.log(1);
emit log("hi");
assertTrue(true);
}
}
```## Development
This project uses [Foundry](https://getfoundry.sh). See the [book](https://book.getfoundry.sh/getting-started/installation.html) for instructions on how to install and use Foundry.