Skip to content

Instantly share code, notes, and snippets.

@0GiS0
Created June 24, 2019 06:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0GiS0/644c9e889fbe649f76f7b3365cc478ee to your computer and use it in GitHub Desktop.
Save 0GiS0/644c9e889fbe649f76f7b3365cc478ee to your computer and use it in GitHub Desktop.
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