An ERC20 Token based on OpenZeppelin contracts
An ERC20 Token that is mintable, burnable, and has a max supply of 21M tokens. The premint is set at 1M tokens. This project was made possible using openzeppelin contracts.
Go to http://remix.ethereum.org and create a new workspace. Under the folder contracts, create a file called "MyToken.sol" and import the code
Set the max supply of your token by modifying the variable _maxSupply on line 20
uint256 private _maxSupply = 21000000 * 10 ** decimals();
The max supply is set at 21000000 (21M) coins, change this accordingly to fit your needs. The max supply of tokens will never change after deployment as it will be hard-coded into the contract.
Change the name of your token by going to line 22 and changing the text inside the quotation.
constructor() ERC20("Maharmeh", "MRM") {
The first quotation "Maharmeh" is the coin name. The second quotation "MRM" is the symbol of the coin. Change these according to your needs.
Change the premint amount by going to line 26 and changing the number
_mint(msg.sender, 1000000 * 10 ** decimals());
Change 1000000 to however many tokens you would like to premint when the contract is deployed. This function is only ran once at deployment. Make sure this doesn't exceed the max supply.
Compile the code on Remix IDE using the 0.8.2 Solidity Compiler.
Deploy your contract using Remix IDE. Ensure you have enough for gas fees and that you are connected to the correct network.
- Remix - IDE
- OpenZeppelin - Reusable Smart Contracts
- Solidity - Programming Langauge
- @AhmadMaharmeh - Idea & Initial work
- OpenZeppelin Team