VotesMock.sol 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../governance/utils/Votes.sol";
  4. contract VotesMock is Votes {
  5. mapping(address => uint256) private _votingUnits;
  6. constructor(string memory name) EIP712(name, "1") {}
  7. function getTotalSupply() public view returns (uint256) {
  8. return _getTotalSupply();
  9. }
  10. function delegate(address account, address newDelegation) public {
  11. return _delegate(account, newDelegation);
  12. }
  13. function _getVotingUnits(address account) internal view override returns (uint256) {
  14. return _votingUnits[account];
  15. }
  16. function mint(address account, uint256 votes) external {
  17. _votingUnits[account] += votes;
  18. _transferVotingUnits(address(0), account, votes);
  19. }
  20. function burn(address account, uint256 votes) external {
  21. _votingUnits[account] += votes;
  22. _transferVotingUnits(account, address(0), votes);
  23. }
  24. function getChainId() external view returns (uint256) {
  25. return block.chainid;
  26. }
  27. }