This repository was archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathbuidler.config.ts
More file actions
58 lines (48 loc) · 1.4 KB
/
buidler.config.ts
File metadata and controls
58 lines (48 loc) · 1.4 KB
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
import { BuidlerConfig, usePlugin, internalTask } from "@nomiclabs/buidler/config";
import { TASK_COMPILE_RUN_COMPILER } from "@nomiclabs/buidler/builtin-tasks/task-names";
import { execSync } from "child_process";
usePlugin("@nomiclabs/buidler-truffle5");
usePlugin("@nomiclabs/buidler-web3");
//
// Register alias
//
const moduleAlias = require('module-alias');
moduleAlias.addAlias('@utils', __dirname + '/utils');
internalTask(TASK_COMPILE_RUN_COMPILER).setAction(async ({ input }, { config }, runSuper) => {
let solcVersionOutput = "";
try {
solcVersionOutput = execSync(`solc --version`).toString();
} catch (error) {
// Probably failed because solc wasn't installed. We do nothing here.
}
console.log("Output", solcVersionOutput);
if (!solcVersionOutput.includes(config.solc.version)) {
console.log(`Using solcjs`);
return runSuper();
}
console.log(`Using native solc`);
const output = execSync(`solc --standard-json`, {
input: JSON.stringify(input, undefined, 2),
});
return JSON.parse(output.toString(`utf8`));
});
const config: BuidlerConfig = {
solc: {
version: "0.5.7",
optimizer: {
enabled: true,
runs: 200,
},
evmVersion: "byzantium",
},
paths: {
artifacts: "./build/contracts",
tests: "./transpiled/test/contracts",
},
networks: {
buidlerevm: {
blockGasLimit: 20000000,
},
},
};
export default config;