GovernorMock.sol 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/Governor.sol";
  4. import "../governance/extensions/GovernorCountingSimple.sol";
  5. import "../governance/extensions/GovernorVotesQuorumFraction.sol";
  6. contract GovernorMock is Governor, GovernorVotesQuorumFraction, GovernorCountingSimple {
  7. uint256 immutable _votingDelay;
  8. uint256 immutable _votingPeriod;
  9. constructor(
  10. string memory name_,
  11. ERC20Votes token_,
  12. uint256 votingDelay_,
  13. uint256 votingPeriod_,
  14. uint256 quorumNumerator_
  15. ) Governor(name_) GovernorVotes(token_) GovernorVotesQuorumFraction(quorumNumerator_) {
  16. _votingDelay = votingDelay_;
  17. _votingPeriod = votingPeriod_;
  18. }
  19. function votingDelay() public view override returns (uint256) {
  20. return _votingDelay;
  21. }
  22. function votingPeriod() public view override returns (uint256) {
  23. return _votingPeriod;
  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. }