-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.ts
103 lines (97 loc) · 2.58 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
import '@nomiclabs/hardhat-etherscan'
import '@nomiclabs/hardhat-waffle'
import '@typechain/hardhat'
import 'dotenv/config'
// eslint-disable-next-line unicorn/prefer-node-protocol
import fs from 'fs'
import 'hardhat-gas-reporter'
import 'hardhat-log-remover'
import 'hardhat-preprocessor'
import { HardhatUserConfig } from 'hardhat/config'
import { accounts } from './utils/accounts'
/* eslint-disable unicorn/prefer-regexp-test */
function getRemappings() {
return fs
.readFileSync('remappings.txt', 'utf8')
.split('\n')
.filter(Boolean)
.map(line => line.trim().split('='))
}
// task("example", "Example task").setAction(example);
const secret = process.env.PRIVATE_KEY as string
const config: HardhatUserConfig = {
solidity: {
version: '0.8.13',
settings: {
optimizer: {
enabled: true,
runs: 200
},
metadata: {
bytecodeHash: 'none'
},
outputSelection: {
'*': {
'*': ['storageLayout']
}
}
}
},
paths: {
sources: './src', // Use ./src rather than ./contracts as Hardhat expects
cache: './cache_hardhat' // Use a different cache for Hardhat than Foundry
},
// This fully resolves paths for imports in the ./lib directory for Hardhat
preprocess: {
eachLine: () => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [find, replace] of getRemappings()) {
if (line.match(find)) {
line = line.replace(find, replace)
}
}
}
return line
}
})
},
networks: {
hardhat: {
accounts,
forking: {
enabled: !!process.env.FORK,
url: process.env.MAINNET_HTTPS_URL as string
},
blockGasLimit: 30_000_000
},
savings_vault: {
url: 'https://chain.frp.phuture.finance/',
timeout: 100_000_000
},
ropsten: {
url: `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts: [secret]
},
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts: [secret]
},
local: {
url: 'http://127.0.0.1:8545'
}
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: process.env.ETHERSCAN_API_KEY as string
},
gasReporter: {
enabled: !!process.env.REPORT_GAS,
token: process.env.GAS_TOKEN,
gasPriceApi: process.env.GAS_PRICE_API,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
currency: process.env.COINMARKETCAP_DEFAULT_CURRENCY
}
}
export default config