Preserve camelCase in GovernorCountingSimple (#3608)

This commit is contained in:
gmhacker.eth
2022-08-10 09:50:23 +01:00
committed by GitHub
parent 85a9bed49e
commit d514cdd26e

View File

@ -57,26 +57,26 @@ abstract contract GovernorCountingSimple is Governor {
uint256 abstainVotes uint256 abstainVotes
) )
{ {
ProposalVote storage proposalvote = _proposalVotes[proposalId]; ProposalVote storage proposalVote = _proposalVotes[proposalId];
return (proposalvote.againstVotes, proposalvote.forVotes, proposalvote.abstainVotes); return (proposalVote.againstVotes, proposalVote.forVotes, proposalVote.abstainVotes);
} }
/** /**
* @dev See {Governor-_quorumReached}. * @dev See {Governor-_quorumReached}.
*/ */
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) { function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalvote = _proposalVotes[proposalId]; ProposalVote storage proposalVote = _proposalVotes[proposalId];
return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes; return quorum(proposalSnapshot(proposalId)) <= proposalVote.forVotes + proposalVote.abstainVotes;
} }
/** /**
* @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes. * @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes.
*/ */
function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) { function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalvote = _proposalVotes[proposalId]; ProposalVote storage proposalVote = _proposalVotes[proposalId];
return proposalvote.forVotes > proposalvote.againstVotes; return proposalVote.forVotes > proposalVote.againstVotes;
} }
/** /**
@ -89,17 +89,17 @@ abstract contract GovernorCountingSimple is Governor {
uint256 weight, uint256 weight,
bytes memory // params bytes memory // params
) internal virtual override { ) internal virtual override {
ProposalVote storage proposalvote = _proposalVotes[proposalId]; ProposalVote storage proposalVote = _proposalVotes[proposalId];
require(!proposalvote.hasVoted[account], "GovernorVotingSimple: vote already cast"); require(!proposalVote.hasVoted[account], "GovernorVotingSimple: vote already cast");
proposalvote.hasVoted[account] = true; proposalVote.hasVoted[account] = true;
if (support == uint8(VoteType.Against)) { if (support == uint8(VoteType.Against)) {
proposalvote.againstVotes += weight; proposalVote.againstVotes += weight;
} else if (support == uint8(VoteType.For)) { } else if (support == uint8(VoteType.For)) {
proposalvote.forVotes += weight; proposalVote.forVotes += weight;
} else if (support == uint8(VoteType.Abstain)) { } else if (support == uint8(VoteType.Abstain)) {
proposalvote.abstainVotes += weight; proposalVote.abstainVotes += weight;
} else { } else {
revert("GovernorVotingSimple: invalid value for enum VoteType"); revert("GovernorVotingSimple: invalid value for enum VoteType");
} }