The current implementation of the staking contract allows users to unstake their Vested tokens without automatically claiming their pending rewards. This issue can lead to a scenario where users, who would normally incur a penalty for early unstaking and reward claiming, can bypass the penalty. As a result, users may unintentionally or deliberately avoid paying the penalty
The unstaking process in the contract does not automatically trigger a reward claim, even though the unstake action should ideally be coupled with an immediate reward claim. The relevant part of the unstakeVested function is as follows:
The function is designed to transfer the unstaked tokens back to the user and record the unstake event. However, there is no direct call to claim the user's rewards immediately after unstaking. This omission allows users to unstake their tokens without claiming their pending rewards, effectively evading the early claim penalty.
Additionally, the `claimReward` function checks whether the user wants to claim early and applies a penalty accordingly:
Since the `claimReward` function is separate from the `unstakeVested` function, a user who unstakes his vested NFT but does not call `claimReward` immedaitely can avoid paying the early claim penalty.
This vulnerability enables users to bypass the penalty for early reward claiming by unstaking their tokens without immediately claiming their rewards.
Manual Code Review
1. **Enforce Immediate Reward Claim on Unstaking**: Modify the `_unstakeVested` internal function to include an automatic call to the `claimReward` function, ensuring that users cannot unstake vested tokens without claiming their rewards. This will enforce the early claim penalty as intended.
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.