Skip to content

Commit 23f4452

Browse files
ernestognwAmxx
andauthored
Document voting counting until casted in GovernorCountingOverridable (#5309)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
1 parent ccb39d2 commit 23f4452

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

contracts/governance/extensions/GovernorCountingOverridable.sol

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
5252

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

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

@@ -150,7 +159,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
150159
return overridenWeight;
151160
}
152161

153-
/// @dev variant of {Governor-_castVote} that deals with vote overrides.
162+
/// @dev Variant of {Governor-_castVote} that deals with vote overrides.
154163
function _castOverride(
155164
uint256 proposalId,
156165
address account,

0 commit comments

Comments
 (0)