sherlock-audit / 2024-04-teller-finance-judging

10 stars 9 forks source link

OMEN - get sqrt twap price will be incorrect if tick become negative #173

Closed sherlock-admin2 closed 4 months ago

sherlock-admin2 commented 4 months ago

OMEN

medium

get sqrt twap price will be incorrect if tick become negative

Summary

Twap price will be larger than it should be when ticks diff become negative and if int24( (tickCumulatives[1] - tickCumulatives[0]) / int32(twapInterval) ) ! = 0

Vulnerability Detail

uniswap implementation for handling negative ticks However protocol didn't decrease the tick when ticks diff become negative and if int24( (tickCumulatives[1] - tickCumulatives[0]) / int32(twapInterval) ) ! = 0

Impact

price will be bigger than it should be

Code Snippet

https://github.com/sherlock-audit/2024-04-teller-finance/blob/main/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L580-L592

Tool used

Manual Review

Recommendation

pls implement handling ticks like in uniswap

Duplicate of #283