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) {
try { for (const suffix of ['UpgradeSafeWithInit', 'UpgradeSafe', '']) {
return artifacts.require(name + 'UpgradeSafeWithInit'); try {
} catch (e) { return artifacts.require(name + suffix);
if (BuidlerError.isBuidlerError(e) && e.number === 700) { } catch (e) {
return artifacts.require(name + 'UpgradeSafe'); if (BuidlerError.isBuidlerError(e) && e.number === 700 && suffix !== '') {
} else { continue;
throw e; } else {
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