PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 182 forks source link

ethers.getContract is not a function #132

Closed wesley-lewis closed 1 year ago

wesley-lewis commented 1 year ago

Nothing to compile Local network detected! Deploying mocks deploying "VRFCoordinatorV2Mock" (tx: 0xcc454aa73563f7b97237e5ab1ed0859f0eaeea6abea666542e0455b43d97ace6)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 2526713 gas Mocks Deployed

An unexpected error occurred:

Error: ERROR processing /home/username/Desktop/hardhat-smartcontract-lottery-fcc/deploy/01-deploy-raffle.js: TypeError: ethers.getContract is not a function at Object.module.exports [as func] (/home/username/Desktop/hardhat-smartcontract-lottery-fcc/deploy/01-deploy-raffle.js:69:41)

Dynamitetechdev commented 1 year ago

Can you add the more details?

anasimov commented 1 year ago

Have you tried ethers.utils.parseEther

CHYGO1985 commented 1 year ago

If you use console.log to print out ethers, probably you will get undefined.

If that is the case, highly likely, in hardhat.config.js, you did not add the following: require("@nomiclabs/hardhat-ethers")

If it still does not work, I suggest you install ethers and hardhat-ethers (yarn or npm). Then it should work

franciscocfreire commented 1 year ago

yarn add --dev hardhat @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers

This will help you