remove unnecessary determin params call

This commit is contained in:
Iuri Matias 2018-05-22 15:13:20 -04:00
parent 8cc86e0b0f
commit f4010bd66e
1 changed files with 17 additions and 22 deletions

View File

@ -134,32 +134,27 @@ class Deploy {
contractToDeploy(contract, params, callback) {
const self = this;
// TODO: refactor to async
self.determineArguments(params || contract.args, contract, (realArgs) => {
contract.realArgs = realArgs;
// TODO: this whole callback is almost pointless and should be moved to deployContract
this.deployContract(contract, contract.realArgs, function (err, address) {
if (err) {
self.events.emit("deploy:contract:error", contract);
return callback(new Error(err));
}
contract.address = address;
self.events.emit("deploy:contract:deployed", contract);
this.deployContract(contract, contract.realArgs, function (err, address) {
if (err) {
self.events.emit("deploy:contract:error", contract);
return callback(new Error(err));
}
contract.address = address;
self.events.emit("deploy:contract:deployed", contract);
// TODO: can be moved into a afterDeploy event
// just need to figure out the gasLimit coupling issue
self.events.request('code-generator:contract:vanilla', contract, self.gasLimit, (contractCode) => {
self.events.request('runcode:eval', contractCode);
// TODO: can be moved into a afterDeploy event
// just need to figure out the gasLimit coupling issue
self.events.request('code-generator:contract:vanilla', contract, self.gasLimit, (contractCode) => {
self.events.request('runcode:eval', contractCode);
let onDeployPlugins = self.plugins.getPluginsProperty('onDeployActions', 'onDeployActions');
let onDeployPlugins = self.plugins.getPluginsProperty('onDeployActions', 'onDeployActions');
async.eachLimit(onDeployPlugins, 1, function(plugin, nextEach) {
plugin.call(plugin, contract, nextEach);
}, () => {
callback();
});
async.eachLimit(onDeployPlugins, 1, function(plugin, nextEach) {
plugin.call(plugin, contract, nextEach);
}, () => {
callback();
});
});
});
}