From f4010bd66ec03808ca2dde71f342fa079bc7a27a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 22 May 2018 15:13:20 -0400 Subject: [PATCH] remove unnecessary determin params call --- lib/contracts/deploy.js | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 462d7a817..959971b14 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -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(); }); - }); }); }