-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverlayV1Governance.sol
133 lines (96 loc) · 2.88 KB
/
OverlayV1Governance.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "../interfaces/IOverlayV1Mothership.sol";
import "../interfaces/IOverlayToken.sol";
import "../interfaces/IOverlayTokenNew.sol";
import "./OverlayV1Comptroller.sol";
import "./OverlayV1OI.sol";
import "./OverlayV1PricePoint.sol";
abstract contract OverlayV1Governance is
OverlayV1Comptroller,
OverlayV1OI,
OverlayV1PricePoint {
uint constant private ONE = 1e18;
bytes32 constant private COLLATERAL = keccak256("COLLATERAL");
bytes32 constant private GOVERNOR = keccak256("GOVERNOR");
bytes32 constant private MARKET = keccak256("MARKET");
address public immutable ovl;
IOverlayV1Mothership public immutable mothership;
uint256 public leverageMax;
mapping (address => bool) public isCollateral;
modifier onlyCollateral () {
require(isCollateral[msg.sender], "OVLV1:!collateral");
_;
}
modifier onlyGovernor () {
require(mothership.hasRole(GOVERNOR, msg.sender), "OVLV1:!governor");
_;
}
modifier enabled() {
require(mothership.hasRole(MARKET, address(this)), "OVLV1:!enabled");
_;
}
constructor(
address _mothership
) {
mothership = IOverlayV1Mothership(_mothership);
ovl = address(IOverlayV1Mothership(_mothership).ovl());
}
function addCollateral (address _collateral) public onlyGovernor {
isCollateral[_collateral] = true;
}
function removeCollateral (address _collateral) public onlyGovernor {
isCollateral[_collateral] = false;
}
function setEverything (
uint256 _k,
uint256 _pbnj,
uint256 _compoundPeriod,
uint256 _lmbda,
uint256 _staticCap,
uint256 _brrrrdExpected,
uint256 _brrrrdWindowMacro,
uint256 _brrrrdWindowMicro
) public onlyGovernor {
setK(_k);
setSpread(_pbnj);
setPeriods(
_compoundPeriod
);
setComptrollerParams(
_lmbda,
_staticCap,
_brrrrdExpected,
_brrrrdWindowMacro,
_brrrrdWindowMicro
);
}
function setSpread(
uint256 _pbnj
) public onlyGovernor {
pbnj = _pbnj;
}
function setK (
uint256 _k
) public onlyGovernor {
k = _k;
}
function setPeriods(
uint256 _compoundingPeriod
) public onlyGovernor {
compoundingPeriod = _compoundingPeriod;
}
function setComptrollerParams (
uint256 _lmbda,
uint256 _staticCap,
uint256 _brrrrExpected,
uint256 _brrrrdWindowMacro,
uint256 _brrrrdWindowMicro
) public onlyGovernor {
lmbda = _lmbda;
staticCap = _staticCap;
brrrrdExpected = _brrrrExpected;
brrrrdWindowMacro = _brrrrdWindowMacro;
brrrrdWindowMicro = _brrrrdWindowMicro;
}
}