Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ abstract contract GovernorCountingOverridable is GovernorVotes {

error GovernorAlreadyOverriddenVote(address account);

error GovernorInsufficientDelegateVotes(uint256 available, uint256 required);

mapping(uint256 proposalId => ProposalVote) private _proposalVotes;

/// @inheritdoc IGovernor
Expand Down Expand Up @@ -153,7 +155,11 @@ abstract contract GovernorCountingOverridable is GovernorVotes {
proposalVote.voteReceipt[delegate].overriddenWeight += SafeCast.toUint208(overriddenWeight);
} else {
uint8 delegateSupport = delegateCasted - 1;
proposalVote.votes[delegateSupport] -= overriddenWeight;
uint256 currentVotes = proposalVote.votes[delegateSupport];
if (currentVotes < overriddenWeight) {
revert GovernorInsufficientDelegateVotes(currentVotes, overriddenWeight);
}
proposalVote.votes[delegateSupport] = currentVotes - overriddenWeight;
emit VoteReduced(delegate, proposalId, delegateSupport, overriddenWeight);
}

Expand Down
Loading