You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
pragma solidity ^0.5.0;
|
|
|
|
import "../../GSN/Context.sol";
|
|
import "../Roles.sol";
|
|
|
|
contract MinterRole is Context {
|
|
using Roles for Roles.Role;
|
|
|
|
event MinterAdded(address indexed account);
|
|
event MinterRemoved(address indexed account);
|
|
|
|
Roles.Role private _minters;
|
|
|
|
constructor () internal {
|
|
_addMinter(_msgSender());
|
|
}
|
|
|
|
modifier onlyMinter() {
|
|
require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role");
|
|
_;
|
|
}
|
|
|
|
function isMinter(address account) public view returns (bool) {
|
|
return _minters.has(account);
|
|
}
|
|
|
|
function addMinter(address account) public onlyMinter {
|
|
_addMinter(account);
|
|
}
|
|
|
|
function renounceMinter() public {
|
|
_removeMinter(_msgSender());
|
|
}
|
|
|
|
function _addMinter(address account) internal {
|
|
_minters.add(account);
|
|
emit MinterAdded(account);
|
|
}
|
|
|
|
function _removeMinter(address account) internal {
|
|
_minters.remove(account);
|
|
emit MinterRemoved(account);
|
|
}
|
|
}
|
|
|