Unverified Commit 3e74681e by Hadrien Croubois Committed by GitHub

Read allowance from overridable function in increase/decrease (#3213)

parent f6b614a7
......@@ -180,7 +180,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[owner][spender] + addedValue);
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
......@@ -200,7 +200,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment