* release candidate v2.0.0-rc.1 * fix linter error (cherry picked from commitc12a1c6898) * Roles now emit events in construction and when renouncing. (cherry picked from commit21198bf1c1)
45 lines
859 B
Solidity
45 lines
859 B
Solidity
pragma solidity ^0.4.24;
|
|
|
|
import "../Roles.sol";
|
|
|
|
|
|
contract PauserRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event PauserAdded(address indexed account);
|
|
event PauserRemoved(address indexed account);
|
|
|
|
Roles.Role private pausers;
|
|
|
|
constructor() public {
|
|
_addPauser(msg.sender);
|
|
}
|
|
|
|
modifier onlyPauser() {
|
|
require(isPauser(msg.sender));
|
|
_;
|
|
}
|
|
|
|
function isPauser(address account) public view returns (bool) {
|
|
return pausers.has(account);
|
|
}
|
|
|
|
function addPauser(address account) public onlyPauser {
|
|
_addPauser(account);
|
|
}
|
|
|
|
function renouncePauser() public {
|
|
_removePauser(msg.sender);
|
|
}
|
|
|
|
function _addPauser(address account) internal {
|
|
pausers.add(account);
|
|
emit PauserAdded(account);
|
|
}
|
|
|
|
function _removePauser(address account) internal {
|
|
pausers.remove(account);
|
|
emit PauserRemoved(account);
|
|
}
|
|
}
|