diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 695103a8..da20f957 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -30,38 +30,30 @@ class Deploy { } } - let realArgs = []; - async.eachLimit(args, 1, (arg, nextEachCb) => { + async.map(args, (arg, nextEachCb) => { if (arg[0] === "$") { let contractName = arg.substr(1); self.events.request('contracts:contract', contractName, (referedContract) => { - realArgs.push(referedContract.deployedAddress); - nextEachCb(); + nextEachCb(null, referedContract.deployedAddress); }); } else if (Array.isArray(arg)) { - let subRealArgs = []; - - async.eachLimit(arg, 1, (sub_arg, nextSubEachCb) => { + async.map(arg, (sub_arg, nextSubEachCb) => { if (sub_arg[0] === "$") { let contractName = sub_arg.substr(1); self.events.request('contracts:contract', contractName, (referedContract) => { - subRealArgs.push(referedContract.deployedAddress); - nextSubEachCb(); + nextSubEachCb(null, referedContract.deployedAddress); }); } else { - subRealArgs.push(sub_arg); - nextSubEachCb(); + nextSubEachCb(null, sub_arg); } - }, () => { - realArgs.push(subRealArgs); - nextEachCb(); + }, (err, subRealArgs) => { + nextEachCb(null, subRealArgs); }); } else { - realArgs.push(arg); - nextEachCb(); + nextEachCb(null, arg); } - }, () => { + }, (err, realArgs) => { callback(realArgs); }); }