0

I'm attempting to swap BCLNC tokens for ETH on Uniswap, but I get the following error:

The transaction cannot succeed due to error: TransferHelper: TRANSFER_FROM_FAILED. This is probably an issue with one of the tokens you are swapping.

However, it is clear that other transactions are successful such as this one.

I've attempted to perform a swapExactTokensForETH directly on the Uniswap contract replicating the details such as Path and the correct values for amountIn, to and deadline, but it attempts to charge me an excessive gas fee (over $160), and MetaMask displays the following error:

ALERT: Transaction Error. Exception thrown in contract code.

Any idea what the issue could be here?

14
  • This error is usually the result of you not calling approve prior to calling transferFrom. Nov 3 '20 at 13:11
  • In other words: Nov 3 '20 at 13:15
  • 2
    @Neo I'm really sorry to inform you that you were a victim of a honeypot contract. Look at the ensure modifier, only the owner can make arbitrary transfers.
    – Ismael
    Nov 3 '20 at 17:28
  • 2
    @Neo Look at transfer and transferFrom both are guarded by ensure modifier. That modifier prevents arbitrary transfers, you can buy tokens from the owner, and from uniswap's pool, but you can't sell them to anyone but the owner.
    – Ismael
    Nov 4 '20 at 0:55
  • 2
    @Neo You are correct. Another suspicious function is delegate that allows owner arbitrary code execution.
    – Ismael
    Nov 4 '20 at 13:22
0

It is because your function needs to be payable if your receiver address is a contract

2
  • Thanks for your answer.. but the question is not to transfer Ether. It is to transfer a Token. and it does not need to have wallet payable. Dec 15 '20 at 13:25
  • ah maybe you need to approve your tokens in order for unsiwap to spend it? Dunno if your tokens are an ERC20 token
    – Maxstgt
    Dec 28 '20 at 14:02

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