GovernorCompatibilityBravoMockUpgradeable.sol 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. __Context_init_unchained();
  23. __ERC165_init_unchained();
  24. __EIP712_init_unchained(name_, version());
  25. __IGovernor_init_unchained();
  26. __IGovernorTimelock_init_unchained();
  27. __IGovernorCompatibilityBravo_init_unchained();
  28. __Governor_init_unchained(name_);
  29. __GovernorCompatibilityBravo_init_unchained();
  30. __GovernorSettings_init_unchained(votingDelay_, votingPeriod_, proposalThreshold_);
  31. __GovernorTimelockCompound_init_unchained(timelock_);
  32. __GovernorVotesComp_init_unchained(token_);
  33. __GovernorCompatibilityBravoMock_init_unchained(name_, token_, votingDelay_, votingPeriod_, proposalThreshold_, timelock_);
  34. }
  35. function __GovernorCompatibilityBravoMock_init_unchained(
  36. string memory,
  37. ERC20VotesCompUpgradeable,
  38. uint256,
  39. uint256,
  40. uint256,
  41. ICompoundTimelockUpgradeable
  42. ) internal onlyInitializing {}
  43. function supportsInterface(bytes4 interfaceId)
  44. public
  45. view
  46. virtual
  47. override(IERC165Upgradeable, GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  48. returns (bool)
  49. {
  50. return super.supportsInterface(interfaceId);
  51. }
  52. function quorum(uint256) public pure override returns (uint256) {
  53. return 0;
  54. }
  55. function state(uint256 proposalId)
  56. public
  57. view
  58. virtual
  59. override(IGovernorUpgradeable, GovernorUpgradeable, GovernorTimelockCompoundUpgradeable)
  60. returns (ProposalState)
  61. {
  62. return super.state(proposalId);
  63. }
  64. function proposalEta(uint256 proposalId)
  65. public
  66. view
  67. virtual
  68. override(IGovernorTimelockUpgradeable, GovernorTimelockCompoundUpgradeable)
  69. returns (uint256)
  70. {
  71. return super.proposalEta(proposalId);
  72. }
  73. function proposalThreshold() public view override(GovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
  74. return super.proposalThreshold();
  75. }
  76. function propose(
  77. address[] memory targets,
  78. uint256[] memory values,
  79. bytes[] memory calldatas,
  80. string memory description
  81. ) public virtual override(IGovernorUpgradeable, GovernorUpgradeable, GovernorCompatibilityBravoUpgradeable) returns (uint256) {
  82. return super.propose(targets, values, calldatas, description);
  83. }
  84. function queue(
  85. address[] memory targets,
  86. uint256[] memory values,
  87. bytes[] memory calldatas,
  88. bytes32 salt
  89. ) public virtual override(IGovernorTimelockUpgradeable, GovernorTimelockCompoundUpgradeable) returns (uint256) {
  90. return super.queue(targets, values, calldatas, salt);
  91. }
  92. function execute(
  93. address[] memory targets,
  94. uint256[] memory values,
  95. bytes[] memory calldatas,
  96. bytes32 salt
  97. ) public payable virtual override(IGovernorUpgradeable, GovernorUpgradeable) returns (uint256) {
  98. return super.execute(targets, values, calldatas, salt);
  99. }
  100. function _execute(
  101. uint256 proposalId,
  102. address[] memory targets,
  103. uint256[] memory values,
  104. bytes[] memory calldatas,
  105. bytes32 descriptionHash
  106. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) {
  107. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  108. }
  109. /**
  110. * @notice WARNING: this is for mock purposes only. Ability to the _cancel function should be restricted for live
  111. * deployments.
  112. */
  113. function cancel(
  114. address[] memory targets,
  115. uint256[] memory values,
  116. bytes[] memory calldatas,
  117. bytes32 salt
  118. ) public returns (uint256 proposalId) {
  119. return _cancel(targets, values, calldatas, salt);
  120. }
  121. function _cancel(
  122. address[] memory targets,
  123. uint256[] memory values,
  124. bytes[] memory calldatas,
  125. bytes32 salt
  126. ) internal virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (uint256 proposalId) {
  127. return super._cancel(targets, values, calldatas, salt);
  128. }
  129. function getVotes(address account, uint256 blockNumber)
  130. public
  131. view
  132. virtual
  133. override(IGovernorUpgradeable, GovernorVotesCompUpgradeable)
  134. returns (uint256)
  135. {
  136. return super.getVotes(account, blockNumber);
  137. }
  138. function _executor() internal view virtual override(GovernorUpgradeable, GovernorTimelockCompoundUpgradeable) returns (address) {
  139. return super._executor();
  140. }
  141. uint256[50] private __gap;
  142. }