The current implementation of the `isLiquidatable` function contains a flaw that prevents certain accounts from being flagged and liquidated as required. This incorrect implementation affects the timely liquidation of accounts and reduces the rewards obtained during liquidation events by the marginCollateralRecipient.
The vulnerability lies in the implementation of the `isLiquidatable` function. According to the documentation, an account is considered liquidatable when: -- https://docs.zaros.fi/overview/products/perpetuals-dex/liquidation#liquidation-criteria:~:text=Liquidation-,Liquidation Criteria,requiredMaintenanceMargin,-Liquidation Mechanics
However, the code does not correctly check this condition. Instead, it only checks if `requiredMaintenanceMarginUsdX18` is greater than `marginBalanceUsdX18`:
This implementation allows for accounts that should be considered liquidatable by the keeper to be skipped when Function checkUpkeep is called.
Due to the flawed code implementation, some accounts that should be flagged and liquidated are not liquidated on time. This results in decreased rewards for marginCollateralRecipient as the ideal optimal opportunities are missed and lesser fees are obtained.
- Manual Solidity code analysis
- Documentation review
**Correct the `isLiquidatable` Logic**: Update the `isLiquidatable` function to correctly implement the condition specified in the documentation. The function should ensure that the required maintenance margin plus any applicable liquidation fee is compared against the margin balance.
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.