-
Notifications
You must be signed in to change notification settings - Fork 4
/
hardhat.config.ts
108 lines (101 loc) · 2.53 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
import { task, HardhatUserConfig } from 'hardhat/config'
import { NetworksUserConfig } from 'hardhat/types'
import '@nomiclabs/hardhat-etherscan'
import '@nomiclabs/hardhat-waffle'
import '@openzeppelin/hardhat-upgrades'
import 'hardhat-gas-reporter'
import 'hardhat-contract-sizer'
import config, { NetworkConfig } from './config'
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task('accounts', 'Prints the list of accounts', async (args, hre) => {
const accounts = await hre.ethers.getSigners()
for (const account of accounts) {
console.log(account.address)
}
})
const networks: NetworksUserConfig = {
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${config.ALCHEMY_MAINNET_KEY}`,
accounts: [`0x${config.MAINNET_PRIVATE_KEY}`],
gasPrice: 250000000000
},
rinkeby: {
url: `https://eth-rinkeby.alchemyapi.io/v2/${config.ALCHEMY_RINKEBY_KEY}`,
accounts: [`0x${config.RINKEBY_PRIVATE_KEY}`],
},
matic: {
url: `https://polygon-mainnet.g.alchemy.com/v2/${config.ALCHEMY_MATIC_KEY}`,
accounts: [`0x${config.MATIC_PRIVATE_KEY}`],
},
maticmum: {
url: `https://polygon-mumbai.g.alchemy.com/v2/${config.ALCHEMY_MUMBAI_KEY}`,
accounts: [`0x${config.MATIC_MUMBAI_PRIVATE_KEY}`],
},
}
const getNetworks = (config: NetworkConfig) => {
const networkName = config.NETWORK.toLowerCase()
const network = networks[networkName]
return {
hardhat: {},
...(network && { [networkName]: network }),
}
}
const hardhatConfig: HardhatUserConfig = {
defaultNetwork: 'hardhat',
networks: getNetworks(config),
etherscan: {
apiKey: config.ETHERSCAN_API_KEY,
},
solidity: {
compilers: [{
version: "0.8.6", settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
},
{
version: "0.8.4", settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
},
{
version: "0.8.0", settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
},
{
version: "0.6.12", settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
}, {
version: "0.6.6", settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
}],
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
gasReporter: {
currency: 'USD',
gasPrice: 50,
},
}
export default hardhatConfig