@ -27,8 +27,8 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
struct VoteReceipt {
uint8 casted ; / / 0 if vote was not casted . Otherwise : support + 1
bool hasOverriden ;
uint208 overridenWeight ;
bool hasOverridd en ;
uint208 overridd enWeight ;
}
struct ProposalVote {
@ -42,7 +42,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
/ / / @ dev A delegated vote on ` proposalId ` was overridden by ` weight `
event OverrideVoteCast ( address indexed voter , uint256 proposalId , uint8 support , uint256 weight , string reason ) ;
error GovernorAlreadyOverridenVote ( address account ) ;
error GovernorAlreadyOverridd enVote ( address account ) ;
mapping ( uint256 proposalId => ProposalVote ) private _proposalVotes ;
@ -70,7 +70,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
* @ dev Check if an ` account ` has overridden their delegate for a proposal .
* /
function hasVotedOverride ( uint256 proposalId , address account ) public view virtual returns ( bool ) {
return _proposalVotes [ proposalId ] . voteReceipt [ account ] . hasOverriden ;
return _proposalVotes [ proposalId ] . voteReceipt [ account ] . hasOverridd en ;
}
/**
@ -122,7 +122,7 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
revert GovernorAlreadyCastVote ( account ) ;
}
totalWeight -= proposalVote . voteReceipt [ account ] . overridenWeight ;
totalWeight -= proposalVote . voteReceipt [ account ] . overridd enWeight ;
proposalVote . votes [ support ] += totalWeight ;
proposalVote . voteReceipt [ account ] . casted = support + 1 ;
@ -141,26 +141,26 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
revert GovernorInvalidVoteType ( ) ;
}
if ( proposalVote . voteReceipt [ account ] . hasOverriden ) {
revert GovernorAlreadyOverridenVote ( account ) ;
if ( proposalVote . voteReceipt [ account ] . hasOverridd en ) {
revert GovernorAlreadyOverridd enVote ( account ) ;
}
uint256 snapshot = proposalSnapshot ( proposalId ) ;
uint256 overridenWeight = VotesExtended ( address ( token ( ) ) ) . getPastBalanceOf ( account , snapshot ) ;
uint256 overridd enWeight = VotesExtended ( address ( token ( ) ) ) . getPastBalanceOf ( account , snapshot ) ;
address delegate = VotesExtended ( address ( token ( ) ) ) . getPastDelegate ( account , snapshot ) ;
uint8 delegateCasted = proposalVote . voteReceipt [ delegate ] . casted ;
proposalVote . voteReceipt [ account ] . hasOverriden = true ;
proposalVote . votes [ support ] += overridenWeight ;
proposalVote . voteReceipt [ account ] . hasOverridd en = true ;
proposalVote . votes [ support ] += overridd enWeight ;
if ( delegateCasted == 0 ) {
proposalVote . voteReceipt [ delegate ] . overridenWeight += SafeCast . toUint208 ( overridenWeight ) ;
proposalVote . voteReceipt [ delegate ] . overridd enWeight += SafeCast . toUint208 ( overrid denWeight ) ;
} else {
uint8 delegateSupport = delegateCasted - 1 ;
proposalVote . votes [ delegateSupport ] -= overridenWeight ;
emit VoteReduced ( delegate , proposalId , delegateSupport , overridenWeight ) ;
proposalVote . votes [ delegateSupport ] -= overridd enWeight ;
emit VoteReduced ( delegate , proposalId , delegateSupport , overridd enWeight ) ;
}
return overridenWeight ;
return overridd enWeight ;
}
/ / / @ dev Variant of { Governor - _castVote } that deals with vote overrides . Returns the overridden weight .
@ -172,13 +172,13 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
) internal virtual returns ( uint256 ) {
_validateStateBitmap ( proposalId , _encodeStateBitmap ( ProposalState . Active ) ) ;
uint256 overridenWeight = _countOverride ( proposalId , account , support ) ;
uint256 overridd enWeight = _countOverride ( proposalId , account , support ) ;
emit OverrideVoteCast ( account , proposalId , support , overridenWeight , reason ) ;
emit OverrideVoteCast ( account , proposalId , support , overridd enWeight , reason ) ;
_tallyUpdated ( proposalId ) ;
return overridenWeight ;
return overridd enWeight ;
}
/ / / @ dev Public function for casting an override vote . Returns the overridden weight .