Possible bug in returning decimals?

I noticed a particular token that should return the decimals as 0 is returning18 when queried. It looks like the token is not fully compliant with the ERC20 standard, however another version of the token does properly return 0 for the decimals.

Incorrect Decimals value returned: 0x5B1d1BBDCc432213F83b15214B93Dc24D31855Ef

Correct Decimals value returned: 0x14fEe7d23233AC941ADd278c123989b86eA7e1fF

The contracts aren’t identical but are similar and both have the standard decimals() function, although it is slightly different than the ERC20 standard.

ERC20 standard decimals function:
function decimals() public view returns (uint8) {return _decimals;}

Contract decimals function:
function decimals() public pure returns (uint8) {return _decimals;}

Generally this wouldn’t be a concern because I saw the error and have manually implemented a correction for this particular token in my app. My app uses the decimals to add the token to MetaMask which, in turn, causes MetaMask to transact an incorrect amount of tokens.

I really just want to bring this up so the bitquery team can double check if it is a fluke on this particular token or if the issue is known to consistently pop up.

query:

query MyQuery {
ethereum(network: bsc) {
address(address: {is: “0x5B1d1BBDCc432213F83b15214B93Dc24D31855Ef”}) {
smartContract {
currency {
decimals
symbol
}
}
address
}
}
}

The exact same query will return the wrong decimals for one token, and the correct for another token that has nearly identical contract code.

Thanks!
Ryan Dunn

Thank you for pointing this bug. I’ll put it forward to the technical team.