如何写个合约,可以给里面转某种REC20代币,也可以取出来

pragma solidity ^0.5.8;

import "./ITRC20.sol";

contract Tokentest2{

           ITRC20 public tokenaddress;
           address  public tokenOwner;

     constructor(address tokenadd,address _tokenOwner)public{
           tokenaddress = ITRC20(tokenadd);
           tokenOwner = _tokenOwner;
     }      

    function withdraw(uint256 withdraw_amount)public {

        tokenaddress.transferFrom(tokenOwner,msg.sender,withdraw_amount);

    }

    function givetoken(uint256 give_amount)public{

        address buyer = address(msg.sender);
        tokenaddress.approve()
        tokenaddress.transferFrom(buyer,tokenOwner,give_amount); 

    }

}
请先 登录 后评论

1 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 0 收藏,921 浏览
  • 金浦哥哥 提出于 2020-11-20 15:08