diff --git a/src/arg_parser.rs b/src/arg_parser.rs index 47808c8abe70db..96ebe02d1b6807 100644 --- a/src/arg_parser.rs +++ b/src/arg_parser.rs @@ -112,6 +112,14 @@ where .validator(is_valid_pubkey) .help("Stake Account Address"), ) + .arg( + Arg::with_name("sol_for_fees") + .default_value("1.0") + .long("sol-for-fees") + .takes_value(true) + .value_name("SOL_AMOUNT") + .help("Amount of SOL to put in system account to pay for fees"), + ) .arg( Arg::with_name("stake_authority") .long("stake-authority") @@ -177,6 +185,7 @@ fn parse_distribute_stake_args(matches: &ArgMatches<'_>) -> DistributeStakeArgs< transactions_db: value_t_or_exit!(matches, "transactions_db", String), dry_run: matches.is_present("dry_run"), stake_account_address: value_t_or_exit!(matches, "stake_account_address", String), + sol_for_fees: value_t_or_exit!(matches, "sol_for_fees", f64), stake_authority: value_t!(matches, "stake_authority", String).ok(), withdraw_authority: value_t!(matches, "withdraw_authority", String).ok(), fee_payer: value_t!(matches, "fee_payer", String).ok(), diff --git a/src/args.rs b/src/args.rs index 3e1d21055fdd1e..f918535e0f519e 100644 --- a/src/args.rs +++ b/src/args.rs @@ -17,6 +17,7 @@ pub struct DistributeStakeArgs { pub allocations_csv: String, pub transactions_db: String, pub dry_run: bool, + pub sol_for_fees: f64, pub stake_account_address: P, pub stake_authority: Option, pub withdraw_authority: Option, @@ -75,6 +76,7 @@ pub fn resolve_command( &mut wallet_manager, ) .unwrap(), + sol_for_fees: args.sol_for_fees, stake_authority: args.stake_authority.as_ref().map(|key_url| { signer_from_path(&matches, &key_url, "stake authority", &mut wallet_manager) .unwrap() diff --git a/src/tokens.rs b/src/tokens.rs index 6bccd3375c700d..ab9462481408ba 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -168,7 +168,7 @@ fn distribute_stake( let result = if args.dry_run { Ok(Signature::default()) } else { - let system_sol = 1.0; + let system_sol = args.sol_for_fees; let fee_payer_pubkey = args.fee_payer.as_ref().unwrap().pubkey(); let stake_authority = args.stake_authority.as_ref().unwrap().pubkey(); let withdraw_authority = args.withdraw_authority.as_ref().unwrap().pubkey(); @@ -540,6 +540,7 @@ pub fn test_process_distribute_stake_with_client(client: C, sender_ke withdraw_authority: Some(Box::new(withdraw_authority)), fee_payer: Some(Box::new(fee_payer)), dry_run: false, + sol_for_fees: 1.0, allocations_csv, transactions_db: transactions_db.clone(), };