-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.js
More file actions
31 lines (27 loc) · 837 Bytes
/
hardhat.config.js
File metadata and controls
31 lines (27 loc) · 837 Bytes
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
const {
FORK_RPC_URL, FORK_BLOCK_NUMBER, ACCOUNT_PK, CHAIN_ID,
} = process.env
const HardhatConfig = {
solidity: "0.8.9",
networks: {
hardhat: {}
}
}
function addConfig(rootConfig, config, value) {
if (HardhatConfig.networks.hardhat[rootConfig]) {
HardhatConfig.networks.hardhat[rootConfig][config] = value
} else {
HardhatConfig.networks.hardhat[rootConfig] = {}
HardhatConfig.networks.hardhat[rootConfig][config] = value
}
}
if (FORK_RPC_URL)
addConfig('forking', 'url', FORK_RPC_URL)
if (FORK_BLOCK_NUMBER)
addConfig('forking', 'blockNumber', Number(FORK_BLOCK_NUMBER))
if (ACCOUNT_PK)
addConfig('forking', 'accounts', [ACCOUNT_PK])
if (CHAIN_ID)
HardhatConfig.networks.hardhat.chainId = Number(CHAIN_ID)
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = HardhatConfig