31

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

 2 years ago
source link: https://learnblockchain.cn/question/2220
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
有偿求助,合约 转 erc20 代币,出现Gas estimation errored,账户里有代币,并授权过

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

回答问题即可获得 5 经验值,回答被采纳后即可获得 25 学分。

错误:
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方法
    }
}

已解决*****************


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK