-
Notifications
You must be signed in to change notification settings - Fork 390
/
hardhat.config.ts
95 lines (82 loc) · 2.28 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
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import fs from 'fs';
import 'hardhat-contract-sizer';
import { HardhatUserConfig } from 'hardhat/config';
import path from 'path';
import 'solidity-coverage';
const configPath = path.join(__dirname, '/config.json');
const configFile = fs.existsSync(configPath) ? JSON.parse(fs.readFileSync(configPath, 'utf8')) : {};
const loadAPIKey = (apiKeyName: string) => {
return configFile.apiKeys ? (configFile.apiKeys[apiKeyName] ? configFile.apiKeys[apiKeyName] : '') : '';
};
// Casting to unknown assume the good type is provided
const loadENVKey = <T>(envKeyName: string) => {
return process.env[envKeyName] as unknown as T;
};
const configNetworks = configFile.networks || {};
const config: HardhatUserConfig = {
networks: {
hardhat: {
gasPrice: 20000000000,
gas: 9500000,
accounts: {
count: 10,
accountsBalance: '10000000000000000000000000000'
},
allowUnlimitedContractSize: true
},
mainnet: {
url: ''
},
...configNetworks
},
typechain: {
outDir: 'typechain',
target: 'ethers-v5'
},
solidity: {
compilers: [
{
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 200
},
metadata: {
bytecodeHash: 'none'
}
}
},
{
version: '0.8.13',
settings: {
optimizer: {
enabled: true,
runs: 200
},
metadata: {
bytecodeHash: 'none'
}
}
}
]
},
contractSizer: {
alphaSort: true,
runOnCompile: false,
disambiguatePaths: false
},
mocha: {
timeout: 600000,
color: true,
bail: loadENVKey('BAIL')
},
etherscan: {
apiKey: ''
}
};
export default config;