Skip to content

Commit

Permalink
fix threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavcpawar committed Aug 14, 2023
1 parent 520faea commit 6193074
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion utils/frame/generate-bags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ pub fn generate_thresholds<T: pallet_staking::Config>(
writeln!(buf, "//! Autogenerated bag thresholds.")?;
writeln!(buf, "//!")?;
writeln!(buf, "//! Generated on {}", now.to_rfc3339())?;
writeln!(buf, "//! Arguments")?;
writeln!(buf, "//! Total issuance: {}", &total_issuance)?;
writeln!(buf, "//! Minimum balance: {}", &minimum_balance)?;

writeln!(
buf,
"//! for the {} runtime.",
Expand Down Expand Up @@ -234,6 +238,17 @@ pub fn generate_thresholds<T: pallet_staking::Config>(
writeln!(buf)?;
writeln!(buf, "/// Upper thresholds delimiting the bag list.")?;
writeln!(buf, "pub const THRESHOLDS: [u64; {}] = [", thresholds.len())?;
for threshold in &thresholds {
num_buf.write_formatted(threshold, &format);
// u64::MAX, with spacers every 3 digits, is 26 characters wide
writeln!(buf, " {:>26},", num_buf.as_str())?;
}
writeln!(buf, "];")?;

// thresholds balance
writeln!(buf)?;
writeln!(buf, "/// Upper thresholds delimiting the bag list.")?;
writeln!(buf, "pub const THRESHOLDS_BALANCES: [u128; {}] = [", thresholds.len())?;
for threshold in thresholds {
num_buf.write_formatted(&threshold, &format);
// u64::MAX, with spacers every 3 digits, is 26 characters wide
Expand All @@ -242,4 +257,4 @@ pub fn generate_thresholds<T: pallet_staking::Config>(
writeln!(buf, "];")?;

Ok(())
}
}

0 comments on commit 6193074

Please sign in to comment.