Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hardhat.config.js
// hardhat.config.js
require("dotenv/config")
require("@nomiclabs/hardhat-etherscan")
require("@nomiclabs/hardhat-solhint")
// require("@nomiclabs/hardhat-solpp")
require("@tenderly/hardhat-tenderly")
require("@nomiclabs/hardhat-waffle")
require("hardhat-abi-exporter")
require("hardhat-deploy")
require("hardhat-deploy-ethers")
require("hardhat-gas-reporter")
require("hardhat-spdx-license-identifier")
require("hardhat-watcher")
require("solidity-coverage")
const { task } = require("hardhat/config")
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (args, hre) => {
const accounts = await hre.ethers.getSigners()
for (const account of accounts) {
console.log(account.address)
}
})
const { removeConsoleLog } = require("hardhat-preprocessor")
const accounts = {
mnemonic: process.env.MNEMONIC || "test test test test test test test test test test test junk",
accountsBalance: "990000000000000000000",
}
module.exports = {
abiExporter: {
path: "./build/abi",
//clear: true,
flat: true,
// only: [],
// except: []
},
defaultNetwork: "hardhat",
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: process.env.ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: process.env.REPORT_GAS ? true : false,
currency: "USD",
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
excludeContracts: ["contracts/mocks/", "contracts/libraries/"],
},
hardhat: {
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_API_KEY}`,
},
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
blockGasLimit: 0x1fffffffffffff,
chainId: 31337,
accounts,
},
ropsten: {
url: `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts,
chainId: 3,
live: true,
saveDeployments: true,
},
kovan: {
url: `https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts,
chainId: 42,
live: true,
saveDeployments: true,
},
},
preprocess: {
eachLine: removeConsoleLog(bre => bre.network.name !== "hardhat" && bre.network.name !== "localhost"),
},
solidity: {
version: "0.6.12",
settings: {
optimizer: {
enabled: true,
runs: 5000,
},
},
},
spdxLicenseIdentifier: {
overwrite: false,
runOnCompile: true,
},
tenderly: {
project: process.env.TENDERLY_PROJECT,
username: process.env.TENDERLY_USERNAME,
},
watcher: {
compile: {
tasks: ["compile"],
files: ["./contracts"],
verbose: true,
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment