diff --git a/contracts/token/ERC777/ERC777.sol b/contracts/token/ERC777/ERC777.sol index 9a7782811..1ef6aaf55 100644 --- a/contracts/token/ERC777/ERC777.sol +++ b/contracts/token/ERC777/ERC777.sol @@ -144,16 +144,7 @@ contract ERC777 is Context, IERC777, IERC20 { * Also emits a {Sent} event. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { - require(recipient != address(0), "ERC777: transfer to the zero address"); - - address from = _msgSender(); - - _callTokensToSend(from, from, recipient, amount, "", ""); - - _move(from, from, recipient, amount, "", ""); - - _callTokensReceived(from, from, recipient, amount, "", "", false); - + _send(_msgSender(), recipient, amount, "", "", false); return true; } @@ -286,13 +277,7 @@ contract ERC777 is Context, IERC777, IERC20 { address recipient, uint256 amount ) public virtual override returns (bool) { - require(recipient != address(0), "ERC777: transfer to the zero address"); - require(holder != address(0), "ERC777: transfer from the zero address"); - address spender = _msgSender(); - - _callTokensToSend(spender, holder, recipient, amount, "", ""); - uint256 currentAllowance = _allowances[holder][spender]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC777: transfer amount exceeds allowance"); @@ -301,9 +286,7 @@ contract ERC777 is Context, IERC777, IERC20 { } } - _move(spender, holder, recipient, amount, "", ""); - - _callTokensReceived(spender, holder, recipient, amount, "", "", false); + _send(holder, recipient, amount, "", "", false); return true; } @@ -392,8 +375,8 @@ contract ERC777 is Context, IERC777, IERC20 { bytes memory operatorData, bool requireReceptionAck ) internal virtual { - require(from != address(0), "ERC777: send from the zero address"); - require(to != address(0), "ERC777: send to the zero address"); + require(from != address(0), "ERC777: transfer from the zero address"); + require(to != address(0), "ERC777: transfer to the zero address"); address operator = _msgSender();