From 1755b439bab178b6872239164a0d3de88665e5c3 Mon Sep 17 00:00:00 2001 From: Paul Noel Date: Wed, 21 Aug 2024 11:26:33 -0600 Subject: [PATCH] cloud_functions: add isTokenDenylisted call --- cloud_functions/src/computeTvlTvm.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cloud_functions/src/computeTvlTvm.ts b/cloud_functions/src/computeTvlTvm.ts index b1a84941..23462015 100644 --- a/cloud_functions/src/computeTvlTvm.ts +++ b/cloud_functions/src/computeTvlTvm.ts @@ -6,8 +6,10 @@ import { ACCOUNTANT_CONTRACT_ADDRESS, AccountEntry, assertEnvironmentVariable, + isTokenDenylisted, TokenMetaDatum, } from '@wormhole-foundation/wormhole-monitor-common'; +import { toChain, toChainId } from '@wormhole-foundation/sdk-base'; const WORMCHAIN_URLS: string[] = [ 'https://gateway.mainnet.xlabs.xyz', @@ -115,6 +117,11 @@ async function populateMaps() { const metaData: TokenMetaDatum[] = await getTokenMetadata(); console.log(`Got ${metaData.length} token metadata entries`); for (const md of metaData) { + try { + if (isTokenDenylisted(toChainId(toChain(md.token_chain)), md.native_address)) continue; + } catch (e) { + // The metadata table has a chain that the SDK doesn't know about, yet. Don't want to fail or skip the token. + } const key = `${md.token_chain}/${md.token_address}`; // wormhole supports a maximum of 8 decimals if (md.decimals > 8) {