If collateral's decimals is not 18, collateral value is not calculated correctly.
Let's examine how collateral value is calculated:
Protocol traverses s_collateralTokens to get the each collateral value:
Collateral value is price * ADDITIONAL_FEED_PRECISION * amount / PRECISION
, PRECISION
here is 18 because it assumes that every collateral's decimals is 18, however, it's not always the case, collateral with different decimals can be used, for example, USDT has 6 decimals, if USDT is used, its value will be much less than the actual value.
Collateral's value is not calculated correctly.
Manual Review
The correct way to calculate collateral value should be price * ADDITIONAL_FEED_PRECISION * amount / decimals
, where decimals
here is the collateral's 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.