-
Notifications
You must be signed in to change notification settings - Fork 3
/
ComptrollerCommonImpl.sol
39 lines (32 loc) · 1.23 KB
/
ComptrollerCommonImpl.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
import "../ErrorReporter.sol";
import "../Utils/ExponentialNoError.sol";
import "../PToken/PToken.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
import "./ComptrollerInterface.sol";
contract ComptrollerCommonImpl is ComptrollerCommonInterface, ComptrollerErrorReporter, ExponentialNoError {
constructor() internal {
admin = msg.sender;
}
function _become(Unitroller unitroller) public {
require(msg.sender == unitroller.admin(), "only unitroller admin can change brains");
unitroller._acceptImplementation();
}
function getBlockNumber() internal view returns (uint) {
return block.number;
}
/**
* @notice Checks caller is admin, or this contract is becoming the new implementation
*/
function adminOrInitializing() internal view {
require(msg.sender == admin || msg.sender == comptrollerPart1Implementation || msg.sender == comptrollerPart2Implementation, "only admin or initializing");
}
function onlyAdmin() internal view {
require(msg.sender == admin, "only admin");
}
function isComptroller() external pure returns (bool) {
return false;
}
}