CHAP 7 :- my deploy script is not working when im switching to goerli #2350
-
When I'm doing yarn hardhat deploy --network goerli , it is showing an error invalid address (argument="address", value="\t0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e", code=INVALID_ARGUMENT, version=address/5.5.0) (argument="priceFeed", value="\t0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e", code=INVALID_ARGUMENT, version=abi/5.5.0) this is my 01-deploy-fund-me.js const { getNamedAccounts, deployments, network } = require("hardhat")
const { networkConfig, developmentChains } = require("../helper-hardhat-config")
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 (chainId == 31337) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
log("----------------------------------------------------")
log("Deploying FundMe and waiting for confirmations...")
const fundMe = await deploy("FundMe", {
from: deployer,
args: [ethUsdPriceFeedAddress],
log: true,
// we need to wait if on a live network so we can verify properly
waitConfirmations: network.config.blockConfirmations || 1,
})
log(`FundMe deployed at ${fundMe.address}`)
if (
!developmentChains.includes(network.name) &&
process.env.ETHERSCAN_API_KEY
) {
await verify(fundMe.address, [ethUsdPriceFeedAddress])
}
}
module.exports.tags = ["all", "fundme"] this is my helper-hardhat-config const networkConfig = {
31337: {
name: "localhost",
},
5: {
name: "goerli",
ethUsdPriceFeed: " 0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e",
},
}
const developmentChains = ["hardhat", "localhost"]
module.exports = {
networkConfig,
developmentChains,
} this is my hardhat.config.js require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
require("hardhat-deploy")
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || ""
const GOERLI_RPC_URL =
process.env.GOERLI_RPC_URL || ""
const PRIVATE_KEY =
process.env.PRIVATE_KEY || ""
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ""
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
// gasPrice: 130000000000,
},
kovan: {
url: KOVAN_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 42,
blockConfirmations: 6,
gas: 6000000,
},
goerli: {
url: GOERLI_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 5,
blockConfirmations: 6,
},
},
solidity: {
compilers: [
{
version: "0.8.8",
},
{
version: "0.6.6",
},
],
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: true,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
// coinmarketcap: COINMARKETCAP_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
},
},
mocha: {
timeout: 500000,
},
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@soumalya340 : I have found the issue! In your Correct your
As you have given space in the beginning of your address quotes :
Let me know if your issue is resolved! |
Beta Was this translation helpful? Give feedback.
@soumalya340 : I have found the issue!
In your
helper-hardhat-config.js
file:Correct your
ethUsdPriceFeed
to this :ethUsdPriceFeed: "0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e"
without any spaces in quotes.As you have given space in the beginning of your address quotes :
ethUsdPriceFeed: " 0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e",
There is a space in quotes in the beginning, thats why error is coming!Let me know if your issue is resolved!