forked from aave/aave-v3-core
-
Notifications
You must be signed in to change notification settings - Fork 2
/
helper-hardhat-config.ts
37 lines (31 loc) · 1.21 KB
/
helper-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
// @ts-ignore
import { HardhatNetworkForkingUserConfig, HardhatUserConfig } from 'hardhat/types';
import { eEthereumNetwork, iParamsPerNetwork } from './helpers/types';
require('dotenv').config();
const FORK = process.env.FORK || '';
const FORK_BLOCK_NUMBER = process.env.FORK_BLOCK_NUMBER
? parseInt(process.env.FORK_BLOCK_NUMBER)
: 0;
const GWEI = 1000 * 1000 * 1000;
export const buildForkConfig = (): HardhatNetworkForkingUserConfig | undefined => {
let forkMode: HardhatNetworkForkingUserConfig | undefined;
if (FORK) {
forkMode = {
url: NETWORKS_RPC_URL[FORK as eEthereumNetwork],
};
if (FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK as eEthereumNetwork]) {
forkMode.blockNumber = FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK as eEthereumNetwork];
}
}
return forkMode;
};
export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
[eEthereumNetwork.coverage]: 'http://localhost:8555',
[eEthereumNetwork.hardhat]: 'http://localhost:8545',
[eEthereumNetwork.rollux]: `https://rpc.rollux.com`,
};
export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
[eEthereumNetwork.rollux]: undefined,
[eEthereumNetwork.coverage]: undefined,
[eEthereumNetwork.hardhat]: undefined,
};