GovernorCompMockUpgradeable.sol 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
  4. import "../governance/extensions/GovernorVotesCompUpgradeable.sol";
  5. import "../proxy/utils/Initializable.sol";
  6. contract GovernorCompMockUpgradeable is Initializable, GovernorVotesCompUpgradeable, GovernorCountingSimpleUpgradeable {
  7. function __GovernorCompMock_init(string memory name_, ERC20VotesCompUpgradeable token_) internal onlyInitializing {
  8. __EIP712_init_unchained(name_, version());
  9. __Governor_init_unchained(name_);
  10. __GovernorVotesComp_init_unchained(token_);
  11. }
  12. function __GovernorCompMock_init_unchained(string memory, ERC20VotesCompUpgradeable) internal onlyInitializing {}
  13. function quorum(uint256) public pure override returns (uint256) {
  14. return 0;
  15. }
  16. function votingDelay() public pure override returns (uint256) {
  17. return 4;
  18. }
  19. function votingPeriod() public pure override returns (uint256) {
  20. return 16;
  21. }
  22. function cancel(
  23. address[] memory targets,
  24. uint256[] memory values,
  25. bytes[] memory calldatas,
  26. bytes32 salt
  27. ) public returns (uint256 proposalId) {
  28. return _cancel(targets, values, calldatas, salt);
  29. }
  30. function getVotes(address account, uint256 blockNumber)
  31. public
  32. view
  33. virtual
  34. override(IGovernorUpgradeable, GovernorVotesCompUpgradeable)
  35. returns (uint256)
  36. {
  37. return super.getVotes(account, blockNumber);
  38. }
  39. /**
  40. * @dev This empty reserved space is put in place to allow future versions to add new
  41. * variables without shifting down storage in the inheritance chain.
  42. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  43. */
  44. uint256[50] private __gap;
  45. }