NomicLabsHardhatPluginError: The constructor for contracts/FundMe.sol:FundMe has 1 parameters but 0 arguments were provided instead. #2256
-
at Nothing to compile
reusing "FundMe" at 0x2A0D25e07c111002d38924BFa804228cF27B8f1a
Verifying contract....
Nothing to compile
NomicLabsHardhatPluginError: The constructor for contracts/FundMe.sol:FundMe has 1 parameters
but 0 arguments were provided instead. My Solidity "FundMe" contract source code is this. //SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./priceConverter.sol";
contract FundMe {
using priceConverter for uint256;
uint256 public minimumUSD = 50 * 1e18; // 1 * 10 ** 18
address[] public Funders;
mapping(address => uint256) public addrs_toamount_track;
address public owner;
AggregatorV3Interface public priceFeed;
constructor(address priceFeedAddress) {
owner = msg.sender;
priceFeed = AggregatorV3Interface(priceFeedAddress);
}
function Fund() public payable {
require(
//1st_Arg...................(2nd_Arg)
msg.value.getConvertionRate(priceFeed) >= minimumUSD,
"Didn't send enough eth "
);
Funders.push(msg.sender);
addrs_toamount_track[msg.sender] += msg.value;
}
function withdraw() public Onlyyowner {
// require(msg.sender == owner,"Only owner can call this function");
/*starting index; ending index; step amount*/
for (
uint256 funderindex = 0;
funderindex < Funders.length;
funderindex += 1
) {
address fundersagain = Funders[funderindex];
addrs_toamount_track[fundersagain] = 0;
}
// reset the array
Funders = new address[](0);
(bool callsuccess, ) = payable(msg.sender).call{
value: address(this).balance
}("");
require(callsuccess, "Call failed");
}
modifier Onlyyowner() {
require(msg.sender == owner, "only owner can call this function");
_;
}
} and my 01-deploy-fundme.js source code is this: const { verify } = require("../Utils/verify");
const { network } = require("hardhat");
module.exports = async (hre) => {
const { getNamedAccounts, deployments } = hre;
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
const {
networkConfig,
developmentChains,
} = require("../helper-hardhat-config");
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,
});
// #VERIFICATION
if (
!developmentChains.includes(network.name) &&
process.env.ETHERSCAN_API_KEY
) {
await verify(fundMe.address, args);
}
log("_______________________________________________");
};
module.exports.tags = ["all", "waqar"]; I've also tried to place here is my helper-hardhat-config.js script as well: const networkConfig = {
4: {
name: "rinkeby",
ethUsdPriceFeed: "0x8A753747A1Fa494EC906cE90E9f37563A8AF630e",
},
137: {
name: "polygon",
ethUsdPriceFeed: "0xF9680D99D6C9589e2a93a78A04A279e509205945",
},
};
const developmentChains = ["hardhat", "localhost"];
const DECIMALS = 8;
const INITIAL_ANSWER = 200000000000;
module.exports = { networkConfig, developmentChains, DECIMALS, INITIAL_ANSWER }; if you want any other source code to as well, mention in comments and I'll show that as well. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Hey @OmarWaqar123 please share your verify.js code. |
Beta Was this translation helpful? Give feedback.
-
Push to GitHub and reply w/ the link. |
Beta Was this translation helpful? Give feedback.
Hey @OmarWaqar123 please share your verify.js code.