Hello,
I used wizard to create my token. I customized the decimal and everything as per my need. However, I was unable to implement ERC20Capped.sol in my contract. I read several topics here and documentation on-site, but there seems to be some problem from my side. So can someone provide a guide for the dummy to implement it? I want to cap my minting max to 5.3 million and the initial token amount to be 10k.
Here I am attaching the code of my token. Rest are libraries of openzeppeline so I guess I don't have to add em.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts@4.3.2/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts@4.3.2/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts@4.3.2/access/AccessControl.sol";
import "@openzeppelin/contracts@4.3.2/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts@4.3.2/token/ERC20/extensions/ERC20Votes.sol";
contract GodToken is ERC20, ERC20Burnable, AccessControl, ERC20Permit, ERC20Votes {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() ERC20("God Token", "GDTN") ERC20Permit("God Token") {
_mint(msg.sender, 10000 * 10 ** decimals());
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
}
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
_mint(to, amount);
}
// The following functions are overrides required by Solidity.
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._burn(account, amount);
}
}