|
@@ -0,0 +1,90 @@
|
|
1
|
+# Hardhat Boilerplate
|
|
2
|
+
|
|
3
|
+This repository contains a sample project that you can use as the starting point
|
|
4
|
+for your Ethereum project. It's also a great fit for learning the basics of
|
|
5
|
+smart contract development.
|
|
6
|
+
|
|
7
|
+This project is intended to be used with the
|
|
8
|
+[Hardhat Beginners Tutorial](https://hardhat.org/tutorial), but you should be
|
|
9
|
+able to follow it by yourself by reading the README and exploring its
|
|
10
|
+`contracts`, `tests`, `scripts` and `frontend` directories.
|
|
11
|
+
|
|
12
|
+## Quick start
|
|
13
|
+
|
|
14
|
+The first things you need to do are cloning this repository and installing its
|
|
15
|
+dependencies:
|
|
16
|
+
|
|
17
|
+```sh
|
|
18
|
+git clone https://github.com/NomicFoundation/hardhat-boilerplate.git
|
|
19
|
+cd hardhat-boilerplate
|
|
20
|
+npm install
|
|
21
|
+```
|
|
22
|
+
|
|
23
|
+Once installed, let's run Hardhat's testing network:
|
|
24
|
+
|
|
25
|
+```sh
|
|
26
|
+npx hardhat node
|
|
27
|
+```
|
|
28
|
+
|
|
29
|
+Then, on a new terminal, go to the repository's root folder and run this to
|
|
30
|
+deploy your contract:
|
|
31
|
+
|
|
32
|
+```sh
|
|
33
|
+npx hardhat run scripts/deploy.js --network localhost
|
|
34
|
+```
|
|
35
|
+
|
|
36
|
+Finally, we can run the frontend with:
|
|
37
|
+
|
|
38
|
+```sh
|
|
39
|
+cd frontend
|
|
40
|
+npm install
|
|
41
|
+npm start
|
|
42
|
+```
|
|
43
|
+
|
|
44
|
+Open [http://localhost:3000/](http://localhost:3000/) to see your Dapp. You will
|
|
45
|
+need to have [Metamask](https://metamask.io) installed and listening to
|
|
46
|
+`localhost 8545`.
|
|
47
|
+
|
|
48
|
+## User Guide
|
|
49
|
+
|
|
50
|
+You can find detailed instructions on using this repository and many tips in [its documentation](https://hardhat.org/tutorial).
|
|
51
|
+
|
|
52
|
+- [Writing and compiling contracts](https://hardhat.org/tutorial/writing-and-compiling-contracts/)
|
|
53
|
+- [Setting up the environment](https://hardhat.org/tutorial/setting-up-the-environment/)
|
|
54
|
+- [Testing Contracts](https://hardhat.org/tutorial/testing-contracts/)
|
|
55
|
+- [Setting up Metamask](https://hardhat.org/tutorial/boilerplate-project#how-to-use-it)
|
|
56
|
+- [Hardhat's full documentation](https://hardhat.org/docs/)
|
|
57
|
+
|
|
58
|
+For a complete introduction to Hardhat, refer to [this guide](https://hardhat.org/getting-started/#overview).
|
|
59
|
+
|
|
60
|
+## What's Included?
|
|
61
|
+
|
|
62
|
+This repository uses our recommended hardhat setup, by using our [`@nomicfoundation/hardhat-toolbox`](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox). When you use this plugin, you'll be able to:
|
|
63
|
+
|
|
64
|
+- Deploy and interact with your contracts using [ethers.js](https://docs.ethers.io/v5/) and the [`hardhat-ethers`](https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-ethers) plugin.
|
|
65
|
+- Test your contracts with [Mocha](https://mochajs.org/), [Chai](https://chaijs.com/) and our own [Hardhat Chai Matchers](https://hardhat.org/hardhat-chai-matchers) plugin.
|
|
66
|
+- Interact with Hardhat Network with our [Hardhat Network Helpers](https://hardhat.org/hardhat-network-helpers).
|
|
67
|
+- Verify the source code of your contracts with the [hardhat-etherscan](https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan) plugin.
|
|
68
|
+- Get metrics on the gas used by your contracts with the [hardhat-gas-reporter](https://github.com/cgewecke/hardhat-gas-reporter) plugin.
|
|
69
|
+- Measure your tests coverage with [solidity-coverage](https://github.com/sc-forks/solidity-coverage).
|
|
70
|
+
|
|
71
|
+This project also includes [a sample frontend/Dapp](./frontend), which uses [Create React App](https://github.com/facebook/create-react-app).
|
|
72
|
+
|
|
73
|
+## Troubleshooting
|
|
74
|
+
|
|
75
|
+- `Invalid nonce` errors: if you are seeing this error on the `npx hardhat node`
|
|
76
|
+ console, try resetting your Metamask account. This will reset the account's
|
|
77
|
+ transaction history and also the nonce. Open Metamask, click on your account
|
|
78
|
+ followed by `Settings > Advanced > Reset Account`.
|
|
79
|
+
|
|
80
|
+## Setting up your editor
|
|
81
|
+
|
|
82
|
+[Hardhat for Visual Studio Code](https://hardhat.org/hardhat-vscode) is the official Hardhat extension that adds advanced support for Solidity to VSCode. If you use Visual Studio Code, give it a try!
|
|
83
|
+
|
|
84
|
+## Getting help and updates
|
|
85
|
+
|
|
86
|
+If you need help with this project, or with Hardhat in general, please read [this guide](https://hardhat.org/hardhat-runner/docs/guides/getting-help) to learn where and how to get it.
|
|
87
|
+
|
|
88
|
+For the latest news about Hardhat, [follow us on Twitter](https://twitter.com/HardhatHQ), and don't forget to star [our GitHub repository](https://github.com/NomicFoundation/hardhat)!
|
|
89
|
+
|
|
90
|
+**Happy _building_!**
|