Lesson15 verify issues, Nothing to compile NomicLabsHardhatPluginError & Connect Timeout Error #4961
Answered
by
alymurtazamemon
EightMilesZhangjx
asked this question in
Q&A
-
I encounter the issues while I run the command "yarn hardhat deploy --network goerli", I tried many times to resolve it but failed. I hope if somebody can find the reason. I have reset the VPN but seems failed again: require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
require("hardhat-deploy")
// 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 GOERLI_RPC_URL =
process.env.GOERLI_RPC_URL || "https://eth-goerli.alchemyapi.io/v2/your-api-key"
const PRIVATE_KEY = process.env.PRIVATE_KEY || ""
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ""
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
// gasPrice: 130000000000,
},
goerli: {
url: GOERLI_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 5,
blockConfirmations: 6,
},
/**
mainnet: {
url: process.env.MAINNET_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 1,
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
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
},
},
mocha: {
timeout: 200000, // 200 seconds max for running tests
},
} File<helper-hardhat-config.js> : const networkConfig = {
31337: {
name: "localhost",
ethUsdPriceFeed: "0x9326BFA02ADD2366b30bacB125260Af641031331",
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc", // 30 gwei
mintFee: "100000000", // 0.01 ETH
callbackGasLimit: "5000000", // 500,000 gas
},
// Price Feed Address, values can be obtained at https://docs.chain.link/docs/reference-contracts
5: {
name: "goerli",
ethUsdPriceFeed: "0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e",
vrfCoordinatorV2: "0x2Ca8E0C643bDe4C2E08ab1fA0da3401AdAD7734D",
gasLane: "0x79d3d8832d904592c0bf9818b621522c988bb8b0c05cdc3b15aea1b6e8db0c15",
callbackGasLimit: "5000000", // 500,000 gas
mintFee: "100000000", // 0.01 ETH
subscriptionId: "1002", // add your ID here!
},
}
const DECIMALS = "18"
const INITIAL_PRICE = "200000000000000000000"
const developmentChains = ["hardhat", "localhost"]
module.exports = {
networkConfig,
developmentChains,
DECIMALS,
INITIAL_PRICE,
} File<01-deploy-nft-marketplace.js>: const { network } = require("hardhat")
const { developmentChains, VERIFICATION_BLOCK_CONFIRMATIONS } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const waitBlockConfirmations = developmentChains.includes(network.name)
? 1
: VERIFICATION_BLOCK_CONFIRMATIONS
log("----------------------------------------------------")
const arguments = []
const nftMarketplace = await deploy("NftMarketPlace", {
from: deployer,
args: arguments,
log: true,
waitConfirmations: waitBlockConfirmations,
})
// Verify the deployment
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(nftMarketplace.address, arguments)
}
log("----------------------------------------------------")
}
module.exports.tags = ["all", "nftmarketplace"]`
<Files:02-deploy-basec-nft.js> `const { network } = require("hardhat")
const { developmentChains, VERIFICATION_BLOCK_CONFIRMATIONS } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const waitBlockConfirmations = developmentChains.includes(network.name)
? 1
: VERIFICATION_BLOCK_CONFIRMATIONS
log("----------------------------------------------------")
const arguments = []
const nftMarketplace = await deploy("NftMarketPlace", {
from: deployer,
args: arguments,
log: true,
waitConfirmations: waitBlockConfirmations,
})
// Verify the deployment
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(nftMarketplace.address, arguments)
}
log("----------------------------------------------------")
}
module.exports.tags = ["all", "nftmarketplace"] |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Mar 1, 2023
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
@EightMilesZhangjx Try it after some time and make sure your internet connection is stable. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@EightMilesZhangjx Try it after some time and make sure your internet connection is stable.