GovernorPreventLateQuorumMockUpgradeable.sol 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorPreventLateQuorumUpgradeable.sol";
  4. import "../governance/extensions/GovernorSettingsUpgradeable.sol";
  5. import "../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
  6. import "../governance/extensions/GovernorVotesUpgradeable.sol";
  7. import "../proxy/utils/Initializable.sol";
  8. contract GovernorPreventLateQuorumMockUpgradeable is
  9. Initializable, GovernorSettingsUpgradeable,
  10. GovernorVotesUpgradeable,
  11. GovernorCountingSimpleUpgradeable,
  12. GovernorPreventLateQuorumUpgradeable
  13. {
  14. uint256 private _quorum;
  15. function __GovernorPreventLateQuorumMock_init(
  16. string memory name_,
  17. IVotesUpgradeable token_,
  18. uint256 votingDelay_,
  19. uint256 votingPeriod_,
  20. uint256 quorum_,
  21. uint64 voteExtension_
  22. ) internal onlyInitializing {
  23. __EIP712_init_unchained(name_, version());
  24. __Governor_init_unchained(name_);
  25. __GovernorSettings_init_unchained(votingDelay_, votingPeriod_, 0);
  26. __GovernorVotes_init_unchained(token_);
  27. __GovernorPreventLateQuorum_init_unchained(voteExtension_);
  28. __GovernorPreventLateQuorumMock_init_unchained(name_, token_, votingDelay_, votingPeriod_, quorum_, voteExtension_);
  29. }
  30. function __GovernorPreventLateQuorumMock_init_unchained(
  31. string memory,
  32. IVotesUpgradeable,
  33. uint256,
  34. uint256,
  35. uint256 quorum_,
  36. uint64
  37. ) internal onlyInitializing {
  38. _quorum = quorum_;
  39. }
  40. function quorum(uint256) public view virtual override returns (uint256) {
  41. return _quorum;
  42. }
  43. function proposalDeadline(uint256 proposalId)
  44. public
  45. view
  46. virtual
  47. override(GovernorUpgradeable, GovernorPreventLateQuorumUpgradeable)
  48. returns (uint256)
  49. {
  50. return super.proposalDeadline(proposalId);
  51. }
  52. function proposalThreshold() public view virtual override(GovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
  53. return super.proposalThreshold();
  54. }
  55. function _castVote(
  56. uint256 proposalId,
  57. address account,
  58. uint8 support,
  59. string memory reason
  60. ) internal virtual override(GovernorUpgradeable, GovernorPreventLateQuorumUpgradeable) returns (uint256) {
  61. return super._castVote(proposalId, account, support, reason);
  62. }
  63. /**
  64. * @dev This empty reserved space is put in place to allow future versions to add new
  65. * variables without shifting down storage in the inheritance chain.
  66. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  67. */
  68. uint256[49] private __gap;
  69. }