GovernorVotesComp.sol 800 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotesComp.sol)
  3. pragma solidity ^0.8.0;
  4. import "../Governor.sol";
  5. import "../../token/ERC20/extensions/ERC20VotesComp.sol";
  6. /**
  7. * @dev Extension of {Governor} for voting weight extraction from a Comp token.
  8. *
  9. * _Available since v4.3._
  10. */
  11. abstract contract GovernorVotesComp is Governor {
  12. ERC20VotesComp public immutable token;
  13. constructor(ERC20VotesComp token_) {
  14. token = token_;
  15. }
  16. /**
  17. * Read the voting weight from the token's built in snapshot mechanism (see {IGovernor-getVotes}).
  18. */
  19. function getVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {
  20. return token.getPriorVotes(account, blockNumber);
  21. }
  22. }