Skip to content
Request an audit

‹ All findings

Partially removing liquidity may underflow if the price of the pool has changed significantly

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

Description

removeLiquidity() updates the position quote and base amount based on the removed quote and base amounts.

However, if the proportions changed since the position was opened, it may underflow.

Recommendation

Reduce the quote and base amounts of the position pro-rata to the removed shares.

Status

Addressed in the AMMRouter