The bug in the buyOutEstateNFT
function arises from the incorrect use of return instead of continue in the distribution loop and the miscalculation of the transfer amount as finalAmount / divisor instead of value / divisor. These issues prevent proper fund distribution and fairness among beneficiaries
The function uses a for loop to distribute funds to beneficiaries other than the buyer (msg.sender). However, the loop contains the following condition
The return statement causes the function to exit immediately when the buyer's address is encountered in the beneficiaries array. This means that only beneficiaries listed before the buyer in the array receive their share, while those listed after the buyer are skipped entirely.
Early Return Issue: Some beneficiaries may not receive their share of the buyout funds, depending on their position in the beneficiaries array relative to the buyer. This breaks the fairness and intent of the buyout mechanism.
To prevent this from happening, it is better to change the function to the following form:
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.