Skip to content

Commit 4397642

Browse files
committed
Merge branch 'loadFixture_hardhat_reset_bug_issue_#4151' of https://github.com/Saty248/hardhat into loadFixture_hardhat_reset_bug_issue_#4151
adding a testcase
2 parents c537b24 + 0a40266 commit 4397642

File tree

31 files changed

+195
-80
lines changed

31 files changed

+195
-80
lines changed

.changeset/chatty-mirrors-yell.md

-5
This file was deleted.

.changeset/chilly-meals-enjoy.md

-5
This file was deleted.

.changeset/five-colts-remain.md

-5
This file was deleted.

.changeset/khaki-otters-explain.md

-5
This file was deleted.

.changeset/quick-pumas-rest.md

-5
This file was deleted.

.changeset/slimy-dots-prove.md

-5
This file was deleted.

.changeset/ten-hairs-attend.md

-5
This file was deleted.

.changeset/three-maps-judge.md

-5
This file was deleted.

.changeset/warm-taxis-sneeze.md

-5
This file was deleted.

docs/src/content/hardhat-runner/plugins/plugins.ts

+33
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,39 @@ const communityPlugins: IPlugin[] = [
782782
"The hardhat-w3f plugin allows builders to build & run Web3 Functions connecting smart off-chain data with smart contracts ",
783783
tags: ["Gelato", "w3f", "offchain", "functions"],
784784
},
785+
{
786+
name: "hardhat-publish-typechain",
787+
author: "xiaosongfu",
788+
npmPackage: "hardhat-publish-typechain",
789+
authorUrl: "https://github.com/xiaosongfu",
790+
description: "Publish generated typechain-types to NPM",
791+
tags: ["typechain-types", "npm registry"],
792+
},
793+
{
794+
name: "hardhat-deployed-records",
795+
author: "xiaosongfu",
796+
npmPackage: "hardhat-deployed-records",
797+
authorUrl: "https://github.com/xiaosongfu",
798+
description: "Recording deployed contracts address to json file",
799+
tags: ["deployed history"],
800+
},
801+
{
802+
name: "hardhat-generate-function-selectors",
803+
author: "3obby",
804+
npmPackage: "hardhat-generate-function-selectors",
805+
authorUrl: "https://github.com/3obby/function-selectors-plugin",
806+
description:
807+
"generate an output file of organized function selectors for all ABI/.json files within ./artifacts/contracts",
808+
tags: ["function", "selectors", "tooling", "router"],
809+
},
810+
{
811+
name: "hardhat-gasless-deployer",
812+
author: "Ahmed Ali",
813+
authorUrl: "https://twitter.com/0xAhmedAli",
814+
npmPackage: "https://www.npmjs.com/package/hardhat-gasless-deployer",
815+
description: "Deploy contracts with Hardhat using Gas Station Network",
816+
tags: ["GSN", "Gasless", "Deployment"],
817+
},
785818
];
786819

