2020-06-26 19:28:18 +00:00
|
|
|
import {usePlugin, BuidlerConfig} from '@nomiclabs/buidler/config';
|
|
|
|
import path from 'path';
|
|
|
|
import fs from 'fs';
|
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-05-29 14:55:31 +00:00
|
|
|
|
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
|
|
|
|
2020-07-05 21:44:19 +00:00
|
|
|
['misc'].forEach((folder) => {
|
2020-06-26 19:28:18 +00:00
|
|
|
const tasksPath = path.join(__dirname, 'tasks', folder);
|
2020-05-29 14:55:31 +00:00
|
|
|
fs.readdirSync(tasksPath).forEach((task) => require(`${tasksPath}/${task}`));
|
|
|
|
});
|
|
|
|
|
2020-06-10 08:31:33 +00:00
|
|
|
const DEFAULT_BLOCK_GAS_LIMIT = 10000000;
|
2020-05-29 14:55:31 +00:00
|
|
|
const DEFAULT_GAS_PRICE = 10;
|
2020-06-26 19:28:18 +00:00
|
|
|
const HARDFORK = 'istanbul';
|
|
|
|
const INFURA_KEY = '';
|
|
|
|
const ETHERSCAN_KEY = '';
|
2020-05-29 14:55:31 +00:00
|
|
|
const MNEMONIC_PATH = "m/44'/60'/0'/0";
|
2020-06-08 12:03:40 +00:00
|
|
|
const MNEMONICS: {[network: string]: string} = {
|
2020-06-26 19:28:18 +00:00
|
|
|
[eEthereumNetwork.kovan]: '',
|
|
|
|
[eEthereumNetwork.ropsten]: '',
|
|
|
|
[eEthereumNetwork.main]: '',
|
2020-05-29 14:55:31 +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: {
|
|
|
|
mnemonic: MNEMONICS[networkName],
|
|
|
|
path: MNEMONIC_PATH,
|
|
|
|
initialIndex: 0,
|
|
|
|
count: 20,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-06-26 19:28:18 +00:00
|
|
|
const config: any = {
|
2020-05-29 14:55:31 +00:00
|
|
|
solc: {
|
2020-06-26 19:28:18 +00:00
|
|
|
version: '0.6.8',
|
2020-06-08 12:03:40 +00:00
|
|
|
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: {
|
2020-06-26 19:28:18 +00:00
|
|
|
url: 'https://api-kovan.etherscan.io/api',
|
2020-05-29 14:55:31 +00:00
|
|
|
apiKey: ETHERSCAN_KEY,
|
|
|
|
},
|
2020-06-26 19:28:18 +00:00
|
|
|
defaultNetwork: 'buidlerevm',
|
2020-05-29 14:55:31 +00:00
|
|
|
mocha: {
|
2020-06-08 12:03:40 +00:00
|
|
|
timeout: 0,
|
2020-05-29 14:55:31 +00:00
|
|
|
},
|
|
|
|
networks: {
|
|
|
|
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,
|
|
|
|
chainId: 31337,
|
|
|
|
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-06-10 11:46:42 +00:00
|
|
|
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,
|
2020-06-10 11:46:42 +00:00
|
|
|
count: 20,
|
|
|
|
},
|
2020-06-10 08:31:33 +00:00
|
|
|
},
|
2020-07-13 08:54:08 +00:00
|
|
|
},
|
2020-05-29 14:55:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default config;
|