fix(@embark/contracts-manager): always deploy contracts with deploy: true

This was an issue experienced with ENS contracts not being deployed
because the configs used `strategy: explicit` and ENS configs are
not in configs.
To fix, I changed the way we check for deploy. If `deploy` is set as
`true` it should always deploy even if not in configs. It just means
they were added from a plugin (like ENS)
Also, I needed to set to `false` the `deploy` property of contracts
compiled that were not in config, because otherwise, they tried to
deploy, which goes against the strategy. This is because those
contracts get initiated as `deploy: true`.
This commit is contained in:
Jonathan Rainville 2020-02-05 11:54:55 -05:00
parent 0e30bf3926
commit 87a04cd5db
1 changed files with 6 additions and 2 deletions

View File

@ -313,6 +313,9 @@ export default class ContractsManager {
contract = new Contract(self.logger, contractConfig);
contract.className = className;
contract.args = [];
if (contractsConfig.strategy === constants.deploymentStrategy.explicit) {
contract.deploy = false;
}
}
contract.code = compiledContract.code;
@ -353,15 +356,16 @@ export default class ContractsManager {
for (className in self.contracts) {
contract = self.contracts[className];
contract.deploy = (contract.deploy === undefined) || contract.deploy;
if (self.deployOnlyOnConfig && !contractsConfig.contracts[className]) {
contract.deploy = false;
}
if (!contractsConfig.contracts[className] && contractsConfig.strategy === constants.deploymentStrategy.explicit) {
if (contract.deploy !== true && !contractsConfig.contracts[className] && contractsConfig.strategy === constants.deploymentStrategy.explicit) {
contract.deploy = false;
}
contract.deploy = contract.deploy ?? true;
if (contract.code === "") {
const message = __("assuming %s to be an interface", className);
if (contract.silent || (isTest && !contractsInConfig.includes(className))) {