Closed sherlock-admin closed 1 year ago
0xdice91
medium
Division before multiplication may lead to loss of precision
In the function _getTicksForPosition division before multiplication is used to get the value of floorTick.
_getTicksForPosition
floorTick
function _getTicksForPosition( int24 tick, int24 positionRange, int24 tickSpacingOffset, int24 tickSpacing ) private pure returns (int24 lowerTick, int24 upperTick) { int24 floorTick = (tick / tickSpacing) * tickSpacing; if (tickSpacingOffset == 0) { // More code .... }
Loss of precision
https://github.com/sherlock-audit/2023-06-real-wagmi/blob/main/concentrator/contracts/Multipool.sol#L259
Manual Review
Recommend Using Multiplication before Division instead.
function _getTicksForPosition( int24 tick, int24 positionRange, int24 tickSpacingOffset, int24 tickSpacing ) private pure returns (int24 lowerTick, int24 upperTick) { int24 floorTick = (tick * tickSpacing) / tickSpacing; if (tickSpacingOffset == 0) { // More code... }
Duplicate of #82
0xdice91
medium
Loss Of Precision Due To Division Before Multiplication
Summary
Division before multiplication may lead to loss of precision
Vulnerability Detail
In the function
_getTicksForPosition
division before multiplication is used to get the value offloorTick
.Impact
Loss of precision
Code Snippet
https://github.com/sherlock-audit/2023-06-real-wagmi/blob/main/concentrator/contracts/Multipool.sol#L259
Tool used
Manual Review
Recommendation
Recommend Using Multiplication before Division instead.
Duplicate of #82