1
// SPDX-License-Identifier: MIT
2
pragma solidity ^0.8.20;
3
4
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol";
5
6
/**
7
* @title LockItInTimelock
8
* @author LockItIn Protocol DAO
9
* @notice Timelock controller for governance proposal execution
10
* @dev Adds mandatory delay between proposal passing and execution.
11
* This gives users time to react to governance decisions.
12
*
13
* Roles:
14
* - PROPOSER_ROLE: Only the Governor can queue proposals
15
* - EXECUTOR_ROLE: Anyone can execute after delay (address(0))
16
* - CANCELLER_ROLE: Governor can cancel queued proposals
17
* - DEFAULT_ADMIN_ROLE: Renounced after setup (no admin)
18
*
19
* Security:
20
* - 2-day initial delay for all executions
21
* - Delay can be changed via governance proposal
22
* - No admin can bypass the delay
23
*/
24
contract LockItInTimelock is TimelockController {
25
26
/// @notice Initial delay: 2 days (in seconds)
27
/// @dev Gives users 48 hours to react to passed proposals
28
uint256 public constant INITIAL_DELAY = 2 days;
29
30
/**
31
* @notice Deploy timelock with initial configuration
32
* @dev After deployment:
33
* 1. Deploy Governor pointing to this timelock
34
* 2. Call grantRole(PROPOSER_ROLE, governorAddress)
35
* 3. Call grantRole(CANCELLER_ROLE, governorAddress)
36
* 4. Call renounceRole(DEFAULT_ADMIN_ROLE, deployer)
37
*
38
* @param admin Initial admin (deployer) - will renounce after setup
39
*/
40
constructor(address admin)
41
TimelockController(
42
INITIAL_DELAY,
43
new address[](0), // proposers - added after Governor deploy
44
new address[](0), // executors - set below
45
admin // temporary admin for setup
46
)
47
{
48
// Allow anyone to execute after delay
49
// This prevents execution from being blocked by a single party
50
_grantRole(EXECUTOR_ROLE, address(0));
51
}
52
}