metamask-mobile
metamask-mobile copied to clipboard
Unable to complete MM swap on non-native assets with Ledger and MM mobile over Polygon/Mainnet
Description
When I attempt to conduct a swap with a Ledger address through MMM, the transaction fails with this error according to Polygonscan: "Fail with error 'ERC20: transfer amount exceeds allowance'". Also shows " Warning! Error encountered during contract execution [execution reverted] " in red as well.
My first attempt was swapping .001 wEth for Matic (native) where a token spending approval required. In the MMM UI I granted approval for .00112345 wETH. It seems this may not have been broadcast based on the tx history for the address. Please note that I did have the Ledger setting "Display contract data details" Displayed, and that is why the video shows me having to validate the input of 70 fields before I was able to actually approve the transaction.
Upon my second attempt I tried to swap .005 Matic (native) for GRT and this transaction does not require a token spending approval, and succeeded.
For my third attempt I tried to swap .01 GRT for Matic (native) where a token spending approval is required. In the MMM UI I granted approval for .01123456. Here again, it seems this approval is not being broadcast in advance of the swap. In the video you can see the notification at 27 seconds that the swap was complete, but that transaction was reverted like the first.
Acceptance Criteria
- When attempting a swap that requires a token spending approval be granted, that should be signed and broadcast to the network before the actual swap transaction.
Scenario: MetaMask swap from a Non-native token
- GIVEN a user is attempting to swap out of a non-native asset
- WHEN a user grants a token spending approval in the MMM UI
- AND the amount granted is equal to or greater than the swap amount
- THEN the token spending approval should be signed and transmitted to the network in advance of the swap
References
First swap:
- Recording: https://recordit.co/B5Zb0l38dk
- tx: https://polygonscan.com/tx/0xd90aed6a43e9539ef4ae8726f68755ce3ae7d5e4a395f44a8243230a6bcd5659
Successful swap:
- Recording: https://recordit.co/vRwpLYlJc2
- tx: https://polygonscan.com/tx/0x94acdc11bad07e6cc6dd824ba927f89882299b3759780517b5f2be69234c3ed5
Third swap:
- Recording: https://recordit.co/QfvhuJWp4x
- tx; https://polygonscan.com/tx/0x526bdd64aa631167b83d835ff9dc1f325466ec5752c69566da38708bb9bcd49e
Following up on an earlier question- This is also the case on Mainnet. If the swap requires a token spending approval the user can grant that approval in the MetaMask UI, but the approval may not be sent to Ledger and is certainly not broadcast to a network in advance of the swap attempt.
Fixed in https://github.com/MetaMask/metamask-mobile/commit/39c97fa8d17aa19ef061b27e1424c02600abc8b5
This issue was closed because it has been stalled for 7 days with no activity. If you feel this was closed in error please reopen and provide evidence on the current production app. Thank you for your contributions.