-
Notifications
You must be signed in to change notification settings - Fork 12
/
GovernanceTimelock.sol
33 lines (24 loc) · 1.09 KB
/
GovernanceTimelock.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
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/governance/TimelockController.sol";
contract GovernanceTimelock is TimelockController {
// contructor()
bytes32 public constant DAO = keccak256("DAO");
bytes32 public constant TIMELOCK = keccak256("TIMELOCK");
bytes32 public constant ADMIN = keccak256("ADMIN");
bytes32 public constant GOV = keccak256("GOV");
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) TimelockController(minDelay, proposers, executors, admin) {
_setRoleAdmin(DAO, GOV);
_setRoleAdmin(TIMELOCK, GOV);
_setRoleAdmin(ADMIN, GOV);
_grantRole(DAO, address(this));
_grantRole(DAO, msg.sender);
_grantRole(GOV, msg.sender);
}
function checkRole(bytes32 role, address _sender) public view returns(bool){
return hasRole(role, _sender) || hasRole(DAO, _sender);
}
function checkOnlyRole(bytes32 role, address _sender) public view returns(bool){
return hasRole(role, _sender);
}
}