Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document voting counting until casted in GovernorCountingOverridable #5309

Merged
merged 8 commits into from
Nov 22, 2024
13 changes: 11 additions & 2 deletions contracts/governance/extensions/GovernorCountingOverridable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ abstract contract GovernorCountingOverridable is GovernorVotes {

/**
* @dev See {IGovernor-hasVoted}.
*
* NOTE: Calling {castVote} (or similar) casts a vote using the voting power that is delegated to the voter.
* Conversely, calling {castOverrideVote} (or similar) uses the voting power of the account itself, from its asset
* balances. Casting an "override vote" does not count as voting and won't be reflected by this getter. Consider
* using {hasVotedOverride} to check if an account has casted an "override vote" for a given proposal id.
*/
function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) {
return _proposalVotes[proposalId].voteReceipt[account].casted != 0;
Expand Down Expand Up @@ -120,7 +125,11 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
return totalWeight;
}

/// @dev Variant of {Governor-_countVote} that deals with vote overrides.
/**
* @dev Variant of {Governor-_countVote} that deals with vote overrides.
*
* NOTE: See {hasVoted} for more details about the difference between {castVote} and {castOverrideVote}.
*/
function _countOverride(uint256 proposalId, address account, uint8 support) internal virtual returns (uint256) {
ProposalVote storage proposalVote = _proposalVotes[proposalId];

Expand Down Expand Up @@ -150,7 +159,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
return overridenWeight;
}

/// @dev variant of {Governor-_castVote} that deals with vote overrides.
/// @dev Variant of {Governor-_castVote} that deals with vote overrides.
function _castOverride(
uint256 proposalId,
address account,
Expand Down