forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathVotesMock.sol
More file actions
42 lines (32 loc) · 1.22 KB
/
Copy pathVotesMock.sol
File metadata and controls
42 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Votes} from "../governance/utils/Votes.sol";
abstract contract VotesMock is Votes {
mapping(address voter => uint256) private _votingUnits;
function getTotalSupply() public view returns (uint256) {
return _getTotalSupply();
}
function delegate(address account, address newDelegation) public {
return _delegate(account, newDelegation);
}
function _getVotingUnits(address account) internal view override returns (uint256) {
return _votingUnits[account];
}
function _mint(address account, uint256 votes) internal {
_votingUnits[account] += votes;
_transferVotingUnits(address(0), account, votes);
}
function _burn(address account, uint256 votes) internal {
_votingUnits[account] += votes;
_transferVotingUnits(account, address(0), votes);
}
}
abstract contract VotesTimestampMock is VotesMock {
function clock() public view override returns (uint48) {
return uint48(block.timestamp);
}
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual override returns (string memory) {
return "mode=timestamp";
}
}