HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: high
Invalid

Improper Use of SafeERC20 Library in AaveDIVAWrapper Contract

Summary

The AaveDIVAWrapper contract imports the SafeERC20 library from OpenZeppelin, which is designed to safely interact with ERC-20 tokens, including non-standard tokens like USDT. However, the contract does not fully utilize the library's functionality. Instead of using the safeApprove or forceApprove functions provided by SafeERC20, the contract uses the standard approve function. This creates a potential issue when interacting with tokens like USDT, which require specific handling for approve (e.g., setting allowance to zero before setting a new non-zero allowance).

Vulnerability Details

  • forceApprove: A more robust version of safeApprove that forcefully sets the allowance, even if the current allowance is non-zero.

Current implementation:

_wTokenContract.approve(_diva, type(uint256).max);
_collateralTokenContract.approve(_aaveV3Pool, type(uint256).max);

Impact

  • Transaction Reverts: When interacting with USDT or similar tokens, the approve function will revert if the current allowance is non-zero.

Tools Used

Manual Review -> Kann Audits

Recommendations
use forceApprove

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol

Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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