Lesson:7 yarn hardhat deploy returns nothing to compile #911
-
hardhat deploy Below are by codes
const { networkConfig } = require("../helper-hardhat-config")
const { network } = require("hardhat")
const { developmentChains } = require("../../helper-hardhat-config")
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("MocksV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
const fundMe = await deploy("FundMe", {
from: deployer,
args: [ethUsdPriceFeedAddress], // put price feed address
log: true,
})
log("....................")
}
module.exports.tags = ["all","fundme"]
const networkConfig = {
4: {
name: "rinkeby",
ethUsdPriceFeed:"0x8A753747A1Fa494EC906cE90E9f37563A8AF630e",
s
},
137 : {
name: "polygon",
ethUsdPriceFeed: "0xF9680D99D6C9589e2a93a78A04A279e509205945",
},
}
const developmentChains = ["hardhat", "localhost"] //here we are using names not chainId
const DECIMALS = 8
const INITIAL_ANSWER = 200000000000 //2000*10**8
module.exports = {
networkConfig,
developmentChains,
DECIMALS,
INITIAL_ANSWER,
} |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jul 12, 2022
Replies: 1 comment 29 replies
-
@Maakai123 There are a couple of issues here: resolve all of these.
const { networkConfig } = require("../helper-hardhat-config")
const { developmentChains } = require("../../helper-hardhat-config") here the same file comes from different paths, verify it.
- const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
+ ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
const fundMe = await deploy("FundMe", {
from: deployer,
args: [ethUsdPriceFeedAddress], // put price feed address
log: true,
waitConfirmations: network.config.blockConfirmations || 1, // here
}) and make sure to add waitConfirmation to the network (Rinkeby or any else) also. rinkeby: {
...
blockConfirmations: 6,
}, |
Beta Was this translation helpful? Give feedback.
29 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Maakai123 There are a couple of issues here: resolve all of these.
helper-hardhat-config.js
is at the root level.here the same file comes from different paths, verify it.