-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhardhat.config.ts
98 lines (89 loc) · 2.11 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
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-web3'
import '@nomiclabs/hardhat-waffle'
import 'hardhat-typechain'
// deployment plugins
import 'hardhat-deploy'
import 'hardhat-deploy-ethers'
import '@openzeppelin/hardhat-upgrades'
// Tools
import 'hardhat-gas-reporter'
import 'solidity-coverage'
import '@nomiclabs/hardhat-etherscan'
import { HardhatUserConfig } from 'hardhat/types'
import dotenv from 'dotenv'
import path from 'path'
import fs from 'fs'
dotenv.config()
const PRIVATE_KEY = process.env.PRIVATE_KEY
const MAINNET_RPC = process.env.MAINNET_RPC || ""
const ARBITRUM_RPC = process.env.ARBITRUM_RPC || ""
const GOERLI_RPC = process.env.GOERLI_RPC || ""
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
const ARBISCAN_API_KEY = process.env.ARBISCAN_API_KEY
function loadTasks() {
const tasksPath = path.join(__dirname, 'tasks')
fs.readdirSync(tasksPath).forEach(task => {
require(`${tasksPath}/${task}`)
})
}
if (
fs.existsSync(path.join(__dirname, 'artifacts')) &&
fs.existsSync(path.join(__dirname, 'typechain'))
) {
loadTasks()
}
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.4',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
]
},
namedAccounts: {
deployer: 0
},
defaultNetwork: 'hardhat',
networks: {
hardhat: {
allowUnlimitedContractSize: true,
blockGasLimit: 12000000
},
mainnet: {
url: MAINNET_RPC,
accounts: PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : undefined
},
goerli: {
url: GOERLI_RPC,
accounts: PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : undefined
},
arbitrum: {
url: ARBITRUM_RPC,
accounts: PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : undefined
},
localhost: {
url: 'http://127.0.0.1:8545'
}
},
gasReporter: {
enabled: !!(process.env.REPORT_GAS)
},
mocha: {
timeout: 200000
},
etherscan: {
apiKey: {
mainnet: ETHERSCAN_API_KEY,
goerli: ETHERSCAN_API_KEY,
arbitrumOne: ARBISCAN_API_KEY
}
}
}
export default config