aave-protocol-v2/buidler.config.ts

111 lines
3.0 KiB
TypeScript
Raw Normal View History

2020-08-20 15:38:57 +00:00
import path from 'path';
import fs from 'fs';
import {usePlugin, task} from '@nomiclabs/buidler/config';
2020-05-29 14:55:31 +00:00
// @ts-ignore
2020-06-26 19:28:18 +00:00
import {accounts} from './test-wallets.js';
import {eEthereumNetwork} from './helpers/types';
2020-09-15 15:25:34 +00:00
import {BUIDLEREVM_CHAINID, COVERAGE_CHAINID} from './helpers/buidler-constants';
import {setDRE} from './helpers/misc-utils';
2020-05-29 14:55:31 +00:00
require('dotenv').config();
2020-06-26 19:28:18 +00:00
usePlugin('@nomiclabs/buidler-ethers');
usePlugin('buidler-typechain');
usePlugin('solidity-coverage');
usePlugin('@nomiclabs/buidler-waffle');
usePlugin('@nomiclabs/buidler-etherscan');
2020-05-29 14:55:31 +00:00
const SKIP_LOAD = process.env.SKIP_LOAD === 'true';
2020-10-30 12:40:06 +00:00
const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
2020-05-29 14:55:31 +00:00
const DEFAULT_GAS_PRICE = 10;
2020-06-26 19:28:18 +00:00
const HARDFORK = 'istanbul';
2020-09-24 15:48:29 +00:00
const INFURA_KEY = process.env.INFURA_KEY || '';
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || '';
2020-05-29 14:55:31 +00:00
const MNEMONIC_PATH = "m/44'/60'/0'/0";
2020-10-30 12:40:06 +00:00
const MNEMONIC = process.env.MNEMONIC || '';
2020-05-29 14:55:31 +00:00
task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).setAction(
async (_, _DRE) => {
setDRE(_DRE);
return _DRE;
}
);
2020-08-20 15:38:57 +00:00
2020-06-26 19:28:18 +00:00
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
2020-05-29 14:55:31 +00:00
return {
url: `https://${networkName}.infura.io/v3/${INFURA_KEY}`,
hardfork: HARDFORK,
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gasMultiplier: DEFAULT_GAS_PRICE,
chainId: networkId,
accounts: {
2020-10-30 12:40:06 +00:00
mnemonic: MNEMONIC,
2020-05-29 14:55:31 +00:00
path: MNEMONIC_PATH,
initialIndex: 0,
count: 20,
},
};
};
const buidlerConfig: any = {
2020-05-29 14:55:31 +00:00
solc: {
2020-11-20 10:41:58 +00:00
version: '0.6.12',
optimizer: {enabled: true, runs: 200},
2020-06-26 19:28:18 +00:00
evmVersion: 'istanbul',
2020-05-29 14:55:31 +00:00
},
typechain: {
2020-06-26 19:28:18 +00:00
outDir: 'types',
target: 'ethers-v4',
2020-05-29 14:55:31 +00:00
},
etherscan: {
apiKey: ETHERSCAN_KEY,
},
2020-06-26 19:28:18 +00:00
defaultNetwork: 'buidlerevm',
2020-05-29 14:55:31 +00:00
mocha: {
timeout: 0,
2020-05-29 14:55:31 +00:00
},
networks: {
coverage: {
url: 'http://localhost:8555',
2020-09-14 13:57:11 +00:00
chainId: COVERAGE_CHAINID,
},
2020-05-29 14:55:31 +00:00
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
buidlerevm: {
2020-06-26 19:28:18 +00:00
hardfork: 'istanbul',
2020-05-29 14:55:31 +00:00
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gas: DEFAULT_BLOCK_GAS_LIMIT,
gasPrice: 8000000000,
2020-09-14 13:57:11 +00:00
chainId: BUIDLEREVM_CHAINID,
2020-05-29 14:55:31 +00:00
throwOnTransactionFailures: true,
throwOnCallFailures: true,
2020-06-26 19:28:18 +00:00
accounts: accounts.map(({secretKey, balance}: {secretKey: string; balance: string}) => ({
privateKey: secretKey,
balance,
})),
2020-05-29 14:55:31 +00:00
},
2020-10-19 09:01:27 +00:00
buidlerevm_docker: {
hardfork: 'istanbul',
blockGasLimit: 9500000,
gas: 9500000,
gasPrice: 8000000000,
chainId: BUIDLEREVM_CHAINID,
throwOnTransactionFailures: true,
throwOnCallFailures: true,
url: 'http://localhost:8545',
},
ganache: {
2020-06-26 19:28:18 +00:00
url: 'http://ganache:8545',
2020-06-10 10:46:18 +00:00
accounts: {
2020-06-26 19:28:18 +00:00
mnemonic: 'fox sight canyon orphan hotel grow hedgehog build bless august weather swarm',
2020-06-10 10:46:18 +00:00
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
},
},
2020-07-13 08:54:08 +00:00
},
2020-05-29 14:55:31 +00:00
};
export default buidlerConfig;