InheritanceManager::buyOutEstateNFT() can be used by one of the beneficiaries to buy out an NFT by paying the other beneficiaries their share of NFT value. Two variables are defined in the scope of this function that are relevant to this bug. divisor is the total number of beneficiaries. multiplier is the total number of beneficiaries minus msg.sender. The finalAmount is the amount to be payed by the msg.sender. This value should be divided by multiplier but is instead divided by divisor to settle the purchase of the NFT.
Incorrect fund allocation, leading to users receiving lower funds than they should. This breaks a contract invariant.
Copy the following into InheritanceManager.t.sol and run the test:
Expected Result:
Bug fix:
Give variable names that are reflective of what the variables are and not where they're used, in case they need to be used in multiple contexts. For example, you could rename divisor as numberOfBeneficiaries and multiplier as beneficiariesMinusOne, which would make this kind of bug less likely.
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.