sorry for a newbie question. I have a file from my study with the following code:

const { expect, assert } = require("chai");
const { ethers } = require("hardhat");
const { impersonateFundErc20 } = require("../utils/utilities");

const {
} = require("../artifacts/contracts/interfaces/IERC20.sol/IERC20.json");

const provider = waffle.provider;

Everything worked first, but after installing new Hardhat I saw a message about migrating from Waffle to Hardhat Chai Matchers. I've done everything from hardhat documentation. But without Waffle I'm receiving an error:

ReferenceError: waffle is not defined

If I install waffle back hardhat tells that there is a conflict. Is there any way to use this Chai Matchers or I need to install everything as it was 2 months ago with an older Hardhat and Waffles? Thanks and sorry again)


1 Answer 1


Try to change your line

const { ethers } = require("hardhat");


const { ethers, waffle } = require("hardhat");

and try again

Link to doc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.