MyGovernor1Upgradeable.sol 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.2;
  3. import "../../governance/GovernorUpgradeable.sol";
  4. import "../../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
  5. import "../../governance/extensions/GovernorVotesUpgradeable.sol";
  6. import "../../governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol";
  7. import "../../governance/extensions/GovernorTimelockControlUpgradeable.sol";
  8. import "../../proxy/utils/Initializable.sol";
  9. contract MyGovernor1Upgradeable is
  10. Initializable, GovernorUpgradeable,
  11. GovernorTimelockControlUpgradeable,
  12. GovernorVotesUpgradeable,
  13. GovernorVotesQuorumFractionUpgradeable,
  14. GovernorCountingSimpleUpgradeable
  15. {
  16. function __MyGovernor1_init(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {
  17. __Context_init_unchained();
  18. __ERC165_init_unchained();
  19. __EIP712_init_unchained("MyGovernor", version());
  20. __IGovernor_init_unchained();
  21. __IGovernorTimelock_init_unchained();
  22. __Governor_init_unchained("MyGovernor");
  23. __GovernorTimelockControl_init_unchained(_timelock);
  24. __GovernorVotes_init_unchained(_token);
  25. __GovernorVotesQuorumFraction_init_unchained(4);
  26. __GovernorCountingSimple_init_unchained();
  27. __MyGovernor1_init_unchained(_token, _timelock);
  28. }
  29. function __MyGovernor1_init_unchained(IVotesUpgradeable, TimelockControllerUpgradeable) internal onlyInitializing {}
  30. function votingDelay() public pure override returns (uint256) {
  31. return 1; // 1 block
  32. }
  33. function votingPeriod() public pure override returns (uint256) {
  34. return 45818; // 1 week
  35. }
  36. // The following functions are overrides required by Solidity.
  37. function quorum(uint256 blockNumber)
  38. public
  39. view
  40. override(IGovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable)
  41. returns (uint256)
  42. {
  43. return super.quorum(blockNumber);
  44. }
  45. function getVotes(address account, uint256 blockNumber)
  46. public
  47. view
  48. override(IGovernorUpgradeable, GovernorVotesUpgradeable)
  49. returns (uint256)
  50. {
  51. return super.getVotes(account, blockNumber);
  52. }
  53. function state(uint256 proposalId) public view override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (ProposalState) {
  54. return super.state(proposalId);
  55. }
  56. function propose(
  57. address[] memory targets,
  58. uint256[] memory values,
  59. bytes[] memory calldatas,
  60. string memory description
  61. ) public override(GovernorUpgradeable, IGovernorUpgradeable) returns (uint256) {
  62. return super.propose(targets, values, calldatas, description);
  63. }
  64. function _execute(
  65. uint256 proposalId,
  66. address[] memory targets,
  67. uint256[] memory values,
  68. bytes[] memory calldatas,
  69. bytes32 descriptionHash
  70. ) internal override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) {
  71. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  72. }
  73. function _cancel(
  74. address[] memory targets,
  75. uint256[] memory values,
  76. bytes[] memory calldatas,
  77. bytes32 descriptionHash
  78. ) internal override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (uint256) {
  79. return super._cancel(targets, values, calldatas, descriptionHash);
  80. }
  81. function _executor() internal view override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (address) {
  82. return super._executor();
  83. }
  84. function supportsInterface(bytes4 interfaceId)
  85. public
  86. view
  87. override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
  88. returns (bool)
  89. {
  90. return super.supportsInterface(interfaceId);
  91. }
  92. uint256[50] private __gap;
  93. }