GovernorVotesComp.sol 721 B

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