Liquidation won't work for collateral assets with more than 18 decimal places.
There are ERC-20 tokens with more than 18 decimal places, for example is YAMv2 with 24 decimal places.
When we use this as collateral asset, it can cause problem in computation of costInEuros (see below), because it will result to underflow error (18 decimal - 24 decimal) in line 245.
If this part of the code fails, this can revert the function of distributeAssets which can cause to revert the runLiquidation, failing to proceed with liquidation process.
Let us run the coded POC to prove the case.
Before we run this test, please replace 8 into 19 like the following code in common.js file in line 52. We are testing 19 decimal places in mock WBTC token.
Here is the coded POC, please copy and insert at line 288 of liquidationPool.js, then run npx hardhat test test/liquidationPool.js
Liquidation won't be executed and this will result to bad debt of the protocol.
Manual review, Foundry
Revise the formula in costInEuros by replacing 18 in line 245 here by a number matched with number of decimal places of a certain collateral asset. For example, in the list of accepted tokens, 24 is highest number of decimal places, replace the formula with 24
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.