IGovernorCompatibilityBravo.sol 3.3 KB

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