GovernorTimelockCompoundMockUpgradeable.sol 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorTimelockCompoundUpgradeable.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 GovernorTimelockCompoundMockUpgradeable is
  9. Initializable, GovernorSettingsUpgradeable,
  10. GovernorTimelockCompoundUpgradeable,
  11. GovernorVotesQuorumFractionUpgradeable,
  12. GovernorCountingSimpleUpgradeable
  13. {
  14. function __GovernorTimelockCompoundMock_init(
  15. string memory name_,
  16. IVotesUpgradeable token_,
  17. uint256 votingDelay_,
  18. uint256 votingPeriod_,
  19. ICompoundTimelockUpgradeable timelock_,
  20. uint256 quorumNumerator_
  21. ) internal onlyInitializing {
  22. __Context_init_unchained();
  23. __ERC165_init_unchained();
  24. __EIP712_init_unchained(name_, version());
  25. __IGovernor_init_unchained();
  26. __IGovernorTimelock_init_unchained();
  27. __Governor_init_unchained(name_);
  28. __GovernorSettings_init_unchained(votingDelay_, votingPeriod_, 0);
  29. __GovernorTimelockCompound_init_unchained(timelock_);
  30. __GovernorVotes_init_unchained(token_);
  31. __GovernorVotesQuorumFraction_init_unchained(quorumNumerator_);
  32. __GovernorCountingSimple_init_unchained();
  33. __GovernorTimelockCompoundMock_init_unchained(name_, token_, votingDelay_, votingPeriod_, timelock_, quorumNumerator_);
  34. }
  35. function __GovernorTimelockCompoundMock_init_unchained(
  36. string memory,
  37. IVotesUpgradeable,
  38. uint256,
  39. uint256,
  40. ICompoundTimelockUpgradeable,
  41. uint256
  42. ) internal onlyInitializing {}
  43. function supportsInterface(bytes4 interfaceId)
  44. public
  45. view
  46. virtual
  47. override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  48. returns (bool)
  49. {
  50. return super.supportsInterface(interfaceId);
  51. }
  52. function quorum(uint256 blockNumber)
  53. public
  54. view
  55. override(IGovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable)
  56. returns (uint256)
  57. {
  58. return super.quorum(blockNumber);
  59. }
  60. function cancel(
  61. address[] memory targets,
  62. uint256[] memory values,
  63. bytes[] memory calldatas,
  64. bytes32 salt
  65. ) public returns (uint256 proposalId) {
  66. return _cancel(targets, values, calldatas, salt);
  67. }
  68. /**
  69. * Overriding nightmare
  70. */
  71. function state(uint256 proposalId)
  72. public
  73. view
  74. virtual
  75. override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  76. returns (ProposalState)
  77. {
  78. return super.state(proposalId);
  79. }
  80. function proposalThreshold() public view override(GovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
  81. return super.proposalThreshold();
  82. }
  83. function _execute(
  84. uint256 proposalId,
  85. address[] memory targets,
  86. uint256[] memory values,
  87. bytes[] memory calldatas,
  88. bytes32 descriptionHash
  89. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) {
  90. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  91. }
  92. function _cancel(
  93. address[] memory targets,
  94. uint256[] memory values,
  95. bytes[] memory calldatas,
  96. bytes32 salt
  97. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (uint256 proposalId) {
  98. return super._cancel(targets, values, calldatas, salt);
  99. }
  100. function getVotes(address account, uint256 blockNumber)
  101. public
  102. view
  103. virtual
  104. override(IGovernorUpgradeable, GovernorVotesUpgradeable)
  105. returns (uint256)
  106. {
  107. return super.getVotes(account, blockNumber);
  108. }
  109. function _executor() internal view virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (address) {
  110. return super._executor();
  111. }
  112. uint256[50] private __gap;
  113. }