Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fork tests #2050

Merged
merged 5 commits into from
May 9, 2024
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
17 changes: 12 additions & 5 deletions contracts/utils/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ const resolveAsset = async (symbol) => {
// "Hardhat can't be initialized while its config is being defined"
const hre = require("hardhat");

if (hre.network.name != "hardhat") {
// Not using helpers here as they import hardhat which won't work for Hardhat tasks
if (process.env.FORK === "true" || hre.network.name != "hardhat") {
const network =
hre.network.name != "hardhat"
? hre.network.name != "hardhat"
: hre.network.config.chainId == 17000
? "holesky"
: "mainnet";

const assetAddr =
addresses[hre.network.name][symbol + "Proxy"] ||
addresses[hre.network.name][symbol];
addresses[network][symbol + "Proxy"] || addresses[network][symbol];
if (!assetAddr) {
throw Error(
`Failed to resolve symbol "${symbol}" to an address on the "${hre.network.name}" network`
`Failed to resolve symbol "${symbol}" to an address on the "${network}" network`
);
}
log(`Resolved ${symbol} to ${assetAddr}`);
log(`Resolved ${symbol} to ${assetAddr} on the ${network} network`);
const asset = await ethers.getContractAt("IERC20Metadata", assetAddr);
return asset;
}
Expand Down
Loading