-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhardhat.config.js
80 lines (74 loc) · 1.64 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
const {
has,
assoc,
} = require('ramda')
const {
ENDPOINT_ENV_VAR_KEY,
ETHERSCAN_ENV_VAR_KEY
} = require('./lib/constants')
require('hardhat-erc1820')
require('@nomiclabs/hardhat-web3')
require('@nomiclabs/hardhat-waffle')
require('@nomiclabs/hardhat-etherscan')
require('@openzeppelin/hardhat-upgrades')
const SUPPORTED_NETWORKS = [
'fantom',
'polygon',
'rinkeby',
'ropsten',
'bscMainnet',
'ambrosTestnet',
'arbitrum',
'ethMainnet',
'goerli',
'sepolia',
]
const getAllSupportedNetworks = _ => {
if (!has(ENDPOINT_ENV_VAR_KEY, process.env)) {
let errorMsg = `✘ No '${
ENDPOINT_ENV_VAR_KEY
}' environment variable found! Please provide one! (See 'README.md' for more details)`
throw new Error(errorMsg)
} else {
return SUPPORTED_NETWORKS.reduce((_acc, _network) =>
assoc(_network, { url: process.env[ENDPOINT_ENV_VAR_KEY] }, _acc), {}
)
}
}
const addLocalNetwork = _allSupportedNetworks =>
assoc('localhost', { url: 'http://localhost:8545' }, _allSupportedNetworks)
const getAllNetworks = _ =>
addLocalNetwork(getAllSupportedNetworks())
module.exports = {
networks: getAllNetworks(),
solidity: {
compilers: [
{
version: '0.6.2',
settings: {
optimizer: {
runs: 200,
enabled: true,
}
}
},
{
version: '0.4.18',
settings: {
optimizer: {
runs: 200,
enabled: true,
}
}
},
],
overrides: {
'contracts/wEth.sol': {
version: '0.4.18',
}
}
},
etherscan: {
apiKey: process.env[ETHERSCAN_ENV_VAR_KEY]
},
}