Skip to content

Instantly share code, notes, and snippets.

@KolevDarko
Created December 15, 2022 05:42
Show Gist options
  • Save KolevDarko/e02e74cb4143b5cdc327a5cd58b3c292 to your computer and use it in GitHub Desktop.
Save KolevDarko/e02e74cb4143b5cdc327a5cd58b3c292 to your computer and use it in GitHub Desktop.
Governor execute
function execute(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public payable virtual override returns (uint256) {
uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);
ProposalState status = state(proposalId);
require(
status == ProposalState.Succeeded || status == ProposalState.Queued,
"Governor: proposal not successful"
);
_proposals[proposalId].executed = true;
emit ProposalExecuted(proposalId);
_beforeExecute(proposalId, targets, values, calldatas, descriptionHash);
_execute(proposalId, targets, values, calldatas, descriptionHash);
_afterExecute(proposalId, targets, values, calldatas, descriptionHash);
return proposalId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment