Section 7: Nothing logs when I deploy contract or mock #1101
-
Hi when I run "yarn hardhat deploy --mocks" on the command line, the only output I see is Nothing to compile
✨ Done in 5.38s. This is my 00-deploy-mocks.js file which completely follows the video const { network } = require("hardhat")
const {
developmentChains,
DECIMALS,
INITIAL_ANSWER
} = require("../helper-hardhat-config")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
// This is the set up to deploy something/contracts
if (developmentChains.includes(network.name)) {
log("Local Netowkr detected! Deploying mocks.....")
await deploy("MockV3Aggregator", {
contract: "MockV3Aggregator",
from: deployer,
log: true,
args: [DECIMALS, INITIAL_ANSWER]
})
log("Mocks Deployed!")
log("-------------------------------------------------------------")
}
}
module.exports.tags = ["all", "mocks"] This is my hardhat.config file, which I copied pasted from the repo. // require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
require("hardhat-deploy")
require("@nomiclabs/hardhat-ethers")
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || ""
const KOVAN_RPC_URL =
process.env.KOVAN_RPC_URL ||
"https://eth-mainnet.alchemyapi.io/v2/your-api-key"
const RINKEBY_RPC_URL =
process.env.RINKEBY_RPC_URL ||
"https://eth-mainnet.alchemyapi.io/v2/your-api-key"
const PRIVATE_KEY =
process.env.PRIVATE_KEY ||
"0x11ee3108a03081fe260ecdc106554d09d9d1209bcafd46942b10e02943effc4a"
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ""
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
// gasPrice: 130000000000,
},
kovan: {
url: KOVAN_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 42,
blockConfirmations: 6,
gas: 6000000,
},
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
blockConfirmations: 6,
},
},
solidity: {
compilers: [
{
version: "0.8.8",
},
{
version: "0.6.6",
},
],
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: true,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
// coinmarketcap: COINMARKETCAP_API_KEY,
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
4: 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
},
},
} I hope this is detailed information or I hope someone else experienced this issue and can help because I'm very confused why logging isn't working. Console.log doesn't work either |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 17 replies
-
Probably You didn't mentioned --tags. First run this: And then: I hope this works |
Beta Was this translation helpful? Give feedback.
-
@popoviciyoel Add a console.log("Any message") after chainId and show the terminal. |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue and have done everything and cannot find any solution to this problem. Please guide me on this. |
Beta Was this translation helpful? Give feedback.
@popoviciyoel Add a console.log("Any message") after chainId and show the terminal.