Correct syntax for deploy.js file

JohJoh Member Posts: 1
I've been using solc-js and Node.js to compile my solidity contracts and it all worked fine for solidity V0.4.18 and when I have one contract with no inheritance or imports. But it does not work for any imports etc. Here is the code that I've been using for my simple contracts. Can anyone please help me fix this so I can compile contracts that include imports and that is compatible with solidity 0.4.21?

The solidity file is Lottery.sol and the contract name is Lottery. Here is the code:

const path = require('path');
const fs = require('fs');
const solc = require('solc');

const lotteryPath = path.resolve(__dirname, 'contracts', 'Lottery.sol');
const source = fs.readFileSync(lotteryPath, 'utf8');
//console.log(solc.compile(source,1));

console.log(solc.compile(source,1));
module.exports = solc.compile(source, 1).contracts[':Lottery'];

Sign In or Register to comment.