IGovernorCompatibilityBravoUpgradeable.sol 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. }
  14. function __IGovernorCompatibilityBravo_init_unchained() internal onlyInitializing {
  15. }
  16. /**
  17. * @dev Proposal structure from Compound Governor Bravo. Not actually used by the compatibility layer, as
  18. * {{proposal}} returns a very different structure.
  19. */
  20. struct Proposal {
  21. uint256 id;
  22. address proposer;
  23. uint256 eta;
  24. address[] targets;
  25. uint256[] values;
  26. string[] signatures;
  27. bytes[] calldatas;
  28. uint256 startBlock;
  29. uint256 endBlock;
  30. uint256 forVotes;
  31. uint256 againstVotes;
  32. uint256 abstainVotes;
  33. bool canceled;
  34. bool executed;
  35. mapping(address => Receipt) receipts;
  36. }
  37. /**
  38. * @dev Receipt structure from Compound Governor Bravo
  39. */
  40. struct Receipt {
  41. bool hasVoted;
  42. uint8 support;
  43. uint96 votes;
  44. }
  45. /**
  46. * @dev Part of the Governor Bravo's interface.
  47. */
  48. function quorumVotes() public view virtual returns (uint256);
  49. /**
  50. * @dev Part of the Governor Bravo's interface: _"The official record of all proposals ever proposed"_.
  51. */
  52. function proposals(uint256)
  53. public
  54. view
  55. virtual
  56. returns (
  57. uint256 id,
  58. address proposer,
  59. uint256 eta,
  60. uint256 startBlock,
  61. uint256 endBlock,
  62. uint256 forVotes,
  63. uint256 againstVotes,
  64. uint256 abstainVotes,
  65. bool canceled,
  66. bool executed
  67. );
  68. /**
  69. * @dev Part of the Governor Bravo's interface: _"Function used to propose a new proposal"_.
  70. */
  71. function propose(
  72. address[] memory targets,
  73. uint256[] memory values,
  74. string[] memory signatures,
  75. bytes[] memory calldatas,
  76. string memory description
  77. ) public virtual returns (uint256);
  78. /**
  79. * @dev Part of the Governor Bravo's interface: _"Queues a proposal of state succeeded"_.
  80. */
  81. function queue(uint256 proposalId) public virtual;
  82. /**
  83. * @dev Part of the Governor Bravo's interface: _"Executes a queued proposal if eta has passed"_.
  84. */
  85. function execute(uint256 proposalId) public payable virtual;
  86. /**
  87. * @dev Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold.
  88. */
  89. function cancel(uint256 proposalId) public virtual;
  90. /**
  91. * @dev Part of the Governor Bravo's interface: _"Gets actions of a proposal"_.
  92. */
  93. function getActions(uint256 proposalId)
  94. public
  95. view
  96. virtual
  97. returns (
  98. address[] memory targets,
  99. uint256[] memory values,
  100. string[] memory signatures,
  101. bytes[] memory calldatas
  102. );
  103. /**
  104. * @dev Part of the Governor Bravo's interface: _"Gets the receipt for a voter on a given proposal"_.
  105. */
  106. function getReceipt(uint256 proposalId, address voter) public view virtual returns (Receipt memory);
  107. /**
  108. * This empty reserved space is put in place to allow future versions to add new
  109. * variables without shifting down storage in the inheritance chain.
  110. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  111. */
  112. uint256[50] private __gap;
  113. }