IGovernorCompatibilityBravoUpgradeable.sol 3.6 KB

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