GovernorCompatibilityBravoMock.sol 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. override(IERC165, Governor, GovernorTimelockCompound)
  30. returns (bool)
  31. {
  32. return super.supportsInterface(interfaceId);
  33. }
  34. function quorum(uint256) public pure override returns (uint256) {
  35. return 0;
  36. }
  37. function state(uint256 proposalId)
  38. public
  39. view
  40. override(IGovernor, Governor, GovernorTimelockCompound)
  41. returns (ProposalState)
  42. {
  43. return super.state(proposalId);
  44. }
  45. function proposalEta(uint256 proposalId)
  46. public
  47. view
  48. override(IGovernorTimelock, GovernorTimelockCompound)
  49. returns (uint256)
  50. {
  51. return super.proposalEta(proposalId);
  52. }
  53. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  54. return super.proposalThreshold();
  55. }
  56. function propose(
  57. address[] memory targets,
  58. uint256[] memory values,
  59. bytes[] memory calldatas,
  60. string memory description
  61. ) public override(IGovernor, Governor, GovernorCompatibilityBravo) returns (uint256) {
  62. return super.propose(targets, values, calldatas, description);
  63. }
  64. function queue(
  65. address[] memory targets,
  66. uint256[] memory values,
  67. bytes[] memory calldatas,
  68. bytes32 salt
  69. ) public override(IGovernorTimelock, GovernorTimelockCompound) returns (uint256) {
  70. return super.queue(targets, values, calldatas, salt);
  71. }
  72. function execute(
  73. address[] memory targets,
  74. uint256[] memory values,
  75. bytes[] memory calldatas,
  76. bytes32 salt
  77. ) public payable override(IGovernor, Governor) returns (uint256) {
  78. return super.execute(targets, values, calldatas, salt);
  79. }
  80. function _execute(
  81. uint256 proposalId,
  82. address[] memory targets,
  83. uint256[] memory values,
  84. bytes[] memory calldatas,
  85. bytes32 descriptionHash
  86. ) internal override(Governor, GovernorTimelockCompound) {
  87. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  88. }
  89. /**
  90. * @notice WARNING: this is for mock purposes only. Ability to the _cancel function should be restricted for live
  91. * deployments.
  92. */
  93. function cancel(
  94. address[] memory targets,
  95. uint256[] memory values,
  96. bytes[] memory calldatas,
  97. bytes32 salt
  98. ) public returns (uint256 proposalId) {
  99. return _cancel(targets, values, calldatas, salt);
  100. }
  101. function _cancel(
  102. address[] memory targets,
  103. uint256[] memory values,
  104. bytes[] memory calldatas,
  105. bytes32 salt
  106. ) internal override(Governor, GovernorTimelockCompound) returns (uint256 proposalId) {
  107. return super._cancel(targets, values, calldatas, salt);
  108. }
  109. function _executor() internal view override(Governor, GovernorTimelockCompound) returns (address) {
  110. return super._executor();
  111. }
  112. }