Describe the bug
getContract() seems to not be able to load the deployed contract, showing the following error:
Error: No Contract deployed with name EventLog
at Object.getContract (node_modules\@nomiclabs\hardhat-ethers\src\internal\helpers.ts:447:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Context.<anonymous> (test\unit\EventLog.test.js:12:20)
describe("EventLog", async function () {
let eventLog, deployer
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer
deployments.fixture(["all"])
eventLog = await ethers.getContract("EventLog", deployer)
})
describe("constructor", async function () {
it("sets the number of events correctly", async function () {
const numberOfEvents = await log.getNumberOfEvents()
assert.equal(numberOfEvents, 0)
})
})
})
**Expected behavior**
Retrieve the contract EventLog by using getContract()
**versions**
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomiclabs/hardhat-etherscan": "^3.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.6.8",
"hardhat": "^2.9.7",
"hardhat-deploy": "^0.11.10",
**Additional context**
The contract was deployed and showed up as a log on the hardhat node terminal:
deploying "EventLog" (tx: 0x354af893172d75a1289de2b61f271e55902f65757e99efc56dd183f15cb62e40)...: deployed at 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 with 2558179 gas
Describe the bug getContract() seems to not be able to load the deployed contract, showing the following error:
To Reproduce Steps to reproduce the behavior:
module.exports = async (hre) => { const { getNamedAccounts, deployments } = hre const { deploy, log, get } = deployments const { deployer } = await getNamedAccounts()
} module.exports.tags = ["all", "eventLog"]
const { inputToConfig } = require("@ethereum-waffle/compiler") const { assert } = require("chai") const { deployments, ethers, getNamedAccounts } = require("hardhat")
describe("EventLog", async function () { let eventLog, deployer beforeEach(async function () { deployer = (await getNamedAccounts()).deployer deployments.fixture(["all"]) eventLog = await ethers.getContract("EventLog", deployer) })
})