-
Notifications
You must be signed in to change notification settings - Fork 6
/
VotingModule.sol
64 lines (47 loc) · 2.29 KB
/
VotingModule.sol
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
abstract contract VotingModule {
/*//////////////////////////////////////////////////////////////
IMMUTABLE STORAGE
//////////////////////////////////////////////////////////////*/
address immutable governor;
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error NotGovernor();
error ExistingProposal();
error InvalidParams();
error AlreadyVoted();
/*//////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////*/
function _onlyGovernor() internal view {
if (msg.sender != governor) revert NotGovernor();
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(address _governor) {
governor = _governor;
}
/*//////////////////////////////////////////////////////////////
WRITE FUNCTIONS
//////////////////////////////////////////////////////////////*/
function propose(uint256 proposalId, bytes memory proposalData, bytes32 descriptionHash) external virtual;
function _countVote(uint256 proposalId, address account, uint8 support, uint256 weight, bytes memory params)
external
virtual;
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
function _formatExecuteParams(uint256 proposalId, bytes memory proposalData)
external
virtual
returns (address[] memory targets, uint256[] memory values, bytes[] memory calldatas);
function _voteSucceeded(uint256 /* proposalId */ ) external view virtual returns (bool) {
return true;
}
function COUNTING_MODE() external pure virtual returns (string memory);
function PROPOSAL_DATA_ENCODING() external pure virtual returns (string memory);
function VOTE_PARAMS_ENCODING() external pure virtual returns (string memory);
}