-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompile.js
More file actions
33 lines (25 loc) · 763 Bytes
/
compile.js
File metadata and controls
33 lines (25 loc) · 763 Bytes
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
////////////////////////////////////////////
const path = require('path');
const solc = require('solc');
const fs = require('fs-extra');
const inboxPath=path.resolve(__dirname,'contracts','Authorship.sol');
const source=fs.readFileSync(inboxPath,'utf8');
var input = {
language: 'Solidity',
sources: {
'Authorship.sol': {
content: source
}
},
settings: {
outputSelection: {
'*': {
'*': [ '*' ]
}
}
}
}
const output = JSON.parse(solc.compile(JSON.stringify(input)));
console.log(output.contracts['Authorship.sol'].Author.evm.bytecode)
console.log(output.contracts['Authorship.sol'].Author.abi)
module.exports=output.contracts['Authorship.sol'].Author;