First Flight #21: KittyFi

First Flight #21
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Incorrect Precision Handling for Chainlink Price Feed

Summary

The getTotalMeowllateralInAave function calculates the total value of collateral deposited in Aave in USD. The function retrieves the collateral price from Chainlink's price feed and uses it to convert the total collateral value to USD. However, the current implementation incorrectly adjusts the price feed value, potentially resulting in inaccurate calculations due to misalignment of precision handling.

Vulnerability Details

The getTotalMeowllateralInAave function retrieves the price of collateral in USD from Chainlink's price feed and multiplies it by EXTRA_DECIMALS before performing the division. Chainlink price feeds commonly use 8 decimal places for price precision. By multiplying collateralToUsdPrice by EXTRA_DECIMALS, which is intended to align with precision, the calculation may incorrectly scale the price.

return totalCollateralBase.mulDiv(PRECISION, uint256(collateralToUsdPrice) * EXTRA_DECIMALS);

Impact

The misalignment in decimal precision can lead to incorrect calculations of the total collateral value in USD. This can affect the accuracy of financial computations within the contract, potentially impacting users' collateral calculations and leading to incorrect balance or liquidation assessments.

Tools Used

Manual Review

Recommendations

Modify the function to correctly align with the precision of the price feed.

Updates

Lead Judging Commences

shikhar229169 Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.