Skip to content
Request an audit

‹ All findings

_getPriceToTick() reverts if the price is smaller than 1e10, which may happen in _search() as it assumes the final tick as going entirely to the amm

MediumNftperp Exchange·Three Sigma · NFT perpetuals · 2nd January, 20243S-NFTPerp-M01

Description

_search() calculates the final tick as if the order is completely filled on the amm. This means that if a significant chunk of the liquidity is in the limit orders, if a user has an order bigger than the current amm liquidity, it may return 1e7 from amm.getMarkPriceAfterOpen(), which reverts in _getPriceToTick(), as it divides by 1e10 and reverts when calculating the tick.

Recommendation

Return 1e10 instead of 1e7 so that it does not round down to 0 in _getPriceToTick().

Status

Addressed in the AMMRouter