Block: 46

Timestamp: 12:31:57

AuditProfile

Security blog

Uniswap tick calculation

While reading a report from Salty Protocol, I came across an interesting issue that I would like to share with you.

Did you know that you should be careful when using the Uniswap Oracle to calculate a current tick?

This function is used to get twap price tick. It uses pool.observe() to get tickCumulatives array which is then used to calculate int24 tick.

The problem is that in case if int24(tickCumulatives[1] - tickCumulatives[0]) is negative, then the tick should be rounded down.

Here is an example from Uniswap periphery contract OracleLibrary.sol where this case is shown:

As result, the returned tick in Salty code will be bigger then it should be, which opens possibility for some price manipulations and arbitrage opportunities.

So be careful and use ticks correctly.

#uniswap

#tick

Connent with me:

Регистрация прошла успешно! Спасибо за внимание!

loader