GovernorSuperQuorumMock.sol 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.20;
  3. import {Governor} from "../../governance/Governor.sol";
  4. import {GovernorSettings} from "../../governance/extensions/GovernorSettings.sol";
  5. import {GovernorVotes} from "../../governance/extensions/GovernorVotes.sol";
  6. import {GovernorSuperQuorum} from "../../governance/extensions/GovernorSuperQuorum.sol";
  7. import {GovernorCountingSimple} from "../../governance/extensions/GovernorCountingSimple.sol";
  8. import {GovernorTimelockControl} from "../../governance/extensions/GovernorTimelockControl.sol";
  9. abstract contract GovernorSuperQuorumMock is
  10. GovernorSettings,
  11. GovernorVotes,
  12. GovernorTimelockControl,
  13. GovernorSuperQuorum,
  14. GovernorCountingSimple
  15. {
  16. uint256 private _quorum;
  17. uint256 private _superQuorum;
  18. constructor(uint256 quorum_, uint256 superQuorum_) {
  19. _quorum = quorum_;
  20. _superQuorum = superQuorum_;
  21. }
  22. function quorum(uint256) public view override returns (uint256) {
  23. return _quorum;
  24. }
  25. function superQuorum(uint256) public view override returns (uint256) {
  26. return _superQuorum;
  27. }
  28. function state(
  29. uint256 proposalId
  30. ) public view override(Governor, GovernorSuperQuorum, GovernorTimelockControl) returns (ProposalState) {
  31. return super.state(proposalId);
  32. }
  33. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  34. return super.proposalThreshold();
  35. }
  36. function proposalVotes(
  37. uint256 proposalId
  38. )
  39. public
  40. view
  41. virtual
  42. override(GovernorCountingSimple, GovernorSuperQuorum)
  43. returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes)
  44. {
  45. return super.proposalVotes(proposalId);
  46. }
  47. function _cancel(
  48. address[] memory targets,
  49. uint256[] memory values,
  50. bytes[] memory calldatas,
  51. bytes32 descriptionHash
  52. ) internal override(Governor, GovernorTimelockControl) returns (uint256) {
  53. return super._cancel(targets, values, calldatas, descriptionHash);
  54. }
  55. function _executeOperations(
  56. uint256 proposalId,
  57. address[] memory targets,
  58. uint256[] memory values,
  59. bytes[] memory calldatas,
  60. bytes32 descriptionHash
  61. ) internal override(Governor, GovernorTimelockControl) {
  62. super._executeOperations(proposalId, targets, values, calldatas, descriptionHash);
  63. }
  64. function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) {
  65. return super._executor();
  66. }
  67. function _queueOperations(
  68. uint256 proposalId,
  69. address[] memory targets,
  70. uint256[] memory values,
  71. bytes[] memory calldatas,
  72. bytes32 descriptionHash
  73. ) internal override(Governor, GovernorTimelockControl) returns (uint48) {
  74. return super._queueOperations(proposalId, targets, values, calldatas, descriptionHash);
  75. }
  76. function proposalNeedsQueuing(
  77. uint256 proposalId
  78. ) public view override(Governor, GovernorTimelockControl) returns (bool) {
  79. return super.proposalNeedsQueuing(proposalId);
  80. }
  81. }