@@ -5,32 +5,38 @@ pragma solidity ^0.8.0;
5
5
contract Timelock {
6
6
event NewAdmin (address indexed newAdmin );
7
7
event NewPendingAdmin (address indexed newPendingAdmin );
8
- event NewDelay (uint indexed newDelay );
9
- event CancelTransaction (bytes32 indexed txHash , address indexed target , uint value , string signature , bytes data , uint eta );
10
- event ExecuteTransaction (bytes32 indexed txHash , address indexed target , uint value , string signature , bytes data , uint eta );
11
- event QueueTransaction (bytes32 indexed txHash , address indexed target , uint value , string signature , bytes data , uint eta );
12
-
13
- uint public constant GRACE_PERIOD = 14 days ;
14
- uint public constant MINIMUM_DELAY = 2 days ;
15
- uint public constant MAXIMUM_DELAY = 30 days ;
8
+ event NewDelay (uint256 indexed newDelay );
9
+ event CancelTransaction (
10
+ bytes32 indexed txHash , address indexed target , uint256 value , string signature , bytes data , uint256 eta
11
+ );
12
+ event ExecuteTransaction (
13
+ bytes32 indexed txHash , address indexed target , uint256 value , string signature , bytes data , uint256 eta
14
+ );
15
+ event QueueTransaction (
16
+ bytes32 indexed txHash , address indexed target , uint256 value , string signature , bytes data , uint256 eta
17
+ );
18
+
19
+ uint256 public constant GRACE_PERIOD = 14 days ;
20
+ uint256 public constant MINIMUM_DELAY = 2 days ;
21
+ uint256 public constant MAXIMUM_DELAY = 30 days ;
16
22
17
23
address public admin;
18
24
address public pendingAdmin;
19
- uint public delay;
25
+ uint256 public delay;
20
26
21
- mapping (bytes32 => bool ) public queuedTransactions;
27
+ mapping (bytes32 => bool ) public queuedTransactions;
22
28
23
- constructor (address admin_ , uint delay_ ) {
29
+ constructor (address admin_ , uint256 delay_ ) {
24
30
require (delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay. " );
25
31
require (delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay. " );
26
32
27
33
admin = admin_;
28
34
delay = delay_;
29
35
}
30
36
31
- receive () external payable { }
37
+ receive () external payable {}
32
38
33
- function setDelay (uint delay_ ) public {
39
+ function setDelay (uint256 delay_ ) public {
34
40
require (msg .sender == address (this ), "Timelock::setDelay: Call must come from Timelock. " );
35
41
require (delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay. " );
36
42
require (delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay. " );
@@ -54,9 +60,15 @@ contract Timelock {
54
60
emit NewPendingAdmin (pendingAdmin);
55
61
}
56
62
57
- function queueTransaction (address target , uint value , string memory signature , bytes memory data , uint eta ) public returns (bytes32 ) {
63
+ function queueTransaction (address target , uint256 value , string memory signature , bytes memory data , uint256 eta )
64
+ public
65
+ returns (bytes32 )
66
+ {
58
67
require (msg .sender == admin, "Timelock::queueTransaction: Call must come from admin. " );
59
- require (eta >= getBlockTimestamp () + delay, "Timelock::queueTransaction: Estimated execution block must satisfy delay. " );
68
+ require (
69
+ eta >= getBlockTimestamp () + delay,
70
+ "Timelock::queueTransaction: Estimated execution block must satisfy delay. "
71
+ );
60
72
61
73
bytes32 txHash = keccak256 (abi.encode (target, value, signature, data, eta));
62
74
queuedTransactions[txHash] = true ;
@@ -65,7 +77,9 @@ contract Timelock {
65
77
return txHash;
66
78
}
67
79
68
- function cancelTransaction (address target , uint value , string memory signature , bytes memory data , uint eta ) public {
80
+ function cancelTransaction (address target , uint256 value , string memory signature , bytes memory data , uint256 eta )
81
+ public
82
+ {
69
83
require (msg .sender == admin, "Timelock::cancelTransaction: Call must come from admin. " );
70
84
71
85
bytes32 txHash = keccak256 (abi.encode (target, value, signature, data, eta));
@@ -74,7 +88,11 @@ contract Timelock {
74
88
emit CancelTransaction (txHash, target, value, signature, data, eta);
75
89
}
76
90
77
- function executeTransaction (address target , uint value , string memory signature , bytes memory data , uint eta ) public payable returns (bytes memory ) {
91
+ function executeTransaction (address target , uint256 value , string memory signature , bytes memory data , uint256 eta )
92
+ public
93
+ payable
94
+ returns (bytes memory )
95
+ {
78
96
require (msg .sender == admin, "Timelock::executeTransaction: Call must come from admin. " );
79
97
80
98
bytes32 txHash = keccak256 (abi.encode (target, value, signature, data, eta));
@@ -101,8 +119,8 @@ contract Timelock {
101
119
return returnData;
102
120
}
103
121
104
- function getBlockTimestamp () internal view returns (uint ) {
122
+ function getBlockTimestamp () internal view returns (uint256 ) {
105
123
// solium-disable-next-line security/no-block-members
106
124
return block .timestamp ;
107
125
}
108
- }
126
+ }
0 commit comments