DSCEngine.liquidate doesn't allow to do liquidation when liquidator is under liquidation. This doesn't make any sense, because the purpose of system is to make sure that all positions are backed.
DSCEngine.liquidate
can be called by anyone who wants to liquidate account. As result of liquidation liquidator will send stablecoin on behalf of account and will receive 10% bonus. So actually liquidator makes money in such way.
In the end of function there is a check that liquidator has good health factor. This check doesn't make any sense, because liquidator doesn't increase his s_DSCMinted
balance and doesn't decrease his s_collateralDeposited
balance.
Even if liquidator is same as account, then there is already a check that liquidation increased health factor.
As result liquidator, that is under liquidation is not allowed to do liquidation. However, there is no need for that and also liquidator can use this collateral that he received(with 10% bonus) to increase his health factor. Overall, i think that stablecoin is interested that liquidators under liquidations can liquidate, so they use earned bonus as collateral in the system.
Liquidators under liquidations can't liquidate and provide collateral.
VsCode
Remove check in the end.
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.