mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Improved hardhat config
This commit is contained in:
parent
bf27360b3c
commit
baa5de09d0
|
@ -3,9 +3,10 @@ import fs from 'fs';
|
||||||
import { HardhatUserConfig } from 'hardhat/types';
|
import { HardhatUserConfig } from 'hardhat/types';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { accounts } from './test-wallets.js';
|
import { accounts } from './test-wallets.js';
|
||||||
import { eEthereumNetwork } from './helpers/types';
|
import { eEthereumNetwork, iParamsPerNetwork } from './helpers/types';
|
||||||
import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants';
|
import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants';
|
||||||
|
import { NETWORKS_RPC_URL, NETWORKS_DEFAULT_GAS } from './helper-hardhat-config';
|
||||||
|
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
import '@nomiclabs/hardhat-ethers';
|
import '@nomiclabs/hardhat-ethers';
|
||||||
|
@ -43,58 +44,25 @@ if (!SKIP_LOAD) {
|
||||||
|
|
||||||
require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`);
|
require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`);
|
||||||
|
|
||||||
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
|
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => ({
|
||||||
const net = networkName === 'main' ? 'mainnet' : networkName;
|
url: NETWORKS_RPC_URL[networkName],
|
||||||
if (networkName == 'matic') return {
|
hardfork: HARDFORK,
|
||||||
url: 'https://rpc-mainnet.matic.network',
|
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
||||||
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
gasMultiplier: DEFAULT_GAS_MUL,
|
||||||
gasMultiplier: DEFAULT_GAS_MUL,
|
gasPrice: NETWORKS_DEFAULT_GAS[networkName],
|
||||||
gasPrice: 7500000000,
|
chainId: networkId,
|
||||||
chainId: networkId,
|
accounts: {
|
||||||
accounts: {
|
mnemonic: MNEMONIC,
|
||||||
mnemonic: MNEMONIC,
|
path: MNEMONIC_PATH,
|
||||||
path: MNEMONIC_PATH,
|
initialIndex: 0,
|
||||||
initialIndex: 0,
|
count: 20,
|
||||||
count: 20,
|
},
|
||||||
},
|
});
|
||||||
}
|
|
||||||
if (networkName == 'mumbai') return {
|
|
||||||
url: 'https://rpc-mumbai.maticvigil.com',
|
|
||||||
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
|
||||||
gasMultiplier: DEFAULT_GAS_MUL,
|
|
||||||
gasPrice: 1 * 1000 * 1000 * 1000,
|
|
||||||
chainId: networkId,
|
|
||||||
accounts: {
|
|
||||||
mnemonic: MNEMONIC,
|
|
||||||
path: MNEMONIC_PATH,
|
|
||||||
initialIndex: 0,
|
|
||||||
count: 20,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
url: ALCHEMY_KEY
|
|
||||||
? `https://eth-${net}.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://${net}.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
hardfork: HARDFORK,
|
|
||||||
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
|
||||||
gasMultiplier: DEFAULT_GAS_MUL,
|
|
||||||
gasPrice: DEFAULT_GAS_PRICE,
|
|
||||||
chainId: networkId,
|
|
||||||
accounts: {
|
|
||||||
mnemonic: MNEMONIC,
|
|
||||||
path: MNEMONIC_PATH,
|
|
||||||
initialIndex: 0,
|
|
||||||
count: 20,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mainnetFork = MAINNET_FORK
|
const mainnetFork = MAINNET_FORK
|
||||||
? {
|
? {
|
||||||
blockNumber: 11739065,
|
blockNumber: 11739065,
|
||||||
url: ALCHEMY_KEY
|
url: NETWORKS_RPC_URL['main'],
|
||||||
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
}
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|
41
helper-hardhat-config.ts
Normal file
41
helper-hardhat-config.ts
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// @ts-ignore
|
||||||
|
import { eEthereumNetwork, iParamsPerNetwork } from './helpers/types';
|
||||||
|
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const INFURA_KEY = process.env.INFURA_KEY || '';
|
||||||
|
const ALCHEMY_KEY = process.env.ALCHEMY_KEY || '';
|
||||||
|
|
||||||
|
const GWEI = 1000 * 1000 * 1000;
|
||||||
|
|
||||||
|
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',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: ALCHEMY_KEY
|
||||||
|
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
||||||
|
: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
||||||
|
[eEthereumNetwork.mumbai]: 'https://rpc-mumbai.maticvigil.com',
|
||||||
|
[eEthereumNetwork.matic]: 'https://rpc-mainnet.matic.network',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
|
||||||
|
[eEthereumNetwork.kovan]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.ropsten]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.main]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.coverage]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.hardhat]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.buidlerevm]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.tenderlyMain]: 65 * GWEI ,
|
||||||
|
[eEthereumNetwork.mumbai]: 1 * GWEI ,
|
||||||
|
[eEthereumNetwork.matic]: 65 * GWEI ,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user