wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

Error with running test on ethers version 6.0.4 #423

Closed bagdasaryanem closed 1 year ago

bagdasaryanem commented 1 year ago

Describe the bug When running yarn hardhat test on hardhat project, where ethers package version is 6.0.4, got this error calling ethers.getContract() image

To Reproduce Steps to reproduce the behavior:

  1. Create basic smart contract and create basic deploy steps
  2. Create basic unit test, for example:
    
    const { assert } = require("chai");
    const { ethers, deployments, getNamedAccounts } = require("hardhat");

describe("TestContract", () => { let contract; let deployer; beforeEach(async () => { deployer = (await getNamedAccounts()).deployer; await deployments.fixture(["all"]); contract = await ethers.getContract("TestContract", deployer); }); describe("constructor", async () => { it("it tests", async () => {}); }); });


3. Execute `yarn hardhat test` 
4. See error 
![image](https://user-images.githubusercontent.com/73189633/219620164-d4425019-7811-4f3e-8536-567231ea877c.png)

**Expected behavior**
Should not throw error and get contract

**versions**
 - hardhat-deploy [^0.11.23]
 - hardhat [^2.12.7] 
 - nodejs [18.13.0]
wighawag commented 1 year ago

So hardhat-deploy-ethers is moving to be an extension to @nomiclabs/hardhat-ethers

you can try hardhat-deploy-ethers@next which does this and if the error persist then you better submit the issue in https://github.com/NomicFoundation/hardhat/tree/main/packages/hardhat-ethers

wighawag commented 1 year ago

hardhat-deploy-ethers v0.4.1 is now out