re-enabling safemath revert reasons in ERC20, ERC777 and ERC1155 (#2491)
* re-enabling safemath revert reasons in ERC20 and ERC1155 * adding revert messages to ERC777 * removing uncheck block
This commit is contained in:
@ -277,6 +277,8 @@ contract ERC777 is Context, IERC777, IERC20 {
|
||||
_callTokensToSend(spender, holder, recipient, amount, "", "");
|
||||
|
||||
_move(spender, holder, recipient, amount, "", "");
|
||||
|
||||
require(_allowances[holder][spender] >= amount, "ERC777: transfer amount exceeds allowance");
|
||||
_approve(holder, spender, _allowances[holder][spender] - amount);
|
||||
|
||||
_callTokensReceived(spender, holder, recipient, amount, "", "", false);
|
||||
@ -317,8 +319,8 @@ contract ERC777 is Context, IERC777, IERC20 {
|
||||
_beforeTokenTransfer(operator, address(0), account, amount);
|
||||
|
||||
// Update state variables
|
||||
_totalSupply = _totalSupply + amount;
|
||||
_balances[account] = _balances[account] + amount;
|
||||
_totalSupply += amount;
|
||||
_balances[account] += amount;
|
||||
|
||||
_callTokensReceived(operator, address(0), account, amount, userData, operatorData, true);
|
||||
|
||||
@ -383,8 +385,9 @@ contract ERC777 is Context, IERC777, IERC20 {
|
||||
_beforeTokenTransfer(operator, from, address(0), amount);
|
||||
|
||||
// Update state variables
|
||||
_balances[from] = _balances[from] - amount;
|
||||
_totalSupply = _totalSupply - amount;
|
||||
require(_balances[from] >= amount, "ERC777: burn amount exceeds balance");
|
||||
_balances[from] -= amount;
|
||||
_totalSupply -= amount;
|
||||
|
||||
emit Burned(operator, from, amount, data, operatorData);
|
||||
emit Transfer(from, address(0), amount);
|
||||
@ -402,8 +405,9 @@ contract ERC777 is Context, IERC777, IERC20 {
|
||||
{
|
||||
_beforeTokenTransfer(operator, from, to, amount);
|
||||
|
||||
_balances[from] = _balances[from] - amount;
|
||||
_balances[to] = _balances[to] + amount;
|
||||
require(_balances[from] >= amount, "ERC777: transfer amount exceeds balance");
|
||||
_balances[from] -= amount;
|
||||
_balances[to] += amount;
|
||||
|
||||
emit Sent(operator, from, to, amount, userData, operatorData);
|
||||
emit Transfer(from, to, amount);
|
||||
|
||||
Reference in New Issue
Block a user