Sparkn

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

Dos when sending tokens to winners

Summary

Denial of service might occur when one transfer fails when distributing tokens.

Vulnerability Details

The following is used to send tokens.

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

Issues such as transfer to zero Address which is possible due to lack of validation of individual winners array items, can to DOSing the function.

Impact

Some supporters will miss rewards.

Tools Used

Manual review

Recommendations

Consider using pull over push pattern of adding to _distribute().

uint256 winnersLength = winners.length;
for (uint256 i; i < winnersLength;) {
if(winners[i] == Address(0)) revert Distributor__NoZeroAddress();
unchecked {
++i;
}
}

Support

FAQs

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