IGovernorCompatibilityBravo.sol 3.5 KB

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