From e13c0b3724d6e1258ed7a4a8fafa5d3d07ea9088 Mon Sep 17 00:00:00 2001 From: hodlbank Date: Tue, 2 Oct 2018 21:30:42 +0000 Subject: [PATCH] [a] Added applyArgumentPlugins before _determineArguments in ContractDeployer for plugins that calculate arguments dynamically. [m] Made possible for deploy:contract:beforeDeploy plugin to modify arguments list. --- lib/modules/deployment/contract_deployer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/modules/deployment/contract_deployer.js b/lib/modules/deployment/contract_deployer.js index 384ecf7ac..734137c4d 100644 --- a/lib/modules/deployment/contract_deployer.js +++ b/lib/modules/deployment/contract_deployer.js @@ -116,6 +116,11 @@ class ContractDeployer { next(); }); }, + function applyArgumentPlugins(next) { + self.plugins.emitAndRunActionsForEvent('deploy:contract:arguments', {contract: contract}, (_params) => { + next(); + }); + }, function _determineArguments(next) { self.determineArguments(params || contract.args, contract, accounts, (err, realArgs) => { if (err) { @@ -189,7 +194,6 @@ class ContractDeployer { deployContract(contract, callback) { let self = this; - let contractParams = (contract.realArgs || contract.args).slice(); let deployObject; async.waterfall([ @@ -239,6 +243,7 @@ class ContractDeployer { function createDeployObject(next) { let contractCode = contract.code; let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition}); + let contractParams = (contract.realArgs || contract.args).slice(); try { const dataCode = contractCode.startsWith('0x') ? contractCode : "0x" + contractCode;