I have a WETH contract that I want to deploy on my hardhat test network. Source of the WETH contract can be found here.
When I run the following hardhat test:
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("testing", function () {
it("Should work", async function () {
const Weth = ethers.getContractFactory("WETH")
const weth = await Weth.deploy()
await weth.deployed()
expect(true).to.equal(true);
});
});
I receive the following error:
testing
1) Should work
0 passing (725ms)
1 failing
1) testing
Should work:
TypeError: Weth.deploy is not a function
at Context.<anonymous> (test/test.js:22:29)
at processImmediate (internal/timers.js:439:21)
Why is it saying I can't deploy the contract? Is the solidity version so old Hardhat can't deploy it?
Best Answer