diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 934f5fcf2..494b34a20 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -20,6 +20,7 @@ class Deploy { // TODO: determining the arguments could also be in a module since it's not // part of ta 'normal' contract deployment determineArguments(suppliedArgs, contract, callback) { + const self = this; let realArgs = [], contractName, referedContract; let args = suppliedArgs; @@ -41,10 +42,13 @@ class Deploy { if (arg[0] === "$") { contractName = arg.substr(1); - referedContract = this.contractsManager.getContract(contractName); - realArgs.push(referedContract.deployedAddress); + self.events.request('contracts:contract', contractName, (referedContract) => { + realArgs.push(referedContract.deployedAddress); + nextEachCb(); + }); } else if (Array.isArray(arg)) { let subRealArgs = []; + // todo: convert to async each for (let sub_arg of arg) { if (sub_arg[0] === "$") { contractName = sub_arg.substr(1); @@ -54,14 +58,15 @@ class Deploy { subRealArgs.push(sub_arg); } } + // todo: put this in the final callback realArgs.push(subRealArgs); + nextEachCb(); } else { realArgs.push(arg); + nextEachCb(); } - nextEachCb(); - }, () => { callback(realArgs); });