forked from yieldprotocol/yield-utils-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
114 lines (107 loc) · 2.33 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
109
110
111
112
113
114
import * as fs from 'fs'
import * as path from 'path'
import '@nomiclabs/hardhat-waffle'
import '@nomiclabs/hardhat-etherscan'
import 'hardhat-abi-exporter'
import 'hardhat-contract-sizer'
import 'hardhat-gas-reporter'
import 'hardhat-typechain'
import 'solidity-coverage'
import 'hardhat-deploy'
// REQUIRED TO ENSURE METADATA IS SAVED IN DEPLOYMENTS (because solidity-coverage disable it otherwise)
/* import {
TASK_COMPILE_GET_COMPILER_INPUT
} from "hardhat/builtin-tasks/task-names"
task(TASK_COMPILE_GET_COMPILER_INPUT).setAction(async (_, bre, runSuper) => {
const input = await runSuper()
input.settings.metadata.useLiteralContent = bre.network.name !== "coverage"
return input
}) */
function nodeUrl(network: any) {
let infuraKey
try {
infuraKey = fs.readFileSync(path.resolve(__dirname, '.infuraKey')).toString().trim()
} catch(e) {
infuraKey = ''
}
return `https://${network}.infura.io/v3/${infuraKey}`
}
let mnemonic = process.env.MNEMONIC
if (!mnemonic) {
try {
mnemonic = fs.readFileSync(path.resolve(__dirname, '.secret')).toString().trim()
} catch(e){}
}
const accounts = mnemonic ? {
mnemonic,
}: undefined
let etherscanKey = process.env.ETHERSCANKEY
if (!etherscanKey) {
try {
etherscanKey = fs.readFileSync(path.resolve(__dirname, '.etherscanKey')).toString().trim()
} catch(e){}
}
module.exports = {
solidity: {
version: '0.8.1',
settings: {
optimizer: {
enabled: true,
runs: 20000,
}
}
},
typechain: {
outDir: 'typechain',
target: 'ethers-v5',
},
abiExporter: {
path: './abi',
clear: true,
flat: true,
// only: [':ERC20$'],
spacing: 2
},
contractSizer: {
alphaSort: true,
runOnCompile: false,
disambiguatePaths: false,
},
gasReporter: {
enabled: true,
},
defaultNetwork: 'hardhat',
namedAccounts: {
deployer: 0,
owner: 1,
other: 2,
},
networks: {
kovan: {
accounts,
url: nodeUrl('kovan')
},
goerli: {
accounts,
url: nodeUrl('goerli'),
},
rinkeby: {
accounts,
url: nodeUrl('rinkeby')
},
ropsten: {
accounts,
url: nodeUrl('ropsten')
},
mainnet: {
accounts,
url: nodeUrl('mainnet')
},
coverage: {
url: 'http://127.0.0.1:8555',
},
},
etherscan: {
apiKey: etherscanKey
},
}