Skip to content

Commit

Permalink
Allow overrides of allowance in ERC20
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro committed Aug 2, 2019
1 parent 15ada12 commit c54a18a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/token/ERC20/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ contract ERC20 is IERC20 {
*/
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));
_approve(sender, msg.sender, allowance(sender, msg.sender).sub(amount));
return true;
}

Expand All @@ -112,7 +112,7 @@ contract ERC20 is IERC20 {
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
_approve(msg.sender, spender, allowance(msg.sender, spender).add(addedValue));
return true;
}

Expand All @@ -131,7 +131,7 @@ contract ERC20 is IERC20 {
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
_approve(msg.sender, spender, allowance(msg.sender, spender).sub(subtractedValue));
return true;
}

Expand Down Expand Up @@ -223,6 +223,6 @@ contract ERC20 is IERC20 {
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
_approve(account, msg.sender, allowance(account, msg.sender).sub(amount));
}
}

0 comments on commit c54a18a

Please sign in to comment.