Sparkn

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

Distributor.sol should check for non-zero values before transfer

Summary

Before transferring ERC20-s, a check for non-zero value must be done.

Vulnerability Details

Some ERC20 tokens revert on zero-value transfers. In such cases, a check must be done that amount > 0. If a single user's amount is 0 for whatever reason, the whole transaction will revert and no user will get their tokens. This could happen due to 2 main reasons: 1. Very little funds are distributed. 2. The user has a percentages value of 0 (there is no restriction prohibiting it)

for (uint256 i; i < winnersLength;) {
uint256 amount = totalAmount * percentages[i] / BASIS_POINTS;
erc20.safeTransfer(winners[i], amount);

Impact

DoS

Tools Used

Manual review

Recommendations

add a check for non-zero value transfers

Support

FAQs

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