diff --git a/lib/modules/deployment/contract_deployer.js b/lib/modules/deployment/contract_deployer.js index db634d46f..7b76ed4b1 100644 --- a/lib/modules/deployment/contract_deployer.js +++ b/lib/modules/deployment/contract_deployer.js @@ -143,7 +143,7 @@ class ContractDeployer { self.plugins.emitAndRunActionsForEvent('deploy:contract:shouldDeploy', {contract: contract, shouldDeploy: true}, function(_err, params) { let trackedContract = params.contract; if (!params.shouldDeploy) { - return next(); + return self.willNotDeployContract(contract, trackedContract, next); } if (!trackedContract.address) { return self.deployContract(contract, next); @@ -161,6 +161,12 @@ class ContractDeployer { ], callback); } + willNotDeployContract(contract, trackedContract, callback) { + contract.deploy = false; + this.events.emit("deploy:contract:undeployed", contract); + callback(); + } + contractAlreadyDeployed(contract, trackedContract, callback) { const self = this; this.logFunction(contract)(contract.className.bold.cyan + __(" already deployed at ").green + trackedContract.address.bold.cyan); diff --git a/test_apps/test_app/config/contracts.js b/test_apps/test_app/config/contracts.js index 8b4a36bcd..c68c002ef 100644 --- a/test_apps/test_app/config/contracts.js +++ b/test_apps/test_app/config/contracts.js @@ -53,7 +53,7 @@ module.exports = { } }, SomeContract: { - deployIf: 'MyToken.methods.isAvailable().call()', + deployIf: 'await MyToken.methods.isAvailable().call()', args: [ ["$MyToken2", "$SimpleStorage"], 100