* Now compiling in a separate directory using truffle 5. * Ported to 0.5.1, now compiling using 0.5.1. * test now also compiles using the truffle 5 hack. * Downgraded to 0.5.0. * Sorted scripts. * Cleaned up the compile script a bit.
44 lines
940 B
Solidity
44 lines
940 B
Solidity
pragma solidity ^0.5.0;
|
|
|
|
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);
|
|
}
|
|
}
|