The calculation of finalAmount in the buyOutEstateNFT function is incorrect, leading to a loss of funds. The formula (value / divisor) * multiplier truncates the division result before multiplication, causing an incorrect distribution of funds.
The current calculation:
This divides value by divisor first, which truncates the result (due to Solidity’s integer division), and then multiplies by multiplier.
For example, if value = 100, divisor = 3, and multiplier = 2:
value / divisor = 100 / 3 = 33 (truncated).
33 * 2 = 66 (incorrect result).
The correct result should be (100 * 2) / 3 = 66.666..., but Solidity truncates this to 66, causing a loss of 0.666...
The incorrect calculation results in a loss of funds during the buyout process.
Manual review
To avoid losing funds, we can:
Calculate the base amount each beneficiary should receive (finalAmount / divisor).
Calculate the remainder (finalAmount % divisor).
Distribute the remainder to one of the beneficiaries (e.g., the first or last).
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.