withdraw() enables user to take their tokens out of staking contract.
The current implementation lacks a mechanism to accurately track the time that tokens remain outside the stakingContract
.
The existing logic assumes that tokens are continuously present within the contract from the moment of idToCreationTimestamp
or lastClaim
until the point of claimRewards
. However, there is no provision to account for instances where tokens might be withdrawn prematurely.
PoC:
Manual review
To rectify this, it is advised to introduce a timer mechanism within the withdraw
function that commences when tokens are deposited and ceases upon execution of the withdraw
function. This will ensure that the duration of tokens within the contract is accurately measured and reflected in the reward calculations.
High severity, this allows users to claim additional rewards without committing to intended weekly staking period via multi-deposit/deposit right before claiming rewards.
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.