GovernorProposalThreshold.sol 1021 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../Governor.sol";
  4. /**
  5. * @dev Extension of {Governor} for proposal restriction to token holders with a minimum balance.
  6. *
  7. * _Available since v4.3._
  8. */
  9. abstract contract GovernorProposalThreshold is Governor {
  10. /**
  11. * @dev See {IGovernor-propose}.
  12. */
  13. function propose(
  14. address[] memory targets,
  15. uint256[] memory values,
  16. bytes[] memory calldatas,
  17. string memory description
  18. ) public virtual override returns (uint256) {
  19. require(
  20. getVotes(msg.sender, block.number - 1) >= proposalThreshold(),
  21. "GovernorCompatibilityBravo: proposer votes below proposal threshold"
  22. );
  23. return super.propose(targets, values, calldatas, description);
  24. }
  25. /**
  26. * @dev Part of the Governor Bravo's interface: _"The number of votes required in order for a voter to become a proposer"_.
  27. */
  28. function proposalThreshold() public view virtual returns (uint256);
  29. }