GovernorCompMock.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. receive() external payable {}
  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 quorum(uint256) public pure override returns (uint256) {
  26. return 0;
  27. }
  28. function cancel(
  29. address[] memory targets,
  30. uint256[] memory values,
  31. bytes[] memory calldatas,
  32. bytes32 salt
  33. ) public returns (uint256 proposalId) {
  34. return _cancel(targets, values, calldatas, salt);
  35. }
  36. function getVotes(address account, uint256 blockNumber)
  37. public
  38. view
  39. virtual
  40. override(IGovernor, GovernorVotesComp)
  41. returns (uint256)
  42. {
  43. return super.getVotes(account, blockNumber);
  44. }
  45. }