Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: low
Invalid

descaleAmount and scaleAmount will not work for more than 18

Summary

some erc20 tokens have more than 18 decimals so this will cause descaleAmount and scaleAmount to be revert.

Vulnerability Details

function descaleAmount(uint256 amount, uint8 decimals) internal pure returns (uint256) {
if (decimals == 18) {
return amount;
}
unchecked {
uint256 scaleFactor = 10 ** (18 - decimals);
return amount / scaleFactor;
}
}
/// @dev Scales the provided `amount` from token's decimals number to 18 decimals fixed-point number.
function scaleAmount(uint256 amount, uint8 decimals) internal pure returns (uint256) {
if (decimals == 18) {
return amount;
}
unchecked {
uint256 scaleFactor = 10 ** (18 - decimals);
return amount * scaleFactor;
}
}

Impact

scaleAmount and descaleAmount will be reverted.

Tools Used

Recommendations

check for the decimals not greater than 18.

Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[Invalid] Tokens with decimals > 18

Support

FAQs

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