-
Notifications
You must be signed in to change notification settings - Fork 11
/
hardhat.config.ts
59 lines (52 loc) · 1.47 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
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
import '@nomicfoundation/hardhat-foundry'
import dotenv from 'dotenv'
dotenv.config()
import { SolidityUserConfig } from 'hardhat/types'
import toml from 'toml'
import fs from 'fs'
const config: HardhatUserConfig = {
solidity: getSolidityConfigFromFoundryToml(
process.env.FOUNDRY_PROFILE || 'default'
),
networks: {
fork: {
url: process.env.FORK_URL || 'http://localhost:8545',
},
arb1: {
url: 'https://arb1.arbitrum.io/rpc',
},
mainnet: {
url: 'https://mainnet.infura.io/v3/' + process.env['INFURA_KEY'],
},
sepolia: {
url: 'https://sepolia.infura.io/v3/' + process.env['INFURA_KEY'],
},
arbSepolia: {
url: 'https://sepolia-rollup.arbitrum.io/rpc',
},
nova: {
url: 'https://nova.arbitrum.io/rpc',
},
holesky: {
url: 'https://1rpc.io/holesky',
},
},
}
function getSolidityConfigFromFoundryToml(profile: string): SolidityUserConfig {
const data = toml.parse(fs.readFileSync('foundry.toml', 'utf-8'))
const defaultConfig = data.profile['default']
const profileConfig = data.profile[profile || 'default']
const solidity = {
version: profileConfig?.solc_version || defaultConfig.solc_version,
settings: {
optimizer: {
enabled: true,
runs: profileConfig?.optimizer_runs || defaultConfig.optimizer_runs,
},
},
}
return solidity
}
export default config