GovernorMock.sol 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/extensions/GovernorProposalThreshold.sol";
  4. import "../governance/extensions/GovernorSettings.sol";
  5. import "../governance/extensions/GovernorCountingSimple.sol";
  6. import "../governance/extensions/GovernorVotesQuorumFraction.sol";
  7. contract GovernorMock is
  8. GovernorProposalThreshold,
  9. GovernorSettings,
  10. GovernorVotesQuorumFraction,
  11. GovernorCountingSimple
  12. {
  13. constructor(
  14. string memory name_,
  15. ERC20Votes token_,
  16. uint256 votingDelay_,
  17. uint256 votingPeriod_,
  18. uint256 quorumNumerator_
  19. )
  20. Governor(name_)
  21. GovernorSettings(votingDelay_, votingPeriod_, 0)
  22. GovernorVotes(token_)
  23. GovernorVotesQuorumFraction(quorumNumerator_)
  24. {}
  25. function cancel(
  26. address[] memory targets,
  27. uint256[] memory values,
  28. bytes[] memory calldatas,
  29. bytes32 salt
  30. ) public returns (uint256 proposalId) {
  31. return _cancel(targets, values, calldatas, salt);
  32. }
  33. function getVotes(address account, uint256 blockNumber)
  34. public
  35. view
  36. virtual
  37. override(IGovernor, GovernorVotes)
  38. returns (uint256)
  39. {
  40. return super.getVotes(account, blockNumber);
  41. }
  42. function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
  43. return super.proposalThreshold();
  44. }
  45. function propose(
  46. address[] memory targets,
  47. uint256[] memory values,
  48. bytes[] memory calldatas,
  49. string memory description
  50. ) public virtual override(Governor, GovernorProposalThreshold) returns (uint256) {
  51. return super.propose(targets, values, calldatas, description);
  52. }
  53. }