* 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 CapperRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event CapperAdded(address indexed account);
|
|
event CapperRemoved(address indexed account);
|
|
|
|
Roles.Role private _cappers;
|
|
|
|
constructor () internal {
|
|
_addCapper(msg.sender);
|
|
}
|
|
|
|
modifier onlyCapper() {
|
|
require(isCapper(msg.sender));
|
|
_;
|
|
}
|
|
|
|
function isCapper(address account) public view returns (bool) {
|
|
return _cappers.has(account);
|
|
}
|
|
|
|
function addCapper(address account) public onlyCapper {
|
|
_addCapper(account);
|
|
}
|
|
|
|
function renounceCapper() public {
|
|
_removeCapper(msg.sender);
|
|
}
|
|
|
|
function _addCapper(address account) internal {
|
|
_cappers.add(account);
|
|
emit CapperAdded(account);
|
|
}
|
|
|
|
function _removeCapper(address account) internal {
|
|
_cappers.remove(account);
|
|
emit CapperRemoved(account);
|
|
}
|
|
}
|