mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 06:25:57 +00:00
remove unnecessary passing of params around
This commit is contained in:
parent
000d7beb27
commit
21026e07ae
@ -32,34 +32,36 @@ class DeployManager {
|
||||
async.waterfall([
|
||||
function buildContracts(callback) {
|
||||
self.contractsManager.deployOnlyOnConfig = self.deployOnlyOnConfig; // temporary, should refactor
|
||||
self.contractsManager.build(callback);
|
||||
self.contractsManager.build(() => {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function checkCompileOnly(contractsManager, callback){
|
||||
function checkCompileOnly(callback){
|
||||
if(self.onlyCompile){
|
||||
self.events.emit('contractsDeployed', contractsManager);
|
||||
self.events.emit('contractsDeployed', self.contractsManager);
|
||||
return done();
|
||||
}
|
||||
return callback(null, contractsManager);
|
||||
return callback();
|
||||
},
|
||||
|
||||
// TODO: could be implemented as an event (beforeDeployAll)
|
||||
function checkIsConnectedToBlockchain(contractsManager, callback) {
|
||||
function checkIsConnectedToBlockchain(callback) {
|
||||
self.blockchain.assertNodeConnection((err) => {
|
||||
callback(err, contractsManager);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
||||
// TODO: this can be done on the fly or as part of the initialization
|
||||
function determineDefaultAccount(contractsManager, callback) {
|
||||
function determineDefaultAccount(callback) {
|
||||
self.blockchain.determineDefaultAccount((err) => {
|
||||
callback(err, contractsManager);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
||||
function deployAllContracts(contractsManager, callback) {
|
||||
function deployAllContracts(callback) {
|
||||
let deploy = new Deploy({
|
||||
blockchain: self.blockchain,
|
||||
contractsManager: contractsManager,
|
||||
contractsManager: self.contractsManager,
|
||||
logger: self.logger,
|
||||
events: self.events,
|
||||
chainConfig: self.chainConfig,
|
||||
@ -70,15 +72,15 @@ class DeployManager {
|
||||
|
||||
deploy.deployAll(function (err) {
|
||||
if (!err) {
|
||||
self.events.emit('contractsDeployed', contractsManager);
|
||||
self.events.emit('contractsDeployed', self.contractsManager);
|
||||
}
|
||||
if (err && self.fatalErrors) {
|
||||
return callback(err);
|
||||
}
|
||||
callback(null, contractsManager);
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function runAfterDeployCommands(contractsManager, callback) {
|
||||
function runAfterDeployCommands(callback) {
|
||||
// TODO: should instead emit a afterDeploy event and/or run a afterDeploy plugin
|
||||
let afterDeployCmds = self.config.contractsConfig.afterDeploy || [];
|
||||
|
||||
@ -87,7 +89,7 @@ class DeployManager {
|
||||
let onDeployCode = afterDeployCmds.map((cmd) => {
|
||||
let realCmd = cmd.replace(regex, (match) => {
|
||||
let referedContractName = match.slice(1);
|
||||
let referedContract = contractsManager.getContract(referedContractName);
|
||||
let referedContract = self.contractsManager.getContract(referedContractName);
|
||||
if (!referedContract) {
|
||||
self.logger.error(referedContractName + ' does not exist');
|
||||
self.logger.error(__("error running afterDeploy: ") + cmd);
|
||||
@ -128,14 +130,10 @@ class DeployManager {
|
||||
}
|
||||
}
|
||||
|
||||
callback(null, contractsManager);
|
||||
}
|
||||
], function (err, result) {
|
||||
if (err) {
|
||||
done(err, null);
|
||||
} else {
|
||||
done(null, result);
|
||||
callback();
|
||||
}
|
||||
], function (err, _result) {
|
||||
done(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user