Sparkn

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

Percentage of 0 for a winner may cause transaction to revert

Summary

If percentage is set to 0 for a winner, there will be a transfer of 0 amount, causing the transaction to revert with some tokens.

Vulnerability Details

If percentage is set to 0 for a winner, there will be a transfer of 0 amount. Some tokens can revert if the amount being transferred is 0. Therefore, it's important to check whether the percentage being transferred is more than 0.

More info - https://github.com/d-xo/weird-erc20#revert-on-zero-value-transfers

Impact

There could be some situations where winners of 0 percentage could have a use case, such as honorable mentions, and the organizer would want to do this without having the transaction reverting.

Tools Used

Manual analysis

Recommendations

Instead of trying to transfer the funds to each address, store in a state variable how many funds each address can withdraw and then create a withdraw function, where each participant can withdraw the funds their own. Push over pull.

Support

FAQs

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