The endingUserHealthFactor <= startingUserHealthFactor
check in the liquidate
function is not required, by removing it you can save a lot of gas every time a user calls the liquidate
function.
Since we apply the moreThanZero(debtToCover)
on the liquidate
function, the debtToCover
can't be 0 which means that the state of endingUserHealthFactor <= startingUserHealthFactor
can never be achieved.
Adding this extra check at the end of the liquidate
function add additional unnecessary computation (we calculate the liquidated user health factor again and add an if statement).
Since the state can never be achieved this recalculation and comparison can be removed to significantly reduce the gas cost of the liquidate
function.
Save a lot of gas every time users call the liquidate
function.
VSCode
Remove the following check from the liquidate
function all at once:
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.