怎么从合约账户中转出代币

合约的转账代码

function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
       _transfer(sender, recipient, amount);
        _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
        return true;
    }

function _transfer(address sender, address recipient, uint256 amount) internal {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

合约地址是 aaaaa 里面是有很多币的 发行账号 bbbbb 余额是0 现在的需求是 要怎么把合约aaaa 里的部分币转给bbbb 通过上面的transferFrom 调用老是提示SafeMath: subtraction overflow

请先 登录 后评论

2 个回答

zen
请先 登录 后评论
Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 0 收藏,4386 浏览
  • laodeng 提出于 2021-10-28 21:35