Skip to content

Commit c3bbec8

Browse files
panoelevan-gray
authored andcommitted
cloud_functions: add isTokenDenylisted call
1 parent d747b06 commit c3bbec8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cloud_functions/src/computeTvlTvm.ts

+7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import {
66
ACCOUNTANT_CONTRACT_ADDRESS,
77
AccountEntry,
88
assertEnvironmentVariable,
9+
isTokenDenylisted,
910
TokenMetaDatum,
1011
} from '@wormhole-foundation/wormhole-monitor-common';
12+
import { toChain, toChainId } from '@wormhole-foundation/sdk-base';
1113

1214
const WORMCHAIN_URLS: string[] = [
1315
'https://gateway.mainnet.xlabs.xyz',
@@ -115,6 +117,11 @@ async function populateMaps() {
115117
const metaData: TokenMetaDatum[] = await getTokenMetadata();
116118
console.log(`Got ${metaData.length} token metadata entries`);
117119
for (const md of metaData) {
120+
try {
121+
if (isTokenDenylisted(toChainId(toChain(md.token_chain)), md.native_address)) continue;
122+
} catch (e) {
123+
// The metadata table has a chain that the SDK doesn't know about, yet. Don't want to fail or skip the token.
124+
}
118125
const key = `${md.token_chain}/${md.token_address}`;
119126
// wormhole supports a maximum of 8 decimals
120127
if (md.decimals > 8) {

0 commit comments

Comments
 (0)