forked from CodeforDAO/contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.js
84 lines (73 loc) · 2.43 KB
/
hardhat.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require('dotenv').config();
const { removeConsoleLog } = require('hardhat-preprocessor');
const { prepareNetworkConfigs } = require('./utils/configs');
require('@nomiclabs/hardhat-waffle');
require('@nomiclabs/hardhat-ethers');
require('@nomiclabs/hardhat-etherscan');
require('hardhat-deploy');
require('hardhat-gas-reporter');
require('solidity-coverage');
require('@tenderly/hardhat-tenderly');
/**
* @type import('hardhat/config').HardhatUserConfig
*/
function prepareHardhatConfigs() {
// The hardhat config object will be returned.
const config = {
networks: prepareNetworkConfigs(['mainnet', 'rinkeby', 'kovan', 'ropsten', 'goerli']),
solidity: {
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
// Named accounts for plugin `hardhat-deploy`
namedAccounts: {
deployer: 0,
},
// Rewrite the `./test` folder to `./tests`
paths: {
tests: './tests',
},
// Remove console.log when deploying to public networks
preprocess: {
eachLine: removeConsoleLog(
(hre) => hre.network.name !== 'hardhat' && hre.network.name !== 'localhost'
),
},
/**
* gas reporter configuration that let's you know
* an estimate of gas for contract deployments and function calls
* More here: https://www.npmjs.com/package/hardhat-gas-reporter
*/
gasReporter: {
currency: 'USD',
gasPrice: 50,
enabled: !!process.env.REPORT_GAS,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
maxMethodDiff: 10,
},
};
// Hardhat plugin for integration with Tenderly.
// This plugin adds `tenderly:verify` task and `tenderly:push` task to Hardhat.
// To use this plugin, you will need to exec `tenderly login` first on the `tenderly-cli`
// More here: https://www.npmjs.com/package/@tenderly/hardhat-tenderly
if (process.env.TENDERLY_PROJECT_ID && process.env.TENDERLY_USERNAME) {
config.tenderly = {
project: process.env.TENDERLY_PROJECT_ID,
username: process.env.TENDERLY_USERNAME,
};
}
// Hardhat plugin for integration with Etherscan's contract verification service.
// Provides the verify task, which allows you to verify contracts through Etherscan's service.
if (process.env.ETHERSCAN_API_KEY) {
config.etherscan = {
apiKey: process.env.ETHERSCAN_API_KEY,
};
}
return config;
}
module.exports = prepareHardhatConfigs();