From 0e346ca9e7129885ee31ede1ab3524c6dbf95093 Mon Sep 17 00:00:00 2001 From: unforkableco <103948226+unforkableco@users.noreply.github.com> Date: Wed, 20 Dec 2023 23:20:33 +0100 Subject: [PATCH] Added fix to avoid parsing the broken token decimals Not sure how to test this, but the same token also returns a huge value for decimals and could cause further issues --- src/mappings/helpers.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mappings/helpers.ts b/src/mappings/helpers.ts index b5fd836a..1b8e5e1c 100644 --- a/src/mappings/helpers.ts +++ b/src/mappings/helpers.ts @@ -113,14 +113,14 @@ export function fetchTokenName(tokenAddress: Address): string { return nameValue } -// HOT FIX: we cant implement try catch for overflow catching so skip total supply parsing on these tokens that overflow +// HOT FIX: we cant implement try catch for overflow catching so skip total supply and decimals parsing on these tokens that overflow // TODO: find better way to handle overflow -let SKIP_TOTAL_SUPPLY: string[] = [ +let SKIP_TOTAL_SUPPLY_AND_DECIMALS: string[] = [ "0x0000000000bf2686748e1c0255036e7617e7e8a5" ] export function fetchTokenTotalSupply(tokenAddress: Address): BigInt { - if (SKIP_TOTAL_SUPPLY.includes(tokenAddress.toHexString())) { + if (SKIP_TOTAL_SUPPLY_AND_DECIMALS.includes(tokenAddress.toHexString())) { return BigInt.fromI32(0) } @@ -134,6 +134,9 @@ export function fetchTokenTotalSupply(tokenAddress: Address): BigInt { } export function fetchTokenDecimals(tokenAddress: Address): BigInt { + if (SKIP_TOTAL_SUPPLY_AND_DECIMALS.includes(tokenAddress.toHexString())) { + return BigInt.fromI32(0) + } // static definitions overrides let staticDefinition = TokenDefinition.fromAddress(tokenAddress) if (staticDefinition != null) {