Releases: NomicFoundation/hardhat
Hardhat v2.0.1
Buidler is now Hardhat 👷♂️
We are pleased to announce the release of Hardhat, the new and evolved version of Buidler. This release is a special one for two reasons. Naturally, the first is due to the rebrand. The second reason this release is special is that this new release packs a lot of new functionality.
You can learn more about this release in our announcement. Check out our Migrating from Buidler guide to learn how to start using it in your existing projects, or the Getting started guide to try it out in a fresh project.
Changelog
This is the complete list of changes introduced in Hardhat.
Rebranded the different components
- Buidler, as a development environment, is now called Hardhat.
- The task runner component, used to extend and customize setups, is now called Hardhat Runner.
- Buidler EVM, our development network with
console.log
and stack traces for Solidity, is now called Hardhat Network.
Package names and versions
- The
@nomiclabs/buidler
package is nowhardhat
. - The official Buidler plugins, which used to have package names like
@nomiclabs/buidler-<plugin>
are now named@nomiclabs/hardhat-<plugin>
. - All package versions start from
2.0.0
. The only exceptions are@nomiclabs/hardhat-ethers
and@nomiclabs/hardhat-waffle
.- Use their
2.0.0
version if you want to useethers.js
v5. - Use their
1.0.0
version if you want to useethers.js
v4.
- Use their
Mainnet forking on Hardhat Network
Hardhat Network can now fork from Mainnet and other live networks, replicating their state without having to sync an entire blockchain. Read the guide to learn how to use it.
Revamped compilation pipeline
Hardhat has a new Solidity compilation pipeline. This includes lots of improvements:
- Native support for multiple Solidity versions in a single project. Check out the compiling your contracts guide to learn how to set it up.
- Smarter caching and recompilation, leading to dramatically faster builds
- Hardhat uses native versions of
solc
whenever possible, relying onsolcjs
only as a fallback. - You can now customize any setting of
solc
, not just the optimizer.
Improved ethers.js support
Hardhat comes with better support from ethers.js:
- The
@nomiclabs/hardhat-ethers
now offers a native way of linking libraries. - The signers returned by
ethers.getSigners()
have anaddress
property now. No moreawait signer.getAddress()
everywhere.
Both versions of the plugin have received the same improvements. Please, refer to their documentation to learn more.
Improved TypeScript support
Setting up TypeScript in Hardhat is now simpler. All you need to do is install typescript
, ts-node
and have a hardhat.config.ts
that import
s your plugins.
There's no need to have a tsconfig.json
with special settings. Check our TypeScript guide to learn more.
Other improvements
Hardhat's core
- Global installations of Hardhat cannot be used anymore, except for initializing a project.
- The function
usePlugin
doesn't exist anymore. Plugins are automatically loaded when imported/required. - Hardhat supports having multiple contracts with the same name.
- When reading an artifact, an error will be thrown if there are multiple contracts with the same name (link).
- The
artifacts
directory stores artifacts in a nested structure, and it has new files (link). - The
readArtifact
andreadArtifactSync
functions fromhardhat/plugins
don't exist anymore. Instead, thehre
has anartifacts
object to interact with artifacts (link). internalTask
is deprecated. Users should usesubtask
now.- The default solc used is now
0.7.3
. - When configuring accounts, private keys are automatically
0x
prefixed when appropriate. type-extensions.d.ts
and plugin entries intsconfig.json#files
are no longer needed- All the TypeScript types now live under
hardhat/types
. You shouldn't use deeper modules likehardhat/types/config
, unless you are extending an interface. - The solc input/output jsons are no longer saved in the
cache
directory. - Hardhat providers are now compatible with EIP1193.
- The project setup creates a
package.json
and (optionally) installs the needed dependencies. subtask
supports complex types, no need to use stringified objects anymore.- Solidity imports and artifacts names are case sensitive now.
- The
hre
global variable is now present when running scripts, tests, and tasks. - Files can be imported from
node_modules
using relative paths. - There's a new
solidity-files-cache.json
file in the cache. This file is considered internal and shouldn't be depended upon nor modified. - Hardhat collects anonymous data if the user gives its consent.
- If
--network
isn't used, the value ofargs.network
is undefined instead of having the value of the default network. tsconfig
is now a reserved param (not used at the moment)
Hardhat Network
- Hardhat Network accounts now can be configured using a mnemonic.
- Hardhat Network has new RPC methods:
hardhat_impersonateAccount
,hardhat_stopImpersonatingAccount
andhardhat_reset
. - The value returned by the Hardhat Network for the
web3_clientVersion
method is now a Hardhat-specific value. - Hardhat Network's
eth_getStorageAt
method now always returns 32 bytes.
Builtin tasks
- The
flatten
task can receive a list of files to be flattened. - The compile task has a new
--quiet
flag. - The subtasks of the
compile
task were significantly changed. This can affect you if you were overriding some of them. - Better error messages when
solc
returns an internal compiler error. - The
clean
task has a--global
flag, which deletes the Solidity compilers and other global caches. - The default hostname of
hardhat node
is 0.0.0.0 when executed inside a docker container.
Hardhat ether.js plugins
hardhat-ethers
: contract factories for abstract contracts cannot be created anymore. UsegetContractAt
if you want to use an abstract interface to interact with a deployed contract.
Buidler 1.4.8 released
This is a small version that improves the flatten
task. It now supports multi-line imports.
buidler-ethers v2.0.2 released
This version includes a hotfix to an issue that prevented ethers from working with Buidler.
This version temporarily changed how buidler-ethers
manages the gas
setting in your networks, by substracting 1M from it. If this brings you any problem, you can increase it by 1M, making sure that it won't go beyond the block gas limit. In the case of the buidlerevm
network, you can increase the block gas limit.
For more information about these settings, please go to: https://buidler.dev/config/#networks-configuration
buidler-ethers v2.0.1
This version was deprecated in favor of @nomiclabs/[email protected]
buidler-vyper 1.3.4 released
This version updates the docker images used for fetching the Vyper compiler.
Buidler 1.4.7 released
This new version of Buidler extends Buidler EVM's functionality, making it compatible with other tools like Tenderly and The Graph.
It's now possible to run RPC methods using any block number as blockTag
. For more info, take a look at #778.
This release will also decrease the number of error messages when using buidler node
with MetaMask.
Buidler version 1.4.6 released
buidler-etherscan 2.1.0 released
This version adds support for verifying libraries and improves some error messages.
buidler-waffle 2.1.0 released
This version fixes a problem with loadFixtures
and JSON-RPC based networks.
Thanks to @PaulRBerg for the contribution!