11

其它 4 个回答

 3 years ago
source link: https://learnblockchain.cn/question/1695
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.
neoserver,ios ssh client
我想写一个USDT归集转账的合约,想在这个归集合约里面调用USDT的transferForm接口,可是调用的时候报错了。 | 登链社区 | 技术问答

40 我想写一个USDT归集转账的合约,想在这个归集合约里面调用USDT的transferForm接口,可是调用的时候报错了。

我调用的合约代码如下:

    function collect() public {
        for (uint i; i < userList.length - 1; i++) {
            
            uint256 allowance = handler.allowance(userList[i], gather_address);
            
            handler.transferFrom(userList[i], gather_address, allowance);
        }
    }

错误提示信息如下:

###### Gas estimation failed

**

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }

调用在归集合约中调用 USDT 合约的 allowance,balanceof 接口都正常。希望能帮忙。谢谢

最佳答案 2020-11-24 19:43

把 hander 接口定义的 transferFrom 的返回值去掉。
这个是因为 USDT 没有完全遵循 ERC20 标准

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 47% | 回答于 2020-11-24 19:43

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK