openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

ERC20.sol "decimals" variable description left in comments from prev versions

Open ivan-kyuchukov opened this issue 3 years ago • 2 comments

The decimals variable comment is left from previous versions: image

💻 Environment

📝 Details

🔢 Code to reproduce bug

ivan-kyuchukov avatar Feb 01 '22 16:02 ivan-kyuchukov

Hello @ivan-kyuchukov

That is not a mistake.

This contract include a decimal function.

    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

If someone wants to change the decimal, the process is to override the decimals() function. We left a comment here, because devs coming from a 3.x version would be looking to customize that in the constructor → this message tells them that the upgrade is done elsewhere.

Amxx avatar Feb 01 '22 16:02 Amxx

Maybe the documentation is confusing because it's in the constructor. We could move the part about decimals to the contract-level docs.

frangio avatar Feb 02 '22 14:02 frangio