It's an example of ERC20 Token that mintable, burnable, and has a max supply.
Go to http://remix.ethereum.org and create a new workspace. Create a file under contracts folder, named "erc20token.sol" and paste the code.
Set the max supply of your token by modifying the variable _maxSupply on line 9
uint256 private _maxSupply = 10000000 * 10 ** decimals();
The max supply is set at 10000000 (10M) 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 11 and changing the text inside the quotation.
constructor() ERC20("BFY Digital", "BFY") {
The first quotation "BFY Digital" is the coin name. The second quotation "BFY" is the symbol of the coin. Change these according to your needs.
Change the premint amount by going to line 12 and changing the number
_mint(msg.sender, 1000000 * 10 ** decimals());
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.
After deployment, you can call "mint" function from owner account with "erc20 address" and "amount" parameters. (on line: 19)
If you want to burn some token with your code, you can call "mint" function from owner account with "0x0000000000000000000000000000000000000000" (genesis address) and "amount" parameters. (on line: 19) or you can use "burn" function is come from "ERC20Burnable" package with amount parameters.
- Remix - IDE
- OpenZeppelin - Reusable Smart Contracts
- Solidity - Programming Langauge