【发布时间】:2022-01-02 02:14:00
【问题描述】:
我真的对合同缺乏经验,需要您的帮助。我用 remix 创建了一个合约,并发送了一些 bnb 给它。我想找回它,但我似乎无法做到。
pragma solidity ^0.8;
interface IERC20 {
function transfer(address _to, uint256 _amount) external returns (bool);
}
contract MyContract {
function withdrawToken(address _tokenContract, uint256 _amount) external {
IERC20 tokenContract = IERC20(_tokenContract);
// transfer the token from address of this contract
// to address of the user (executing the withdrawToken() function)
tokenContract.transfer(msg.sender, _amount);
}
}
这是我在另一篇文章中使用的代码,但我不明白。我必须用数字更改“_to”“和“_amount”还是我只是复制代码并编译它?
我真的很抱歉,但我不知道我做了什么,所以我只想拿回令牌。
谢谢
【问题讨论】:
标签: solidity smartcontracts remix erc20