MetaMask / MetaMask/metamask-extension
Alert user of failing transaction for dapp proposed Token Transfer when the user doesn't have enough token balance
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
**Problem**: a Dapp can trigger a Token Transfer for a Token which I have 0 balance. This results in paying tx fees for an already failed transaction. We could know beforehand that the transaction was going to fail if we checked against our token balance.
Notice this behaviour is not possible from MetaMask itself, as before landing to the Confirmation screen, there is a validation that checks our Token balance is greater than the Amount for that Send.
https://user-images.githubusercontent.com/54408225/204812500-49da02ae-8e61-4d81-979b-9c14b753c218.mp4
**Steps to reproduce**
1. Go to Test Dapp https://metamask.github.io/test-dapp/
2. Connect to Test Dapp
3. Click Create Contract and Accept Tx on MM
4. Click Add Token to Wallet and Accept on MM
5. Go to MM and send all the Tokens to another address
6. Go back to Testdapp
7. Click Transfer Tokens -- see that you can proceed with this transaction, which will result in a failed tx as you don't have balance for that token
**Version**
10.23.0
**Browser**
Chrome
**Operating system**
Linux
Contributor guide
Research direction
Reproduce the failure with the MetaMask Test Dapp using the listed steps, especially after sending all tokens away. Trace the proposed Token Transfer flow before the Confirmation screen and identify where the token balance can be checked; done means a transfer with insufficient balance is rejected or clearly alerted before a transaction fee can be incurred.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100