GovernorCompatibilityBravoMock.sol 3.7 KB

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