node_runtime_generate_bags/main.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Make the set of bag thresholds to be used with pallet-bags-list.
19
20use clap::Parser;
21use generate_bags::generate_thresholds;
22use std::path::PathBuf;
23
24#[derive(Debug, Parser)]
25// #[clap(author, version, about)]
26struct Opt {
27 /// How many bags to generate.
28 #[arg(long, default_value_t = 200)]
29 n_bags: usize,
30
31 /// Where to write the output.
32 output: PathBuf,
33
34 /// The total issuance of the currency used to create `VoteWeight`.
35 #[arg(short, long)]
36 total_issuance: u128,
37
38 /// The minimum account balance (i.e. existential deposit) for the currency used to create
39 /// `VoteWeight`.
40 #[arg(short, long)]
41 minimum_balance: u128,
42}
43
44fn main() -> Result<(), std::io::Error> {
45 let Opt { n_bags, output, total_issuance, minimum_balance } = Opt::parse();
46 generate_thresholds::<kitchensink_runtime::Runtime>(
47 n_bags,
48 &output,
49 total_issuance,
50 minimum_balance,
51 )
52}