This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathhardhat.config.ts
79 lines (73 loc) · 1.98 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
// Load the configuration from the .env file.
import 'dotenv/config';
// Load the hardhat plugins.
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-solhint';
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import 'solidity-coverage';
import type { HardhatUserConfig } from 'hardhat/types';
function node(networkName: string) {
const fallback = 'http://localhost:8545';
const uppercase = networkName.toUpperCase();
const uri = process.env[`ETHEREUM_NODE_${uppercase}`] || process.env.ETHEREUM_NODE || fallback;
return uri.replace('{{NETWORK}}', networkName);
}
function accounts(networkName: string) {
const uppercase = networkName.toUpperCase();
const accounts = process.env[`ETHEREUM_ACCOUNTS_${uppercase}`] || process.env.ETHEREUM_ACCOUNTS || '';
return accounts
.split(',')
.map((account) => account.trim())
.filter(Boolean);
}
if (!process.env.ETHEREUM_NODE_MAINNET) {
console.warn('WARNING: Missing "ETHEREUM_NODE_MAINNET" environment parameter. Forking disabled.');
}
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
mocha: {
timeout: 60000,
},
networks: {
hardhat: {
accounts: {
mnemonic: 'test test test test test test test test test test test junk',
},
forking: {
blockNumber: 13230834,
enabled: !!process.env.ETHEREUM_NODE_MAINNET,
url: process.env.ETHEREUM_NODE_MAINNET ?? '',
},
},
kovan: {
accounts: accounts('kovan'),
url: node('kovan'),
},
mainnet: {
accounts: accounts('mainnet'),
url: node('mainnet'),
},
rinkeby: {
accounts: accounts('rinkeby'),
url: node('rinkeby'),
},
},
solidity: {
settings: {
optimizer: {
details: {
yul: false,
},
enabled: true,
runs: 200,
},
},
version: '0.6.12',
},
};
export default config;