embark-etherscan-verifier/index.js

29 lines
946 B
JavaScript
Raw Normal View History

2019-01-16 19:11:44 +00:00
/*global require, module*/
2019-01-16 20:20:16 +00:00
const Flattener = require('./lib/Flattener');
2019-01-16 19:11:44 +00:00
module.exports = (embark) => {
2019-01-16 20:20:16 +00:00
const flattener = new Flattener(embark);
2019-01-16 19:11:44 +00:00
embark.registerConsoleCommand({
description: "Flattens all or some of your contracts so that they can be verified on etherscan\n\t\tYou can specify which contract to flatten by using their filename (relative to the contract directory specified in embark.json). For multiple contracts, separate them using a comma",
matches: (cmd) => {
2019-01-17 16:30:36 +00:00
const [commandName] = cmd.split(' ');
2019-01-16 19:11:44 +00:00
return commandName === 'flatten';
},
usage: "flatten or flatten <contracts>",
process: (cmd, callback) => {
const [, contractNames] = cmd.split(' ');
if (contractNames) {
embark.logger.info('Flattening ' + contractNames);
2019-01-16 19:11:44 +00:00
} else {
embark.logger.info('Flattening all contracts');
2019-01-16 19:11:44 +00:00
}
2019-01-16 20:20:16 +00:00
flattener.flatten(contractNames, callback);
2019-01-16 19:11:44 +00:00
}
});
};