Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix permill->perthousand #405

Merged
merged 2 commits into from
Sep 26, 2024
Merged
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
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
Loading