-
helper-hardhat-config.js const networkConfig = {
4: {
name: "rinkeby",
ethUsdPriceFeed: "0x8a753747a1fa494ec906ce90e9f37563a8af630e",
},
137: {
name: "polygon",
ethUsdPriceFeed: "0xf9680d99d6c9589e2a93a78a04a279e509205945",
},
31337: {
name: "localhost",
},
};
const developmentChains = ["hardhat", "localhost"];
const DECIMALS = 8;
const INITIAL_ANSWER = 200000000000;
module.exports = {
networkConfig,
developmentChains,
DECIMALS,
INITIAL_ANSWER,
}; hardhat-config.js require("@nomicfoundation/hardhat-toolbox");
require("hardhat-deploy");
require("dotenv").config();
/** @type import('hardhat/config').HardhatUserConfig */
const RINKBY_RPC_URL = process.env.RINKBY_RPC_URL || "https://eth-rinkeby";
const PRIVATE_KEY = process.env.PRIVATE_KEY || "0xkey";
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "key";
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || "key";
module.exports = {
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
defaultNetwork: "hardhat",
networks: {
rinkeby: {
url: RINKBY_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
blockConfirmations:6,
},
localhost: {
url: "http://127.0.0.1:8545/",
chainId: 31337,
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: false,
outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
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
},
},
}; deploy-fundMe.js // function deployFunc(hre) {
// console.log("hiiii");
// }
// module.exports.default = deployFunc;
// module.exports = async (hre) => {
// const {getNamedAccounts,deployments} = hre
// }
const {
networkConfig,
developmentChains,
} = require("../helper-hardhat-config");
const { network } = require("hardhat");
const { verify } = require("../utils/verify");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chianId;
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"]; |
Beta Was this translation helpful? Give feedback.
Answered by
krakxn
Jul 15, 2022
Replies: 1 comment 6 replies
-
Delete this line: Inside fundMe: |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Delete this line:
const args = [ethUsdPriceFeedAddress];
Inside fundMe:
args: [ethUsdPriceFeedAddress],