In the OrderBranch.sol contract, specifically within the simulateTrade()
function, there is a check that prevents liquidatable accounts from performing any trades, including those that would reduce their position and bring them back above the liquidation threshold:
This check is performed before considering the nature of the trade being attempted. As a result, it blocks all trading activity for accounts that have fallen below the liquidation threshold, even if the trade would improve their position.
The simulateTrade()
function is a key component in the trading process, used by the createMarketOrder()
function to validate and simulate trades before execution. By blocking all trades for liquidatable accounts, the system prevents these accounts from taking actions that could potentially save them from liquidation.
Accounts that could recover through position reduction are forced into liquidation.
Alice's account falls slightly below the liquidation threshold due to market movements.
Alice attempts to reduce her position to bring her account above the liquidation threshold.
The simulateTrade()
function is called as part of processing Alice's createMarketOrder()
call.
The function immediately reverts due to the liquidation check, without considering that Alice's trade would improve her position.
Alice is unable to reduce her position and is subsequently liquidated.
Modify the simulateTrade()
function to allow position-reducing trades for accounts below the liquidation threshold. This can be achieved by:
Determine if the trade is reducing the position size.
If the account is liquidatable but the trade is reducing the position, allow the simulation to continue.
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.