Description
In LikeRegistry::matchRewards
, the matching fee is calculated as (totalRewards * FIXEDFEE) / 100
. However, since Solidity performs integer division, any decimal values are truncated instead of rounded, leading to small amounts of ETH being lost.
Impact
The fee calculation is inaccurate, reducing platform revenue due to round down truncation.
Proof of Concepts
User A and user B both like each other, adding up a total rewards of 2 ETH
matchingFees
is calculated as (2 * 10) / 100 = (20 / 100)
The result is truncated to 0, when it had to be calculated as 0.2 ETH
Recommended mitigation
Add the following change to the code:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.