Closed sherlock-admin closed 2 years ago
Ch_301
high
unit
Missing updating of the unit value.
On TimeLockPool.sol == > setCurvePoint() When the Gov decide to add a point to the curve or remove the last point of the curve
TimeLockPool.sol
setCurvePoint()
Gov
curve
} else if (_position == curve.length) { curve.push(_newPoint); } else { if (curve.length - 1 < 2) { revert ShortCurveError(); } curve.pop(); }
There is no updating to the unit value We can see here how the unit is calculating
unit = maxLockDuration / (curve.length - 1);
So any change in the curve.length will affect the unit value which means getMultiplier() will return the wrong value.
curve.length
getMultiplier()
getMultiplier() will deliver a wrong multiplier value And this will affect the shares calculation on deposit()
multiplier
share
deposit()
uint256 mintAmount = _amount * getMultiplier(duration) / 1e18;
function setCurvePoint(uint256 _newPoint, uint256 _position) external onlyGov { if (_newPoint > maxBonus) { revert MaxBonusError(); } if (_position < curve.length) { curve[_position] = _newPoint; } else if (_position == curve.length) { curve.push(_newPoint); } else { if (curve.length - 1 < 2) { revert ShortCurveError(); } curve.pop(); } emit CurveChanged(_msgSender()); }
https://github.com/sherlock-audit/2022-10-merit-circle/blob/main/merit-liquidity-mining/contracts/TimeLockPool.sol#L322-L337
Manual Review
If you add or remove a point to/from the curve Reculcale the unit
Duplicate of #101
Ch_301
high
Missing updating of the
unit
value.Summary
Missing updating of the
unit
value.Vulnerability Detail
On
TimeLockPool.sol
== >setCurvePoint()
When theGov
decide to add a point to thecurve
or remove the last point of thecurve
There is no updating to the
unit
value We can see here how theunit
is calculatingSo any change in the
curve.length
will affect theunit
value which meansgetMultiplier()
will return the wrong value.Impact
getMultiplier()
will deliver a wrongmultiplier
value And this will affect theshare
s calculation ondeposit()
Code Snippet
https://github.com/sherlock-audit/2022-10-merit-circle/blob/main/merit-liquidity-mining/contracts/TimeLockPool.sol#L322-L337
Tool used
Manual Review
Recommendation
If you add or remove a point to/from the curve Reculcale the
unit
Duplicate of #101