-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOperated.sol
34 lines (28 loc) · 1.01 KB
/
Operated.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pragma solidity ^0.4.25;
import "Owned.sol";
// ----------------------------------------------------------------------------
// Maintain a list of operators that are permissioned to execute certain
// functions
// ----------------------------------------------------------------------------
contract Operated is Owned {
mapping(address => bool) public operators;
event OperatorAdded(address _operator);
event OperatorRemoved(address _operator);
modifier onlyOperator() {
require(operators[msg.sender] || owner == msg.sender);
_;
}
function initOperated(address _owner) internal {
initOwned(_owner);
}
function addOperator(address _operator) public onlyOwner {
require(!operators[_operator]);
operators[_operator] = true;
emit OperatorAdded(_operator);
}
function removeOperator(address _operator) public onlyOwner {
require(operators[_operator]);
delete operators[_operator];
emit OperatorRemoved(_operator);
}
}