Skip to content

Commit

Permalink
fix two third over two third nay
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Fraccaroli committed Jan 22, 2024
1 parent 60bce05 commit 8abb1a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/governance/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ impl ProposalResult {
+ self.total_abstain_power
>= self.total_voting_power.mul_ceil(Dec::two() / 3);

let at_least_two_thirds_voted_nay =
self.total_nay_power.mul_ceil(Dec::two() / 3)
>= (self.total_yay_power + self.total_nay_power);
let at_least_two_thirds_voted_nay = self.total_nay_power
>= (self.total_yay_power + self.total_nay_power)
.mul_ceil(Dec::two() / 3);

at_least_two_third_voted && at_least_two_thirds_voted_nay
}
Expand Down Expand Up @@ -1345,6 +1345,8 @@ mod test {
token::Amount::zero(),
"abstain"
);

assert!(proposal_result.two_thirds_nay_over_two_thirds_total())
}

#[test]
Expand Down Expand Up @@ -1399,5 +1401,7 @@ mod test {
token::Amount::zero(),
"abstain"
);

assert!(!proposal_result.two_thirds_nay_over_two_thirds_total())
}
}

0 comments on commit 8abb1a5

Please sign in to comment.