GovernorCompMock.sol 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/GovernorVotesComp.sol";
  6. contract GovernorCompMock is Governor, GovernorVotesComp, GovernorCountingSimple {
  7. uint256 immutable _votingDelay;
  8. uint256 immutable _votingPeriod;
  9. constructor(
  10. string memory name_,
  11. ERC20VotesComp token_,
  12. uint256 votingDelay_,
  13. uint256 votingPeriod_
  14. ) Governor(name_) GovernorVotesComp(token_) {
  15. _votingDelay = votingDelay_;
  16. _votingPeriod = votingPeriod_;
  17. }
  18. function votingDelay() public view override returns (uint256) {
  19. return _votingDelay;
  20. }
  21. function votingPeriod() public view override returns (uint256) {
  22. return _votingPeriod;
  23. }
  24. function quorum(uint256) public pure override returns (uint256) {
  25. return 0;
  26. }
  27. function cancel(
  28. address[] memory targets,
  29. uint256[] memory values,
  30. bytes[] memory calldatas,
  31. bytes32 salt
  32. ) public returns (uint256 proposalId) {
  33. return _cancel(targets, values, calldatas, salt);
  34. }
  35. function getVotes(address account, uint256 blockNumber)
  36. public
  37. view
  38. virtual
  39. override(IGovernor, GovernorVotesComp)
  40. returns (uint256)
  41. {
  42. return super.getVotes(account, blockNumber);
  43. }
  44. }