The allocateFunds() function in the Treasury.sol contract incorrectly overwrites the allocation amount for recipients rather than adding to the existing balance. This leads to the previous allocation being lost each time the function is called, causing issues with accurate fund tracking and potentially misallocating treasury funds.
Treasury.sol:When allocating funds to a recipient, the new allocation amount should be added to any previous allocations for that recipient, allowing the total allocation to accumulate over time.
Instead of adding to the previous allocation, the function directly assigns the new amount, replacing any prior allocation.
Loss of Previous Allocations: Each call to allocateFunds() erases the prior allocated amount, which leads to incomplete or incorrect fund tracking.
Inaccurate Fund Distribution: Allocators might unknowingly override funds that have already been allocated, resulting in improper distribution of the treasury's resources.
Inconsistent Fund Records: Allocations will not accumulate correctly, causing discrepancies in the treasury's allocation records.
Potential loss of old allocation: If funds are meant to be distributed progressively, each allocation will overwrite the previous one, leading to the loss of previous amounts.
Manual Code Review
Modify allocateFunds() to Accumulate Allocations Instead of Overwriting:
To ensure allocations are properly accumulated, modify the function to add the new amount to the existing value for that recipient.
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.