Skip to content

Commit

Permalink
build: install openzeppelin
Browse files Browse the repository at this point in the history
docs: update README.md file
  • Loading branch information
ahmedali8 committed Feb 14, 2024
1 parent 67620c6 commit b911593
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ A Foundry + Hardhat based template for developing Solidity smart contracts, with
deploy smart contracts
- [Forge Std](https://github.com/foundry-rs/forge-std): collection of helpful contracts and
cheatcodes for testing
- [Solhint Community](https://github.com/solhint-community/solhint-community): code linter
- [Prettier Plugin Solidity](https://github.com/prettier-solidity/prettier-plugin-solidity): code
formatter
- [Solhint](https://github.com/protofire/solhint): linter for Solidity code

## Table of Contents

Expand Down Expand Up @@ -78,7 +76,7 @@ $ cd my-project
$ forge init --template ahmedali8/foundry-hardhat-template
```

Recommended node version is v18.x
Recommended node version is v20.x

If you have [nvm](https://github.com/nvm-sh/nvm) then run:

Expand Down Expand Up @@ -145,6 +143,21 @@ Note though that by default it injects `.env.example` env variables into github

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.
`yarn add dependency-name:dependency-url`
- Use this syntax to install from GitHub: `yarn add repo-name@github:username/repo-name#tag-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.

# Usage

### Pre Requisites
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.4",
"@openzeppelin/contracts": "^5.0.1",
"@primitivefi/hardhat-dodoc": "^0.2.3",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@typechain/ethers-v6": "^0.5.1",
Expand All @@ -55,7 +56,7 @@
"eslint-config-prettier": "^9.1.0",
"ethers": "6.11.0",
"evm-bn": "^1.1.2",
"forge-std": "github:foundry-rs/forge-std#v1.7.5",
"forge-std": "github:foundry-rs/forge-std#v1.7.6",
"fs-extra": "^11.2.0",
"hardhat": "2.20.0",
"hardhat-contract-sizer": "2.10.0",
Expand Down
4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ds-test/=node_modules/forge-std/lib/ds-test/src/
forge-std/=node_modules/forge-std/src/
hardhat/=node_modules/hardhat/
hardhat/=node_modules/hardhat/
@openzeppelin/=node_modules/@openzeppelin/
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ __metadata:
"@nomicfoundation/hardhat-network-helpers": "npm:^1.0.10"
"@nomicfoundation/hardhat-toolbox": "npm:^4.0.0"
"@nomicfoundation/hardhat-verify": "npm:^2.0.4"
"@openzeppelin/contracts": "npm:^5.0.1"
"@primitivefi/hardhat-dodoc": "npm:^0.2.3"
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@typechain/ethers-v6": "npm:^0.5.1"
Expand Down Expand Up @@ -1494,6 +1495,13 @@ __metadata:
languageName: node
linkType: hard

"@openzeppelin/contracts@npm:^5.0.1":
version: 5.0.1
resolution: "@openzeppelin/contracts@npm:5.0.1"
checksum: 10/d0a9ae98c2486eb3c4a3fa31cb9d4e8ea21aef3f1d0d4709a6c8550be0133ccfbad541e524980356b802c10c47de24c49844fac1b746980dbd5b560bd1762301
languageName: node
linkType: hard

"@pkgjs/parseargs@npm:^0.11.0":
version: 0.11.0
resolution: "@pkgjs/parseargs@npm:0.11.0"
Expand Down

0 comments on commit b911593

Please sign in to comment.