Lesson 7( little logging out issue) #3264
-
Hi I am on lesson 7 at 10:52:50 this is my code for 01-fund-me-deploy.js const { networkConfig } = require("../helper-hardhat-config")
const { network } = require("hardhat")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = getNamedAccounts
const chainId = network.config.chainId
//if ChainId is X use address y
// if chainId is Z use addrs A
// const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
let etethUsdPriceFeedAddress
if (developmentChains.includes(network.name)) {
const ethUsdAggregator = await deployments.wait("MockV3Aggregator")
etethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
//if a contract doesnt exist we deploy a minimal version of
// for our local testing
//when going to a localhost or a hardhat network we use a mock
//well what happens when we want to change chains?
const FundMe = await deploy("FundMe", {
from: deployer,
args: [
etethUsdPriceFeedAddress,
/*address*/
], // put a price feed address
log: true,
})
log("------------------------------------------------")
}
module.exports.tags = ["all", "fundme"] This is my code for 00-deploy-mocks-js const { network } = require("hardhat")
const {
developmentChains,
DECIMALS,
INITIAL_ANSWER,
} = require("../helper-hardhat-config")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = getNamedAccounts
const chainId = network.config.chainId
if (developmentChains.includes(network.name)) {
log("Local network detected! Deploying mocks...")
await deploy("MockV3Aggregator", {
contract: "MockV3Aggregator",
from: deployer,
log: true,
args: [DECIMALS, INITILA_ANSWER],
})
console.log("Mocks deployed")
log("-------------------------------------")
}
}
module.exports.tags = ["all", "mocks"] This is my helper-hardhat-config.js const networkConfig = {
5: {
names: "goerli",
ethUsdPriceFeed: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
},
137: {
name: "polygon",
ethUsdPriceFeed: "0xF9680D99D6C9589e2a93a78A04A279e509205945",
},
//31337
}
const developmentChains = ["hardhat", "localhost"]
const DECIMALS = 8
const INITIAL_ANSWER = 200000000000
module.exports = {
networkConfig,
DECIMALS,
INITIAL_ANSWER,
developmentChains,
} and this is what the console logs out
I Have seen a similar discussion but my code has no such spelling mistakes |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
@NeoRusi |
Beta Was this translation helpful? Give feedback.
@NeoRusi
compile
command just compile and it is showing nothing to compile means your code is already compiled. You will see logs when you deploy your deploy scripts.