User needs to call claim()
then call withdraw()
and then call claim()
functions again to get all their rewards.
A common user will leave the protocol by claiming their rewards by calling claim()
function and then calling withdraw()
function with all their funds (or vice versa). This however leaves the user with leftover rewards still in the system since _withdraw()
function updates the users userData.pendingRewards
Implement a new line in claim()
function to show amount of pending rewards when the test is ran.
Implement the test shown below, under describe('#withdraw', () => {
and run the test.
Console output is as shown below
Test shows that after withdraw()
is called user is left with rewards still in the system. If the user calls withdraw()
first and then calls claim()
they do not get the maximum amount of rewards they should.
So for a user to get maximum amount of rewards and have none left in the system they would need to call claim()
first, then call withdraw()
and then call claim()
again.
User will not get the maximum amount of rewards they can.
Manual review.
_withdraw()
function already checks if the user is withdrawing all their funds. Implement a new line in this function that will call claim()
when a user is withdrawing all their funds.
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.