IGovernorCompatibilityBravo.sol 3.4 KB

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