From 4f0cf533a3d084fd282a310ddbe49eb5f60f3e79 Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Sun, 10 Sep 2023 22:32:49 +0200 Subject: [PATCH] fix: Correct scripts contract resolution utility Was recently broken during a refactor. --- scripts/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/utils.ts b/scripts/utils.ts index a673bdc23..99ab46d7f 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -116,9 +116,7 @@ export function resolveHubChainId(spokeChainId: number): number { * @returns ethers Contract instance. */ export async function getContract(chainId: number, contractName: string): Promise { - const hubPoolChainId = resolveHubChainId(chainId); - - const contract = getDeployedContract(contractName, hubPoolChainId); + const contract = getDeployedContract(contractName, chainId); const provider = new ethers.providers.StaticJsonRpcProvider(getProviderUrl(chainId)); return contract.connect(provider); } @@ -129,7 +127,8 @@ export async function getContract(chainId: number, contractName: string): Promis * @returns SpokePool contract instance. */ export async function getSpokePoolContract(chainId: number): Promise { - const hubPool = await getContract(chainId, "HubPool"); + const hubChainId = resolveHubChainId(chainId); + const hubPool = await getContract(hubChainId, "HubPool"); const spokePoolAddr = (await hubPool.crossChainContracts(chainId))[1]; const contract = new Contract(spokePoolAddr, contracts.SpokePool__factory.abi);