Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Valid

decimals() is not a part of the ERC-20 standard

Summary

[L-3] decimals() is not a part of the ERC-20 standard

The decimals() function is not a part of the ERC-20 standard, and was added later as an optional extension. As such, some valid ERC20 tokens do not support this interface, so it is unsafe to blindly cast all tokens to this interface, and then call this function.

file: /contracts/oracles/GMXOracle.sol
314 return uint256(_price) * 10 ** (30 - IERC20Metadata(token).decimals() - _priceDecimals);
file: /contracts/strategy/gmx/GMXManager.sol
80 uint256 _tokenADecimals = IERC20Metadata(address(self.tokenA)).decimals();
81 uint256 _tokenBDecimals = IERC20Metadata(address(self.tokenB)).decimals();
Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Unsafe call to decimals()

Support

FAQs

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