Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Incorrect calculation for the payment amount in buyOutEstateNFT

Summary

The buyOutEstateNFT function in the InheritanceManager contract contains an incorrect calculation for the payment amount when a beneficiary buys out an NFT representing a real-world asset. The calculation uses integer division before multiplication, which leads to rounding errors and incorrect payouts to beneficiaries.

Vulnerability Details

The issue arises because the calculation (value / divisor) * multiplier performs integer division before multiplication. This results in loss of precision due to rounding down during the division step. For example:

If value = 100, divisor = 3, and multiplier = 2, the calculation becomes (100 / 3) * 2 = 33 * 2 = 66.
The correct calculation should be (100 * 2) / 3 = 200 / 3 = 66.66 (rounded down to 66).

This rounding error causes beneficiaries to receive less than their fair share.

Impact

Beneficiaries receive incorrect amounts due to rounding errors, leading to unfair payouts.

Tools Used

Manual code review

Recommendations

To fix the issue, the calculation should be adjusted to perform multiplication before division to minimize rounding errors

Updates

Lead Judging Commences

0xtimefliez Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

buyOutNFT has wrong denominator

Support

FAQs

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