-
Notifications
You must be signed in to change notification settings - Fork 5
/
PauseAdmin.sol
48 lines (37 loc) · 1.17 KB
/
PauseAdmin.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
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.21;
import {Root} from "../Root.sol";
import {Auth} from "./../util/Auth.sol";
/// @title Delayed Admin
/// @dev Any ward can manage accounts who can pause.
/// Any pauser can instantaneously pause the Root.
contract PauseAdmin is Auth {
Root public immutable root;
mapping(address => uint256) public pausers;
event AddPauser(address indexed user);
event RemovePauser(address indexed user);
// --- Events ---
event File(bytes32 indexed what, address indexed data);
constructor(address root_) {
root = Root(root_);
wards[msg.sender] = 1;
emit Rely(msg.sender);
}
modifier canPause() {
require(pausers[msg.sender] == 1, "PauseAdmin/not-authorized-to-pause");
_;
}
// --- Administration ---
function addPauser(address user) external auth {
pausers[user] = 1;
emit AddPauser(user);
}
function removePauser(address user) external auth {
pausers[user] = 0;
emit RemovePauser(user);
}
// --- Admin actions ---
function pause() public canPause {
root.pause();
}
}