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

Clicking on Approve USDT does nothing #1172

Closed
simundev opened this issue Oct 18, 2020 · 3 comments
Closed

Clicking on Approve USDT does nothing #1172

simundev opened this issue Oct 18, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@simundev
Copy link

Bug Description
Clicking on Approve does nothing. It does not bring up Metamask to proceed with the approval.

Steps to Reproduce
I am not sure how to reproduce this, but I've noticed this doesn't happen for all my addresses. Some work. This address in particular I've used with Uniswap many times before and probably already approved USDT up to some amount (maybe to infinity, maybe not). So my theory is that sometimes the interface doesn't correctly recognize the state of approval that already exists, yet it also does not decide a new approval is needed, thus leaving me stuck and unable to exchange USDT for ETH.

Expected Behavior
I expect the click to the button to bring up Metamask and ask me to confirm the approval transaction. I'm pretty sure I already approved to infinity before, but I'm OK doing it again. I just need to be allowed to do it.

Additional Context
Everything looks normal. I've got plenty USDT. But clicking on the Approve button does nothing.

Untitled 30

@simundev simundev added the bug Something isn't working label Oct 18, 2020
@moodysalem
Copy link
Contributor

This is duplicate of #1034

Unfortunately you must approve 0 for the Uniswap v2 router because USDT approves fail if the existing approval is non-zero

@simundev
Copy link
Author

I think that there should be a button in the interface to do this (call Approve with 0) or there should be a popup message with instructions saying what needs to be done and how. I'm a programmer and it is not immediately clear to me where I should first find the correct Uniswap v2 router address, then where do I find the correct USDT ERC20 contract address, then how to call Approve() on the USDT ERC20 contract using Etherscan and pass the Uniswap v2 router address as one of the parameters. If it's not clear to technical people, I'd wager it's impossible for non-technical people and it's very likely many people struggle with this.

@simundev
Copy link
Author

OK so if anyone ends up here via Google, here is what to do:

The contract address of USDT ERC20 is: 0xdAC17F958D2ee523a2206206994597C13D831ec7
The Uniswap V2 router is: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D

Go to the USDT ERC20 contract, click "Write contract", you should end up here: https://etherscan.io/writecontract/index.html?m=normal&v=20.8.4.2&a=0xdac17f958d2ee523a2206206994597c13d831ec7&n=mainnet#collapse2

Click the "Connect with web3" link in the upper left corner to connect Metamask.

Find the approve function.

For "_spender (address)" enter 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
For "_value (uint256)" enter 0

Click "Write".

Check the Metamask transaction details. They should be 0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000000000000000000000

If Metamask asks you whether you want to permit Etherscan to spend your USDT, as it did for me, double check the transaction details. If they are like above, you are fine and you will be approving Uniswap v2 router and not Etherscan.

Double check the fee Metamask is offering, it said ~$140 for me. The approve() function should take ~15000 gas, if you put ~50000 it should be enough.

Click "Confirm".

Once your transaction is confirmed you can go back to Uniswap and go ahead with the approval process there.

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

No branches or pull requests

2 participants