In LendingPool
previously unhealthy positions that become healthy can still be liquidated.
This is the closeLiquidation
function which removes an address from being under liquidation if it repays its debt:
However, there are some issues. Previously unhealthy positions that become healthy can be liquidated in 3 different scenarios:
User partially pays his debt, making his position healthy. However, he can't close the liquidation if the doesn't pay the full amount and is now subject to full liquidation even though he repaid some amount. This is because this check if (userDebt > DUST_THRESHOLD) revert DebtNotZero();
.
User's NFT temporarily falls in value with result of him becoming under liquidation. However, his NFT goes up in price again and now his position is healthy. User is forced to repay the whole position to closeLiquidation
even though his position is healthy.
User repays the full amount but doesn't call closeLiquidation
. This could be due to him forgetting or being a contract which hasn't implemented this functionality, since msg.sender
must be the under liquidation address. This healthy address will still get liquidated since there is no health factor check in the finalizeLiquidation
function:
Healthy addresses can get unfairly liquidated and lose their NFTs.
Manual review
Just add a health factor check in the finalizeLiquidation
function so healthy positions are not liquidatable.
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.