0

I am experimenting with Uniswap's swapExactTokensForTokensSupportingFeeOnTransferTokens method by attempting to swap USDC -> WETH -> UNI-v2 using ethers.js just for the sake of understanding how the function works. My transaction fails with error TransferHelper: TRANSFER_FROM_FAILED that in my experience is almost always caused by not calling the approve method before the swap. Surely enough, when I check the parity trace on Goerli's etherscan.io I see that the error returned from the last call in my transaction is (ERC20: transfer amount exceeds allowance). My question is, which contract must I approve here? Approving Uniswap's v2 router did not work.

Here is such a failed transaction: https://goerli.etherscan.io/tx/0x677fef980f6e7ee813282811cb2edcf8bc71ceb6f61a9969574506084e89b112

2
  • Yes, the allowance must be the issue. Looking at your Tx history, looks like you have succeed approving and swapping now?
    – kfx
    Oct 25, 2022 at 16:00
  • Indeed I have, I will write the answer shortly Oct 25, 2022 at 16:30

1 Answer 1

0

The issue was that I was approving UniswapV3's contract to spend balance of the token in question but swapExactTokensForTokensSupportingFeeOnTransferTokens method was called on Uniswap's V2 router contract. Once I gave V2 Router contract the approval to spend, the transaction worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.