Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

Consider using `safeTransfer`/`safeTransferFrom`

Summary

Consider using safeTransfer/safeTransferFrom instead of transfer/transferFrom.

Vulnerability Details

Using safeTransfer() instead of transfer() is a best practice in Solidity because safeTransfer() includes extra checks and error handling that ensure compatibility with both standard and non-standard ERC20 tokens.

Impact

transfer() may not revert on failure while safeTransfer() reverts if the transfer fails. Using safeTransfer() ensures that the contract is robust and compatible with a broader range of ERC20 tokens, reducing the risk of failed transfers and enhancing security.

Tools Used

Manual audit

Recommendations

Import SafeERC20 library from OpenZeppelin:

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
using SafeERC20 for IERC20;

Use safeTransfer() / safeTransferFrom() with IERC20 casting:

IERC20(token).safeTransfer(recipient, amount);
Updates

Lead Judging Commences

inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[KNOWN] - Low-35 Unsafe use of transfer()/transferFrom() with IERC20

Support

FAQs

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