Repository navigation
Expand file tree
/
Copy pathOlympusAuthority.sol
More file actions
101 lines (73 loc) · 2.94 KB
/
Copy pathOlympusAuthority.sol
File metadata and controls
101 lines (73 loc) · 2.94 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.7.5;
import "./interfaces/IOlympusAuthority.sol";
import "./types/OlympusAccessControlled.sol";
contract OlympusAuthority is IOlympusAuthority, OlympusAccessControlled {
/* ========== STATE VARIABLES ========== */
address public override governor;
address public override guardian;
address public override policy;
address public override vault;
address public newGovernor;
address public newGuardian;
address public newPolicy;
address public newVault;
/* ========== Constructor ========== */
constructor(
address _governor,
address _guardian,
address _policy,
address _vault
) OlympusAccessControlled( IOlympusAuthority(address(this)) ) {
governor = _governor;
emit GovernorPushed(address(0), governor, true);
guardian = _guardian;
emit GuardianPushed(address(0), guardian, true);
policy = _policy;
emit PolicyPushed(address(0), policy, true);
vault = _vault;
emit VaultPushed(address(0), vault, true);
}
/* ========== GOV ONLY ========== */
function pushGovernor(address _newGovernor, bool _effectiveImmediately) external onlyGovernor {
if( _effectiveImmediately ) governor = _newGovernor;
newGovernor = _newGovernor;
emit GovernorPushed(governor, newGovernor, _effectiveImmediately);
}
function pushGuardian(address _newGuardian, bool _effectiveImmediately) external onlyGovernor {
if( _effectiveImmediately ) guardian = _newGuardian;
newGuardian = _newGuardian;
emit GuardianPushed(guardian, newGuardian, _effectiveImmediately);
}
function pushPolicy(address _newPolicy, bool _effectiveImmediately) external onlyGovernor {
if( _effectiveImmediately ) policy = _newPolicy;
newPolicy = _newPolicy;
emit PolicyPushed(policy, newPolicy, _effectiveImmediately);
}
function pushVault(address _newVault, bool _effectiveImmediately) external onlyGovernor {
if( _effectiveImmediately ) vault = _newVault;
newVault = _newVault;
emit VaultPushed(vault, newVault, _effectiveImmediately);
}
/* ========== PENDING ROLE ONLY ========== */
function pullGovernor() external {
require(msg.sender == newGovernor, "!newGovernor");
emit GovernorPulled(governor, newGovernor);
governor = newGovernor;
}
function pullGuardian() external {
require(msg.sender == newGuardian, "!newGuard");
emit GuardianPulled(guardian, newGuardian);
guardian = newGuardian;
}
function pullPolicy() external {
require(msg.sender == newPolicy, "!newPolicy");
emit PolicyPulled(policy, newPolicy);
policy = newPolicy;
}
function pullVault() external {
require(msg.sender == newVault, "!newVault");
emit VaultPulled(vault, newVault);
vault = newVault;
}
}