Error in verifying code on Etherscan using hardhat. #5377
-
This is the error I'm getting.
This is my deploy script. const { networkConfig, developmentChain } = require("../helper-hardhat-config");
const { network } = require("hardhat");
const { verify } = require("../utils/verify");
module.exports = async (hre) => {
const { getNamedAccounts, deployments } = hre; //pulling these variables out from hre
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
let ethUsdPriceFeedAddress;
if (developmentChain.includes(network.name)) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator"); //we get the address like this.
ethUsdPriceFeedAddress = ethUsdAggregator.address;
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
}
//if the contract doesn't exist, we deploy a minimal version for our local testing.
//when going for localhost or hardhat network we want to use a mock to get the price feeds
log("the constructor argument is:", ethUsdPriceFeedAddress);
const fundMe = await deploy("FundMe2", {
from: deployer,
args: [ethUsdPriceFeedAddress], //put pricefeed address
log: true,
waitConfirmations: network.config.blockConfirmations || 1,
});
if (!developmentChain.includes(network.name)) {
//verify
await verify(fundMe.address, [ethUsdPriceFeedAddress]); //contract address and contract arguments as parameters
}
log("---------------------------------------------------");
log("contract deployed at:", network.name, fundMe.address);
};
module.exports.tags = ["all", "fundme"];
javascript```
This is my verify.js const { run } = require("hardhat");
const verify = async (contractAddress, args) => {
console.log("verifying contract...");
try {
r
await run("verify:verify", {
address: contractAddress,
contructorArguments: args,
});
} catch (e) {
if (e.message.toLowerCase().includes("already verified")) {
console.log("Already Verified!");
} else {
console.log(e);
}
}
};
module.exports = { verify };
module.exports.tags = ["all", "verify"];
javascript```
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Apr 29, 2023
Replies: 1 comment 8 replies
-
@jediGovind Can you show what did you get on the console? Also please share your repository link. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jediGovind Issue is in your verify function,
constructorArguments: args,
here you have a spelling mistake.