2021-02-22 08:59:21 +00:00
|
|
|
// @ts-ignore
|
2021-05-14 12:47:19 +00:00
|
|
|
import { HardhatNetworkForkingUserConfig, HardhatUserConfig } from 'hardhat/types';
|
2021-03-02 16:21:04 +00:00
|
|
|
import {
|
2021-07-16 08:46:07 +00:00
|
|
|
eAvalancheNetwork,
|
2021-03-02 16:21:04 +00:00
|
|
|
eEthereumNetwork,
|
|
|
|
ePolygonNetwork,
|
|
|
|
eXDaiNetwork,
|
|
|
|
iParamsPerNetwork,
|
|
|
|
} from './helpers/types';
|
2021-02-22 08:59:21 +00:00
|
|
|
|
|
|
|
require('dotenv').config();
|
|
|
|
|
|
|
|
const INFURA_KEY = process.env.INFURA_KEY || '';
|
|
|
|
const ALCHEMY_KEY = process.env.ALCHEMY_KEY || '';
|
2021-03-02 16:21:04 +00:00
|
|
|
const TENDERLY_FORK_ID = process.env.TENDERLY_FORK_ID || '';
|
2021-05-14 12:47:19 +00:00
|
|
|
const FORK = process.env.FORK || '';
|
|
|
|
const FORK_BLOCK_NUMBER = process.env.FORK_BLOCK_NUMBER
|
|
|
|
? parseInt(process.env.FORK_BLOCK_NUMBER)
|
|
|
|
: 0;
|
2021-02-22 08:59:21 +00:00
|
|
|
|
|
|
|
const GWEI = 1000 * 1000 * 1000;
|
|
|
|
|
2021-05-14 12:47:19 +00:00
|
|
|
export const buildForkConfig = (): HardhatNetworkForkingUserConfig | undefined => {
|
|
|
|
let forkMode;
|
|
|
|
if (FORK) {
|
|
|
|
forkMode = {
|
|
|
|
url: NETWORKS_RPC_URL[FORK],
|
|
|
|
};
|
|
|
|
if (FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK]) {
|
|
|
|
forkMode.blockNumber = FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return forkMode;
|
|
|
|
};
|
|
|
|
|
2021-02-22 08:59:21 +00:00
|
|
|
export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
|
|
|
|
[eEthereumNetwork.kovan]: ALCHEMY_KEY
|
|
|
|
? `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
|
|
: `https://kovan.infura.io/v3/${INFURA_KEY}`,
|
|
|
|
[eEthereumNetwork.ropsten]: ALCHEMY_KEY
|
|
|
|
? `https://eth-ropsten.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
|
|
: `https://ropsten.infura.io/v3/${INFURA_KEY}`,
|
|
|
|
[eEthereumNetwork.main]: ALCHEMY_KEY
|
|
|
|
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
|
|
: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
|
|
[eEthereumNetwork.coverage]: 'http://localhost:8555',
|
|
|
|
[eEthereumNetwork.hardhat]: 'http://localhost:8545',
|
|
|
|
[eEthereumNetwork.buidlerevm]: 'http://localhost:8545',
|
2021-07-14 14:41:32 +00:00
|
|
|
[eEthereumNetwork.tenderly]: `https://rpc.tenderly.co/fork/`,
|
2021-02-22 09:55:36 +00:00
|
|
|
[ePolygonNetwork.mumbai]: 'https://rpc-mumbai.maticvigil.com',
|
2021-07-26 16:06:36 +00:00
|
|
|
[ePolygonNetwork.matic]:
|
|
|
|
// 'https://rpc-mainnet.maticvigil.com/v1/e616b9ddc7598ffae92629f8145614d55094c722',
|
|
|
|
'https://polygon-mainnet.g.alchemy.com/v2/6NUmfWDZw6lC3RPAphj0p_2vm7ElOn2U',
|
|
|
|
// [ePolygonNetwork.matic]: 'https://rpc-mainnet.matic.network',
|
2021-02-22 09:55:36 +00:00
|
|
|
[eXDaiNetwork.xdai]: 'https://rpc.xdaichain.com/',
|
2021-08-27 11:49:28 +00:00
|
|
|
[eAvalancheNetwork.avalanche]: 'https://api.avax.network/ext/bc/C/rpc',
|
|
|
|
[eAvalancheNetwork.fuji]: 'https://api.avax-test.network/ext/bc/C/rpc',
|
2021-03-02 16:21:04 +00:00
|
|
|
};
|
2021-02-22 08:59:21 +00:00
|
|
|
|
|
|
|
export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
|
2021-12-06 15:29:34 +00:00
|
|
|
[eEthereumNetwork.kovan]: 3 * GWEI,
|
2021-03-02 16:21:04 +00:00
|
|
|
[eEthereumNetwork.ropsten]: 65 * GWEI,
|
|
|
|
[eEthereumNetwork.main]: 65 * GWEI,
|
|
|
|
[eEthereumNetwork.coverage]: 65 * GWEI,
|
|
|
|
[eEthereumNetwork.hardhat]: 65 * GWEI,
|
|
|
|
[eEthereumNetwork.buidlerevm]: 65 * GWEI,
|
2021-07-14 14:41:32 +00:00
|
|
|
[eEthereumNetwork.tenderly]: 1 * GWEI,
|
2021-12-17 15:23:11 +00:00
|
|
|
[ePolygonNetwork.mumbai]: 35 * GWEI,
|
|
|
|
[ePolygonNetwork.matic]: 35 * GWEI,
|
2021-02-22 09:55:36 +00:00
|
|
|
[eXDaiNetwork.xdai]: 1 * GWEI,
|
2021-10-05 08:06:22 +00:00
|
|
|
[eAvalancheNetwork.avalanche]: 225 * GWEI,
|
2021-08-27 11:49:28 +00:00
|
|
|
[eAvalancheNetwork.fuji]: 85 * GWEI,
|
2021-03-02 16:21:04 +00:00
|
|
|
};
|
2021-05-10 13:34:31 +00:00
|
|
|
|
|
|
|
export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
|
|
|
|
[eEthereumNetwork.main]: 12406069,
|
|
|
|
[eEthereumNetwork.kovan]: undefined,
|
|
|
|
[eEthereumNetwork.ropsten]: undefined,
|
|
|
|
[eEthereumNetwork.coverage]: undefined,
|
|
|
|
[eEthereumNetwork.hardhat]: undefined,
|
|
|
|
[eEthereumNetwork.buidlerevm]: undefined,
|
2021-07-14 14:41:32 +00:00
|
|
|
[eEthereumNetwork.tenderly]: undefined,
|
2021-05-10 13:34:31 +00:00
|
|
|
[ePolygonNetwork.mumbai]: undefined,
|
|
|
|
[ePolygonNetwork.matic]: undefined,
|
|
|
|
[eXDaiNetwork.xdai]: undefined,
|
2021-07-16 08:46:07 +00:00
|
|
|
[eAvalancheNetwork.avalanche]: undefined,
|
2021-08-27 11:49:28 +00:00
|
|
|
[eAvalancheNetwork.fuji]: undefined,
|
2021-05-10 13:34:31 +00:00
|
|
|
};
|