AccessControlERC20MintMissing.sol 830 B

123456789101112131415161718192021222324
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.20;
  3. import {AccessControl} from "../../../access/AccessControl.sol";
  4. import {ERC20} from "../../../token/ERC20/ERC20.sol";
  5. contract AccessControlERC20MintMissing is ERC20, AccessControl {
  6. bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
  7. bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
  8. constructor() ERC20("MyToken", "TKN") {
  9. // Grant the contract deployer the default admin role: it will be able
  10. // to grant and revoke any roles
  11. _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
  12. }
  13. function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
  14. _mint(to, amount);
  15. }
  16. function burn(address from, uint256 amount) public onlyRole(BURNER_ROLE) {
  17. _burn(from, amount);
  18. }
  19. }