15 有偿求助,合约 转 erc20 代币,出现Gas estimation errored,账户里有代币,并授权过

错误: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? The execution failed due to an exception. Reverted

kovan ,代币地址:0x7228fdb0738ad6b3fe768b53fc764eef89aea216 代码已经上传,构造需要传参数

调用代码:

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);
}

contract TokenTransfer{
    IERC20 public wowToken;

    constructor() public{
       wowToken = IERC20(0x7228fDb0738Ad6B3fE768B53FC764eef89aea216); //实例化一个token
    }

    function tokenTransfer(address _to, uint _amt) public {
        wowToken.transfer(_to,_amt); //调用token的transfer方法
    }
}

已解决*****

请先 登录 后评论

2 个回答

livehere
请先 登录 后评论
xmenzp
请先 登录 后评论
  • 2 关注
  • 0 收藏,3244 浏览
  • livehere 提出于 2021-06-21 15:39