@venusprotocol/governance-contracts 1.4.0-dev.1 → 1.4.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +1 -1
  2. package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +1 -1
  3. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  4. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +1 -1
  5. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +1 -1
  6. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +1 -1
  7. package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +1 -1
  8. package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +1 -1
  9. package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  10. package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  11. package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  12. package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  13. package/artifacts/build-info/4cae30ea57cdf353a709497ac21f209c.json +1 -0
  14. package/artifacts/build-info/da11d367dd07d3f79bea1d8c5833588f.json +1 -0
  15. package/artifacts/contracts/Governance/AccessControlManager.sol/AccessControlManager.dbg.json +1 -1
  16. package/artifacts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +1 -1
  17. package/artifacts/contracts/Governance/GovernorBravoDelegate.sol/GovernorBravoDelegate.dbg.json +1 -1
  18. package/artifacts/contracts/Governance/GovernorBravoDelegate.sol/GovernorBravoDelegate.json +3 -3
  19. package/artifacts/contracts/Governance/GovernorBravoDelegator.sol/GovernorBravoDelegator.dbg.json +1 -1
  20. package/artifacts/contracts/Governance/GovernorBravoDelegator.sol/GovernorBravoDelegator.json +18 -25
  21. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorAlphaInterface.dbg.json +1 -1
  22. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV1.dbg.json +1 -1
  23. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV1.json +2 -2
  24. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV2.dbg.json +1 -1
  25. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV2.json +2 -2
  26. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegatorStorage.dbg.json +1 -1
  27. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegatorStorage.json +2 -2
  28. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoEvents.dbg.json +1 -1
  29. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoEvents.json +2 -2
  30. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/TimelockInterface.dbg.json +1 -1
  31. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/XvsVaultInterface.dbg.json +1 -1
  32. package/artifacts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +1 -1
  33. package/artifacts/contracts/Governance/TimelockV8.sol/TimelockV8.dbg.json +4 -0
  34. package/artifacts/contracts/Governance/TimelockV8.sol/TimelockV8.json +445 -0
  35. package/artifacts/contracts/legacy/GovenorBravoV1.sol/GovernorBravoDelegatorV1.dbg.json +4 -0
  36. package/artifacts/contracts/legacy/GovenorBravoV1.sol/GovernorBravoDelegatorV1.json +418 -0
  37. package/artifacts/contracts/legacy/GovernorBravoDelegateV1.sol/GovernorBravoDelegateV1.dbg.json +1 -1
  38. package/artifacts/contracts/legacy/GovernorBravoDelegateV1.sol/GovernorBravoDelegateV1.json +2 -2
  39. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV1.dbg.json +1 -1
  40. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoDelegateStorageV1.json +2 -2
  41. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoDelegatorStorage.dbg.json +1 -1
  42. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoDelegatorStorage.json +2 -2
  43. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoEventsV1.dbg.json +1 -1
  44. package/artifacts/contracts/legacy/GovernorBravoInterfaces.sol/GovernorBravoEventsV1.json +2 -2
  45. package/artifacts/contracts/test/MockAccessTest.sol/MockAccessTest.dbg.json +1 -1
  46. package/artifacts/contracts/test/TestTimelockV8.sol/TestTimelockV8.dbg.json +4 -0
  47. package/artifacts/contracts/test/TestTimelockV8.sol/TestTimelockV8.json +445 -0
  48. package/contracts/Governance/GovernorBravoDelegate.sol +1 -1
  49. package/contracts/Governance/GovernorBravoDelegator.sol +10 -6
  50. package/contracts/Governance/GovernorBravoInterfaces.sol +5 -19
  51. package/contracts/Governance/TimelockV8.sol +229 -0
  52. package/contracts/legacy/GovenorBravoV1.sol +97 -0
  53. package/contracts/test/TestTimelockV8.sol +19 -0
  54. package/deploy/001-timelock.ts +74 -0
  55. package/deploy/002-access-control.ts +39 -0
  56. package/deployments/bscmainnet_addresses.json +16 -0
  57. package/deployments/bsctestnet_addresses.json +15 -0
  58. package/deployments/ethereum/.chainId +1 -0
  59. package/deployments/ethereum/AccessControlManager.json +564 -0
  60. package/deployments/ethereum/solcInputs/f3b32d95e78d88a56120d2db9f8dd708.json +78 -0
  61. package/deployments/ethereum.json +369 -0
  62. package/deployments/ethereum_addresses.json +7 -0
  63. package/deployments/opbnbtestnet/.chainId +1 -0
  64. package/deployments/opbnbtestnet/AccessControlManager.json +564 -0
  65. package/deployments/opbnbtestnet/solcInputs/ffaffc9ed5d8dcf0602820091777bfe3.json +87 -0
  66. package/deployments/opbnbtestnet.json +369 -0
  67. package/deployments/sepolia_addresses.json +7 -0
  68. package/dist/deploy/{001-access-control.d.ts → 001-timelock.d.ts} +1 -1
  69. package/dist/deploy/001-timelock.d.ts.map +1 -0
  70. package/dist/deploy/001-timelock.js +76 -0
  71. package/dist/deploy/001-timelock.js.map +1 -0
  72. package/dist/deploy/002-access-control.d.ts +4 -0
  73. package/dist/deploy/002-access-control.d.ts.map +1 -0
  74. package/dist/deploy/{001-access-control.js → 002-access-control.js} +6 -7
  75. package/dist/deploy/002-access-control.js.map +1 -0
  76. package/dist/hardhat.config.d.ts +1 -2
  77. package/dist/hardhat.config.d.ts.map +1 -1
  78. package/dist/hardhat.config.js +94 -8
  79. package/dist/hardhat.config.js.map +1 -1
  80. package/dist/{deploy/helpers → helpers/deploy}/constants.d.ts +3 -1
  81. package/dist/helpers/deploy/constants.d.ts.map +1 -0
  82. package/dist/{deploy/helpers → helpers/deploy}/constants.js +2 -0
  83. package/dist/helpers/deploy/constants.js.map +1 -0
  84. package/dist/helpers/deploy/deploymentUtils.d.ts +5 -0
  85. package/dist/helpers/deploy/deploymentUtils.d.ts.map +1 -0
  86. package/dist/helpers/deploy/deploymentUtils.js +33 -0
  87. package/dist/helpers/deploy/deploymentUtils.js.map +1 -0
  88. package/package.json +12 -3
  89. package/artifacts/build-info/0e028ff5062f0f59a7ffef92b702c074.json +0 -1
  90. package/artifacts/build-info/52cd2a2ed6764b7fce3ff5a23ca8a581.json +0 -1
  91. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateInterface.dbg.json +0 -4
  92. package/artifacts/contracts/Governance/GovernorBravoInterfaces.sol/GovernorBravoDelegateInterface.json +0 -58
  93. package/dist/deploy/001-access-control.d.ts.map +0 -1
  94. package/dist/deploy/001-access-control.js.map +0 -1
  95. package/dist/deploy/helpers/constants.d.ts.map +0 -1
  96. package/dist/deploy/helpers/constants.js.map +0 -1
  97. package/dist/deploy/helpers/deploymentUtils.d.ts +0 -5
  98. package/dist/deploy/helpers/deploymentUtils.d.ts.map +0 -1
  99. package/dist/deploy/helpers/deploymentUtils.js +0 -16
  100. package/dist/deploy/helpers/deploymentUtils.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ // SPDX-License-Identifier: BSD-3-Clause
