Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low
Valid

Zero-value transfers may revert

Zero-value transfers may revert

  • Severity: Low

  • Confidence: High

Description

This detector identifies instances where zero-valued ERC20 token transfers are made. Even though EIP-20 states that zero-valued transfers must be treated as normal transfers and events must be triggered, some tokens may revert if this is attempted, which can cause transactions that involve other tokens (such as batch operations) to fully revert. Therefore, it may be safer and more gas-efficient to skip the transfer if the amount is zero.

There are 2 instances of this issue:

  • File: src/Distributor.sol

Line: 147 erc20.safeTransfer(winners[i], amount)

This variable might be zero: amount

https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L147

  • File: src/Distributor.sol

Line: 164 token.safeTransfer(STADIUM_ADDRESS, token.balanceOf(address(this)))

This variable might be zero: token.balanceOf(address(this))

https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L164

Support

FAQs

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