collectReward
function is not working as expected. Producer can get more health tokens than expected.
Producer can get more health tokens than expected. For example, if a producer has 9 martenitsa tokens then he should get 3 health tokens but he is able to get 4 health tokens because of the wrong calculation in the collectReward
function of MartenitsaMarketplace.sol
contract. he can get more 4 health tokens if he call the collectReward
function at 3 martenitsa tokens then he will get 1 health tokens and when he have 6 martenitsa tokens then he call the collectReward
function then he have 2 health tokens but _collectedRewards
mapping is not updated accuretly. So, he can get more health tokens than expected on 9 martenitsa tokens.
then he call the collectReward
function when he have 9 martenitsa tokens then he will get 4 health tokens because of _collectedRewards
shows only 1 health tokens claimed by the producer this will allow the producer to get 4 health tokens on 9 martenitsa tokens.
Put this test in MartenitsaMarketplace.t.sol
.
Run this test by this command.
collectReward function is not working as expected.
Producer can get more health tokens than expected.
Manual review
Make these changes in the collectReward
function of MartenitsaMarketplace.sol
contract.
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.