2
+ pragma solidity 0.8.13;
3
+ import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
4
+
5
+ /**
6
+ * @title TimelockV8
7
+ * @author Venus
8
+ * @notice The Timelock contract using solidity V8.
9
+ * This contract also differs from the original timelock because it has a virtual function to get minimum delays
10
+ * and allow test deployments to override the value.
11
+ */
12
+ contract TimelockV8 {
13
+ /// @notice Event emitted when a new admin is accepted
14
+ event NewAdmin(address indexed newAdmin);
15
+
16
+ /// @notice Event emitted when a new admin is proposed
17
+ event NewPendingAdmin(address indexed newPendingAdmin);
18
+
19
+ /// @notice Event emitted when a new admin is proposed
20
+ event NewDelay(uint256 indexed newDelay);
21
+
22
+ /// @notice Event emitted when a proposal transaction has been cancelled
23
+ event CancelTransaction(
24
+ bytes32 indexed txHash,
25
+ address indexed target,
26
+ uint256 value,
27
+ string signature,
28
+ bytes data,
29
+ uint256 eta
30
+ );
31
+
32
+ /// @notice Event emitted when a proposal transaction has been executed
33
+ event ExecuteTransaction(
34
+ bytes32 indexed txHash,
35
+ address indexed target,
36
+ uint256 value,
37
+ string signature,
38
+ bytes data,
39
+ uint256 eta
40
+ );
41
+
42
+ /// @notice Event emitted when a proposal transaction has been queued
43
+ event QueueTransaction(
44
+ bytes32 indexed txHash,
45
+ address indexed target,
46
+ uint256 value,
47
+ string signature,
48
+ bytes data,
49
+ uint256 eta
50
+ );
51
+
52
+ /// @notice Required period to execute a proposal transaction
53
+ uint256 private constant DEFAULT_GRACE_PERIOD = 14 days;
54
+
55
+ /// @notice Minimum amount of time a proposal transaction must be queued
56
+ uint256 private constant DEFAULT_MINIMUM_DELAY = 1 hours;
57
+
58
+ /// @notice Maximum amount of time a proposal transaction must be queued
59
+ uint256 private constant DEFAULT_MAXIMUM_DELAY = 30 days;
60
+
61
+ /// @notice Timelock admin authorized to queue and execute transactions
62
+ address public admin;
63
+
64
+ /// @notice Account proposed as the next admin
65
+ address public pendingAdmin;
66
+
67
+ /// @notice Period for a proposal transaction to be queued
68
+ uint256 public delay;
69
+
70
+ /// @notice Mapping of queued transactions
71
+ mapping(bytes32 => bool) public queuedTransactions;
72
+
73
+ constructor(address admin_, uint256 delay_) {
74
+ require(delay_ >= MINIMUM_DELAY(), "Timelock::constructor: Delay must exceed minimum delay.");
75
+ require(delay_ <= MAXIMUM_DELAY(), "Timelock::setDelay: Delay must not exceed maximum delay.");
76
+ ensureNonzeroAddress(admin_);
77
+
78
+ admin = admin_;
79
+ delay = delay_;
80
+ }
81
+
82
+ fallback() external payable {}
83
+
84
+ /**
85
+ * @notice Setter for the transaction queue delay
86
+ * @param delay_ The new delay period for the transaction queue
87
+ */
88
+ function setDelay(uint256 delay_) public {
89
+ require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
90
+ require(delay_ >= MINIMUM_DELAY(), "Timelock::setDelay: Delay must exceed minimum delay.");
91
+ require(delay_ <= MAXIMUM_DELAY(), "Timelock::setDelay: Delay must not exceed maximum delay.");
92
+ delay = delay_;
93
+
94
+ emit NewDelay(delay);
95
+ }
96
+
97
+ function GRACE_PERIOD() public view virtual returns (uint256) {
98
+ return DEFAULT_GRACE_PERIOD;
99
+ }
100
+
101
+ function MINIMUM_DELAY() public view virtual returns (uint256) {
102
+ return DEFAULT_MINIMUM_DELAY;
103
+ }
104
+
105
+ function MAXIMUM_DELAY() public view virtual returns (uint256) {
106
+ return DEFAULT_MAXIMUM_DELAY;
107
+ }
108
+
109
+ /**
110
+ * @notice Method for accepting a proposed admin
111
+ */
112
+ function acceptAdmin() public {
113
+ require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
114
+ admin = msg.sender;
115
+ pendingAdmin = address(0);
116
+
117
+ emit NewAdmin(admin);
118
+ }
119
+
120
+ /**
121
+ * @notice Method to propose a new admin authorized to call timelock functions. This should be the Governor Contract
122
+ * @param pendingAdmin_ Address of the proposed admin
123
+ */
124
+ function setPendingAdmin(address pendingAdmin_) public {
125
+ require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
126
+ ensureNonzeroAddress(pendingAdmin_);
127
+ pendingAdmin = pendingAdmin_;
128
+
129
+ emit NewPendingAdmin(pendingAdmin);
130
+ }
131
+
132
+ /**
133
+ * @notice Called for each action when queuing a proposal
134
+ * @param target Address of the contract with the method to be called
135
+ * @param value Native token amount sent with the transaction
136
+ * @param signature Ssignature of the function to be called
137
+ * @param data Arguments to be passed to the function when called
138
+ * @param eta Timestamp after which the transaction can be executed
139
+ * @return Hash of the queued transaction
140
+ */
141
+ function queueTransaction(
142
+ address target,
143
+ uint256 value,
144
+ string memory signature,
145
+ bytes memory data,
146
+ uint256 eta
147
+ ) public returns (bytes32) {
148
+ require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
149
+ require(
150
+ eta >= getBlockTimestamp() + delay,
151
+ "Timelock::queueTransaction: Estimated execution block must satisfy delay."
152
+ );
153
+
154
+ bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
155
+ queuedTransactions[txHash] = true;
156
+
157
+ emit QueueTransaction(txHash, target, value, signature, data, eta);
158
+ return txHash;
159
+ }
160
+
161
+ /**
162
+ * @notice Called to cancel a queued transaction
163
+ * @param target Address of the contract with the method to be called
164
+ * @param value Native token amount sent with the transaction
165
+ * @param signature Ssignature of the function to be called
166
+ * @param data Arguments to be passed to the function when called
167
+ * @param eta Timestamp after which the transaction can be executed
168
+ */
169
+ function cancelTransaction(
170
+ address target,
171
+ uint256 value,
172
+ string memory signature,
173
+ bytes memory data,
174
+ uint256 eta
175
+ ) public {
176
+ require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
177
+
178
+ bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
179
+ queuedTransactions[txHash] = false;
180
+
181
+ emit CancelTransaction(txHash, target, value, signature, data, eta);
182
+ }
183
+
184
+ /**
185
+ * @notice Called to execute a queued transaction
186
+ * @param target Address of the contract with the method to be called
187
+ * @param value Native token amount sent with the transaction
188
+ * @param signature Ssignature of the function to be called
189
+ * @param data Arguments to be passed to the function when called
190
+ * @param eta Timestamp after which the transaction can be executed
191
+ */
192
+ function executeTransaction(
193
+ address target,
194
+ uint256 value,
195
+ string memory signature,
196
+ bytes memory data,
197
+ uint256 eta
198
+ ) public payable returns (bytes memory) {
199
+ require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
200
+
201
+ bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
202
+ require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
203
+ require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
204
+ require(getBlockTimestamp() <= eta + GRACE_PERIOD(), "Timelock::executeTransaction: Transaction is stale.");
205
+
206
+ queuedTransactions[txHash] = false;
207
+
208
+ bytes memory callData;
209
+
210
+ if (bytes(signature).length == 0) {
211
+ callData = data;
212
+ } else {
213
+ callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
214
+ }
215
+
216
+ // solium-disable-next-line security/no-call-value
217
+ (bool success, bytes memory returnData) = target.call{ value: value }(callData);
218
+ require(success, "Timelock::executeTransaction: Transaction execution reverted.");
219
+
220
+ emit ExecuteTransaction(txHash, target, value, signature, data, eta);
221
+
222
+ return returnData;
223
+ }
224
+
225
+ function getBlockTimestamp() internal view returns (uint256) {
226
+ // solium-disable-next-line security/no-block-members
227
+ return block.timestamp;
228
+ }
229
+ }
@@ -0,0 +1,97 @@
1
+ pragma solidity ^0.5.16;
2
+ pragma experimental ABIEncoderV2;
3
+
4
+ import "./GovernorBravoInterfaces.sol";
5
+
6
+ /**
7
+ * @title GovernorBravoDelegator
8
+ * @author Venus
9
+ * @notice The `GovernorBravoDelegator` contract.
10
+ */
11
+ contract GovernorBravoDelegatorV1 is GovernorBravoDelegatorStorage, GovernorBravoEventsV1 {
12
+ constructor(
13
+ address timelock_,
14
+ address xvsVault_,
15
+ address admin_,
16
+ address implementation_,
17
+ uint votingPeriod_,
18
+ uint votingDelay_,
19
+ uint proposalThreshold_,
20
+ address guardian_
21
+ ) public {
22
+ // Admin set to msg.sender for initialization
23
+ admin = msg.sender;
24
+
25
+ delegateTo(
26
+ implementation_,
27
+ abi.encodeWithSignature(
28
+ "initialize(address,address,uint256,uint256,uint256,address)",
29
+ timelock_,
30
+ xvsVault_,
31
+ votingPeriod_,
32
+ votingDelay_,
33
+ proposalThreshold_,
34
+ guardian_
35
+ )
36
+ );
37
+
38
+ _setImplementation(implementation_);
39
+
40
+ admin = admin_;
41
+ }
42
+
43
+ /**
44
+ * @notice Called by the admin to update the implementation of the delegator
45
+ * @param implementation_ The address of the new implementation for delegation
46
+ */
47
+ function _setImplementation(address implementation_) public {
48
+ require(msg.sender == admin, "GovernorBravoDelegator::_setImplementation: admin only");
49
+ require(
50
+ implementation_ != address(0),
51
+ "GovernorBravoDelegator::_setImplementation: invalid implementation address"
52
+ );
53
+
54
+ address oldImplementation = implementation;
55
+ implementation = implementation_;
56
+
57
+ emit NewImplementation(oldImplementation, implementation);
58
+ }
59
+
60
+ /**
61
+ * @notice Internal method to delegate execution to another contract
62
+ * @dev It returns to the external caller whatever the implementation returns or forwards reverts
63
+ * @param callee The contract to delegatecall
64
+ * @param data The raw data to delegatecall
65
+ */
66
+ function delegateTo(address callee, bytes memory data) internal {
67
+ (bool success, bytes memory returnData) = callee.delegatecall(data);
68
+ assembly {
69
+ if eq(success, 0) {
70
+ revert(add(returnData, 0x20), returndatasize)
71
+ }
72
+ }
73
+ }
74
+
75
+ /**
76
+ * @dev Delegates execution to an implementation contract.
77
+ * It returns to the external caller whatever the implementation returns
78
+ * or forwards reverts.
79
+ */
80
+ function() external payable {
81
+ // delegate all other functions to current implementation
82
+ (bool success, ) = implementation.delegatecall(msg.data);
83
+
84
+ assembly {
85
+ let free_mem_ptr := mload(0x40)
86
+ returndatacopy(free_mem_ptr, 0, returndatasize)
87
+
88
+ switch success
89
+ case 0 {
90
+ revert(free_mem_ptr, returndatasize)
91
+ }
92
+ default {
93
+ return(free_mem_ptr, returndatasize)
94
+ }
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,19 @@
1
+ // SPDX-License-Identifier: BSD-3-Clause
2
+ pragma solidity 0.8.13;
3
+ import { TimelockV8 } from "../Governance/TimelockV8.sol";
4
+
5
+ contract TestTimelockV8 is TimelockV8 {
6
+ constructor(address admin_, uint256 delay_) public TimelockV8(admin_, delay_) {}
7
+
8
+ function GRACE_PERIOD() public view override returns (uint256) {
9
+ return 1;
10
+ }
11
+
12
+ function MINIMUM_DELAY() public view override returns (uint256) {
13
+ return 1;
14
+ }
15
+
16
+ function MAXIMUM_DELAY() public view override returns (uint256) {
17
+ return 1 hours;
18
+ }
19
+ }
@@ -0,0 +1,74 @@
1
+ import { DeployFunction } from "hardhat-deploy/types";
2
+ import { HardhatRuntimeEnvironment } from "hardhat/types";
3
+
4
+ import { SUPPORTED_NETWORKS } from "../helpers/deploy/constants";
5
+
6
+ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
7
+ const { deployments, getNamedAccounts } = hre;
8
+ const { deploy } = deployments;
9
+ const { deployer } = await getNamedAccounts();
10
+
11
+ const networkName = hre.network.name as SUPPORTED_NETWORKS;
12
+ const live = hre.network.live;
13
+
14
+ const delayConfig = {
15
+ hardhat: {
16
+ normal: 600,
17
+ fast: 300,
18
+ critical: 100,
19
+ },
20
+ bscmainnet: {
21
+ normal: 172800,
22
+ fast: 21600,
23
+ critical: 3600,
24
+ },
25
+ bsctestnet: {
26
+ normal: 600,
27
+ fast: 300,
28
+ critical: 100,
29
+ },
30
+ sepolia: {
31
+ normal: 600,
32
+ fast: 300,
33
+ critical: 100,
34
+ },
35
+ ethereum: {
36
+ normal: 172800,
37
+ fast: 21600,
38
+ critical: 3600,
39
+ },
40
+ opbnbtestnet: {
41
+ normal: 600,
42
+ fast: 300,
43
+ critical: 100,
44
+ },
45
+ };
46
+
47
+ await deploy("NormalTimelock", {
48
+ contract: live ? "TimelockV8" : "TestTimelockV8",
49
+ from: deployer,
50
+ args: [deployer, delayConfig[networkName].normal],
51
+ log: true,
52
+ autoMine: true,
53
+ });
54
+
55
+ await deploy("FastTrackTimelock", {
56
+ contract: live ? "TimelockV8" : "TestTimelockV8",
57
+ from: deployer,
58
+ args: [deployer, delayConfig[networkName].fast],
59
+ log: true,
60
+ autoMine: true,
61
+ });
62
+
63
+ await deploy("CriticalTimelock", {
64
+ contract: live ? "TimelockV8" : "TestTimelockV8",
65
+ from: deployer,
66
+ args: [deployer, delayConfig[networkName].critical],
67
+ log: true,
68
+ autoMine: true,
69
+ });
70
+ };
71
+
72
+ func.tags = ["Timelock"];
73
+
74
+ export default func;
@@ -0,0 +1,39 @@
1
+ import { ethers } from "hardhat";
2
+ import { DeployFunction } from "hardhat-deploy/types";
3
+ import { HardhatRuntimeEnvironment } from "hardhat/types";
4
+
5
+ import { SUPPORTED_NETWORKS } from "../helpers/deploy/constants";
6
+ import { getAcmAdminAccount } from "../helpers/deploy/deploymentUtils";
7
+
8
+ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
9
+ const { deployments, getNamedAccounts } = hre;
10
+ const { deploy } = deployments;
11
+ const { deployer } = await getNamedAccounts();
12
+
13
+ const acmDeployment = await deploy("AccessControlManager", {
14
+ from: deployer,
15
+ args: [],
16
+ log: true,
17
+ autoMine: true,
18
+ });
19
+
20
+ const acm = await ethers.getContractAt("AccessControlManager", acmDeployment.address);
21
+
22
+ if (hre.network.live) {
23
+ const networkName = hre.network.name as SUPPORTED_NETWORKS;
24
+ const adminAccount = await getAcmAdminAccount(networkName);
25
+ console.log(`Granting DEFAULT_ADMIN_ROLE to ${adminAccount} for ${networkName} network`);
26
+ await acm.grantRole(acm.DEFAULT_ADMIN_ROLE(), adminAccount);
27
+
28
+ console.log(`Renouncing DEFAULT_ADMIN_ROLE from deployer (${deployer}) for ${hre.network.name} network`);
29
+ await acm.renounceRole(acm.DEFAULT_ADMIN_ROLE(), deployer);
30
+ } else {
31
+ const timelockAddress = (await ethers.getContract("NormalTimelock")).address;
32
+
33
+ await acm.grantRole(acm.DEFAULT_ADMIN_ROLE(), timelockAddress);
34
+ }
35
+ };
36
+
37
+ func.tags = ["AccessControl"];
38
+
39
+ export default func;
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "bscmainnet",
3
+ "chainId": "56",
4
+ "addresses": {
5
+ "AccessControlManager": "0x4788629abc6cfca10f9f969efdeaa1cf70c23555",
6
+ "CriticalTimelock": "0x213c446ec11e45b15a6E29C1C1b402B8897f606d",
7
+ "FastTrackTimelock": "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02",
8
+ "GovernorAlpha": "0x406f48f47D25E9caa29f17e7Cfbd1dc6878F078f",
9
+ "GovernorAlpha2": "0x388313BfEFEE8ddfeAD55b585F62812293Cf3A60",
10
+ "GovernorBravoDelegate": "0x360ac19648efC29d2b7b70baC227C35e909272Fd",
11
+ "GovernorBravoDelegator": "0x2d56dC077072B53571b8252008C60e945108c75a",
12
+ "GovernorBravoDelegator_Implementation": "0x360ac19648efc29d2b7b70bac227c35e909272fd",
13
+ "GovernorBravoDelegator_Proxy": "0x2d56dC077072B53571b8252008C60e945108c75a",
14
+ "NormalTimelock": "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "bsctestnet",
3
+ "chainId": "97",
4
+ "addresses": {
5
+ "AccessControlManager": "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA",
6
+ "CriticalTimelock": "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D",
7
+ "FastTrackTimelock": "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6",
8
+ "GovernorAlpha": "0x7df10b2118eb04d9806b15198019f83741a9f8f4",
9
+ "GovernorBravoDelegate": "0x4baF88AbA7f86f6540728BEF454b224C5d2215e7",
10
+ "GovernorBravoDelegator": "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2",
11
+ "GovernorBravoDelegator_Implementation": "0x4baf88aba7f86f6540728bef454b224c5d2215e7",
12
+ "GovernorBravoDelegator_Proxy": "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2",
13
+ "NormalTimelock": "0xce10739590001705F7FF231611ba4A48B2820327"
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ 1