Created
June 24, 2019 06:15
-
-
Save 0GiS0/644c9e889fbe649f76f7b3365cc478ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const fs = require('fs'); | |
const solc = require('solc'); | |
const contractPath = path.resolve(__dirname, "..", 'TimeControl.sol'); | |
const source = fs.readFileSync(contractPath, 'utf8'); | |
let jsonContractSource = JSON.stringify({ | |
language: 'Solidity', | |
sources: { | |
'TimeControl': { | |
content: source, | |
}, | |
}, | |
settings: { | |
outputSelection: { | |
'*': { | |
'*': ['abi', "evm.bytecode"] | |
}, | |
}, | |
}, | |
}); | |
let solcResult = solc.compile(jsonContractSource); | |
const abi = JSON.parse(solcResult).contracts.TimeControl.TimeControl.abi; | |
const bytecode = JSON.parse(solcResult).contracts.TimeControl.TimeControl.evm.bytecode.object; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment