Skip to content

Commit

Permalink
fix permill->perthousand (#405)
Browse files Browse the repository at this point in the history
* fix permill->perthousand

* fmt
  • Loading branch information
brenzi authored Sep 26, 2024
1 parent 43e099d commit fb16ada
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ pub mod pallet {
#[pallet::constant]
type ProposalLifetime: Get<Self::Moment>;

/// Minimum turnout in permill for a proposal to be considered as passing and entering the
/// `Confirming` state.
/// Minimum turnout in perthousand for a proposal to be considered as passing and entering
/// the `Confirming` state.
#[pallet::constant]
type MinTurnout: Get<u128>;
}
Expand Down Expand Up @@ -556,8 +556,8 @@ pub mod pallet {
let proposal = Self::proposals(proposal_id).ok_or(Error::<T>::InexistentProposal)?;
let electorate = proposal.electorate_size;

let turnout_permill = (tally.turnout * 1000).checked_div(electorate).unwrap_or(0);
if turnout_permill < T::MinTurnout::get() {
let turnout_perthousand = (tally.turnout * 1000).checked_div(electorate).unwrap_or(0);
if turnout_perthousand < T::MinTurnout::get() {
return Ok(false);
}

Expand Down

0 comments on commit fb16ada

Please sign in to comment.