123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { config as dotenvConfig } from "dotenv";
- import { resolve } from "path";
- dotenvConfig({ path: resolve(__dirname, "./.env") });
- import { BuidlerConfig, usePlugin } from "@nomiclabs/buidler/config";
- import { HDAccountsConfig } from "@nomiclabs/buidler/types";
- import "./tasks/accounts";
- import "./tasks/clean";
- import "./tasks/typechain";
- usePlugin("@nomiclabs/buidler-waffle");
- usePlugin("solidity-coverage");
- interface HDAccountsConfigExtended extends HDAccountsConfig {
- url: string;
- }
- /**
- * @dev You must have a `.env` file. Follow the example in `.env.example`.
- * @param {string} network The name of the testnet
- */
- function createHDAccountConfig(network: string): HDAccountsConfigExtended {
- if (!process.env.MNEMONIC) {
- console.log("Please set your MNEMONIC in a .env file");
- process.exit(1);
- }
- if (!process.env.INFURA_API_KEY) {
- console.log("Please set your INFURA_API_KEY");
- process.exit(1);
- }
- return {
- initialIndex: 0,
- mnemonic: process.env.MNEMONIC,
- path: "m/44'/60'/0'/0",
- url: `https://${network}.infura.io/v3/${process.env.INFURA_API_KEY}`,
- };
- }
- const config: BuidlerConfig = {
- defaultNetwork: "buidlerevm",
- mocha: {
- delay: true,
- },
- networks: {
- buidlerevm: {
- chainId: 31337,
- },
- coverage: {
- url: "http://127.0.0.1:8555",
- },
- goerli: {
- ...createHDAccountConfig("goerli"),
- chainId: 5,
- },
- kovan: {
- ...createHDAccountConfig("kovan"),
- chainId: 42,
- },
- rinkeby: {
- ...createHDAccountConfig("rinkeby"),
- chainId: 4,
- },
- ropsten: {
- ...createHDAccountConfig("ropsten"),
- chainId: 3,
- },
- },
- paths: {
- artifacts: "./artifacts",
- cache: "./cache",
- coverage: "./coverage",
- coverageJson: "./coverage.json",
- root: "./",
- sources: "./contracts",
- tests: "./test",
- },
- solc: {
- /* https://buidler.dev/buidler-evm/#solidity-optimizer-support */
- optimizer: {
- enabled: false,
- runs: 200,
- },
- version: "0.6.10",
- },
- typechain: {
- outDir: "typechain",
- target: "ethers-v5",
- },
- };
- export default config;
|