From 80d5f8c4216ff98cd52045932762f48b53bd7636 Mon Sep 17 00:00:00 2001 From: bmzig <57361391+bmzig@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:58:35 -0600 Subject: [PATCH] fix: add token mapping exception for sepolia (#1999) Signed-off-by: bennett --- src/clients/ProfitClient.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/clients/ProfitClient.ts b/src/clients/ProfitClient.ts index 8c3e9616f..41df0ff4b 100644 --- a/src/clients/ProfitClient.ts +++ b/src/clients/ProfitClient.ts @@ -544,7 +544,12 @@ export class ProfitClient { .filter(({ symbol }) => isDefined(TOKEN_SYMBOLS_MAP[symbol])) .map(({ symbol }) => { const { addresses } = TOKEN_SYMBOLS_MAP[symbol]; - const address = addresses[CHAIN_IDs.MAINNET]; + let address = addresses[CHAIN_IDs.MAINNET]; + // For testnet only, if we cannot resolve the token address, revert to ETH. On mainnet, if `address` is undefined, + // we will throw an error instead. + if (this.hubPoolClient.chainId === CHAIN_IDs.SEPOLIA && !isDefined(address)) { + address = TOKEN_SYMBOLS_MAP.ETH.addresses[CHAIN_IDs.MAINNET]; + } return [symbol, address]; }) );