ERC20 `decimals` , what if it's not present

@abcoathup

Hey Andrew,

As we know, decimals is an optional parameter on ERC20…

I was wondering what if decimals is not set on a contract.

Does it mean that if I send 10 in the transfer function, it means that it actually transfers 10 - this all means that by default decimals is 0.

WDYT ?

Yeah, the default value of decimals is 18, if you want to set it as 0, you can rewrite the function decimals when your contract is inherited from OpenZeppelin ERC20 contract.
And if decimals is equal to 0, when you transfer 10, it just means 10 token. But you should notice that, with a lower decimals, it may loss more

1 Like