The function divides the total available balance (ethAmountAvailable
or assetAmountAvailable
) by the number of beneficiaries (divisor
). However, Solidity division truncates the result, which can lead to loss of funds if the total balance is not perfectly divisible by the number of beneficiaries.
The division ethAmountAvailable / divisor
and assetAmountAvailable / divisor
truncates any remainder.
For example, if ethAmountAvailable = 101
and divisor = 3
, each beneficiary receives 33
wei, and 2
wei are left unallocated in the contract.
Loss of Funds: A small amount of Ether or tokens may remain stuck in the contract, inaccessible to beneficiaries.
Inequitable Distribution: Beneficiaries may not receive their fair share of the funds.
Manual code review
Distribute the remainder to one of the beneficiaries (e.g., the first or last) to ensure all funds are allocated.
The recommended approach ensures that:
Each beneficiary receives an equal share (amountPerBeneficiary
).
Only one beneficiary (e.g., the first) receives the additional remainder.
The total distributed amount matches the available balance.
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.