-
I am on Lesson 7: hardhat FundMe . at 10:59:00 on youtube . after I run this command
01-fund-me.js :- const{networkConfig, developmentChains} = require("../helper-hardhat-config")
const { network, deployments } = require("hardhat")
const {verify} = require("../utils/verify")
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"] hardhat.config.js :- require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-solhint");
require("hardhat-deploy");
require("@nomiclabs/hardhat-ethers");
require("@nomicfoundation/hardhat-chai-matchers");
require('dotenv').config()
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
},
},
}; |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello @arf92, the problem seems to be in the |
Beta Was this translation helpful? Give feedback.
-
You are just missing |
Beta Was this translation helpful? Give feedback.
Hello @arf92, the problem seems to be in the
ethUsdPriceFeed
key, make sure the address stored in thehelper-hardhat-config
file forgoerli
is a string and the name of the key in the file is as wellethUsdPriceFeed
.