Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into chore/3925-ci-improve…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
galargh committed Jul 29, 2024
2 parents 6e86198 + 6c943bb commit 684653b
Show file tree
Hide file tree
Showing 57 changed files with 493 additions and 395 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-eyes-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/hardhat-verify": patch
---

Make the `--force` flag override the check of any existing verification, even in the presence of errors.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-mangos-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Add `debug` logs to Hardhat Network initialization process.
5 changes: 5 additions & 0 deletions .changeset/great-crabs-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Added an `enableRip7212` optional flag to the Hardhat Network config that enables [RIP-7212 (Precompile for secp256r1 Curve Support)](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md).
5 changes: 5 additions & 0 deletions .changeset/grumpy-dragons-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Bump EDR to [v0.4.2](https://github.com/NomicFoundation/edr/releases/tag/%40nomicfoundation%2Fedr%400.4.2).
5 changes: 5 additions & 0 deletions .changeset/modern-points-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Bumped EDR to [v0.5.0](https://github.com/NomicFoundation/edr/releases/tag/%40nomicfoundation%2Fedr%400.5.0).
5 changes: 5 additions & 0 deletions .changeset/rude-suits-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Fix message for error HH206
5 changes: 0 additions & 5 deletions .changeset/shiny-wasps-invite.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/unlucky-tips-jam.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/src/content/hardhat-network/docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ The `baseFeePerGas` of the first block. Note that when forking a remote network,

The address used as coinbase in new blocks. Default value: `"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e"`.

#### `enableRip7212`

A flag indicating whether to enable [RIP-7212 (Precompile for secp256r1 Curve Support)](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md). Default value: `false`.

### Mining modes

You can configure the mining behavior under your Hardhat Network settings:
Expand Down
29 changes: 25 additions & 4 deletions docs/src/content/hardhat-runner/plugins/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ const communityPlugins: IPlugin[] = [
authorUrl: "https://distributedlab.com/",
description:
"Hardhat plugin to automate the deployment and verification of contracts",
tags: ["Deployment", "Verification", "Migration"],
tags: ["Deployment", "Verification", "Migration", "Solarity"],
},
{
name: "hardhat-notifier",
Expand All @@ -683,7 +683,7 @@ const communityPlugins: IPlugin[] = [
authorUrl: "https://distributedlab.com/",
description:
"Hardhat plugin to generate smart contract bindings for Golang",
tags: ["Bindings", "Go", "Testing"],
tags: ["Bindings", "Go", "Testing", "Solarity"],
},
{
name: "hardhat-storage-vault",
Expand Down Expand Up @@ -729,7 +729,7 @@ const communityPlugins: IPlugin[] = [
authorUrl: "https://distributedlab.com/",
description:
"Hardhat plugin to generate customizable smart contracts documentation",
tags: ["Documentation", "NatSpec", "Markdown"],
tags: ["Documentation", "NatSpec", "Markdown", "Solarity"],
},
{
name: "hardhat-contract-clarity",
Expand Down Expand Up @@ -843,7 +843,7 @@ const communityPlugins: IPlugin[] = [
author: "Distributed Lab",
authorUrl: "https://distributedlab.com/",
description: "Hardhat plugin to deeply compare smart contracts",
tags: ["Storage Layout", "Bytecode", "Diff", "Compare"],
tags: ["Storage Layout", "Bytecode", "Diff", "Compare", "Solarity"],
},
{
name: "hardhat-logger",
Expand Down Expand Up @@ -974,6 +974,27 @@ const communityPlugins: IPlugin[] = [
"Hardhat plugin for verifying smart contracts deployed on the EVM chains including X Layer",
tags: ["OKX Explorer", "Verification", "X Layer"],
},
{
name: "@solarity/hardhat-zkit",
author: "Distributed Lab",
authorUrl: "https://distributedlab.com/",
description: "The ultimate environment for building with Circom",
tags: ["Circom", "zk", "SnarkJS", "environment", "Solarity"],
},
{
name: "@solarity/hardhat-habits",
author: "Distributed Lab",
authorUrl: "https://distributedlab.com/",
description: "Hardhat plugin to get interfaceid",
tags: ["ABI", "interfaceid", "Solarity"],
},
{
name: "@yankeguo/hardhat-trezor",
author: "Yanke G.",
authorUrl: "https://yankeguo.com",
description: "Hardhat plugin for the Trezor hardware wallet",
tags: ["Trezor", "Wallet"],
},
];

const officialPlugins: IPlugin[] = [
Expand Down
147 changes: 75 additions & 72 deletions docs/src/content/ignition/docs/advanced/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,77 @@ To get started, we’ll uninstall the `hardhat-deploy` plugin and install the Ha

1. Remove the `hardhat-deploy` packages from your project:

::::tabsgroup{options="npm,yarn"}
::::tabsgroup{options="npm,yarn"}

:::tab{value="npm"}
:::tab{value="npm"}

```sh
npm uninstall hardhat-deploy hardhat-deploy-ethers
```
```sh
npm uninstall hardhat-deploy hardhat-deploy-ethers
```

:::
:::

:::tab{value=yarn}
:::tab{value=yarn}

```sh
yarn remove hardhat-deploy hardhat-deploy-ethers
```
```sh
yarn remove hardhat-deploy hardhat-deploy-ethers
```

:::
:::

::::
::::

2. Install the Hardhat Ignition package and `hardhat-network-helpers` to provide additional testing support as a replacement for `hardhat-deploy` functionality like EVM snapshots:

::::tabsgroup{options="npm,yarn"}
::::tabsgroup{options="npm,yarn"}

:::tab{value="npm"}
:::tab{value="npm"}

```sh
npm install --save-dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
```
```sh
npm install --save-dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
```

:::
:::

:::tab{value=yarn}
:::tab{value=yarn}

```sh
yarn add --dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
```
```sh
yarn add --dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
```

:::
:::

::::
::::

3. Update the project’s `hardhat.config` file to remove `hardhat-deploy` and `hardhat-deploy-ethers` and instead import Hardhat Ignition:

::::tabsgroup{options="typescript,javascript"}
::::tabsgroup{options="typescript,javascript"}

:::tab{value="typescript"}
:::tab{value="typescript"}

```git
- import "hardhat-deploy";
- import "hardhat-deploy-ethers";
+ import "@nomicfoundation/hardhat-ignition-ethers";
```
```git
- import "hardhat-deploy";
- import "hardhat-deploy-ethers";
+ import "@nomicfoundation/hardhat-ignition-ethers";
```

:::
:::

:::tab{value=javascript}
:::tab{value=javascript}

```git
- require("hardhat-deploy");
- require("hardhat-deploy-ethers");
+ require("@nomicfoundation/hardhat-ignition-ethers");
```
```git
- require("hardhat-deploy");
- require("hardhat-deploy-ethers");
+ require("@nomicfoundation/hardhat-ignition-ethers");
```

:::
:::

::::
::::

## Convert deployment scripts to Ignition Modules

`hardhat-deploy` represents contract deployments as JavaScript or TypeScript files under the `./deploy/` folder. Hardhat Ignition follows a similar pattern with deployments encapsulated as modules; these are JS/TS files stored under the `./ignition/modules directory`. Each `hardhat-deploy` deploy file will be converted or merged into a Hardhat Ignition module.
`hardhat-deploy` represents contract deployments as JavaScript or TypeScript files under the `./deploy/` folder. Hardhat Ignition follows a similar pattern with deployments encapsulated as modules; these are JS/TS files stored under the `./ignition/modules` directory. Each `hardhat-deploy` deploy file will be converted or merged into a Hardhat Ignition module.

Let’s first create the required folder structure under the root of your project:

Expand All @@ -97,13 +97,16 @@ contract Token {
uint256 public totalSupply = 1000000;
address public owner;
mapping(address => uint256) balances;
constructor(address _owner) {
balances[_owner] = totalSupply;
owner = _owner;
}
function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
function transfer(address to, uint256 amount) external {
require(balances[msg.sender] >= amount, "Not enough tokens");
balances[msg.sender] -= amount;
Expand All @@ -123,9 +126,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
/*
The deploy function uses the hardhat-deploy named accounts feature
to set the deployment's `from` and `args` parameters.
*/
The deploy function uses the hardhat-deploy named accounts feature
to set the deployment's `from` and `args` parameters.
*/
const { deployer, tokenOwner } = await getNamedAccounts();
await deploy("Token", {
from: deployer,
Expand All @@ -152,29 +155,29 @@ import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
For instance, you can deploy contracts via `m.contract()`.
*/
export default buildModule("TokenModule", (m) => {
/*
Instead of named accounts, you get access to the configured accounts
through the `getAccount()` method.
*/
/*
Instead of named accounts, you get access to the configured accounts
through the `getAccount()` method.
*/
const deployer = m.getAccount(0);
const tokenOwner = m.getAccount(1);
/*
Deploy `Token` by calling `contract()` with the constructor arguments
as the second argument. The account to use for the deployment transaction
is set through `from` in the third argument, which is an options object.
*/
Deploy `Token` by calling `contract()` with the constructor arguments
as the second argument. The account to use for the deployment transaction
is set through `from` in the third argument, which is an options object.
*/
const token = m.contract("Token", [tokenOwner], {
from: deployer,
});
/*
The call to `m.contract()` returns a future that can be used in other `m.contract()`
calls (e.g. as a constructor argument, where the future will resolve to the
deployed address), but it can also be returned from the module. Contract
futures that are returned from the module can be leveraged in Hardhat tests
and scripts, as will be shown later.
*/
The call to `m.contract()` returns a future that can be used in other `m.contract()`
calls (e.g. as a constructor argument, where the future will resolve to the
deployed address), but it can also be returned from the module. Contract
futures that are returned from the module can be leveraged in Hardhat tests
and scripts, as will be shown later.
*/
return { token };
});
```
Expand All @@ -193,29 +196,29 @@ const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
For instance, you can deploy contracts via `m.contract()`.
*/
module.exports = buildModule("TokenModule", (m) => {
/*
Instead of named accounts, you get access to the configured accounts
through the `getAccount()` method.
*/
/*
Instead of named accounts, you get access to the configured accounts
through the `getAccount()` method.
*/
const deployer = m.getAccount(0);
const tokenOwner = m.getAccount(1);
/*
Deploy `Token` by calling `contract()` with the constructor arguments
as the second argument. The account to use for the deployment transaction
is set through `from` in the third argument, which is an options object.
*/
Deploy `Token` by calling `contract()` with the constructor arguments
as the second argument. The account to use for the deployment transaction
is set through `from` in the third argument, which is an options object.
*/
const token = m.contract("Token", [tokenOwner], {
from: deployer,
});
/*
The call to `m.contract()` returns a future that can be used in other `m.contract()`
calls (e.g. as a constructor argument, where the future will resolve to the
deployed address), but it can also be returned from the module. Contract
futures that are returned from the module can be leveraged in Hardhat tests
and scripts, as will be shown later.
*/
The call to `m.contract()` returns a future that can be used in other `m.contract()`
calls (e.g. as a constructor argument, where the future will resolve to the
deployed address), but it can also be returned from the module. Contract
futures that are returned from the module can be leveraged in Hardhat tests
and scripts, as will be shown later.
*/
return { token };
});
```
Expand Down
9 changes: 9 additions & 0 deletions packages/hardhat-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# hardhat

## 2.22.6

### Patch Changes

- cdf0160: Upgrade bundled solcjs
- 3c66da2: Add support for Node v22
- 9fadc22: Bump EDR to [v0.4.1](https://github.com/NomicFoundation/edr/releases/tag/%40nomicfoundation%2Fedr%400.4.1).
- 095faa4: Added hardfork histories for Optimim and Arbitrum chains

## 2.22.5

### Patch Changes
Expand Down
Loading

0 comments on commit 684653b

Please sign in to comment.