Wrong math is used when dealing with Chainlink price feeds of differing decimal places. This can result in inaccurate reward distribution and token accounting during the liquidation process..
In the Liquidation process LiquidationPool.distributeAssets()
is called. which distribute rewards of the liquidation between holders based on their staked value.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L205
The issue arises when handling assetPriceUsd and priceEurUsd from Chainlink price feeds. The assumption that these prices will always share the same decimal places (8 decimals) is incorrect. If assetPriceUsd has more decimal places than priceEurUsd, it inflates costInEuros, causing issues in token accounting and reward distribution
The incorrect handling of decimal places between different Chainlink price feeds can lead to inflated or deflated values in calculations
Manual
Restrict the use of collateral tokens to those aligned with Chainlink price feeds having matching decimal places (e.g., 8 decimals).
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.