11use catalyst_toolbox:: snapshot:: { voting_group:: RepsVotersAssigner , RawSnapshot , Snapshot } ;
22use color_eyre:: Report ;
3+ use fraction:: Fraction ;
34use jcli_lib:: utils:: { output_file:: OutputFile , output_format:: OutputFormat } ;
45use jormungandr_lib:: interfaces:: Value ;
56use std:: fs:: File ;
67use std:: io:: Write ;
78use std:: path:: PathBuf ;
89use structopt:: StructOpt ;
910
10- const DEFAULT_DIRECT_VOTER_GROUP : & str = "voter " ;
11+ const DEFAULT_DIRECT_VOTER_GROUP : & str = "direct " ;
1112const DEFAULT_REPRESENTATIVE_GROUP : & str = "rep" ;
1213
1314/// Process raw registrations into blockchain initials
@@ -19,7 +20,7 @@ pub struct SnapshotCmd {
1920 snapshot : PathBuf ,
2021 /// Registrations voting power threshold for eligibility
2122 #[ structopt( short, long) ]
22- threshold : Value ,
23+ min_stake_threshold : Value ,
2324
2425 /// Voter group to assign direct voters to.
2526 /// If empty, defaults to "voter"
@@ -35,6 +36,10 @@ pub struct SnapshotCmd {
3536 #[ structopt( long) ]
3637 reps_db_api_url : reqwest:: Url ,
3738
39+ /// Voting power cap for each account
40+ #[ structopt( short, long) ]
41+ voting_power_cap : Fraction ,
42+
3843 #[ structopt( flatten) ]
3944 output : OutputFile ,
4045
@@ -52,8 +57,13 @@ impl SnapshotCmd {
5257 . representatives_group
5358 . unwrap_or_else ( || DEFAULT_REPRESENTATIVE_GROUP . into ( ) ) ;
5459 let assigner = RepsVotersAssigner :: new ( direct_voter, representative, self . reps_db_api_url ) ?;
55- let initials =
56- Snapshot :: from_raw_snapshot ( raw_snapshot, self . threshold ) . to_voter_hir ( & assigner) ;
60+ let initials = Snapshot :: from_raw_snapshot (
61+ raw_snapshot,
62+ self . min_stake_threshold ,
63+ self . voting_power_cap ,
64+ & assigner,
65+ ) ?
66+ . to_voter_hir ( ) ;
5767 let mut out_writer = self . output . open ( ) ?;
5868 let content = self
5969 . output_format
0 commit comments