Positions with a positive PnL will lose their PnL on liquidation.
When a position is liquidated, it covers the requiredMaintenanceMarginUsdX18
and the liquidationFee
from the marginBalance
of the trading account. In the event that a position has a positive PnL but can still be liquidated, the user will lose their positive PnL (USDz) as there is no explicit case when the PnL is positive.
On liquidation, it will check if requiredMaintenanceMarginUsdX18
> marginBalanceUsdX18
(margin + PnL + funding) and if so, it will deduct requiredMaintenanceMarginUsdX18
from margin only, so PnL will be forgotten and cleared with the position at the end.
User will not receive their positive PnL on liquidation.
Manual Review
Add a check to mint the positive PnL as in SettlementBranch._fillOrder
.
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.