The function has a check to see if the current account should be liquidated. The problem is that it only checks the maintenance margin with the margin of the trader, it does not take into account the liquidation fee that the trader has to pay as well if he should be liquidated.
This is where the check is performed
As we can see the liquidation fee that has to be paid by the trader if he is in liquidatable state is not being added to the check. This means that there will be cases where he has to be liquidated in order to have enough margin to cover his pnl and liquidation fee but he will not be because the isLiquidatable()
will return false
High because a user's position will not be in liquidatable state when it should be. This might lead to cases where the protocol has to cover the liquidation fee because the user will not have enough margin deposited.
Manual review
Add the liquidation fee as well when checking if the trader's position is in liquidatable state
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.