15,000 USDC
View results
Submission Details
Severity: medium
Valid

The price will be wrong when the token's USD price feed's decimals != 8

Summary

The price will be wrong when the token's USD price feed's decimals != 8.

Vulnerability Details

According to the project team's understanding, this contract supports tokens from all Chainlink price feeds.ChainlinkOracle assumes and inexplicitly requires the token's USD feed's decimals to be 8. However, there are certain token's USD feed has a different decimals.When the token's USD feed's decimals != 8,the getUsdValue and getTokenAmountFromUsd functions will return incorrect prices, leading to severe calculation errors and potential financial losses.This is the reference link to the previous vulnerability:https://github.com/sherlock-audit/2022-08-sentiment-judging/tree/main/019-H

Impact

This will result in severe calculation errors and financial losses.

Tools Used

vscode

Recommendations

Consider adding a check for feed.decimals() to make sure feed's decimals = 8.

Support

FAQs

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