Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fix to avoid parsing the broken token decimals #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/mappings/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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) {
Expand Down