From 4eac7f1a69861ee7a8799db8af1b8d40eb391dc6 Mon Sep 17 00:00:00 2001 From: 0xb337r007 <0xe4e5@proton.me> Date: Fri, 23 Jun 2023 10:53:08 +0200 Subject: [PATCH] add custom decimals to ERC20 --- contracts/mvp/CommunityERC20.sol | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contracts/mvp/CommunityERC20.sol b/contracts/mvp/CommunityERC20.sol index f1b4984..fcfdbda 100644 --- a/contracts/mvp/CommunityERC20.sol +++ b/contracts/mvp/CommunityERC20.sol @@ -15,12 +15,16 @@ contract CommunityERC20 is */ uint256 public maxSupply; + uint8 private customDecimals; + constructor( string memory _name, string memory _symbol, + uint8 _decimals, uint256 _maxSupply ) ERC20(_name, _symbol) { maxSupply = _maxSupply; + customDecimals = _decimals; } // Events @@ -48,6 +52,9 @@ contract CommunityERC20 is } // Public functions + function decimals() public view virtual override returns (uint8) { + return customDecimals; + } // Internal functions