From 1f49f794e5431f011b4524173cfef9bf9726ef6a Mon Sep 17 00:00:00 2001 From: Taylor Brent Date: Tue, 10 Oct 2023 15:31:54 -0400 Subject: [PATCH] slight tweak to implementation to account for ERC20s that do not handle max allowances the same way --- contracts/libraries/Allowance.sol | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/contracts/libraries/Allowance.sol b/contracts/libraries/Allowance.sol index b8da24064b..e0855f6af2 100644 --- a/contracts/libraries/Allowance.sol +++ b/contracts/libraries/Allowance.sol @@ -30,10 +30,7 @@ library AllowanceLib { // 3. Fall-back to setting a maximum allowance if (!success) { token.approve(spender, type(uint256).max); - require( - token.allowance(address(this), spender) == type(uint256).max, - "allowance not max" - ); + require(token.allowance(address(this), spender) >= value, "allowance missing"); } } }