contract_deployer: Redeploy if track field is set to false.

Always deploy the contract regardless if already deployed
when 'track' field in the contract configuration is specified
and set to false.

In line with #938 requirements:

* If a contract has the track field set to false, that contract
  will always deploy.
* If the track field is set to true, then the existing deployment
  tracking mechanism will be active for that contract.
* If the field is not set, it should be assumed to true by default

Refs: https://github.com/embark-framework/embark/issues/938
This commit is contained in:
Cryptomental 2018-10-05 09:54:24 +02:00 committed by Pascal Precht
parent 115bf1387d
commit bcc1711061
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 5 additions and 0 deletions

View File

@ -155,6 +155,11 @@ class ContractDeployer {
if (!trackedContract.address) {
return self.deployContract(contract, next);
}
// deploy the contract regardless if track field is defined and set to false
if (trackedContract.track === false) {
self.logFunction(contract)(contract.className.bold.cyan + __(" will be redeployed").green);
return self.deployContract(contract, next);
}
self.blockchain.getCode(trackedContract.address, function(_getCodeErr, codeInChain) {
if (codeInChain !== "0x") {