Skip to content

Commit a82d412

Browse files
authored
Merge pull request #7155 from NomicFoundation/clean-template-projects
Remove comments from template projects
2 parents 978c593 + 65e26fd commit a82d412

File tree

7 files changed

+8
-196
lines changed

7 files changed

+8
-196
lines changed

.changeset/curly-shrimps-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Update comments and readme on template projects ([#7149](https://github.com/NomicFoundation/hardhat/issues/7149))

v-next/hardhat/templates/hardhat-3/01-node-test-runner-viem/README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# Hardhat 3 Alpha: `node:test` and `viem` example project
2-
3-
> **WARNING**: This example project uses Hardhat 3, which is still in development. Hardhat 3 is not yet intended for production use.
4-
5-
Welcome to the Hardhat 3 alpha version! This project showcases some of the changes and new features coming in Hardhat 3.
6-
7-
To learn more about the Hardhat 3 Alpha, please visit [its tutorial](https://hardhat.org/hardhat3-alpha). To share your feedback, join our [Hardhat 3 Alpha](https://hardhat.org/hardhat3-alpha-telegram-group) Telegram group or [open an issue](https://github.com/NomicFoundation/hardhat/issues/new?template=hardhat-3-alpha.yml) in our GitHub issue tracker.
1+
# Hardhat 3: `node:test` and `viem` example project
82

93
## Project Overview
104

@@ -19,12 +13,10 @@ This example project includes:
1913

2014
To get the most out of this example project, we recommend exploring the files in the following order:
2115

22-
1. Read the `hardhat.config.ts` file, which contains the project configuration and explains multiple changes.
16+
1. Read the `hardhat.config.ts` file, which contains the project configuration.
2317
2. Review the "Running Tests" section and explore the files in the `contracts/` and `test/` directories.
2418
3. Read the "Make a deployment to Sepolia" section and follow the instructions.
2519

26-
Each file includes inline explanations of its purpose and highlights the changes and new features introduced in Hardhat 3.
27-
2820
## Usage
2921

3022
### Running Tests
@@ -69,5 +61,3 @@ npx hardhat ignition deploy --network sepolia ignition/modules/Counter.ts
6961
```
7062

7163
---
72-
73-
Feel free to explore the project and provide feedback on your experience with Hardhat 3 Alpha!

v-next/hardhat/templates/hardhat-3/01-node-test-runner-viem/hardhat.config.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,12 @@ import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
44
import { configVariable } from "hardhat/config";
55

66
const config: HardhatUserConfig = {
7-
/*
8-
* In Hardhat 3, plugins are defined as part of the Hardhat config instead of
9-
* being based on the side-effect of imports.
10-
*
11-
* Note: A `hardhat-toolbox` like plugin for Hardhat 3 hasn't been defined yet,
12-
* so this list is larger than what you would normally have.
13-
*/
147
plugins: [hardhatToolboxViemPlugin],
158
solidity: {
16-
/*
17-
* Hardhat 3 supports different build profiles, allowing you to configure
18-
* different versions of `solc` and its settings for various use cases.
19-
*
20-
* Note: Using profiles is optional, and any Hardhat 2 `solidity` config
21-
* is still valid in Hardhat 3.
22-
*/
239
profiles: {
24-
/*
25-
* The default profile is used when no profile is defined or specified
26-
* in the CLI or by the tasks you are running.
27-
*/
2810
default: {
2911
version: "0.8.28",
3012
},
31-
/*
32-
* The production profile is meant to be used for deployments, providing
33-
* more control over settings for production builds and taking some extra
34-
* steps to simplify the process of verifying your contracts.
35-
*/
3613
production: {
3714
version: "0.8.28",
3815
settings: {
@@ -44,25 +21,6 @@ const config: HardhatUserConfig = {
4421
},
4522
},
4623
},
47-
/*
48-
* The `networks` configuration is mostly compatible with Hardhat 2.
49-
* The key differences right now are:
50-
*
51-
* - You must set a `type` for each network, which is either `edr` or `http`,
52-
* allowing you to have multiple simulated networks.
53-
*
54-
* - You can set a `chainType` for each network, which is either `generic`,
55-
* `l1`, or `op`. This has two uses. It ensures that you always
56-
* connect to the network with the right Chain Type. And, on `edr`
57-
* networks, it makes sure that the simulated chain behaves exactly like the
58-
* real one. More information about this can be found in the test files.
59-
*
60-
* - The `accounts` field of `http` networks can also receive Configuration
61-
* Variables, which are values that only get loaded when needed. This allows
62-
* Hardhat to still run despite some of its config not being available
63-
* (e.g., a missing private key or API key). More info about this can be
64-
* found in the "Sending a Transaction to Optimism Sepolia" of the README.
65-
*/
6624
networks: {
6725
hardhatMainnet: {
6826
type: "edr-simulated",

v-next/hardhat/templates/hardhat-3/01-node-test-runner-viem/test/Counter.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,13 @@ import { describe, it } from "node:test";
44

55
import { network } from "hardhat";
66

7-
/*
8-
* `node:test` uses `describe` and `it` to define tests, similar to Mocha.
9-
* `describe` blocks support async functions, simplifying the setup of tests.
10-
*/
117
describe("Counter", async function () {
12-
/*
13-
* In Hardhat 3, there isn't a single global connection to a network. Instead,
14-
* you have a `network` object that allows you to connect to different
15-
* networks.
16-
*
17-
* You can create multiple network connections using `network.connect`.
18-
* It takes two optional parameters and returns a `NetworkConnection` object.
19-
*
20-
* Its parameters are:
21-
*
22-
* 1. The name of the network configuration to use (from `config.networks`).
23-
*
24-
* 2. The `ChainType` to use.
25-
*
26-
* Providing a `ChainType` ensures the connection is aware of the kind of
27-
* chain it's using, potentially affecting RPC interactions for HTTP
28-
* connections, and changing the simulation behavior for EDR networks.
29-
* It also ensures the network connection has the correct TypeScript type and
30-
* viem extensions (e.g. Optimism L2 actions).
31-
*
32-
* If you don't provide a `ChainType`, it will be inferred from the network
33-
* config, and default to `generic` if not specified in the config. In either
34-
* case, the connection will have a generic TypeScript type and no viem
35-
* extensions.
36-
*
37-
* Every time you call `network.connect` with an EDR network config name, a
38-
* new instance of EDR will be created. Each of these instances has its own
39-
* state and blockchain, and they have no communication with each other.
40-
*
41-
* Examples:
42-
*
43-
* - `await network.connect({network: "sepolia", chainType: "l1"})`: Connects
44-
* to the `sepolia` network config, treating it as an "l1" network with the
45-
* appropriate viem extensions.
46-
*
47-
* - `await network.connect({network: "hardhatOp", chainType: "op"})`:
48-
* Creates a new EDR instance in Optimism mode, using the `hardhatOp`
49-
* network config.
50-
*
51-
* - `await network.connect()`: Creates a new EDR instance with the default
52-
* network config (i.e. `hardhat`), the `generic` chain type, and no
53-
* viem extensions.
54-
*
55-
* Each network connection object has a `provider` property and other
56-
* network-related fields added by plugins, like `viem` and `networkHelpers`.
57-
*/
588
const { viem } = await network.connect();
599
const publicClient = await viem.getPublicClient();
6010

6111
it("Should emit the Increment event when calling the inc() function", async function () {
6212
const counter = await viem.deployContract("Counter");
6313

64-
// Hardhat 3 comes with assertions to work with viem
6514
await viem.assertions.emitWithArgs(
6615
counter.write.inc(),
6716
counter,

v-next/hardhat/templates/hardhat-3/02-mocha-ethers/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Hardhat 3 Alpha: `mocha` and `ethers` example project
22

3-
> **WARNING**: This example project uses Hardhat 3, which is still in development. Hardhat 3 is not yet intended for production use.
4-
5-
Welcome to the Hardhat 3 alpha version! This project showcases some of the changes and new features coming in Hardhat 3.
6-
7-
To learn more about the Hardhat 3 Alpha, please visit [its tutorial](https://hardhat.org/hardhat3-alpha). To share your feedback, join our [Hardhat 3 Alpha](https://hardhat.org/hardhat3-alpha-telegram-group) Telegram group or [open an issue](https://github.com/NomicFoundation/hardhat/issues/new?template=hardhat-3-alpha.yml) in our GitHub issue tracker.
8-
93
## Project Overview
104

115
This example project includes:
@@ -19,7 +13,7 @@ This example project includes:
1913

2014
To get the most out of this example project, we recommend exploring the files in the following order:
2115

22-
1. Read the `hardhat.config.ts` file, which contains the project configuration and explains multiple changes.
16+
1. Read the `hardhat.config.ts` file, which contains the project configuration.
2317
2. Review the "Running Tests" section and explore the files in the `contracts/` and `test/` directories.
2418
3. Read the "Make a deployment to Sepolia" section and follow the instructions.
2519

@@ -69,5 +63,3 @@ npx hardhat ignition deploy --network sepolia ignition/modules/Counter.ts
6963
```
7064

7165
---
72-
73-
Feel free to explore the project and provide feedback on your experience with Hardhat 3 Alpha!

v-next/hardhat/templates/hardhat-3/02-mocha-ethers/hardhat.config.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,12 @@ import hardhatToolboxMochaEthersPlugin from "@nomicfoundation/hardhat-toolbox-mo
44
import { configVariable } from "hardhat/config";
55

66
const config: HardhatUserConfig = {
7-
/*
8-
* In Hardhat 3, plugins are defined as part of the Hardhat config instead of
9-
* being based on the side-effect of imports.
10-
*
11-
* Note: A `hardhat-toolbox` like plugin for Hardhat 3 hasn't been defined yet,
12-
* so this list is larger than what you would normally have.
13-
*/
147
plugins: [hardhatToolboxMochaEthersPlugin],
158
solidity: {
16-
/*
17-
* Hardhat 3 supports different build profiles, allowing you to configure
18-
* different versions of `solc` and its settings for various use cases.
19-
*
20-
* Note: Using profiles is optional, and any Hardhat 2 `solidity` config
21-
* is still valid in Hardhat 3.
22-
*/
239
profiles: {
24-
/*
25-
* The default profile is used when no profile is defined or specified
26-
* in the CLI or by the tasks you are running.
27-
*/
2810
default: {
2911
version: "0.8.28",
3012
},
31-
/*
32-
* The production profile is meant to be used for deployments, providing
33-
* more control over settings for production builds and taking some extra
34-
* steps to simplify the process of verifying your contracts.
35-
*/
3613
production: {
3714
version: "0.8.28",
3815
settings: {
@@ -44,25 +21,6 @@ const config: HardhatUserConfig = {
4421
},
4522
},
4623
},
47-
/*
48-
* The `networks` configuration is mostly compatible with Hardhat 2.
49-
* The key differences right now are:
50-
*
51-
* - You must set a `type` for each network, which is either `http` or `edr`,
52-
* allowing you to have multiple simulated networks.
53-
*
54-
* - You can set a `chainType` for each network, which is either `generic`,
55-
* `l1`, or `op`. This has two uses. It ensures that you always
56-
* connect to the network with the right Chain Type. And, on `edr`
57-
* networks, it makes sure that the simulated chain behaves exactly like the
58-
* real one. More information about this can be found in the test files.
59-
*
60-
* - The `accounts` field of `http` networks can also receive Configuration
61-
* Variables, which are values that only get loaded when needed. This allows
62-
* Hardhat to still run despite some of its config not being available
63-
* (e.g., a missing private key or API key). More info about this can be
64-
* found in the "Sending a Transaction to Optimism Sepolia" of the README.
65-
*/
6624
networks: {
6725
hardhatMainnet: {
6826
type: "edr-simulated",

v-next/hardhat/templates/hardhat-3/02-mocha-ethers/test/Counter.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,6 @@
11
import { expect } from "chai";
22
import { network } from "hardhat";
33

4-
/*
5-
* In Hardhat 3, there isn't a single global connection to a network. Instead,
6-
* you have a `network` object that allows you to connect to different
7-
* networks.
8-
*
9-
* You can create multiple network connections using `network.connect`.
10-
* It takes two optional parameters and returns a `NetworkConnection` object.
11-
*
12-
* Its parameters are:
13-
*
14-
* 1. The name of the network configuration to use (from `config.networks`).
15-
*
16-
* 2. The `ChainType` to use.
17-
*
18-
* Providing a `ChainType` ensures the connection is aware of the kind of
19-
* chain it's using, potentially affecting RPC interactions for HTTP
20-
* connections, and changing the simulation behavior for EDR networks.
21-
*
22-
* If you don't provide a `ChainType`, it will be inferred from the network
23-
* config, and default to `generic` if not specified in the config.
24-
*
25-
* Every time you call `network.connect` with an EDR network config name, a
26-
* new instance of EDR will be created. Each of these instances has its own
27-
* state and blockchain, and they have no communication with each other.
28-
*
29-
* Examples:
30-
*
31-
* - `await network.connect({network: "sepolia", chainType: "l1"})`: Connects
32-
* to the `sepolia` network config, treating it as an "l1" network.
33-
*
34-
* - `await network.connect(network: "hardhatOp", chainType: "op"})`:
35-
* Creates a new EDR instance in Optimism mode, using the `hardhatOp`
36-
* network config.
37-
*
38-
* - `await network.connect()`: Creates a new EDR instance with the default
39-
* network config (i.e. `hardhat`) and the `generic` chain type.
40-
*
41-
* Each network connection object has a `provider` property and other
42-
* network-related fields added by plugins, like `ethers` and `networkHelpers`.
43-
*/
444
const { ethers } = await network.connect();
455

466
describe("Counter", function () {

0 commit comments

Comments
 (0)