The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Not accounted for tokens with decimals greater than 18

Summary

If the token's decimal is greater than 18, many parts of the protocol will fail to operate correctly.

Vulnerability Details

The protocol assumes that the decimals of all tokens are less than or equal to 18, which is incorrect. If the precision of a token is greater than 18, many parts of the protocol will fail to execute, as illustrated in the following code snippet:

if (asset.amount > 0) {
(,int256 assetPriceUsd,,,) = Chainlink.AggregatorV3Interface(asset.token.clAddr).latestRoundData();
uint256 _portion = asset.amount * _positionStake / stakeTotal;
uint256 costInEuros = _portion * 10 ** (18 - asset.token.dec) * uint256(assetPriceUsd) / uint256(priceEurUsd)
* _hundredPC / _collateralRate;
function getTokenScaleDiff(bytes32 _symbol, address _tokenAddress) private view returns (uint256 scaleDiff) {
return _symbol == NATIVE ? 0 : 18 - ERC20(_tokenAddress).decimals();
}

Impact

The protocol will be unable to operate properly.

Tools Used

Vscode

Recommendations

Consider scenarios where the decimal is greater than 18.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

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