Set ERC20 decimals to value other than 18

Hi @Trade_Coin,

Welcome to the community :wave:

To set decimals to a value other than 18, call _setupDecimals in your constructor.

Whilst decimals are for display purposes, I would suggest only changing from the default of 18 when you have a very special reason not to. See: https://docs.openzeppelin.com/contracts/3.x/erc20#a-note-on-decimals

I noticed that you are using OpenZeppelin Contracts 3.0.1. You may want to change this to OpenZeppelin Contracts 3.4 (the latest 3.x version).

Also OpenZeppelin Contracts 4.0 Beta has been released, see announcement: OpenZeppelin Contracts 4.0 Beta


As an aside, see how to Format code in the forum.

1 Like