IGovernorCompatibilityBravo.sol 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.9.0) (governance/compatibility/IGovernorCompatibilityBravo.sol)
  3. pragma solidity ^0.8.19;
  4. import {IGovernor} from "../IGovernor.sol";
  5. /**
  6. * @dev Interface extension that adds missing functions to the {Governor} core to provide `GovernorBravo` compatibility.
  7. */
  8. abstract contract IGovernorCompatibilityBravo is IGovernor {
  9. /**
  10. * @dev Mismatch between the parameters length for a proposal call.
  11. */
  12. error GovernorInvalidSignaturesLength(uint256 signatures, uint256 calldatas);
  13. /**
  14. * @dev Proposal structure from Compound Governor Bravo. Not actually used by the compatibility layer, as
  15. * {{proposal}} returns a very different structure.
  16. */
  17. struct Proposal {
  18. uint256 id;
  19. address proposer;
  20. uint256 eta;
  21. address[] targets;
  22. uint256[] values;
  23. string[] signatures;
  24. bytes[] calldatas;
  25. uint256 startBlock;
  26. uint256 endBlock;
  27. uint256 forVotes;
  28. uint256 againstVotes;
  29. uint256 abstainVotes;
  30. bool canceled;
  31. bool executed;
  32. mapping(address => Receipt) receipts;
  33. }
  34. /**
  35. * @dev Receipt structure from Compound Governor Bravo
  36. */
  37. struct Receipt {
  38. bool hasVoted;
  39. uint8 support;
  40. uint96 votes;
  41. }
  42. /**
  43. * @dev Part of the Governor Bravo's interface.
  44. */
  45. function quorumVotes() public view virtual returns (uint256);
  46. /**
  47. * @dev Part of the Governor Bravo's interface: _"The official record of all proposals ever proposed"_.
  48. */
  49. function proposals(
  50. uint256
  51. )
  52. public
  53. view
  54. virtual
  55. returns (
  56. uint256 id,
  57. address proposer,
  58. uint256 eta,
  59. uint256 startBlock,
  60. uint256 endBlock,
  61. uint256 forVotes,
  62. uint256 againstVotes,
  63. uint256 abstainVotes,
  64. bool canceled,
  65. bool executed
  66. );
  67. /**
  68. * @dev Part of the Governor Bravo's interface: _"Function used to propose a new proposal"_.
  69. */
  70. function propose(
  71. address[] memory targets,
  72. uint256[] memory values,
  73. string[] memory signatures,
  74. bytes[] memory calldatas,
  75. string memory description
  76. ) public virtual returns (uint256);
  77. /**
  78. * @dev Part of the Governor Bravo's interface: _"Queues a proposal of state succeeded"_.
  79. */
  80. function queue(uint256 proposalId) public virtual;
  81. /**
  82. * @dev Part of the Governor Bravo's interface: _"Executes a queued proposal if eta has passed"_.
  83. */
  84. function execute(uint256 proposalId) public payable virtual;
  85. /**
  86. * @dev Cancels a proposal only if the sender is the proposer or the proposer delegates' voting power dropped below the proposal threshold.
  87. */
  88. function cancel(uint256 proposalId) public virtual;
  89. /**
  90. * @dev Part of the Governor Bravo's interface: _"Gets actions of a proposal"_.
  91. */
  92. function getActions(
  93. uint256 proposalId
  94. )
  95. public
  96. view
  97. virtual
  98. returns (
  99. address[] memory targets,
  100. uint256[] memory values,
  101. string[] memory signatures,
  102. bytes[] memory calldatas
  103. );
  104. /**
  105. * @dev Part of the Governor Bravo's interface: _"Gets the receipt for a voter on a given proposal"_.
  106. */
  107. function getReceipt(uint256 proposalId, address voter) public view virtual returns (Receipt memory);
  108. }