forked from JurgenSchouppe/ThorNode-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XAccessControl.sol
69 lines (56 loc) · 1.66 KB
/
XAccessControl.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2018 The VeChainThor developers
// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
// file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>
pragma solidity ^0.4.24;
import "./utility/Pausable.sol";
contract XAccessControl is Pausable {
event ProtocolUpgrade(address _saleAuction);
event OperatorUpdated(address _op, bool _enabled);
event BlackListUpdated(address _person, bool _op);
mapping(address => bool) public operators;
mapping(address => bool) public blackList;
modifier onlyOperator {
require(operators[msg.sender], "permission denied");
_;
}
modifier inBlackList {
require(blackList[msg.sender], "operation blocked");
_;
}
modifier notInBlackList {
require(!blackList[msg.sender], "operation blocked");
_;
}
function addOperator(address _operator)
external
onlyOwner
whenNotPaused
{
operators[_operator] = true;
emit OperatorUpdated(_operator, true);
}
function removeOperator(address _operator)
external
onlyOwner
whenNotPaused
{
operators[_operator] = false;
emit OperatorUpdated(_operator, false);
}
function addToBlackList(address _badGuy)
external
onlyOwner
whenNotPaused
{
blackList[_badGuy] = true;
emit BlackListUpdated(_badGuy, true);
}
function removeFromBlackList(address _innocent)
external
onlyOwner
whenNotPaused
{
blackList[_innocent] = false;
emit BlackListUpdated(_innocent, false);
}
}