GovernorTimelockCompoundMock.sol 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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(bytes4 interfaceId)
  28. public
  29. view
  30. virtual
  31. override(Governor, GovernorTimelockCompound)
  32. returns (bool)
  33. {
  34. return super.supportsInterface(interfaceId);
  35. }
  36. function quorum(uint256 blockNumber)
  37. public
  38. view
  39. override(IGovernor, GovernorVotesQuorumFraction)
  40. returns (uint256)
  41. {
  42. return super.quorum(blockNumber);
  43. }
  44. function cancel(
  45. address[] memory targets,
  46. uint256[] memory values,
  47. bytes[] memory calldatas,
  48. bytes32 salt
  49. ) public returns (uint256 proposalId) {
  50. return _cancel(targets, values, calldatas, salt);
  51. }
  52. /**
  53. * Overriding nightmare
  54. */
  55. function state(uint256 proposalId)
  56. public
  57. view
  58. virtual
  59. override(Governor, GovernorTimelockCompound)
  60. returns (ProposalState)
  61. {
  62. return super.state(proposalId);
  63. }
  64. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  65. return super.proposalThreshold();
  66. }
  67. function _execute(
  68. uint256 proposalId,
  69. address[] memory targets,
  70. uint256[] memory values,
  71. bytes[] memory calldatas,
  72. bytes32 descriptionHash
  73. ) internal virtual override(Governor, GovernorTimelockCompound) {
  74. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  75. }
  76. function _cancel(
  77. address[] memory targets,
  78. uint256[] memory values,
  79. bytes[] memory calldatas,
  80. bytes32 salt
  81. ) internal virtual override(Governor, GovernorTimelockCompound) returns (uint256 proposalId) {
  82. return super._cancel(targets, values, calldatas, salt);
  83. }
  84. function _executor() internal view virtual override(Governor, GovernorTimelockCompound) returns (address) {
  85. return super._executor();
  86. }
  87. }