/// Constructs the `NnsInitPayloads` from the command line options.
Constructs the `NnsInitPayloads` from the command line options.
Constructs the ` NnsInitPayloads ` from the command line options .
fn create_init_payloads(args: &CliArgs) -> NnsInitPayloads {
    let mut init_payloads_builder = NnsInitPayloadsBuilder::new();
    add_registry_content(
        &mut init_payloads_builder,
        args.initial_registry.as_ref(),
        args.registry_local_store_dir.as_ref(),
    );
    if let Some(path) = &args.initial_neurons {
        eprintln!(
            "{}Initializing neurons from CSV file: {:?}",
            LOG_PREFIX, path
        );
        init_payloads_builder.with_neurons_from_csv_file(path);
    } else if let Some(path) = &args.governance_pb_file {
        eprintln!(
            "{}Initializing governance from PB file: {:?}",
            LOG_PREFIX, path
        );
        let governance_pb =
            read_governance_pb_from_file(path).expect("Couldn't decode Governance protobuf.");
        init_payloads_builder
            .governance
            .with_governance_proto(governance_pb);
    } else {
        eprintln!(
            "{}Initial neuron CSV or PB path not specified, initializing with test neurons",
            LOG_PREFIX
        );
        init_payloads_builder
            // We need some neurons, because we need to vote on some proposals to create subnets.
            .with_test_neurons();
    }
    let mut test_ledger_accounts = vec![];
    for principal in &args.initialize_ledger_with_test_accounts_for_principals {
        test_ledger_accounts.push(ledger_canister::AccountIdentifier::new(*principal, None));
    }
    for account_hex in &args.initialize_ledger_with_test_accounts {
        test_ledger_accounts.push(
            ledger_canister::AccountIdentifier::from_hex(account_hex)
                .expect("failed to parse ledger account identifier"),
        );
    }
    for account in test_ledger_accounts.into_iter() {
        init_payloads_builder.ledger.initial_values.insert(
            account,
            ledger_canister::Tokens::from_tokens(10000).expect("Couldn't create icpts"),
        );
        eprintln!(
            "{}Initializing with test ledger account: {}",
            LOG_PREFIX,
            account.to_hex(),
        );
    }
    if args.initialize_with_gtc_neurons {
        init_payloads_builder.genesis_token.sr_months_to_release =
            args.months_to_release_seed_round_gtc_neurons;
        init_payloads_builder.genesis_token.ect_months_to_release =
            args.months_to_release_ect_gtc_neurons;
        init_payloads_builder.with_gtc_neurons();
    }
    init_payloads_builder
        .genesis_token
        .donate_account_recipient_neuron_id = Some(GTC_DONATE_ACCOUNT_RECIPIENT_NEURON_ID);
    init_payloads_builder
        .genesis_token
        .forward_whitelisted_unclaimed_accounts_recipient_neuron_id =
        Some(GTC_FORWARD_ALL_UNCLAIMED_ACCOUNTS_RECIPIENT_NEURON_ID);
    println!("{}Initialized governance.", LOG_PREFIX);
    init_payloads_builder.build()
}
fn create_init_payloads ( args : & CliArgs ) -> NnsInitPayloads { let mut init_payloads_builder = NnsInitPayloadsBuilder :: new ( ) ; add_registry_content ( & mut init_payloads_builder , args . initial_registry . as_ref ( ) , args . registry_local_store_dir . as_ref ( ) , ) ; if let Some ( path ) = & args . initial_neurons { eprintln ! ( " " LOG_PREFIX path ) ; init_payloads_builder . with_neurons_from_csv_file ( path ) ; } else if let Some ( path ) = & args . governance_pb_file { eprintln ! ( " " LOG_PREFIX path ) ; let governance_pb = read_governance_pb_from_file ( path ) . expect ( " " ) ; init_payloads_builder . governance . with_governance_proto ( governance_pb ) ; } else { eprintln ! ( " " LOG_PREFIX ) ; init_payloads_builder // We need some neurons, because we need to vote on some proposals to create subnets. . with_test_neurons ( ) ; } let mut test_ledger_accounts = vec ! [ ] ; for principal in & args . initialize_ledger_with_test_accounts_for_principals { test_ledger_accounts . push ( ledger_canister :: AccountIdentifier :: new ( * principal , None ) ) ; } for account_hex in & args . initialize_ledger_with_test_accounts { test_ledger_accounts . push ( ledger_canister :: AccountIdentifier :: from_hex ( account_hex ) . expect ( " " ) , ) ; } for account in test_ledger_accounts . into_iter ( ) { init_payloads_builder . ledger . initial_values . insert ( account , ledger_canister :: Tokens :: from_tokens ( 10000 ) . expect ( " " ) , ) ; eprintln ! ( " " LOG_PREFIX account to_hex ( ) ) ; } if args . initialize_with_gtc_neurons { init_payloads_builder . genesis_token . sr_months_to_release = args . months_to_release_seed_round_gtc_neurons ; init_payloads_builder . genesis_token . ect_months_to_release = args . months_to_release_ect_gtc_neurons ; init_payloads_builder . with_gtc_neurons ( ) ; } init_payloads_builder . genesis_token . donate_account_recipient_neuron_id = Some ( GTC_DONATE_ACCOUNT_RECIPIENT_NEURON_ID ) ; init_payloads_builder . genesis_token . forward_whitelisted_unclaimed_accounts_recipient_neuron_id = Some ( GTC_FORWARD_ALL_UNCLAIMED_ACCOUNTS_RECIPIENT_NEURON_ID ) ; println ! ( " " LOG_PREFIX ) ; init_payloads_builder . build ( ) }
Constructs the `NnsInitPayloads` from the command line options.
Constructs the ` NnsInitPayloads ` from the command line options .
args
&CliArgs