fix dashboard state so it doesn't show pending for contracts that were not deployed due to deployIf directive

This commit is contained in:
Iuri Matias 2018-09-15 12:20:20 -04:00
parent a43627de5b
commit 32a1ba0f32
2 changed files with 8 additions and 2 deletions

View File

@ -143,7 +143,7 @@ class ContractDeployer {
self.plugins.emitAndRunActionsForEvent('deploy:contract:shouldDeploy', {contract: contract, shouldDeploy: true}, function(_err, params) { self.plugins.emitAndRunActionsForEvent('deploy:contract:shouldDeploy', {contract: contract, shouldDeploy: true}, function(_err, params) {
let trackedContract = params.contract; let trackedContract = params.contract;
if (!params.shouldDeploy) { if (!params.shouldDeploy) {
return next(); return self.willNotDeployContract(contract, trackedContract, next);
} }
if (!trackedContract.address) { if (!trackedContract.address) {
return self.deployContract(contract, next); return self.deployContract(contract, next);
@ -161,6 +161,12 @@ class ContractDeployer {
], callback); ], callback);
} }
willNotDeployContract(contract, trackedContract, callback) {
contract.deploy = false;
this.events.emit("deploy:contract:undeployed", contract);
callback();
}
contractAlreadyDeployed(contract, trackedContract, callback) { contractAlreadyDeployed(contract, trackedContract, callback) {
const self = this; const self = this;
this.logFunction(contract)(contract.className.bold.cyan + __(" already deployed at ").green + trackedContract.address.bold.cyan); this.logFunction(contract)(contract.className.bold.cyan + __(" already deployed at ").green + trackedContract.address.bold.cyan);

View File

@ -53,7 +53,7 @@ module.exports = {
} }
}, },
SomeContract: { SomeContract: {
deployIf: 'MyToken.methods.isAvailable().call()', deployIf: 'await MyToken.methods.isAvailable().call()',
args: [ args: [
["$MyToken2", "$SimpleStorage"], ["$MyToken2", "$SimpleStorage"],
100 100