I deployed a pre-sale contract for an ERC20 token and have the purchases being made in Tether USDT. The transactions have been failing when calling the transferFrom on the USDT interface because of the gas fees. When I was looking into it a normal transfer was costing around $1.12 and a transferFrom was costing $460.

        usdt.transferFrom(msg.sender, admin, usdtAmount);

        PreSale.transfer(msg.sender, tokenAmount);
        availableTokens -= tokenAmount;

Maybe there is a better way to implement the sales contract. I was considering a fallback function that anytime the contract receives USDT that it would spend a corresponding amount of tokens, but from what I was reading it seemed to only work with ETH and not ERC20 tokens.

Why does a transferFrom cost so much more than a general transfer call? And what should I do instead?

1 Answer 1


Have you approved the transfer of USDT from the owner to the spender (i.e. the contract that you have deployed). The transferFrom function can transfer x ERC20 tokens only after an amount y (>= x) has already been approved by the owner to the spender.

Now, the reason that you are seeing a transfer cost of $460 is that the wallet cannot estimate the gas required fro the transfer because of the incorrect logic and sends the maximum amount of gas it can for the transaction. Hence, solving the problem mentioned in my first paragraph will also solve your "high gas" error

  • Yes I do have the front end run an approval first. To allow the smart contract to transfer on behalf of the users connected wallet. The max gas cost is a very helpful point. I'll look into that more as there could be some bug in my code.
    – Alex Wong
    Nov 27, 2022 at 17:36

Your Answer

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

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