From b9a90f56e4988bc65a97e628212b2c669718729e Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:43:52 +0100 Subject: [PATCH] fix(TokenUtils): Support identifying Zora USDzC I don't feel great about this function; we generally need: - A new implementation that does not rely on unique token addresses. - A consolidation of various "is this bridged USDC?" functionalities that are scattered around the various repos. --- src/utils/TokenUtils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/TokenUtils.ts b/src/utils/TokenUtils.ts index 5391a73e9..3142f5c54 100644 --- a/src/utils/TokenUtils.ts +++ b/src/utils/TokenUtils.ts @@ -127,13 +127,14 @@ export function getTokenInfo(l2TokenAddress: string, chainId: number): L1Token { /** * Get the USDC symbol for the given token address and chain ID. + * Note that this function is not especially safe because it relies on unique token addresses across different chains. * @param l2Token A Web3 token address (not case sensitive) * @param chainId A chain Id to reference - * @returns Either USDC (if native) or USDbC/USDC.e (if bridged) or undefined if the token address is not recognized. + * @returns Either USDC (if native) or USDbC/USDzC/USDC.e (if bridged) or undefined if the token address is not recognized. */ export function getUsdcSymbol(l2Token: string, chainId: number): string | undefined { const compareToken = (token?: string) => isDefined(token) && compareAddressesSimple(l2Token, token); - return ["USDC", "USDbC", "USDC.e"].find((token) => + return ["USDC", "USDbC", "USDzC", "USDC.e"].find((token) => compareToken( (TOKEN_SYMBOLS_MAP as Record }>)[token]?.addresses?.[chainId] )