37 major breaking releases

new 40.0.0 Apr 4, 2025
39.0.0 Jan 14, 2025
38.0.0 Sep 26, 2024
37.0.0 Jul 18, 2024
0.0.0 Nov 21, 2022

#786 in Magic Beans

Download history 80/week @ 2024-12-16 44/week @ 2024-12-23 13/week @ 2024-12-30 37/week @ 2025-01-06 189/week @ 2025-01-13 129/week @ 2025-01-20 119/week @ 2025-01-27 128/week @ 2025-02-03 95/week @ 2025-02-10 36/week @ 2025-02-17 66/week @ 2025-02-24 38/week @ 2025-03-03 29/week @ 2025-03-10 26/week @ 2025-03-17 54/week @ 2025-03-24 163/week @ 2025-03-31

273 downloads per month
Used in 2 crates

Apache-2.0

2.5MB
48K SLoC

Support code to ease the process of generating bag thresholds.

NOTE: this assume the runtime implements pallet_staking::Config, as it requires an implementation of the traits frame_support::traits::Currency and CurrencyToVote.

The process of adding bags to a runtime requires only four steps.

  1. Update the runtime definition.

    parameter_types!{
         pub const BagThresholds: &'static [u64] = &[];
    }
    
    impl pallet_bags_list::Config for Runtime {
         // <snip>
         type BagThresholds = BagThresholds;
    }
    
  2. Write a little program to generate the definitions. This program exists only to hook together the runtime definitions with the various calculations here. Take a look at utils/frame/generate_bags/node-runtime for an example.

  3. Run that program:

    $ cargo run -p node-runtime-generate-bags -- --total-issuance 1234 --minimum-balance 1
    

output.rs ```

  1. Update the runtime definition.

    + mod output;
    - pub const BagThresholds: &'static [u64] = &[];
    + pub const BagThresholds: &'static [u64] = &output::THRESHOLDS;
    

Dependencies

~23–34MB
~583K SLoC