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.
43 lines
860 B
43 lines
860 B
pragma solidity ^0.4.24;
|
|
|
|
import "../Roles.sol";
|
|
|
|
contract MinterRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event MinterAdded(address indexed account);
|
|
event MinterRemoved(address indexed account);
|
|
|
|
Roles.Role private minters;
|
|
|
|
constructor() internal {
|
|
_addMinter(msg.sender);
|
|
}
|
|
|
|
modifier onlyMinter() {
|
|
require(isMinter(msg.sender));
|
|
_;
|
|
}
|
|
|
|
function isMinter(address account) public view returns (bool) {
|
|
return minters.has(account);
|
|
}
|
|
|
|
function addMinter(address account) public onlyMinter {
|
|
_addMinter(account);
|
|
}
|
|
|
|
function renounceMinter() public {
|
|
_removeMinter(msg.sender);
|
|
}
|
|
|
|
function _addMinter(address account) internal {
|
|
minters.add(account);
|
|
emit MinterAdded(account);
|
|
}
|
|
|
|
function _removeMinter(address account) internal {
|
|
minters.remove(account);
|
|
emit MinterRemoved(account);
|
|
}
|
|
}
|
|
|