IGovernorCompatibilityBravo.sol 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.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(uint256)
  48. public
  49. view
  50. virtual
  51. returns (
  52. uint256 id,
  53. address proposer,
  54. uint256 eta,
  55. uint256 startBlock,
  56. uint256 endBlock,
  57. uint256 forVotes,
  58. uint256 againstVotes,
  59. uint256 abstainVotes,
  60. bool canceled,
  61. bool executed
  62. );
  63. /**
  64. * @dev Part of the Governor Bravo's interface: _"Function used to propose a new proposal"_.
  65. */
  66. function propose(
  67. address[] memory targets,
  68. uint256[] memory values,
  69. string[] memory signatures,
  70. bytes[] memory calldatas,
  71. string memory description
  72. ) public virtual returns (uint256);
  73. /**
  74. * @dev Part of the Governor Bravo's interface: _"Queues a proposal of state succeeded"_.
  75. */
  76. function queue(uint256 proposalId) public virtual;
  77. /**
  78. * @dev Part of the Governor Bravo's interface: _"Executes a queued proposal if eta has passed"_.
  79. */
  80. function execute(uint256 proposalId) public payable virtual;
  81. /**
  82. * @dev Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold.
  83. */
  84. function cancel(uint256 proposalId) public virtual;
  85. /**
  86. * @dev Part of the Governor Bravo's interface: _"Gets actions of a proposal"_.
  87. */
  88. function getActions(uint256 proposalId)
  89. public
  90. view
  91. virtual
  92. returns (
  93. address[] memory targets,
  94. uint256[] memory values,
  95. string[] memory signatures,
  96. bytes[] memory calldatas
  97. );
  98. /**
  99. * @dev Part of the Governor Bravo's interface: _"Gets the receipt for a voter on a given proposal"_.
  100. */
  101. function getReceipt(uint256 proposalId, address voter) public view virtual returns (Receipt memory);
  102. }