Skip to content

Commit

Permalink
chore: add timelock operation id explainer
Browse files Browse the repository at this point in the history
  • Loading branch information
chapati23 committed Aug 6, 2024
1 parent 8bfd892 commit 929b275
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utils/get-time-lock-id.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { encodeAbiParameters, parseAbiParameters, keccak256 } from "viem";
import { encodeAbiParameters, keccak256, parseAbiParameters } from "viem";

import { ProposalCreatedEvent } from "../types";

/**
* Given a ProposalCreatedEvent, calculate the corresponding timelock operation ID.
* Governance Watchdogs need the timelock operation ID to veto queued proposals.
*
* The governor proposal ID and the timelock operation ID are not the same, which can
* be confusing. They use different hashing mechanisms to calculate their respective IDs:
* - Timelock Controller Operation IDs: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/58fa0f81c4036f1a3b616fdffad2fd27e5d5ce21/contracts/governance/TimelockControllerUpgradeable.sol#L218
* - Governor Proposal IDs: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0a25c1940ca220686588c4af3ec526f725fe2582/contracts/governance/Governor.sol#L139
*/
export default function getProposalTimeLockId(
event: ProposalCreatedEvent,
): string {
Expand Down

0 comments on commit 929b275

Please sign in to comment.