This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
isUnlocked
, the addToPosition
function will set the position’s lockMultiplier to 0, but at the same time the lockDuration is greater than 0.
#141
qmdddd
Medium
When
isUnlocked
, theaddToPosition
function will set the position’s lockMultiplier to 0, but at the same time the lockDuration is greater than 0.Summary
When isUnlocked, the addToPosition function will set the position’s lockMultiplier to 0, but at the same time the lockDuration is greater than 0, which is unreasonable and noncorresponding..
Vulnerability Detail
In the function
addToPosition
, user could add more tokens to position. The contract will recalculate the lock duration and update the lockMultiplier.However, this logic does not take into account the boundary case of
isUnlocked
. When isUnlocked, the functiongetMultiplierByLockDuration
will return 0. But the position.lockDuration is still large than 0. This means that the user locks position for a period of time, but not receives a boost multiplier.Impact
User locks his/her position for a period of time, but not receives a boost multiplier.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L397-L428
Tool used
Manual Review
Recommendation
When isUnlocked, the position.lockDuration and position.lockMultiplier should be 0 together.
Duplicate of #138
The text was updated successfully, but these errors were encountered: