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

Decimal point is missing in one token balance, showing the actual balance multiplied by 10^18 #9771

Closed
apertamono opened this issue Oct 31, 2020 · 10 comments
Labels
area-tokens needs-reproduction needs-triage Sev2-normal Normal severity; minor loss of service or inconvenience. type-bug

Comments

@apertamono
Copy link

apertamono commented Oct 31, 2020

My UNI token balance, including the dollar value, is displayed as a 20-digit number instead of a 2-digit number with 18 decimals after the period - an impossibly large amount of money. The correct amount is shown on Uniswap, in transactions on Etherscan, and in another address on Metamask where I added the token today. The same issue does not occur with other token balances.

Browser details:

  • Windows 10 Pro
  • No hardware wallet
  • Chrome 86.0.4240.111
  • Metamask 8.0.10

Steps to reproduce:
It's an edge case, it might not be reproducible. I think it's worth looking at since it might cause heart attacks or reckless spending.

  1. I added Uniswap's UNI token to my Metamask account shortly after it was launched. But I didn't qualify for the airdrop, and the balance remained zero for a while.
  2. I bought a few UNI tokens on Bittrex. Ironically, this took a while because I omitted a zero in my first order. Then I withdrew them to this Ethereum account. Note: I only use Account 5, as explained here.
  3. While I'd bought 21.77966... UNI, it showed up as 2177966145000... UNI, with a USD value of $50,988,687,315,279,360,000.00.

21m UNI 1

  1. Metamask even let me send a 21 million UNI transaction back to Bittrex:

[removed]

  1. However, on Etherscan, this transaction showed up correctly, with 10 zeros after the decimal point before the 21:

[removed]

  1. Uniswap itself also shows the correct balance:

[removed]

  1. The error is still there when I'm sending the whole balance to another address:

[removed]

  1. This is an ridiculously high ETH value. Ethereum devs should have listened to me when I proposed a maximum supply of 123,456,789:

21m UNI 6

  1. For the other address (Account 1), where I added the UNI token today, after receiving the tokens, the correct value is displayed, truncated to only 3 decimals:

21m UNI 8

  1. After returning the tokens to Account 5, the impossibly large amount is displayed again:

[removed]

Additional context:

Can't find any indication that anything went wrong on Uniswap's side. One thing that makes my case unusual is that most UNI holders probably received their tokens before they added UNI to Metamask.

This might be related to fixed issue #6762.

Coincidentally, I also have truncation issue #9318, which has been fixed, but not in version 8.0.10 yet. I don't know why my extension hasn't been updated. My browser was restarted when a worker shut off my power yesterday.

21m UNI B truncated

@danjm
Copy link
Contributor

danjm commented Nov 1, 2020

Hi, what MetaMask version did this happen on?

@apertamono
Copy link
Author

@danjm The Chrome extension, version 8.0.10.

@danjm
Copy link
Contributor

danjm commented Nov 2, 2020

You might be able to fix this with the following steps:

  • From the main screen, click on UNI in the token list, so that you are taken to the screen where UNI's balance is shown
  • click the three vertical dots in the top right to open a dropdown menu. Select "Hide token"
  • confirm the "Hide token" message that you see, you'll be taken back to the main screen where all your tokens are listed
  • scroll to the bottom of the list of tokens and click the "Add Token" button
  • On the add token screen, paste the UNI address into the search box 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984. If UNI shows up in the list select it, otherwise click the "Custom Token" tab and paste the address in the first field. Then click next
  • You should see something like the following, with the correct amount of tokens:

If the correct UNI icon doesn't show up, don't worry, that will be fixed in an near future update. Regardless the number of tokens should be correct.

  • Click "Add Tokens", and the problem should be fixed.

If not, please report here what you see and we will dig deeper into this issue.

@apertamono
Copy link
Author

Thank you, re-adding the token does result in the correct amount.

But this isn't a support call, I'm more interested in how this could have happened. Somewhere the wrong unit must have been used.

@danjm
Copy link
Contributor

danjm commented Nov 2, 2020

Whenever a token is added to MetaMask, the symbol, decimals, and address are stored in your local state. UNI normally has 18 decimals, but the numbers you saw indicate that values were being calculated with a decimals of 0. Somehow, when you first added the UNI token, the decimals property that got saved with was set to 0.

How exactly that happened is not immediately clear...

Do you remember how you initially added the token? Did you copy and paste an address into the custom token form? If so, where did you copy the address from?

@danjm
Copy link
Contributor

danjm commented Nov 2, 2020

I wonder if you could have added the token before the node we attempted to fetch the contract data from was updated to include that contract? Or otherwise, the fetch for that data could have failed with no notice given. Either could have caused the decimals to default to zero.

@jacobc-eth jacobc-eth added needs-information Needs additional information from the user who reported the issue area-tokens labels Nov 7, 2020
@apertamono
Copy link
Author

Do you remember how you initially added the token? Did you copy and paste an address into the custom token form? If so, where did you copy the address from?

I think I copied the contract address from the airdrop page.

Shouldn't the default be 18 decimals, which is the most common? Maybe with a sanity check for extremely high or low numbers.

@rekmarks rekmarks added needs-reproduction and removed needs-information Needs additional information from the user who reported the issue labels Jan 7, 2021
@Gudahtt Gudahtt added Sev2-normal Normal severity; minor loss of service or inconvenience. type-bug needs-triage labels Jan 13, 2021
@tmashuang
Copy link
Contributor

Thank you, re-adding the token does result in the correct amount.

This seems issue is resolved. Since this issue was created, there have been improvements to how we handle failing token queries that could have been the issue, MetaMask/eth-token-tracker#53. If this happens again, feel free to add additional information in a new issue and reference this one.

@SenyahG
Copy link

SenyahG commented Oct 28, 2021

This has happened to me with #saitama. How do I rectify the issue? I'm wanting to buy more crypto but am terrified. Thanks

@apertamono
Copy link
Author

@SenyahG Don't worry, it's just a display issue. Try hiding the token and adding it again, as explained above.

But if you mean this token, I'm not sure whether it's an error. That one actually has an extremely high number of coins with a low value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tokens needs-reproduction needs-triage Sev2-normal Normal severity; minor loss of service or inconvenience. type-bug
Projects
None yet
Development

No branches or pull requests

7 participants