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

EIP-681 URL and QRcode for "approve" function does not work #1828

Closed
ravisriv opened this issue Sep 9, 2020 · 7 comments · Fixed by #1847
Closed

EIP-681 URL and QRcode for "approve" function does not work #1828

ravisriv opened this issue Sep 9, 2020 · 7 comments · Fixed by #1847
Labels
type-bug Something isn't working

Comments

@ravisriv
Copy link

ravisriv commented Sep 9, 2020

Bug Description

The following EIP-681 compliant URL for "approve" does not work:

https://metamask.app.link/send/pay-contractAddress/approve?address=receiverAddress&uint256=1e2

Please refer to the discussion on this "closed" issue (#1059). The QR code that is generated in accordance with EIP-681 for "approve" method causes incorrect messages to be displayed on the MetaMask Mobile v1.0.1 and the transactions eventually fail to execute.

This EIP-681 functionality was working in earlier beta releases of MetaMask in January-February 2020 time frame. I had tested it extensively. The functionality probably broke after April of 2020.

To Reproduce

Use the following URL on your iPhone with MetaMask 1.0.1 installed.
https://metamask.app.link/send/pay-0x3dD3DfaAdA4d6765Ae19b8964E2BAC0139eeCb40@4/approve?0x0301dcF5Cf918a6E506AEa3C8FC6c57D8EbB8B92&uint256=50023e2

The purpose of the URL is to approve a smart contract to spend certain amount of an ERC20 token from the user's wallet.

The MetaMask-Mobile should seek user's permission to allow the smart contract permission to spend ERC20 tokens from the user's wallet. However, the MetaMask Mobile screen shows the following erroneous message and fails to process the EIP-681 request correctly.

Screenshot 2020-09-08 at 11 02 47 PM

Next create an "approve" function at the following MetaMask Deep Link Generator:
https://brunobar79.github.io/eip681-link-generator/#

Scan the QRcode. It will fail to process the "approve" transaction.

screenshot2

When you scan the QRcode above using MetaMask Mobile, you get the following screen:

IMG_2201

This is incorrect and confusing.

Expected Behavior

The correct message should be that "Authorize xxx to spend yyy ERC20 tokens from your wallet?" "xxx" in the previous sentence refers to the owner of the smart contract and "yyy ERC20" refers to "number of ". If the user approves the transaction, the smart contract is authorized to withdraw ERC20 tokens from the wallet. However, after scanning the QR code, we get the above screen (which is incorrect) and the "approve" transaction fails.

Smart Phone
Noticed this bug on iPhone X, iOS 13.6.1 MetaMask Mobile v1.0.1.

Criticality
"approve" is a highly critical ERC20 method required for several Dapps. Some of the common use cases include, agreeing to submit earnest money for an auction. The auctioneer will withdraw the money only if the user's bid is accepted. Other instances would include when the "approver" wants the "approvee" to withdraw the money under certain circumstances.

This issue is visible to all users and to anyone who is using EIP-681.

Please take note that in the absence of an SDK for MetaMask mobile, EIP-681 is the only way of interfacing with an app on the mobile device. Therefore, this is a highly critical issue, which needs to be resolved quickly.

@ravisriv ravisriv added the type-bug Something isn't working label Sep 9, 2020
@ravisriv
Copy link
Author

Hi @omnat, @estebanmino and contributors - May I please request your kind attention to this issue regarding ERC20 "approve" method under EIP-681. The reason I'm troubling you is that our entire mobile app development has hit this wall and we cannot proceed any further. This issue appears to be a break-fix, since it was working earlier this year. I understand that you may have prioritized these issues in a certain order. If that is the case, I'd just stand in line until a kind soul picks it up. If I could do anything to speed it up, please let me know. I'd be most honored. Thank you very much!

@ravisriv
Copy link
Author

Thanks @estebanmino I'm ready to test!

@estebanmino
Copy link
Contributor

@ravisriv do you have any example to test?

@ravisriv
Copy link
Author

@estebanmino Yes, will use the following deep link for testing:

https://metamask.app.link/send/0x3dD3DfaAdA4d6765Ae19b8964E2BAC0139eeCb40@4/approve?address=0x178e3e6c9f547A00E33150F7104427ea02cfc747&uint256=5e8

The smart contract 0x3dD...eeCb40 on Rinkeby has created certain ERC20 tokens, which the MetaMask wallet owner will have in their wallet. The MetaMask wallet owner will allow ("approve") the smart contract 0x178...cfc747 (on Rinkeby) to spend 500 of these tokens. If the approval is successful, the smart contract can spend 500 of these ERC20 tokens from the MetaMask owner's wallet in the next step.

@ravisriv
Copy link
Author

@estebanmino In addition to above, if there is full EIP-681 compatibility, we can send other smart contract functions (for example, our smart contract has non-ERC20 functions like "confirm", "cancel", etc.) through the EIP-681 deep link. Therefore, we have extensive capability to test this function quite thoroughly. Thanks you very much, Esteban.

@estebanmino
Copy link
Contributor

this is going to be part of the next release, let's follow other RPC methods here #1872

@estebanmino
Copy link
Contributor

@ravisriv thank you for your insights!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants