# Governance contract or Timelock contract.... Which comes first?

**URL:** <https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048>\
**Category:** Contracts\
**Tags:** openzeppelin-contracts\
**Created:** [October 15, 2021, 11:34pm UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048 "2021-10-15T23:34:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickAlphaC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/patrickalphac/32/4556_2.png) [@PatrickAlphaC](https://forum.openzeppelin.com/u/PatrickAlphaC)\
**Post date:** [October 15, 2021, 11:34pm UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/1 "2021-10-15T23:34:33Z")

</div>

So... I'm setting up some governance examples and I think it's important to show how to do it with a TimelockController. It seems clear to me that I need to deploy a timelockcontroller contract first, since one of the constructor parameters for a governance contract is the GovernorTimelockControl, which needs a timelock.

However... For deploying a [timelock contract](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/TimelockController.sol) I need an array of proposers. This is where the issue comes in:

According to [the docs](https://docs.openzeppelin.com/contracts/4.x/api/governance#timelock-proposer):

> The proposers are in charge of scheduling (and cancelling) operations. This is a critical role, that should be given to governing entities. This could be an EOA, a multisig, or a DAO.

How does it make sense that the proposer has to be the DAO? How can I deploy the timelock contract before I deploy the governor contract, if they depend on each other?

Should I just leave them as blanks and just add the governor contract to the list of proposers later?

Thanks again for these tools

---

<div class="post-metadata">

**Author:** ![PatrickAlphaC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/patrickalphac/32/4556_2.png) [@PatrickAlphaC](https://forum.openzeppelin.com/u/PatrickAlphaC)\
**Post date:** [October 15, 2021, 11:38pm UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/2 "2021-10-15T23:38:59Z")

</div>

> TimelockController uses an AccessControl setup that we need to understand in order to set up roles. The Proposer role is in charge of queueing operations: this is the role the Governor instance should be granted, and it should likely be the only proposer in the system. The Executor role is in charge of executing already available operations: we can assign this role to the special zero address to allow anyone to execute (if operations can be particularly time sensitive, the Governor should be made Executor instead). Lastly, there is the Admin role, which can grant and revoke the two previous roles: this is a very sensitive role that will be granted automatically to both deployer and timelock itself, but should be renounced by the deployer after setup.

Just found this on another tutorial. 🤦‍♂️

Was scratching my head for about an hour. Cool to see I was thinking about it right.

---

<div class="post-metadata">

**Author:** ![spalladino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/spalladino/32/22_2.png) [@spalladino](https://forum.openzeppelin.com/u/spalladino)\
**Post date:** [October 15, 2021, 11:51pm UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/3 "2021-10-15T23:51:22Z")

</div>

Sharing here [as well](https://twitter.com/smpalladino/status/1449159705801236480) for visibility:

> <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e6f26b46fc8015f1b9b09bb85297464069302125/test/governance/extensions/GovernorTimelockControl.test.js#L31-L37>

---

<div class="post-metadata">

**Author:** ![PatrickAlphaC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/patrickalphac/32/4556_2.png) [@PatrickAlphaC](https://forum.openzeppelin.com/u/PatrickAlphaC)\
**Post date:** [October 16, 2021, 12:09am UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/4 "2021-10-16T00:09:41Z")

</div>

I should have went there first, thanks!

---

<div class="post-metadata">

**Author:** ![dagr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dagr/32/8188_2.png) [@dagr](https://forum.openzeppelin.com/u/dagr)\
**Post date:** [February 15, 2023, 3:40am UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/5 "2023-02-15T03:40:28Z")

</div>

The documentation now changed from  
`this is a very sensitive role that will be granted automatically to both deployer and timelock itself, but should be renounced by the deployer after setup`  
to  
`this is a very sensitive role that will be granted automatically to the timelock itself, and optionally to a second account, which can be used for ease of setup but should promptly renounce the role`

Both contracts depend on each other, the Governor requires the address of the Timelock contract and the Timelock needs to set the Governor as the proposer. Is there a way to deploy the governance contracts without granting the admin role to myself and then revoking it? Because either way, at time of deployment, one of the contract addresses will be unknown unless I deploy the Timelock first and pre-calculate the Governor address based on my nonce.

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [March 8, 2023, 9:48pm UTC](https://forum.openzeppelin.com/t/governance-contract-or-timelock-contract-which-comes-first/17048/6 "2023-03-08T21:48:21Z")

</div>

> [@dagr](#):
>
> Is there a way to deploy the governance contracts without granting the admin role to myself and then revoking it?

Like you said, the way to do this without temporarily being admin (which is totally okay though), is to somehow predict the addresses. This may be easier if you use a create2 factory like the following.

> **[Keyless CREATE2 Factory | Address 0x0000000000ffe8b47b3e2130213b802212439497...](https://etherscan.io/address/0x0000000000ffe8b47b3e2130213b802212439497#code)**
>
> The Contract Address 0x0000000000ffe8b47b3e2130213b802212439497 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...
