Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve messages and task descriptions for better consistency and clarity #5750

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/src/content/hardhat-runner/docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ GLOBAL OPTIONS:

AVAILABLE TASKS:

check Check whatever you need
check Runs a user-defined check
clean Clears the cache and deletes all artifacts
compile Compiles the entire project, building all artifacts
console Opens a hardhat console
Expand Down Expand Up @@ -239,6 +239,24 @@ Compiled 2 Solidity files successfully

### Deploying your contracts

In Hardhat v3, we use Hardhat Ignition for deploying contracts. Hardhat Ignition is a new declarative deployment system that offers several improvements:

1. Declarative deployments
2. Built-in error handling and recovery
3. Improved testability
4. Enhanced modularity

To deploy the `Lock` contract, use the following command:

```
npx hardhat ignition deploy ./ignition/modules/Lock.js
```


This will deploy the Ignition module located in `./ignition/modules/Lock.js`.

For more details on Hardhat Ignition and its features in Hardhat v3, refer to the [Hardhat Ignition documentation](/ignition).

Next, to deploy the contract we will use a Hardhat Ignition module.

Inside the `ignition/modules` folder you will find a file with the following code:
Expand Down
13 changes: 11 additions & 2 deletions docs/src/content/hardhat-runner/docs/guides/deploying.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Deploying your contracts

To deploy your contracts, you can use [Hardhat Ignition](/ignition), our declarative deployment system. You can deploy the `Lock` contract from the sample project by using its accompanying Ignition module. An Ignition module is a TypeScript or JavaScript file that allows you to specify what needs to be deployed.
To deploy your contracts, we recommend using [Hardhat Ignition](/ignition), our declarative deployment system. Hardhat Ignition is now the preferred method for deploying contracts in Hardhat v3.

In the sample project, the Ignition module `LockModule` which deploys the `Lock` contract, is under the `./ignition/modules` directory and looks like this:
In the sample project, you'll find an Ignition module for deploying the `Lock` contract. An Ignition module is a TypeScript or JavaScript file that specifies what needs to be deployed.

The `LockModule` which deploys the `Lock` contract is located in the `./ignition/modules` directory and looks like this:

::::tabsgroup{options="TypeScript,JavaScript"}

Expand Down Expand Up @@ -60,4 +62,11 @@ If no network is specified, Hardhat Ignition will run against an in-memory insta

In the sample `LockModule` above, two module parameters are used: `unlockTime` which will default to the 1st of Jan 2030 and `lockedAmount` which will default to one Gwei. You can learn more about overriding these values by providing your own module parameters during deployment in our [Deploying a module](/ignition/docs/guides/deploy#defining-parameters-during-deployment) guide.

Hardhat Ignition, introduced in Hardhat v3, brings several improvements to the deployment process:

1. Declarative deployments: Define your entire deployment pipeline in a single, easy-to-understand module.
2. Built-in error handling and recovery: Automatically resume deployments from where they left off if interrupted.
3. Improved testability: Easily integrate deployments into your test suite.
4. Enhanced modularity: Create reusable deployment modules for different parts of your project.

Read more about Hardhat Ignition generally in the [Hardhat Ignition documentation](/ignition).
8 changes: 8 additions & 0 deletions docs/src/content/hardhat-runner/docs/guides/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ Now you should be able to run it:
```
npx hardhat accounts
```
For tasks that support network parameters, you can specify the network like this:


```
npx hardhat compile --network localhost
```
This will run the task on the specified network (in this case, localhost).


We are using the `task` function to define our new task. Its first argument is the name of the task, and it's what we use in the command line to run it. The second argument is the description of the task, which is printed when you use `npx hardhat help`.

Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-core/src/builtin-tasks/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { task } from "../internal/core/config/config-env";

import { TASK_CHECK } from "./task-names";

task(TASK_CHECK, "Check whatever you need", async () => {});
task(TASK_CHECK, "Runs a user-defined check", async () => {});
10 changes: 3 additions & 7 deletions packages/hardhat-core/src/internal/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,10 @@ async function main() {

// Warning for Hardhat V3 deprecation
console.warn(
chalk.yellow.bold("\n\nDEPRECATION WARNING\n\n"),
chalk.yellow.bold("DEPRECATION WARNING: "),
chalk.yellow(
`Initializing a project with ${chalk.white.italic(
"npx hardhat"
)} is deprecated and will be removed in the future.\n`
),
chalk.yellow(
`Please use ${chalk.white.italic("npx hardhat init")} instead.\n\n`
`Using ${chalk.white.italic("npx hardhat")} to initialize a project is deprecated.\n`,
`Please use ${chalk.white.italic("npx hardhat init")} instead.\n`
)
);

Expand Down