GovernorTimelockCompoundMock.sol 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorTimelockCompound.sol";
  4. import "../governance/extensions/GovernorSettings.sol";
  5. import "../governance/extensions/GovernorCountingSimple.sol";
  6. import "../governance/extensions/GovernorVotesQuorumFraction.sol";
  7. contract GovernorTimelockCompoundMock is
  8. GovernorSettings,
  9. GovernorTimelockCompound,
  10. GovernorVotesQuorumFraction,
  11. GovernorCountingSimple
  12. {
  13. constructor(
  14. string memory name_,
  15. IVotes token_,
  16. uint256 votingDelay_,
  17. uint256 votingPeriod_,
  18. ICompoundTimelock timelock_,
  19. uint256 quorumNumerator_
  20. )
  21. Governor(name_)
  22. GovernorTimelockCompound(timelock_)
  23. GovernorSettings(votingDelay_, votingPeriod_, 0)
  24. GovernorVotes(token_)
  25. GovernorVotesQuorumFraction(quorumNumerator_)
  26. {}
  27. function supportsInterface(
  28. bytes4 interfaceId
  29. ) public view override(Governor, GovernorTimelockCompound) returns (bool) {
  30. return super.supportsInterface(interfaceId);
  31. }
  32. function quorum(
  33. uint256 blockNumber
  34. ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) {
  35. return super.quorum(blockNumber);
  36. }
  37. function cancel(
  38. address[] memory targets,
  39. uint256[] memory values,
  40. bytes[] memory calldatas,
  41. bytes32 salt
  42. ) public returns (uint256 proposalId) {
  43. return _cancel(targets, values, calldatas, salt);
  44. }
  45. /**
  46. * Overriding nightmare
  47. */
  48. function state(
  49. uint256 proposalId
  50. ) public view override(Governor, GovernorTimelockCompound) returns (ProposalState) {
  51. return super.state(proposalId);
  52. }
  53. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  54. return super.proposalThreshold();
  55. }
  56. function _execute(
  57. uint256 proposalId,
  58. address[] memory targets,
  59. uint256[] memory values,
  60. bytes[] memory calldatas,
  61. bytes32 descriptionHash
  62. ) internal override(Governor, GovernorTimelockCompound) {
  63. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  64. }
  65. function _cancel(
  66. address[] memory targets,
  67. uint256[] memory values,
  68. bytes[] memory calldatas,
  69. bytes32 salt
  70. ) internal override(Governor, GovernorTimelockCompound) returns (uint256 proposalId) {
  71. return super._cancel(targets, values, calldatas, salt);
  72. }
  73. function _executor() internal view override(Governor, GovernorTimelockCompound) returns (address) {
  74. return super._executor();
  75. }
  76. }