WIP
This Hardhat plugin automatically starts and stops Anvil when running tests or scripts.
This plugin creates a network named anvil
. When this network is used, a Anvil server will be automatically started before running tests and scripts, and stopped when finished.
npm install --save-dev @foundry/hardhat-anvil
And add the following statement to your hardhat.config.js
:
require("@foundry/hardhat-anvil");
Or, if you are using TypeScript, add this to your hardhat.config.ts
:
import "@foundry/hardhat-anvil";
This plugin hooks into the test
and run
tasks to wrap them in the instantiation and termination of a anvil-core
instance. This plugin creates no additional tasks.
This plugin adds a waffle
object to the Hardhat Runtime Environment. This object has all the Waffle functionality, already adapted to work with Hardhat.
This is a modified, anvil
compatible version of @nomiclabs/hardhat-waffle
.
Once anvil
is installed you can simply run it and configure it via the CLI.
Once installed, you can build your tests almost like in Waffle.
Instead of importing things from ethereum-waffle
, you access them from the waffle
property of the Hardhat Runtime Environment.
You can set any of the Anvil's options through the anvil
network config. All of them are supported, with the exception of accounts
.
This example sets a larger block gas limit and the default balance of Anvil's accounts.
module.exports = {
defaultNetwork: "anvil",
anvil: {
url: "http://127.0.0.1:8545/",
launch: true, // if set to false, this will assume anvil is already running
},
},
};
Note: currently only default settings are used if launch: false
. All other configs are currently ignored
- MIT license (LICENSE or https://opensource.org/licenses/MIT)