IVotes.sol 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)
  3. pragma solidity ^0.8.0;
  4. /**
  5. * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
  6. *
  7. * _Available since v4.5._
  8. */
  9. interface IVotes {
  10. /**
  11. * @dev Emitted when an account changes their delegate.
  12. */
  13. event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
  14. /**
  15. * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
  16. */
  17. event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
  18. /**
  19. * @dev Returns the current amount of votes that `account` has.
  20. */
  21. function getVotes(address account) external view returns (uint256);
  22. /**
  23. * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
  24. * configured to use block numbers, this will return the value at the end of the corresponding block.
  25. */
  26. function getPastVotes(address account, uint256 timepoint) external view returns (uint256);
  27. /**
  28. * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
  29. * configured to use block numbers, this will return the value at the end of the corresponding block.
  30. *
  31. * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
  32. * Votes that have not been delegated are still part of total supply, even though they would not participate in a
  33. * vote.
  34. */
  35. function getPastTotalSupply(uint256 timepoint) external view returns (uint256);
  36. /**
  37. * @dev Returns the delegate that `account` has chosen.
  38. */
  39. function delegates(address account) external view returns (address);
  40. /**
  41. * @dev Delegates votes from the sender to `delegatee`.
  42. */
  43. function delegate(address delegatee) external;
  44. /**
  45. * @dev Delegates votes from signer to `delegatee`.
  46. */
  47. function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
  48. }