From 2ac70185d80866dab3177de94a15deb9dbb66971 Mon Sep 17 00:00:00 2001 From: spsjvc Date: Mon, 9 Dec 2024 15:41:19 +0100 Subject: [PATCH] fix: skip weth gateway on custom gas token chain --- .../arb-token-bridge-ui/src/util/fetchL2Gateways.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts b/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts index ce13b2be68..0c1af3fd1c 100644 --- a/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts +++ b/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts @@ -9,6 +9,7 @@ import { l2UsdcGatewayAddresses, l2wstETHGatewayAddresses } from '../util/networks' +import { constants } from 'ethers' /** * Fetch L2 gateways for a given L2 network using its provider. Useful for specifying which gateways to use when fetching withdrawals. @@ -25,11 +26,8 @@ export async function fetchL2Gateways(l2Provider: Provider) { /* configure gateway addresses for fetching withdrawals */ const { childErc20Gateway, childCustomGateway, childWethGateway } = l2Network.tokenBridge - const gatewaysToUse = [ - childErc20Gateway, - childCustomGateway, - childWethGateway - ] + + const gatewaysToUse = [childErc20Gateway, childCustomGateway] const l2ArbReverseGateway = l2ArbReverseGatewayAddresses[l2Network.chainId] const l2DaiGateway = l2DaiGatewayAddresses[l2Network.chainId] const l2wstETHGateway = l2wstETHGatewayAddresses[l2Network.chainId] @@ -37,6 +35,10 @@ export async function fetchL2Gateways(l2Provider: Provider) { const l2MoonGateway = l2MoonGatewayAddresses[l2Network.chainId] const l2UsdcGateway = l2UsdcGatewayAddresses[l2Network.chainId] + // custom gas token chains will have weth gateway set to address zero + if (childWethGateway !== constants.AddressZero) { + gatewaysToUse.push(childWethGateway) + } if (l2ArbReverseGateway) { gatewaysToUse.push(l2ArbReverseGateway) }