VotesMock.sol 893 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/utils/Votes.sol";
  4. abstract contract VotesMock is Votes {
  5. mapping(address => uint256) private _votingUnits;
  6. function getTotalSupply() public view returns (uint256) {
  7. return _getTotalSupply();
  8. }
  9. function delegate(address account, address newDelegation) public {
  10. return _delegate(account, newDelegation);
  11. }
  12. function _getVotingUnits(address account) internal view override returns (uint256) {
  13. return _votingUnits[account];
  14. }
  15. function _mint(address account, uint256 votes) internal {
  16. _votingUnits[account] += votes;
  17. _transferVotingUnits(address(0), account, votes);
  18. }
  19. function _burn(address account, uint256 votes) internal {
  20. _votingUnits[account] += votes;
  21. _transferVotingUnits(account, address(0), votes);
  22. }
  23. }