The buyOutEstateNFT and** withdrawInheritedFunds** function in the InheritanceManager contract performs fund distribution using integer division. We know that division operations in solidity truncate decimal values instead of rounding them. This leads to an uneven distribution of funds, potentially causing some beneficiaries to receive less than their fair share and leaving an unallocated remainder in the contract.
The amountPerBeneficiary variable in the withdrawInheritedFunds function calculates the amount to be distributed among each beneficiaries, using division operations.
The finalAmount variable in the buyOutEstateNFT function calculates the total amount to be distributed among the beneficiaries, excluding the msg.sender, using division operations.
An example of the issue-
Total Nft buyout value = 100
Number of beneficiaries = 3
Divisor (beneficiaries.length) = 3
Multiplier (beneficiaries.length -1) = 2
Final Amount Calculation: finalAmount = (100 / 3) 2 = 33 * 2 = 66 (Truncated)
Each Remaining Beneficiary Gets: 66 / 3 = 22 (instead of 22.5)
Some beneficiaries may receive slightly less than their expected amount, leading to financial discrepancies.
Manual Review
Use a proportional adjustment strategy.
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.