Skip to content

Commit

Permalink
fix(@embark/contracts-manager): always deploy contracts with deploy: …
Browse files Browse the repository at this point in the history
…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`.
  • Loading branch information
jrainville committed Feb 7, 2020
1 parent 0e30bf3 commit 87a04cd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/stack/contracts-manager/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))) {
Expand Down

0 comments on commit 87a04cd

Please sign in to comment.