Dria

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

Some tokens may revert when zero value transfers are made

Summary

BuyerAgent.sol::withdraw function does not check if _amount is zero before attempting a token transfer some ERC-20 tokens may revert when a zero-value transfer is attempted using the transfer function. This can lead to a revert in the withdraw function

Vulnerability Details

// transfer the tokens to the owner of Buyer
swan.token().transfer(owner(), _amount); // Zero-value transfer may revert

Impact

if _amount is zero the transfer may revert for certain(Swan) tokens, causing a Denial of Service (DoS) and as buyerAgent will not be able to complete withdrawals

Tools Used

  • Manual code review

Recommendations

// Check to prevent zero-value transfers
if (_amount > 0) {
// Ensure the transfer is successful
bool success = swan.token().transfer(owner(), _amount);
require(success, "Token transfer failed");
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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