This repository has been archived by the owner on Nov 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
hardhat.config.ts
124 lines (120 loc) · 3.19 KB
/
hardhat.config.ts
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import 'dotenv/config';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@typechain/hardhat';
import '@typechain/hardhat/dist/type-extensions';
import { removeConsoleLog } from 'hardhat-preprocessor';
import 'hardhat-gas-reporter';
import 'hardhat-deploy';
import 'solidity-coverage';
import { HardhatUserConfig, MultiSolcUserConfig, NetworksUserConfig } from 'hardhat/types';
import { DEFAULT_ACCOUNT, getNodeUrl } from './utils/network';
import 'tsconfig-paths/register';
import kms from './tools/kms';
const networks: NetworksUserConfig = process.env.TEST
? {}
: {
hardhat: {
forking: {
enabled: process.env.FORK ? true : false,
url: getNodeUrl('mainnet'),
},
},
localhost: {
url: getNodeUrl('localhost'),
live: false,
accounts: kms.decryptSeveralSync([(process.env.LOCAL_PRIVATE_KEY as string) || DEFAULT_ACCOUNT]),
tags: ['local'],
},
mainnet: {
url: getNodeUrl('mainnet'),
accounts: kms.decryptSeveralSync([(process.env.MAINNET_PRIVATE_KEY as string) || DEFAULT_ACCOUNT]),
tags: ['production'],
},
rinkeby: {
url: getNodeUrl('rinkeby'),
accounts: kms.decryptSeveralSync([(process.env.RINKEBY_PRIVATE_KEY as string) || DEFAULT_ACCOUNT]),
tags: ['production'],
},
polygon: {
url: getNodeUrl('polygon'),
accounts: kms.decryptSeveralSync([(process.env.POLYGON_PRIVATE_KEY as string) || DEFAULT_ACCOUNT]),
tags: ['production'],
},
ftm: {
url: getNodeUrl('ftm'),
accounts: kms.decryptSeveralSync([(process.env.FTM_PRIVATE_KEY as string) || DEFAULT_ACCOUNT]),
tags: ['production'],
},
};
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
mocha: {
timeout: process.env.MOCHA_TIMEOUT || 300000,
},
networks,
solidity: {
compilers: [
{
version: '0.8.9',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.8.4',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.5.17',
},
],
},
gasReporter: {
currency: process.env.COINMARKETCAP_DEFAULT_CURRENCY || 'USD',
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
enabled: true,
outputFile: 'gasReporterOutput.json',
},
preprocess: {
eachLine: removeConsoleLog((hre) => hre.network.name !== 'hardhat'),
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
typechain: {
outDir: 'typechained',
target: 'ethers-v5',
},
};
if (process.env.TEST) {
(config.solidity as MultiSolcUserConfig).compilers = (config.solidity as MultiSolcUserConfig).compilers.map((compiler) => {
return {
...compiler,
outputSelection: {
'*': {
'*': ['storageLayout'],
},
},
};
});
}
export default config;