-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.js
44 lines (35 loc) · 1.11 KB
/
compile.js
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
const path = require("path");
const fs = require("fs");
const solc = require("solc");
const inboxPath = path.resolve(__dirname, "contracts", "Inbox.sol");
const source = fs.readFileSync(inboxPath, "UTF-8");
// module.exports = solc.compile(source, 1).contracts[':Inbox'];
var complierInput = {
language: "Solidity",
sources: {
"Inbox.sol": {
content: source,
},
},
settings: {
outputSelection: {
"*": {
"*": ["*"],
},
},
},
};
console.log("compiling contract...");
let compiledContract = JSON.parse(
solc.compile(JSON.stringify(complierInput), 1)
);
console.log("Contract Compiled");
console.log(
compiledContract.contracts["Inbox.sol"]["Inbox"].evm.bytecode.object
);
// module.exports = compiledContract.contracts["Inbox.sol"]["Inbox"];
// for (let contractName in compiledContract.contracts['Inbox.sol']) {
// console.log(compiledContract.contracts['Inbox.sol']['Inbox']);
// }
// console.log(JSON.parse(solc.compile(JSON.stringify(input.contract🇸['Inbox.sol']))));
// console.log(solc.compile(source, 1).contracts);