|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity ^0.8.19; |
| 3 | + |
| 4 | +import "../../../governance/Governor.sol"; |
| 5 | +import "../../../governance/compatibility/GovernorCompatibilityBravo.sol"; |
| 6 | +import "../../../governance/extensions/GovernorVotes.sol"; |
| 7 | +import "../../../governance/extensions/GovernorVotesQuorumFraction.sol"; |
| 8 | +import "../../../governance/extensions/GovernorTimelockControl.sol"; |
| 9 | + |
| 10 | +contract MyGovernor is |
| 11 | + Governor, |
| 12 | + GovernorCompatibilityBravo, |
| 13 | + GovernorVotes, |
| 14 | + GovernorVotesQuorumFraction, |
| 15 | + GovernorTimelockControl |
| 16 | +{ |
| 17 | + constructor( |
| 18 | + IVotes _token, |
| 19 | + TimelockController _timelock |
| 20 | + ) Governor("MyGovernor") GovernorVotes(_token) GovernorVotesQuorumFraction(4) GovernorTimelockControl(_timelock) {} |
| 21 | + |
| 22 | + function votingDelay() public pure override returns (uint256) { |
| 23 | + return 7200; // 1 day |
| 24 | + } |
| 25 | + |
| 26 | + function votingPeriod() public pure override returns (uint256) { |
| 27 | + return 50400; // 1 week |
| 28 | + } |
| 29 | + |
| 30 | + function proposalThreshold() public pure override returns (uint256) { |
| 31 | + return 0; |
| 32 | + } |
| 33 | + |
| 34 | + // The functions below are overrides required by Solidity. |
| 35 | + |
| 36 | + function state( |
| 37 | + uint256 proposalId |
| 38 | + ) public view override(Governor, IGovernor, GovernorTimelockControl) returns (ProposalState) { |
| 39 | + return super.state(proposalId); |
| 40 | + } |
| 41 | + |
| 42 | + function propose( |
| 43 | + address[] memory targets, |
| 44 | + uint256[] memory values, |
| 45 | + bytes[] memory calldatas, |
| 46 | + string memory description |
| 47 | + ) public override(Governor, GovernorCompatibilityBravo, IGovernor) returns (uint256) { |
| 48 | + return super.propose(targets, values, calldatas, description); |
| 49 | + } |
| 50 | + |
| 51 | + function cancel( |
| 52 | + address[] memory targets, |
| 53 | + uint256[] memory values, |
| 54 | + bytes[] memory calldatas, |
| 55 | + bytes32 descriptionHash |
| 56 | + ) public override(Governor, GovernorCompatibilityBravo, IGovernor) returns (uint256) { |
| 57 | + return super.cancel(targets, values, calldatas, descriptionHash); |
| 58 | + } |
| 59 | + |
| 60 | + function _execute( |
| 61 | + uint256 proposalId, |
| 62 | + address[] memory targets, |
| 63 | + uint256[] memory values, |
| 64 | + bytes[] memory calldatas, |
| 65 | + bytes32 descriptionHash |
| 66 | + ) internal override(Governor, GovernorTimelockControl) { |
| 67 | + super._execute(proposalId, targets, values, calldatas, descriptionHash); |
| 68 | + } |
| 69 | + |
| 70 | + function _cancel( |
| 71 | + address[] memory targets, |
| 72 | + uint256[] memory values, |
| 73 | + bytes[] memory calldatas, |
| 74 | + bytes32 descriptionHash |
| 75 | + ) internal override(Governor, GovernorTimelockControl) returns (uint256) { |
| 76 | + return super._cancel(targets, values, calldatas, descriptionHash); |
| 77 | + } |
| 78 | + |
| 79 | + function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) { |
| 80 | + return super._executor(); |
| 81 | + } |
| 82 | + |
| 83 | + function supportsInterface( |
| 84 | + bytes4 interfaceId |
| 85 | + ) public view override(Governor, IERC165, GovernorTimelockControl) returns (bool) { |
| 86 | + return super.supportsInterface(interfaceId); |
| 87 | + } |
| 88 | +} |
0 commit comments