Lesson 7: Error: Cannot find module 'nomiclabs/hardhat-waffle' #4653
-
i am on Lesson 7: hardhat FundMe . 10:59:00 on youtube . here is require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-solhint");
require("hardhat-deploy")
require("nomiclabs/hardhat-waffle");
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
module.exports = {
solidity: {
compilers: [
{
version: "0.8.7",
},
{
version: "0.6.6",
},
],
},
defaultNetwork:"hardhat",
networks:{
goerli:{
url: GOERLI_RPC_URL ,
accounts:[PRIVATE_KEY],
chainId:5,
blockConfirmations:6,
},
},
gasReporter : {
enabled : false ,
outputFile: "gas-report.txt",
noColors : "USD",
coinmarketcap:COINMARKETCAP_API_KEY ,
token : "MATIC",
},
etherscan:{
apikey : ETHERSCAN_API_KEY
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
1: 0, // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another
},
},
}; verify.js :- const { run } = require("hardhat")
const verify = async (contractAddress, args) => {
console.log("Verifying contract...")
try {
await run("verify:verify", {
address: contractAddress,
constructorArguments: args,
})
} catch (e) {
if (e.message.toLowerCase().includes("already verified")) {
console.log("Already verified!")
} else {
console.log(e)
}
}
}
module.exports = { verify } 01-deploy-fund-me.js :- const{networkConfig, developmentChains} = require("../helper-hardhat-config")
const { network, deployments } = require("hardhat")
const {verify} = require("../utils/verify")
// function deployFunc(){
// console.log("Hi")
// }
// module.exports.default = deployFunc
module.exports = async({getNamedAccounts,deployments})=>{
const{deploy,log } = deployments
const {deployer} = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if(developmentChains.includes(network.name)){
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
}
else{
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
const args = [ethUsdPriceFeedAddress]
const fundMe = await deploy("FundMe",{
from:deployer,
args:args,
log:true,
waitConfirmations:network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
await verify(fundMe.address,args)
}
log("____________________________")
}
module.exports.tags = ["all","fundme"] After i run this command:
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jan 30, 2023
Replies: 2 comments
-
change to |
Beta Was this translation helpful? Give feedback.
0 replies
-
@arf92 Just remove this line |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
arifulone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@arf92 Just remove this line
require("nomiclabs/hardhat-waffle");
fromhardhat.config.js
file and let me know if you face other isssues.