GovernorBasicHarness.sol 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.2;
  3. import "../../contracts/governance/Governor.sol";
  4. import "../../contracts/governance/extensions/GovernorCountingSimple.sol";
  5. import "../../contracts/governance/extensions/GovernorVotes.sol";
  6. import "../../contracts/governance/extensions/GovernorVotesQuorumFraction.sol";
  7. import "../../contracts/governance/extensions/GovernorTimelockCompound.sol";
  8. /*
  9. Wizard options:
  10. ERC20Votes
  11. TimelockCompound
  12. */
  13. contract GovernorBasicHarness is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockCompound {
  14. constructor(ERC20Votes _token, ICompoundTimelock _timelock, string memory name, uint256 quorumFraction)
  15. Governor(name)
  16. GovernorVotes(_token)
  17. GovernorVotesQuorumFraction(quorumFraction)
  18. GovernorTimelockCompound(_timelock)
  19. {}
  20. function isExecuted(uint256 proposalId) public view returns (bool) {
  21. return _proposals[proposalId].executed;
  22. }
  23. function isCanceled(uint256 proposalId) public view returns (bool) {
  24. return _proposals[proposalId].canceled;
  25. }
  26. uint256 _votingDelay;
  27. function votingDelay() public view override virtual returns (uint256) {
  28. return _votingDelay;
  29. }
  30. uint256 _votingPeriod;
  31. function votingPeriod() public view override virtual returns (uint256) {
  32. return _votingPeriod;
  33. }
  34. /*
  35. function votingDelay() public pure override returns (uint256) {
  36. return _votingDelay;
  37. }
  38. function votingPeriod() public pure override returns (uint256) {
  39. return _votingPeriod;
  40. }
  41. */
  42. // The following functions are overrides required by Solidity.
  43. function quorum(uint256 blockNumber)
  44. public
  45. view
  46. override(IGovernor, GovernorVotesQuorumFraction)
  47. returns (uint256)
  48. {
  49. return super.quorum(blockNumber);
  50. }
  51. function getVotes(address account, uint256 blockNumber)
  52. public
  53. view
  54. override(IGovernor, GovernorVotes)
  55. returns (uint256)
  56. {
  57. return super.getVotes(account, blockNumber);
  58. }
  59. function state(uint256 proposalId)
  60. public
  61. view
  62. override(Governor, GovernorTimelockCompound)
  63. returns (ProposalState)
  64. {
  65. return super.state(proposalId);
  66. }
  67. function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)
  68. public
  69. override(Governor, IGovernor)
  70. returns (uint256)
  71. {
  72. return super.propose(targets, values, calldatas, description);
  73. }
  74. function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
  75. internal
  76. override(Governor, GovernorTimelockCompound)
  77. {
  78. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  79. }
  80. function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
  81. internal
  82. override(Governor, GovernorTimelockCompound)
  83. returns (uint256)
  84. {
  85. return super._cancel(targets, values, calldatas, descriptionHash);
  86. }
  87. function _executor()
  88. internal
  89. view
  90. override(Governor, GovernorTimelockCompound)
  91. returns (address)
  92. {
  93. return super._executor();
  94. }
  95. function supportsInterface(bytes4 interfaceId)
  96. public
  97. view
  98. override(Governor, GovernorTimelockCompound)
  99. returns (bool)
  100. {
  101. return super.supportsInterface(interfaceId);
  102. }
  103. }