forked from forta-network/forta-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.js
More file actions
62 lines (58 loc) · 2 KB
/
Copy pathhardhat.config.js
File metadata and controls
62 lines (58 loc) · 2 KB
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
require('dotenv/config');
require('@nomiclabs/hardhat-ethers');
require('@nomiclabs/hardhat-waffle');
require('@nomiclabs/hardhat-etherscan');
require('solidity-coverage');
require('solidity-docgen');
require('hardhat-gas-reporter');
require('@openzeppelin/hardhat-upgrades');
require('@openzeppelin/hardhat-defender');
const { relative } = require('path');
const argv = require('yargs/yargs')().env('').argv;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: '0.8.9',
settings: {
optimizer: {
enabled: true,
runs: 999,
},
},
},
],
},
networks: { hardhat: {} },
mocha: {
timeout: 300000,
},
etherscan: {
apiKey: argv.etherscan ?? argv.polyscan,
},
defender: {
apiKey: process.env.DEFENDER_API_KEY,
apiSecret: process.env.DEFENDER_API_SECRET,
},
gasReporter: {
currency: 'USD',
coinmarketcap: argv.coinmarketcap,
},
docgen: {
pages: (item, file) => (file.absolutePath.startsWith('contracts') ? relative('contracts', file.absolutePath).replace('.sol', '.md') : undefined),
},
};
const accountsForNetwork = (name) => [argv[`${name}Mnemonic`] && { mnemonic: argv[`${name}Mnemonic`] }, argv[`${name}PrivateKey`] && [argv[`${name}PrivateKey`]]].find(Boolean);
Object.assign(
module.exports.networks,
Object.fromEntries(
['mainnet', 'ropsten', 'rinkeby', 'goerli', 'kovan', 'polygon', 'mumbai', 'local']
.map((name) => [name, { url: argv[`${name}Node`], accounts: accountsForNetwork(name) }])
.filter(([, { url }]) => url)
),
argv.slow && { hardhat: { mining: { auto: false, interval: [3000, 6000] } } }, // Simulate a slow chain locally
argv.fork && { hardhat: { forking: { url: argv.forkNode, block: argv.blockNumber } } } // Simulate a mainnet fork
);