DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

The protocol does not support tokens with precision greater than 18 decimals

Summary

Tokens with precision greater than 18 decimals will encounter errors when calling convertTokenAmountToUd60x18() for conversion.

Vulnerability Details

The function convertTokenAmountToUd60x18() is used to convert a token amount to an 18-decimal format. However, if the token has a precision greater than 18 decimals, this conversion can result in an error. This issue arises because the function might not accurately handle the extra decimals, leading to incorrect calculations or potential loss of precision.

function convertTokenAmountToUd60x18(Data storage self, uint256 amount) internal view returns (UD60x18) {
if (Constants.SYSTEM_DECIMALS == self.decimals) {
return ud60x18(amount);
}
return ud60x18(amount * 10 ** (Constants.SYSTEM_DECIMALS - self.decimals));
}

Impact

The protocol will encounter errors.

Tools Used

Vscode

Recommendations

It is recommended to check if the precision exceeds 18 decimals.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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

Give us feedback!