Network.config.chainId Error in lesson 7 #6725
Unanswered
Nikzadkhan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
in the begging of lesson 7 when i deploy (yarn hardhat --tags mock ) i getting the netwok.config.chainId and network.name undefined , please help me
00-deploy-mock.js code:
const network = require("hardhat");
const {
DECIMALS,
INITIAL_ANSWER,
developmentChains,
} = require("../helper-hardhat-config");
console.log(DECIMALS, INITIAL_ANSWER);
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = await network.config.chainId;
console.log(chainId);
console.log("befor if stament");
if (developmentChains.includes(network.name)) {
log("local network is detected and contract is deploying ");
await deploy("MockV3Aggregator", {
contract: "MockV3Aggregator",
from: deployer,
log: true,
args: [DECIMALS, INITIAL_ANSWER],
});
log("Mocks is deployed Successfully!!");
log(
"____________________________________________________________________________"
);
}
console.log("after the if stament");
};
module.exports.tags = ["all", "mocks"];
helper.hardhat.config.js file code:
const { network } = require("hardhat");
const networkConfig = {
11155111: {
name: "sepolia",
ethUsdPriceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306",
},
};
const developmentChains = ["hardhat", "localhost"];
const DECIMALS = 8;
const INITIAL_ANSWER = 200000000000;
module.exports = {
networkConfig,
developmentChains,
DECIMALS,
INITIAL_ANSWER,
};
Beta Was this translation helpful? Give feedback.
All reactions