let fundMe
let mockV3Aggregator
let deployer
const sendValue = ethers.utils.parseEther("1")
beforeEach(async () => {
// const accounts = await ethers.getSigners()
// deployer = accounts[0]
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContractAt("FundMe", deployer)
mockV3Aggregator = await ethers.getContractAt(
"MockV3Aggregator",
deployer
)
}
错误消息:TypeError:无法读取未定义的属性(阅读“utils”)
另外,我尝试将值直接输入到sendValue变量,然后弹出以下错误:类型错误:无法读取未定义的属性(阅读“getContract”)
PS:我的utils文件夹中填充了以下代码
const { run } = require("hardhat")
async function verify(contractAddress, args) {
console.log("Verifying contract..")
try {
await run("verify:verify", {
// verify:verify the second verify is the subtask of thje actual verify task and {} is the object containing the actual parameters
address: contractAddress,
ConstructorArguments: args,
})
} catch (e) {} // to catch any errors
if (e.message.toLowerCase().includes("already verified")) {
console.log("Already Verified")
} else {
console.log(e)
}
}
module.exports = { verify }
1条答案
按热度按时间gfttwv5a1#
ethers
未定义,您可能没有导入它