Sparkn

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

There is no way to determine winners[] and percentages[] have same order.

Summary

The length of winners[] and percentages[] is checked but there is no to determine if their order is same.

Vulnerability Details

If the order of winners[] and percentages[] is not same, winning funds can be mismatched.

Impact

The winners may lose their winnings and receive very low amounts than what they are supposed to.

Tools Used

Manual Analysis

Recommendations

Instead of using two separate arrays, use a single array of struct.
Example:

struct WinnerDetails {
address Winner;
uint96 percentage; // struct packing to save gas
}

And use this in the _distribute() function:

WinnerDetails[] calldata winners;

Support

FAQs

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