Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

approve()/safeApprove() may revert if the current approval is not zero

Summary

[L-6] approve()/safeApprove() may revert if the current approval is not zero

Calling approve() without first calling approve(0) if the current approval is non-zero will revert with some tokens, such as Tether (USDT). While Tether is known to do this, it applies to other tokens as well, which are trying to protect against this attack vector. safeApprove() itself also implements this protection.
Always reset the approval to zero before changing it to a new value (SafeERC20.forceApprove() does this for you), or use safeIncreaseAllowance()/safeDecreaseAllowance()

file: /contracts/strategy/gmx/GMXWorker.sol
118 IERC20(sp.tokenIn).approve(address(self.swapRouter), sp.amountIn);
133 IERC20(sp.tokenIn).approve(address(self.swapRouter), sp.amountIn);
file: /contracts/strategy/gmx/GMXTrove.sol
38 _store.tokenA.approve(address(vault), type(uint256).max);
39 _store.tokenB.approve(address(vault), type(uint256).max);
Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.