Skip to content

Commit

Permalink
Merge pull request #38 from PaulRBerg/feat/open-zeppelin
Browse files Browse the repository at this point in the history
build: add OpenZeppelin as dependency
  • Loading branch information
PaulRBerg authored Dec 31, 2023
2 parents eb0afd6 + 3d47773 commit 3e3879f
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 88 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ If this is your first time with Foundry, check out the

## Features

This template builds upon the frameworks and libraries mentioned above, so for details about their specific features,
please consult their respective documentation.
This template builds upon the frameworks and libraries mentioned above, so please consult their respective documentation
for details about their specific features.

For example, if you're interested in exploring Foundry in more detail, you should look at the
[Foundry Book](https://book.getfoundry.sh/). In particular, you may be interested in reading the
Expand Down Expand Up @@ -76,6 +76,20 @@ request made to the `main` branch.

You can edit the CI script in [.github/workflows/ci.yml](./.github/workflows/ci.yml).

## Installing Dependencies

Foundry typically uses git submodules to manage dependencies, but this template uses Node.js packages because
[submodules don't scale](https://twitter.com/PaulRBerg/status/1736695487057531328).

This is how to install dependencies:

1. Install the dependency using your preferred package manager, e.g. `pnpm add dependency-name`
- Use this syntax to install from GitHub: `pnpm add github:username/repo-name`
2. Add a remapping for the dependency in [remappings.txt](./remappings.txt), e.g.
`dependency-name=node_modules/dependency-name`

Note that OpenZeppelin Contracts is pre-installed, so you can follow that as an example.

## Writing Tests

To write a new test contract, you start by importing [PRBTest](https://github.com/PaulRBerg/prb-test) and inherit from
Expand Down Expand Up @@ -180,14 +194,6 @@ simply copy paste the path):
$ pnpm test:coverage:report
```

## Notes

1. Foundry uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to manage dependencies. For
detailed instructions on working with dependencies, please refer to the
[guide](https://book.getfoundry.sh/projects/dependencies.html) in the book
2. You don't have to create a `.env` file, but filling in the environment variables may be useful when debugging and
testing against a fork.

## Related Efforts

- [abigger87/femplate](https://github.com/abigger87/femplate)
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
"name": "Paul Razvan Berg",
"url": "https://github.com/PaulRBerg"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.1"
},
"devDependencies": {
"@prb/test": "^0.6.4",
"forge-std": "github:foundry-rs/forge-std#v1",
"prettier": "^3.0.0"
"prettier": "^3.0.0",
"solhint": "^3.6.2"
},
"keywords": [
"blockchain",
Expand All @@ -31,8 +35,5 @@
"test": "forge test",
"test:coverage": "forge coverage",
"test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage"
},
"dependencies": {
"solhint": "^3.6.2"
}
}
Loading

0 comments on commit 3e3879f

Please sign in to comment.