MetaMask / MetaMask/metamask-extension
Confusing warning message when changing ERC20 allowance
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
Hey, I'm developer of tac.dappstar.io where you can review/reset your erc20 token allowances. Basically the site works like this:
1. you provide your address
2. TAC queries the blockchain for all approvals granted by the address
3. TAC shows all found approvals
4. User can change the approval to 0 or any other amount (By calling ERC20 "approve" function for token and spender address with new value)
When the user wants to set a new allowance of e.g. "0" for a token, metamask displays the warning message:

I get frequent feedback from my users that get confused because they feel the message contradicts their action. They want to clear allowance and get asked if TAC is allowed to spend their tokens :-) Obviously TAC does not even have an ethereum address/contract that could spend the tokens. I'm wondering if there is a way to not show this warning for this usecase.
**Steps to reproduce (REQUIRED)**
1. Go to https://tac.dappstar.io
2. Connect wallet
3. In Metamask select & connect an address that at some time in the past issued an approval for an ERC20 token
4. Click the "edit allowance" button
5. Set new desired allowance value for Token and spender address
6. Irritating Metamask warning message comes up (See screenshot)
**Expected behavior**
Ideally there would be no warning message appearing. User just can confirm transaction like any other regular transaction.
I'm assuming that you are checking the transaction if it contains any ERC20 approve call, and display the warning accordingly. Since you can not know who is the owner of the allowed address it may be impossible to detect a "good" case (user wants to decrease/clear existing allowance via TAC) and a "bad" case (User grants new approval to some shady contract).
Still it might be possible to improve the sitation. Some ideas:
- Look at the approved amount. If it is 0, do not show warning message
- Look at the approved spender. Does the spender already have an existing approval? We could reword the warning to `Allow TAC to change your LINK approval?`. This would be a much better match to the actual user action happening.
Thank you
Michael
Contributor guide
Assessment
This issue has not been assessed yet.