@ -122,7 +122,7 @@ contract ERC777 is IERC777, IERC20 {
}
/**
* @ dev Returns the amount of tokens owned by an account ( ` own er` ) .
* @ dev Returns the amount of tokens owned by an account ( ` tokenHold er` ) .
* /
function balanceOf ( address tokenHolder ) public view returns ( uint256 ) {
return _balances [ tokenHolder ] ;
@ -252,8 +252,8 @@ contract ERC777 is IERC777, IERC20 {
* not have allowance , and accounts with allowance may not be operators
* themselves .
* /
function allowance ( address own er, address spender ) public view returns ( uint256 ) {
return _allowances [ own er] [ spender ] ;
function allowance ( address hold er, address spender ) public view returns ( uint256 ) {
return _allowances [ hold er] [ spender ] ;
}
/**
@ -262,7 +262,8 @@ contract ERC777 is IERC777, IERC20 {
* Note that accounts cannot have allowance issued by their operators .
* /
function approve ( address spender , uint256 value ) external returns ( bool ) {
_approve ( msg . sender , spender , value ) ;
address holder = msg . sender ;
_approve ( holder , spender , value ) ;
return true ;
}
@ -275,18 +276,18 @@ contract ERC777 is IERC777, IERC20 {
*
* Emits ` Sent ` and ` Transfer ` events .
* /
function transferFrom ( address sen der, address recipient , uint256 amount ) external returns ( bool ) {
function transferFrom ( address hol der, address recipient , uint256 amount ) external returns ( bool ) {
require ( recipient != address ( 0 ) , " ERC777: transfer to the zero address " ) ;
require ( sen der != address ( 0 ) , " ERC777: transfer from the zero address " ) ;
require ( hol der != address ( 0 ) , " ERC777: transfer from the zero address " ) ;
address operato r = msg . sender ;
address spende r = msg . sender ;
_callTokensToSend ( operator , sen der, recipient , amount , " " , " " ) ;
_callTokensToSend ( spender , hol der, recipient , amount , " " , " " ) ;
_move ( operator , sen der, recipient , amount , " " , " " ) ;
_approve ( sender , operato r, _allowances [ sender ] [ operato r] . sub ( amount ) ) ;
_move ( spender , hol der, recipient , amount , " " , " " ) ;
_approve ( holder , spende r, _allowances [ holder ] [ spende r] . sub ( amount ) ) ;
_callTokensReceived ( operator , sen der, recipient , amount , " " , " " , false ) ;
_callTokensReceived ( spender , hol der, recipient , amount , " " , " " , false ) ;
return true ;
}
@ -406,14 +407,14 @@ contract ERC777 is IERC777, IERC20 {
emit Transfer ( from , to , amount ) ;
}
function _approve ( address own er, address spender , uint256 value ) private {
function _approve ( address hold er, address spender , uint256 value ) private {
/ / TODO : restore this require statement if this function becomes internal , or is called at a new callsite . It is
/ / currently unnecessary .
/ / require ( own er != address ( 0 ) , " ERC777: approve from the zero address " ) ;
/ / require ( hold er != address ( 0 ) , " ERC777: approve from the zero address " ) ;
require ( spender != address ( 0 ) , " ERC777: approve to the zero address " ) ;
_allowances [ own er] [ spender ] = value ;
emit Approval ( own er, spender , value ) ;
_allowances [ hold er] [ spender ] = value ;
emit Approval ( hold er, spender , value ) ;
}
/**