787820
const officialPlugins: IPlugin[] = [

docs/src/content/tutorial/testing-contracts.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ This is what the output of `npx hardhat test` should look like against the full
289289
```
290290
$ npx hardhat test
291291
292-
Token contract
292+
Token contract
293293
Deployment
294-
Should set the right owner
295-
Should assign the total supply of tokens to the owner
294+
Should set the right owner (889ms)
295+
Should assign the total supply of tokens to the owner
296296
Transactions
297-
Should transfer tokens between accounts (199ms)
298-
Should fail if sender doesn’t have enough tokens
299-
Should update balances after transfers (111ms)
297+
Should transfer tokens between accounts (121ms)
298+
Should emit Transfer events
299+
Should fail if sender doesn't have enough tokens (74ms)
300300
301301
302302
5 passing (1s)

packages/hardhat-core/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# hardhat
22

3+
## 2.17.1
4+
5+
### Patch Changes
6+
7+
- 8f50ab814: Removed the `abort-controller` dependency as it's not longer needed. Thanks @orlandoortegajr!
8+
- 951906da2: Improved the flatten task to handle SPDX licenses and pragma directives more effectively.
9+
- e4424e3ad: Added support for solc 0.8.21
10+
- fff90bb6e: `console.log` now works in `pure` functions. Thanks @0age for coming up with this technique!
11+
- 9fe89ef96: Fixed a bug caused by nodes returning 429 responses without a `Retry-After` header (thanks @kowalski!)
12+
- 6390230b7: Added logic to throw an error when the debug_traceTransaction method is called with a tracer parameter that is not supported.
13+
314
## 2.17.0
415

516
### Minor Changes

packages/hardhat-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hardhat",
3-
"version": "2.17.0",
3+
"version": "2.17.1",
44
"author": "Nomic Labs LLC",
55
"license": "MIT",
66
"homepage": "https://hardhat.org",

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-pragma-different-directives/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
pragma experimental ABIEncoderV2;
44

@@ -13,4 +13,4 @@ contract Bar {}
1313

1414
// Original pragma directive: pragma abicoder v1
1515

16-
contract Foo {}
16+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-pragma-multiple-directives/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
pragma abicoder v2;
44

@@ -14,4 +14,4 @@ contract Bar {}
1414
// Original pragma directive: pragma abicoder v2
1515
// Original pragma directive: pragma experimental ABIEncoderV2
1616

17-
contract Foo {}
17+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-pragma-same-directives/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
pragma abicoder v1;
44

@@ -13,4 +13,4 @@ contract Bar {}
1313

1414
// Original pragma directive: pragma abicoder v1
1515

16-
contract Foo {}
16+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-regex-spdx-licenses-and-pragma-directives/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: Linux-man-pages-1-para AND Linux2-man-pages-1-para AND MIT2 AND MPL-2.0-no-copyleft-exception
44

@@ -28,4 +28,4 @@ contract Bar {
2828
// Original license: SPDX_License_Identifier: MPL-2.0-no-copyleft-exception
2929
// Original license: SPDX_License_Identifier: Linux-man-pages-1-para
3030

31-
contract Foo {}
31+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-spdx-different-licenses/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: MIT AND MPL-2.0
44

@@ -14,4 +14,4 @@ contract Bar {
1414

1515
// Original license: SPDX_License_Identifier: MPL-2.0
1616

17-
contract Foo {}
17+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-spdx-different-multiple-licenses/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: Linux-man-pages-1-para AND MIT AND MPL-1.1 AND MPL-2.0-no-copyleft-exception
44

@@ -25,4 +25,4 @@ contract Foo {}
2525
// Original license: SPDX_License_Identifier: Linux-man-pages-1-para
2626
// Original license: SPDX_License_Identifier: MPL-1.1
2727

28-
contract Baz {}
28+
contract Baz {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-spdx-licenses-and-pragma-directives/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: Linux-man-pages-1-para AND MIT AND MPL-1.1 AND MPL-2.0-no-copyleft-exception
44

@@ -33,4 +33,4 @@ contract Foo {}
3333

3434
// Original pragma directive: pragma abicoder v2
3535

36-
contract Baz {}
36+
contract Baz {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-spdx-same-licenses/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: MIT
44

@@ -14,4 +14,4 @@ contract Bar {
1414

1515
// Original license: SPDX_License_Identifier: MIT
1616

17-
contract Foo {}
17+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-spdx-same-multiple-licenses/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: Linux-man-pages-1-para AND MIT
44

@@ -16,4 +16,4 @@ contract Bar {
1616
// Original license: SPDX_License_Identifier: MIT
1717
// Original license: SPDX_License_Identifier: Linux-man-pages-1-para
1818

19-
contract Foo {}
19+
contract Foo {}

packages/hardhat-core/test/fixture-projects/flatten-task/contracts-task-flatten/expected.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Sources flattened with hardhat v2.17.0 https://hardhat.org
1+
// Sources flattened with hardhat v{HARDHAT_VERSION} https://hardhat.org
22

33
// SPDX-License-Identifier: MIT
44

@@ -26,4 +26,4 @@ contract A {}
2626
// Original license: SPDX_License_Identifier: MIT
2727
// Original pragma directive: pragma abicoder v2
2828

29-
contract D {}
29+
contract D {}

packages/hardhat-ledger/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# @nomicfoundation/hardhat-ledger
2+
3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- d8793639e: Pinned version of @ledgerhq/hw-app-eth because the latest version has breaking changes

packages/hardhat-ledger/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nomicfoundation/hardhat-ledger",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Hardhat plugin for the Ledger hardware wallet",
55
"homepage": "https://github.com/nomicfoundation/hardhat/tree/main/packages/hardhat-ledger",
66
"repository": "github:nomicfoundation/hardhat",

packages/hardhat-verify/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @nomicfoundation/hardhat-verify
22

3+
## 1.1.0
4+
5+
### Minor Changes
6+
7+
- e2fc27766: Exposed the Etherscan class as a public API for third-party consumers.
8+
39
## 1.0.4
410

511
### Patch Changes

packages/hardhat-verify/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44

55
[Hardhat](https://hardhat.org) plugin to verify the source of code of deployed contracts.
66

7+
1. [What](#what)
8+
2. [Installation](#installation)
9+
3. [Tasks](#tasks)
10+
4. [Environment extensions](#environment-extensions)
11+
5. [Usage](#usage)
12+
1. [Complex arguments](#complex-arguments)
13+
2. [Libraries with undetectable addresses](#libraries-with-undetectable-addresses)
14+
3. [Multiple API keys and alternative block explorers](#multiple-api-keys-and-alternative-block-explorers)
15+
4. [Adding support for other networks](#adding-support-for-other-networks)
16+
5. [Using programmatically](#using-programmatically)
17+
1. [Providing libraries from a script or task](#providing-libraries-from-a-script-or-task)
18+
2. [Advanced Usage: Using the Etherscan class from another plugin](#advanced-usage-using-the-etherscan-class-from-another-plugin)
19+
6. [How it works](#how-it-works)
20+
7. [Known limitations](#known-limitations)
21+
722
## What
823

924
This plugin helps you verify the source code for your Solidity contracts. At the moment, it supports [Etherscan](https://etherscan.io)-based explorers and explorers compatible with its API like [Blockscout](https://www.blockscout.com/).
@@ -208,6 +223,45 @@ hre.run("verify:verify", {
208223
}
209224
```
210225
226+
#### Advanced Usage: Using the Etherscan class from another plugin
227+
228+
The Etherscan class used for contract verification can be imported from the plugin, allowing its direct usage:
229+
230+
```js
231+
import { Etherscan } from "@nomicfoundation/hardhat-verify/etherscan";
232+
233+
const instance = new Etherscan(
234+
"abc123def123", // Etherscan API key
235+
"https://api.etherscan.io/api", // Etherscan API URL
236+
"https://etherscan.io" // Etherscan browser URL
237+
);
238+
239+
if (!instance.isVerified("0x123abc...")) {
240+
const { message: guid } = await instance.verify(
241+
// Contract address
242+
"0x123abc...",
243+
// Contract source code
244+
'{"language":"Solidity","sources":{"contracts/Sample.sol":{"content":"// SPDX-Lic..."}},"settings":{ ... }}',
245+
// Contract name
246+
"contracts/Sample.sol:MyContract",
247+
// Compiler version
248+
"v0.8.19+commit.7dd6d404",
249+
// Encoded constructor arguments
250+
"0000000000000000000000000000000000000000000000000000000000000032"
251+
);
252+
253+
await sleep(1000);
254+
const verificationStatus = await instance.getVerificationStatus(guid);
255+
256+
if (verificationStatus.isSuccess()) {
257+
const contractURL = instance.getContractUrl("0x123abc...");
258+
console.log(
259+
`Successfully verified contract "MyContract" on Etherscan: ${contractURL}`
260+
);
261+
}
262+
}
263+
```
264+
211265
## How it works
212266
213267
The plugin works by fetching the bytecode in the given address and using it to check which contract in your project corresponds to it. Besides that, some sanity checks are performed locally to make sure that the verification won't fail.

packages/hardhat-verify/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nomicfoundation/hardhat-verify",
3-
"version": "1.0.4",
3+
"version": "1.1.0",
44
"description": "Hardhat plugin for verifying contracts",
55
"keywords": [
66
"ethereum",

0 commit comments

Comments
 (0)