Skip to content

Commit

Permalink
fix: adapt wrong majority voting status handling
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik authored Nov 23, 2023
1 parent 024005a commit d789045
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions modules/client/src/addresslistVoting/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,18 @@ export function computeProposalStatus(
if (startDate >= now) {
return ProposalStatus.PENDING;
}
// The proposal is not executed and the start date is in the past
// So we must check if the proposal reached the approval threshold
// If it reached the approval threshold and it's a signaling proposal
// the status becomes SUCCEEDED
// If it reached the approval threshold and it's not a signaling proposal
// the status becomes SUCCEEDED if the end date is in the past or if the
// proposal is early executable
if (proposal.approvalReached) {
if(proposal.isSignaling) {
return ProposalStatus.SUCCEEDED;
} else {
if (now >= endDate || proposal.earlyExecutable) {
return ProposalStatus.SUCCEEDED;
}
}
// The proposal is not executed and the start date is in the past.
// Accordingly, we check if the proposal reached enough approval
// (i.e., that the supportThreshold and minParticipation criteria are both met).
// If the approval is reached and the vote has ended (end date is in the past) it has succeded.
// This applies to normal mode and vote replacement mode.
if (proposal.approvalReached && endDate <= now) {
return ProposalStatus.SUCCEEDED;
}
// In early exeuction mode, we calculate if subsequent voting can change the result of the vote.
// If not, the proposal is early executable and is therefore succeeded as well.
if(proposal.earlyExecutable){
return ProposalStatus.SUCCEEDED;
}
// The proposal is not executed and the start date is in the past
// and the approval threshold is not reached
Expand Down

0 comments on commit d789045

Please sign in to comment.