34 major breaking releases

37.0.0 Jul 18, 2024
36.0.0 Jul 12, 2024
35.0.0 Jun 24, 2024
34.0.0 May 24, 2024
0.0.0 Nov 21, 2022

#9 in #bags

Download history 5/week @ 2024-05-16 110/week @ 2024-05-23 2/week @ 2024-05-30 4/week @ 2024-06-06 2/week @ 2024-06-13 129/week @ 2024-06-20 13/week @ 2024-06-27 96/week @ 2024-07-11 150/week @ 2024-07-18 127/week @ 2024-07-25

2,030 downloads per month
Used in 2 crates

Apache-2.0

2.5MB
44K 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

~21–34MB
~564K SLoC