GovernorCompatibilityBravoMockUpgradeable.sol 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/compatibility/GovernorCompatibilityBravoUpgradeable.sol";
  4. import "../governance/extensions/GovernorTimelockCompoundUpgradeable.sol";
  5. import "../governance/extensions/GovernorSettingsUpgradeable.sol";
  6. import "../governance/extensions/GovernorVotesCompUpgradeable.sol";
  7. import "../proxy/utils/Initializable.sol";
  8. contract GovernorCompatibilityBravoMockUpgradeable is
  9. Initializable, GovernorCompatibilityBravoUpgradeable,
  10. GovernorSettingsUpgradeable,
  11. GovernorTimelockCompoundUpgradeable,
  12. GovernorVotesCompUpgradeable
  13. {
  14. function __GovernorCompatibilityBravoMock_init(
  15. string memory name_,
  16. ERC20VotesCompUpgradeable token_,
  17. uint256 votingDelay_,
  18. uint256 votingPeriod_,
  19. uint256 proposalThreshold_,
  20. ICompoundTimelockUpgradeable timelock_
  21. ) internal onlyInitializing {
  22. __EIP712_init_unchained(name_, version());
  23. __Governor_init_unchained(name_);
  24. __GovernorSettings_init_unchained(votingDelay_, votingPeriod_, proposalThreshold_);
  25. __GovernorTimelockCompound_init_unchained(timelock_);
  26. __GovernorVotesComp_init_unchained(token_);
  27. }
  28. function __GovernorCompatibilityBravoMock_init_unchained(
  29. string memory,
  30. ERC20VotesCompUpgradeable,
  31. uint256,
  32. uint256,
  33. uint256,
  34. ICompoundTimelockUpgradeable
  35. ) internal onlyInitializing {}
  36. function supportsInterface(bytes4 interfaceId)
  37. public
  38. view
  39. virtual
  40. override(IERC165Upgradeable, GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  41. returns (bool)
  42. {
  43. return super.supportsInterface(interfaceId);
  44. }
  45. function quorum(uint256) public pure override returns (uint256) {
  46. return 0;
  47. }
  48. function state(uint256 proposalId)
  49. public
  50. view
  51. virtual
  52. override(IGovernorUpgradeable, GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  53. returns (ProposalState)
  54. {
  55. return super.state(proposalId);
  56. }
  57. function proposalEta(uint256 proposalId)
  58. public
  59. view
  60. virtual
  61. override(IGovernorTimelockUpgradeable, GovernorTimelockCompoundUpgradeable)
  62. returns (uint256)
  63. {
  64. return super.proposalEta(proposalId);
  65. }
  66. function proposalThreshold() public view override(GovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
  67. return super.proposalThreshold();
  68. }
  69. function propose(
  70. address[] memory targets,
  71. uint256[] memory values,
  72. bytes[] memory calldatas,
  73. string memory description
  74. ) public virtual override(IGovernorUpgradeable, GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable) returns (uint256) {
  75. return super.propose(targets, values, calldatas, description);
  76. }
  77. function queue(
  78. address[] memory targets,
  79. uint256[] memory values,
  80. bytes[] memory calldatas,
  81. bytes32 salt
  82. ) public virtual override(IGovernorTimelockUpgradeable, GovernorTimelockCompoundUpgradeable) returns (uint256) {
  83. return super.queue(targets, values, calldatas, salt);
  84. }
  85. function execute(
  86. address[] memory targets,
  87. uint256[] memory values,
  88. bytes[] memory calldatas,
  89. bytes32 salt
  90. ) public payable virtual override(IGovernorUpgradeable, GovernorUpgradeable) returns (uint256) {
  91. return super.execute(targets, values, calldatas, salt);
  92. }
  93. function _execute(
  94. uint256 proposalId,
  95. address[] memory targets,
  96. uint256[] memory values,
  97. bytes[] memory calldatas,
  98. bytes32 descriptionHash
  99. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) {
  100. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  101. }
  102. /**
  103. * @notice WARNING: this is for mock purposes only. Ability to the _cancel function should be restricted for live
  104. * deployments.
  105. */
  106. function cancel(
  107. address[] memory targets,
  108. uint256[] memory values,
  109. bytes[] memory calldatas,
  110. bytes32 salt
  111. ) public returns (uint256 proposalId) {
  112. return _cancel(targets, values, calldatas, salt);
  113. }
  114. function _cancel(
  115. address[] memory targets,
  116. uint256[] memory values,
  117. bytes[] memory calldatas,
  118. bytes32 salt
  119. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (uint256 proposalId) {
  120. return super._cancel(targets, values, calldatas, salt);
  121. }
  122. function getVotes(address account, uint256 blockNumber)
  123. public
  124. view
  125. virtual
  126. override(IGovernorUpgradeable, GovernorVotesCompUpgradeable)
  127. returns (uint256)
  128. {
  129. return super.getVotes(account, blockNumber);
  130. }
  131. function _executor() internal view virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (address) {
  132. return super._executor();
  133. }
  134. /**
  135. * @dev This empty reserved space is put in place to allow future versions to add new
  136. * variables without shifting down storage in the inheritance chain.
  137. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  138. */
  139. uint256[50] private __gap;
  140. }