合约的转账代码
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