Files
openzeppelin-contracts/contracts/access/roles/MinterRole.sol
Nicolás Venturo 951460696e Added events to the role contracts. (#1302)
* Added events to the role contracts.

* Fixed linter error.
2018-09-07 10:04:52 -03:00

41 lines
789 B
Solidity

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() public {
minters.add(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 {
minters.add(_account);
emit MinterAdded(_account);
}
function renounceMinter() public {
minters.remove(msg.sender);
}
function _removeMinter(address _account) internal {
minters.remove(_account);
emit MinterRemoved(_account);
}
}