GovernorCompatibilityBravoMock.sol 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/compatibility/GovernorCompatibilityBravo.sol";
  4. import "../governance/extensions/GovernorTimelockCompound.sol";
  5. import "../governance/extensions/GovernorSettings.sol";
  6. import "../governance/extensions/GovernorVotesComp.sol";
  7. contract GovernorCompatibilityBravoMock is
  8. GovernorCompatibilityBravo,
  9. GovernorSettings,
  10. GovernorTimelockCompound,
  11. GovernorVotesComp
  12. {
  13. constructor(
  14. string memory name_,
  15. ERC20VotesComp token_,
  16. uint256 votingDelay_,
  17. uint256 votingPeriod_,
  18. uint256 proposalThreshold_,
  19. ICompoundTimelock timelock_
  20. )
  21. Governor(name_)
  22. GovernorTimelockCompound(timelock_)
  23. GovernorSettings(votingDelay_, votingPeriod_, proposalThreshold_)
  24. GovernorVotesComp(token_)
  25. {}
  26. function supportsInterface(bytes4 interfaceId)
  27. public
  28. view
  29. virtual
  30. override(IERC165, Governor, GovernorTimelockCompound)
  31. returns (bool)
  32. {
  33. return super.supportsInterface(interfaceId);
  34. }
  35. function quorum(uint256) public pure override returns (uint256) {
  36. return 0;
  37. }
  38. function state(uint256 proposalId)
  39. public
  40. view
  41. virtual
  42. override(IGovernor, Governor, GovernorTimelockCompound)
  43. returns (ProposalState)
  44. {
  45. return super.state(proposalId);
  46. }
  47. function proposalEta(uint256 proposalId)
  48. public
  49. view
  50. virtual
  51. override(IGovernorTimelock, GovernorTimelockCompound)
  52. returns (uint256)
  53. {
  54. return super.proposalEta(proposalId);
  55. }
  56. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  57. return super.proposalThreshold();
  58. }
  59. function propose(
  60. address[] memory targets,
  61. uint256[] memory values,
  62. bytes[] memory calldatas,
  63. string memory description
  64. ) public virtual override(IGovernor, Governor, GovernorCompatibilityBravo) returns (uint256) {
  65. return super.propose(targets, values, calldatas, description);
  66. }
  67. function queue(
  68. address[] memory targets,
  69. uint256[] memory values,
  70. bytes[] memory calldatas,
  71. bytes32 salt
  72. ) public virtual override(IGovernorTimelock, GovernorTimelockCompound) returns (uint256) {
  73. return super.queue(targets, values, calldatas, salt);
  74. }
  75. function execute(
  76. address[] memory targets,
  77. uint256[] memory values,
  78. bytes[] memory calldatas,
  79. bytes32 salt
  80. ) public payable virtual override(IGovernor, Governor) returns (uint256) {
  81. return super.execute(targets, values, calldatas, salt);
  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(Governor, GovernorTimelockCompound) {
  90. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  91. }
  92. /**
  93. * @notice WARNING: this is for mock purposes only. Ability to the _cancel function should be restricted for live
  94. * deployments.
  95. */
  96. function cancel(
  97. address[] memory targets,
  98. uint256[] memory values,
  99. bytes[] memory calldatas,
  100. bytes32 salt
  101. ) public returns (uint256 proposalId) {
  102. return _cancel(targets, values, calldatas, salt);
  103. }
  104. function _cancel(
  105. address[] memory targets,
  106. uint256[] memory values,
  107. bytes[] memory calldatas,
  108. bytes32 salt
  109. ) internal virtual override(Governor, GovernorTimelockCompound) returns (uint256 proposalId) {
  110. return super._cancel(targets, values, calldatas, salt);
  111. }
  112. function _executor() internal view virtual override(Governor, GovernorTimelockCompound) returns (address) {
  113. return super._executor();
  114. }
  115. }