Here is the contract I created, I created this contract through the use of openzeppelin and through some google help. As I am new in Blockchain I do not understand the depth of my contract. Everything is working correctly as I think.The contract deployed and verified also. The main thing that I don't understand the use of "uint " here in "ERC20Capped(1000000000 * (10**uint256(18)))" and "decimals" here in "1000000000 * 10 ** decimals()". Moreover How constructor works here in my contract with other ERC20 and ERC20Capped.Which will execute first ERC20, ERC20Capped or the body of constructor().I did a lot of R & D but nothing was much helpful.
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.10;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/extensions/ERC20Capped.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable, ERC20Burnable, ERC20Pausable,ERC20Capped {
constructor () ERC20 ("FlashToken", "FLT") ERC20Capped(1000000000 * (10**uint256(18)))
{
_mint(msg.sender,1000000000 * (10**uint256(18)));
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override (ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount) internal override (ERC20,ERC20Capped)
{
require(totalSupply() + amount <= 1000000000 * 10 ** decimals(), "Max number of tokens minted");
super._mint(to, amount);
}
}