Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Dont fetch UpgradeableWithInit contract when name starts with…
… "$""

This reverts commit d4367bb.
  • Loading branch information
ernestognw committed Feb 13, 2024
commit 7d1b418ffb0691f65b55e04cb618fc814c55df8f
12 changes: 2 additions & 10 deletions hardhat/env-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@ function isExpectedError(e, suffix) {
// Modifies the artifact require functions so that instead of X it loads the XUpgradeable contract.
// This allows us to run the same test suite on both the original and the transpiled and renamed Upgradeable contracts.
extendEnvironment(hre => {
// When getting an exposed contract, "UpgradeableWithInit" should not be considered.
const suffixes = [
{ suffix: 'UpgradeableWithInit', filter: name => !name.startsWith('$') },
{ suffix: 'Upgradeable' },
{ suffix: '' },
];
const suffixes = ['UpgradeableWithInit', 'Upgradeable', ''];

// Ethers
const originalReadArtifact = hre.artifacts.readArtifact;
hre.artifacts.readArtifact = async function (name) {
for (const { suffix, filter } of suffixes) {
if (filter?.(name)) {
continue;
}
for (const suffix of suffixes) {
try {
return await originalReadArtifact.call(this, name + suffix);
} catch (e) {
Expand Down