Define parameters in ERC20

Have been finding it very difficult building a Mintable, Burnable, Pausable token with the latest solidity version despite having access to the files here.

Please, I need assistance especially on how to configure the constructor or define the parameters of the token like Name, Symbol, Total Supply, Decimal.

Thank you.

1 Like

Hi @AktiViti,

Welcome to the community :wave:

I suggest looking at the following tutorials:

1 Like

Just like so:

pragma solidity 0.6.12;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";

contract MyToken is Initializable, ERC20Upgradeable {
    function initialize(string memory name, string memory symbol, uint256 initialSupply) public virtual initializer {
        __ERC20_init(name, symbol);
        _mint(_msgSender(), initialSupply);
    }
}

Then you can set for name, symbol and totalSupply, BTW, the default decimals is 18, so if you want to set it for another value, you also need to call the function _setReserveDecimals() to set a new value.

3 Likes

Hi @AktiViti,

Please note, the example from @Skyge above can be used with upgradeable contracts: Create upgradeable ERC20

For a non-upgradeable contract you could look at the following: Deploy a simple ERC20 token in Remix

1 Like

Thanks for your kind remind.

1 Like

Thank you for your assistance. But i want it to be mintable, pausable, and burnable. How do i implement in ERC20UpgradablePresetMinterPauser

1 Like

I observed that. Thank you.

1 Like

Hi @AktiViti,

Please use one of the following tutorials to use the Preset ERC20:

1 Like

Hi @Skyge,

Thanks for being an awesome member of the community :pray:

I really appreciate your contribution.

1 Like

Ohh, it is my pleasure!

1 Like

Hi @AktiViti,

Did you get to try one of the tutorials using the Preset ERC20?

1 Like

Yes. It worked.
Thank you so much for your assistance.

1 Like