GovernorTimelockControlMockUpgradeable.sol 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorTimelockControlUpgradeable.sol";
  4. import "../governance/extensions/GovernorSettingsUpgradeable.sol";
  5. import "../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
  6. import "../governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol";
  7. import "../proxy/utils/Initializable.sol";
  8. contract GovernorTimelockControlMockUpgradeable is
  9. Initializable, GovernorSettingsUpgradeable,
  10. GovernorTimelockControlUpgradeable,
  11. GovernorVotesQuorumFractionUpgradeable,
  12. GovernorCountingSimpleUpgradeable
  13. {
  14. function __GovernorTimelockControlMock_init(
  15. string memory name_,
  16. IVotesUpgradeable token_,
  17. uint256 votingDelay_,
  18. uint256 votingPeriod_,
  19. TimelockControllerUpgradeable timelock_,
  20. uint256 quorumNumerator_
  21. ) internal onlyInitializing {
  22. __EIP712_init_unchained(name_, version());
  23. __Governor_init_unchained(name_);
  24. __GovernorSettings_init_unchained(votingDelay_, votingPeriod_, 0);
  25. __GovernorTimelockControl_init_unchained(timelock_);
  26. __GovernorVotes_init_unchained(token_);
  27. __GovernorVotesQuorumFraction_init_unchained(quorumNumerator_);
  28. }
  29. function __GovernorTimelockControlMock_init_unchained(
  30. string memory,
  31. IVotesUpgradeable,
  32. uint256,
  33. uint256,
  34. TimelockControllerUpgradeable,
  35. uint256
  36. ) internal onlyInitializing {}
  37. function supportsInterface(bytes4 interfaceId)
  38. public
  39. view
  40. virtual
  41. override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
  42. returns (bool)
  43. {
  44. return super.supportsInterface(interfaceId);
  45. }
  46. function quorum(uint256 blockNumber)
  47. public
  48. view
  49. override(IGovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable)
  50. returns (uint256)
  51. {
  52. return super.quorum(blockNumber);
  53. }
  54. function cancel(
  55. address[] memory targets,
  56. uint256[] memory values,
  57. bytes[] memory calldatas,
  58. bytes32 descriptionHash
  59. ) public returns (uint256 proposalId) {
  60. return _cancel(targets, values, calldatas, descriptionHash);
  61. }
  62. /**
  63. * Overriding nightmare
  64. */
  65. function state(uint256 proposalId)
  66. public
  67. view
  68. virtual
  69. override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
  70. returns (ProposalState)
  71. {
  72. return super.state(proposalId);
  73. }
  74. function proposalThreshold() public view override(GovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
  75. return super.proposalThreshold();
  76. }
  77. function _execute(
  78. uint256 proposalId,
  79. address[] memory targets,
  80. uint256[] memory values,
  81. bytes[] memory calldatas,
  82. bytes32 descriptionHash
  83. ) internal virtual override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) {
  84. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  85. }
  86. function _cancel(
  87. address[] memory targets,
  88. uint256[] memory values,
  89. bytes[] memory calldatas,
  90. bytes32 descriptionHash
  91. ) internal virtual override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (uint256 proposalId) {
  92. return super._cancel(targets, values, calldatas, descriptionHash);
  93. }
  94. function getVotes(address account, uint256 blockNumber)
  95. public
  96. view
  97. virtual
  98. override(IGovernorUpgradeable, GovernorVotesUpgradeable)
  99. returns (uint256)
  100. {
  101. return super.getVotes(account, blockNumber);
  102. }
  103. function _executor() internal view virtual override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (address) {
  104. return super._executor();
  105. }
  106. /**
  107. * @dev This empty reserved space is put in place to allow future versions to add new
  108. * variables without shifting down storage in the inheritance chain.
  109. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  110. */
  111. uint256[50] private __gap;
  112. }