My compile.js file is below

const path = require('path');

const fs = require('fs');

const solc = require('solc');

const ballotPath = path.resolve(__dirname, 'contracts', 'blocktitans_ballot.sol');

const source = fs.readFileSync(ballotPath, 'utf8');

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

I need help to export abi and bytecode for multiple contracts to write test scripts.

Above compile.js script works for single contract but how can I compile multiple contracts and export them?


I guess - --by adding the .sol file names in ballotPath for those contracts & --by changing the number 1 to the number of contracts you want to compile, like 2,3 etc --and removing the : blocktitans_ballot from .contracts in module exports so that all the contracts are covered.

apologies in advance if I am incorrect. Thanks.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.