1
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
       )
   }

the error message:

TypeError: Cannot read properties of undefined (reading 'utils')

also, I tried to feed the value directly to the sendValue variable and then this error pops up:

TypeError: Cannot read properties of undefined (reading 'getContract')

PS: I have my utils folder populated with code below

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 }
TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

2

In ethers 6 you can use:

ethers.parseEther("")

instead of ethers.utils.parseEther()

Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63
rushby
  • 21
  • 3