Skip to content

Commit

Permalink
Add a virtual method specifying default additional voting params
Browse files Browse the repository at this point in the history
  • Loading branch information
apbendi committed Jan 17, 2022
1 parent abf9e35 commit f41a8b6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions contracts/governance/Governor.sol
Expand Up @@ -192,6 +192,16 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
bytes memory params
) internal virtual;

/**
* @dev Default additional encoded parameters used by castVote methods that don't include them
*
* Note: Should be overriden by specific implementations to use an appropriate value, the
* meaning of the additional params, in the context of that implementation
*/
function _defaultParams() internal view virtual returns (bytes memory) {
return "";
}

/**
* @dev See {IGovernor-propose}.
*/
Expand Down Expand Up @@ -309,7 +319,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
*/
function castVote(uint256 proposalId, uint8 support) public virtual override returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, "", "");
return _castVote(proposalId, voter, support, "", _defaultParams());
}

/**
Expand All @@ -320,7 +330,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
uint8 support,
string calldata reason
) public virtual override returns (uint256) {
return castVoteWithReasonAndParams(proposalId, support, reason, "");
return castVoteWithReasonAndParams(proposalId, support, reason, _defaultParams());
}

/**
Expand Down Expand Up @@ -352,7 +362,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
r,
s
);
return _castVote(proposalId, voter, support, "", "");
return _castVote(proposalId, voter, support, "", _defaultParams());
}

/**
Expand Down

0 comments on commit f41a8b6

Please sign in to comment.