Commit d18e7e7a by Francisco Giordano

allow artifacts.require to return unmodified contracts

parent 2423440d
...@@ -6,15 +6,18 @@ extendEnvironment(env => { ...@@ -6,15 +6,18 @@ extendEnvironment(env => {
env.artifacts = { env.artifacts = {
...artifacts, ...artifacts,
require (name) { require (name) {
for (const suffix of ['UpgradeSafeWithInit', 'UpgradeSafe', '']) {
try { try {
return artifacts.require(name + 'UpgradeSafeWithInit'); return artifacts.require(name + suffix);
} catch (e) { } catch (e) {
if (BuidlerError.isBuidlerError(e) && e.number === 700) { if (BuidlerError.isBuidlerError(e) && e.number === 700 && suffix !== '') {
return artifacts.require(name + 'UpgradeSafe'); continue;
} else { } else {
throw e; throw e;
} }
} }
}
throw new Error('Unreachable');
}, },
}; };
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment