Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Eric Lau <ericglau@outlook.com> Co-authored-by: Zack Reneau-Wedeen <z.reneau.wedeen@gmail.com>
25 lines
830 B
Solidity
25 lines
830 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {AccessControl} from "../../../access/AccessControl.sol";
|
|
import {ERC20} from "../../../token/ERC20/ERC20.sol";
|
|
|
|
contract AccessControlERC20MintMissing is ERC20, AccessControl {
|
|
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
|
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
|
|
|
|
constructor() ERC20("MyToken", "TKN") {
|
|
// Grant the contract deployer the default admin role: it will be able
|
|
// to grant and revoke any roles
|
|
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
}
|
|
|
|
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
|
|
_mint(to, amount);
|
|
}
|
|
|
|
function burn(address from, uint256 amount) public onlyRole(BURNER_ROLE) {
|
|
_burn(from, amount);
|
|
}
|
|
}
|