Skip to content
Request an audit

‹ Findings database

Realized pnl not returned to trader on _mergeDecrease()

Crit/HighNftperp Exchange audit·Three Sigma·NFT perpetuals·2nd January, 20243S-NFTPerp-H01

Description

On the merge of a liquidator position following a liquidation, the realizedPnl from the previous position is not added to the marginToRemove() variable, but it is removed from the openNotional, leading to loss of yield for the liquidator.

Recommendation

Add the = symbol to the operation marginToRemove += params.rpnl;.

Status

Addressed in the AMMRouter