I am using remix and ganache and metamask and I encounter a confusing error. I compiled and deployed USDT at


on ganache with no problem. In order to do some test on it I wrote following contract in remix:

pragma solidity ^0.6.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/SafeERC20.sol";

contract testTether {
    using SafeERC20 for IERC20;
    IERC20 public token;

    constructor(IERC20 _token) public {
        token = _token;

    function transfer(address to, uint256 amount) public {
        token.safeTransfer(to, amount);

when I try to call transfer function I get:

Gas estimation failed: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Returned error: VM Exception while processing transaction: revert SafeERC20: low-level call failed

what is the problem?

Thanks in advance.

  • You are probably specifying an amount larger than the balance of the from account. – goodvibration Sep 8 '20 at 17:13
  • @goodvibration Thanks for reply but no, it is not the problem and from account has sufficient balance. I am wondering if I should approve amount of token before transfer for owner? As I read here for token exchange two transaction is needed. – Kourosh Sep 8 '20 at 19:38
  • You should approve before transferFrom, not before transfer. – goodvibration Sep 8 '20 at 19:56
  • 1
    As implemented testTether.transfer will transfer tokens from testTether contract balance. It doesn't move tokens from msg.sender. – Ismael Sep 9 '20 at 0:29
  • @Ismael, Thanks, yes you are right. It was because of lack of enough balance in testTether contract. Is there any way to transfer token from one account to another directly using a smart contract function like my code above in a way that transaction fee be paid by sender account not smart contract? – Kourosh Sep 10 '20 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.