* Change import path from zos-lib to upgrades in all contracts * Update readme with new naming * Update package and deps names * Change path to initializable in AST of networks.jsons * Migrate manifest version * Use new oz file locations * Rename in ERC20Migrator comments * Update SDK install instructions in README * Update gitignore to use new session file name * trigger CI * Fixes to readme and package version * Use 2.5.0 release of OpenZeppelin SDK
50 lines
1.1 KiB
Solidity
50 lines
1.1 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
import "../Roles.sol";
|
|
|
|
|
|
contract CapperRole is Initializable {
|
|
using Roles for Roles.Role;
|
|
|
|
event CapperAdded(address indexed account);
|
|
event CapperRemoved(address indexed account);
|
|
|
|
Roles.Role private _cappers;
|
|
|
|
function initialize(address sender) public initializer {
|
|
if (!isCapper(sender)) {
|
|
_addCapper(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);
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|