The contribute
function does not properly update individual contributors' records. While funds are successfully transferred to the campaign, the contribution.amount
field is never incremented. This contradicts the documentation, which states:
"Users can contribute SOL to any active campaign."
Since contributions are not tracked correctly, contributors may not be able to request refunds correctly later.
The function initializes a contribution record if it does not exist but does not increment the amount contributed when a contributor makes multiple contributions.
This could lead to inaccurate refund calculations since the contract would not correctly track how much a user contributed.
A user contributes 5 SOL to a campaign.
The user contributes another 5 SOL later.
Due to the missing update, their total recorded contribution remains 5 SOL instead of 10 SOL.
If they attempt a refund, they may only receive 5 SOL even though they contributed 10 SOL.
Contributors' contributions are not accurately recorded, which may lead to incorrect refund amounts.
If multiple contributions are made, only the first one is considered.
This violates the documented expectation that users can continuously contribute SOL to a campaign.
Manual code review
Update the contribute
function to increment the contributor's recorded amount each time they contribute:
So the corrected function would be:
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.