MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.91k stars 4.87k forks source link

[Bug]: "Insufficient tokens." error when attempting to send zero decimal token in Metamask browser extension #27380

Open immortalcreed opened 5 days ago

immortalcreed commented 5 days ago

Describe the bug

When trying to send an ERC-20 token that is set to zero decimals using the Metamask browser extension on Chrome on Windows, Metamask appears to be treating the token as having 18 decimals instead of 0. This results in an "Insufficient tokens." error displayed and the Continue option being disabled when entering whole number values for the send. All other parts of Metamask seem to handle the zero decimal value correctly.

image

image

Selecting MAX here shows Metamask treating the token value as having 18 decimals instead of 0: image

I do not see the same behavior in the Metamask iOS app when sending the zero decimal token. The token contract I am working with is 0x8cdf9becee3d673ed725345c2dea7656a801cd58 on Polygon Mainnet. Unfortunately I do not have a good way to test this behavior with another zero decimal token.

Expected behavior

I expect to be able to send a whole number of the zero decimal token, without receiving an "Insufficient tokens." error or having to work around the issue by providing a value set to 18 decimals when sending using the Metamask browser extension.

Screenshots/Recordings

See screenshots in description.

Steps to reproduce

  1. Import an ERC-20 token set to 0 decimals (I am using ORIGINS on Polygon Mainnet 0x8cdf9becee3d673ed725345c2dea7656a801cd58).
  2. Obtain 1 or more of the imported token. I can provide ORIGINS tokens for testing if needed.
  3. Select the Send option for this token.
  4. Choose a recipient address.
  5. Enter 1 for the token amount to send.

Error messages or log output

Insufficient tokens.

Detection stage

In production (default)

Version

12.2.4

Build type

None

Browser

Chrome

Operating system

Windows

Hardware wallet

No response

Additional context

No response

Severity

No response

immortalcreed commented 5 days ago

This may be a duplicate of https://github.com/MetaMask/metamask-extension/issues/26975.

bergeron commented 4 days ago

See similar issues, check if already fixed: