simplify method dealing with instanceOf

This commit is contained in:
Iuri Matias 2016-10-30 20:48:16 -04:00
parent 5c283b5232
commit 99c528c230
1 changed files with 36 additions and 33 deletions

View File

@ -80,18 +80,21 @@ ContractsManager.prototype.build = function(done) {
}
callback();
},
function setDeployIntention(callback) {
var className, contract;
for(className in self.contracts) {
contract = self.contracts[className];
contract.deploy = (contract.deploy === undefined) || contract.deploy;
}
},
function dealWithSpecialConfigs(callback) {
var className, contract, parentContractName, parentContract;
for(className in self.contracts) {
contract = self.contracts[className];
// if deploy intention is not specified default is true
if (contract.deploy === undefined) {
contract.deploy = true;
}
if (contract.instanceOf === undefined) { continue; }
if (contract.instanceOf !== undefined) {
parentContractName = contract.instanceOf;
parentContract = self.contracts[parentContractName];
@ -101,7 +104,7 @@ ContractsManager.prototype.build = function(done) {
}
if (parentContract === undefined) {
slef.logger.error(className + ": couldn't find instanceOf contract " + parentContractName);
self.logger.error(className + ": couldn't find instanceOf contract " + parentContractName);
continue;
}
@ -121,7 +124,7 @@ ContractsManager.prototype.build = function(done) {
contract.gas = contract.gas || parentContract.gas;
contract.gasPrice = contract.gasPrice || parentContract.gasPrice;
}
}
callback();
},