Closed leomassazza closed 4 weeks ago
Left preliminary feedback (no tests yet).
Before merging, please ensure
isEligibleForMarginLiquidation()
behaves as expected under the following conditions (at minimum):
availableMargin < 0
availableMargin > 0
self.debt > 0
self.debt < 0 && self.debt >= totalLiquidationReward
self.debt > 0 && self.debt < totalLiquidationReward
The function should return true in situations where the user runs out of margin, This is the case when his availableMargin less the liquidationReward (paid to liquidator) is less than zero.
make self-liquidate unprofitable by only allowing it if the account has outstanding debt