Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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