-
Notifications
You must be signed in to change notification settings - Fork 1
/
buidler.config.ts
93 lines (85 loc) · 2.08 KB
/
buidler.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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;