See bellow
In the _unstakeVested function of the staking contract, the handling of full and partial unstakes appears inconsistent with respect to how points are updated in the FjordPoints contract. The function processes both full and partial unstakes using the same logic, which can lead to incorrect points calculations.
Code Snippet:
Full Unstake: When isFullUnstaked is true, the function transfers the NFT back to the owner. However, it still calls the onUnstaked function with the amount parameter, which is intended for partial unstakes.
Partial Unstake: The onUnstaked function processes the amount and updates the user’s staked balance and pending points.
Relevant onUnstaked Function in FjordPoints Contract:
When a full unstake is executed:
The NFT is transferred back to the user.
The onUnstaked function is invoked with the amount parameter, which is intended for partial unstaking.
This creates a mismatch:
For full unstake: The amount parameter should logically be irrelevant since the entire NFT (and thus the entire stake) is being returned. However, the onUnstaked function adjusts the staked balance as if it were a partial unstake.
The staked balance might be incorrectly reduced if the amount used in the onUnstaked function is not accurate. This could leave the user's staked balance in an inconsistent state.
The pending points calculation might be skewed because the onUnstaked function updates points based on the amount parameter. For full unstakes, this could mean points are calculated or left pending inaccurately.
Manual
separate the logic for full unstake into its own function or conditional handling that ensures correct points adjustment when transferring the NFT:
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.