In the redeemFromMarket function of the MarketCreator contract, the market.reward value is not reduced after distributing rewards to users. This leads to incorrect reward distribution, where each subsequent withdrawal calculates rewards based on the initial market.reward value instead of the remaining rewards. As a result, users may receive disproportionately large rewards, and the contract may over-distribute rewards, potentially depleting the contract's balance.
The key problem is that market.reward is not reduced after transferring the reward to the user. This means that the calculateReward function will always use the initial market.reward value, leading to incorrect calculations and potential over-distribution of rewards.
Incorrect Reward Distribution: Users who withdraw later may receive disproportionately large rewards, even if their contribution was minimal.
Over-Distribution of Rewards: The contract may distribute more rewards than intended, potentially depleting the contract's balance of raacToken.
Financial Loss: If the contract runs out of rewards, later users may not receive their fair share, leading to financial losses and loss of trust in the protocol.
Manual code review
To fix this issue, the market.reward value should be reduced by the distributed reward amount after each withdrawal.
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.