Skip to content

Commit

Permalink
Document voting counting until casted in GovernorCountingOverridable (#…
Browse files Browse the repository at this point in the history
…5309)

Co-authored-by: Hadrien Croubois <[email protected]>
  • Loading branch information
ernestognw and Amxx authored Nov 22, 2024
1 parent ccb39d2 commit 23f4452
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 23f4452

Please sign in to comment.