2727 std:: { rc:: Rc , sync:: Arc } ,
2828} ;
2929
30- #[ allow( deprecated) ]
31- use spl_single_pool:: find_default_deposit_account_address;
32-
3330mod config;
3431use config:: * ;
3532
@@ -93,9 +90,6 @@ impl Command {
9390 Command :: Withdraw ( command_config) => {
9491 command_withdraw ( config, command_config, matches, wallet_manager) . await
9592 }
96- Command :: CreateDefaultStake ( command_config) => {
97- command_create_stake ( config, command_config) . await
98- }
9993 Command :: Display ( command_config) => command_display ( config, command_config) . await ,
10094 }
10195 }
@@ -218,6 +212,7 @@ async fn command_deposit(
218212) -> CommandResult {
219213 let payer = config. fee_payer ( ) ?;
220214 let owner = config. default_signer ( ) ?;
215+ let stake_account_address = command_config. stake_account_address ;
221216 let stake_authority = command_config
222217 . stake_withdraw_authority
223218 . and_then ( |source| {
@@ -232,34 +227,16 @@ async fn command_deposit(
232227
233228 let current_epoch = config. rpc_client . get_epoch_info ( ) . await ?. epoch ;
234229
235- // the cli invocation for this is conceptually simple, but a bit tricky
236- // the user can provide pool or vote and let the cli infer the stake account
237- // address but they can also provide pool or vote with the stake account, as
238- // a safety check first we want to get the pool address if they provided a
239- // pool or vote address
230+ // we originally accepted this because there was the notion of a "canonical"
231+ // stake account keyed off each wallet/pool combination. now we just derive
232+ // the pool address from the stake account delegation, but we still allow
233+ // the pool or vote address to be supplied for optional validation
240234 let provided_pool_address = command_config. pool_address . or_else ( || {
241235 command_config
242236 . vote_account_address
243237 . map ( |address| find_pool_address ( & spl_single_pool:: id ( ) , & address) )
244238 } ) ;
245239
246- // from there we can determine the stake account address
247- let stake_account_address = if let Some ( stake_account_address) =
248- command_config. stake_account_address
249- {
250- stake_account_address
251- } else if let Some ( pool_address) = provided_pool_address {
252- assert ! ( command_config. default_stake_account) ;
253- eprintln_display (
254- config,
255- "WARNING: This flag is DEPRECATED and will be removed in a future release." . to_string ( ) ,
256- ) ;
257- #[ allow( deprecated) ]
258- find_default_deposit_account_address ( & pool_address, & stake_authority. pubkey ( ) )
259- } else {
260- unreachable ! ( )
261- } ;
262-
263240 // now we validate the stake account and definitively resolve the pool address
264241 let ( pool_address, user_stake_active) = if let Some ( ( meta, stake) ) =
265242 quarantine:: get_stake_info ( config, & stake_account_address) . await ?
@@ -694,86 +671,6 @@ async fn command_update_metadata(
694671 ) )
695672}
696673
697- // create default stake account
698- async fn command_create_stake ( config : & Config , command_config : CreateStakeCli ) -> CommandResult {
699- eprintln_display (
700- config,
701- "WARNING: This command is DEPRECATED and will be removed in a future release." . to_string ( ) ,
702- ) ;
703-
704- let payer = config. fee_payer ( ) ?;
705- let owner = config. default_signer ( ) ?;
706- let stake_authority_address = command_config
707- . stake_authority_address
708- . unwrap_or_else ( || owner. pubkey ( ) ) ;
709-
710- let pool_address = pool_address_from_args (
711- command_config. pool_address ,
712- command_config. vote_account_address ,
713- ) ;
714-
715- #[ allow( deprecated) ]
716- let stake_account_address =
717- find_default_deposit_account_address ( & pool_address, & stake_authority_address) ;
718-
719- println_display (
720- config,
721- format ! ( "Creating default stake account for pool {}\n " , pool_address) ,
722- ) ;
723-
724- let vote_account_address = if let Some ( vote_account_address) =
725- command_config. vote_account_address
726- {
727- vote_account_address
728- } else if let Ok ( vote_account_address) = get_vote_address_from_pool ( config, pool_address) . await
729- {
730- vote_account_address
731- } else {
732- return Err ( format ! (
733- "Cannot determine vote account address from provided pool address {}" ,
734- pool_address,
735- )
736- . into ( ) ) ;
737- } ;
738-
739- if command_config. vote_account_address . is_some ( )
740- && pool_is_initialized ( config, pool_address) . await . is_err ( )
741- {
742- eprintln_display (
743- config,
744- format ! ( "warning: Pool {} has not been initialized" , pool_address) ,
745- ) ;
746- }
747-
748- #[ allow( deprecated) ]
749- let instructions = spl_single_pool:: instruction:: create_and_delegate_user_stake (
750- & spl_single_pool:: id ( ) ,
751- & vote_account_address,
752- & stake_authority_address,
753- & quarantine:: get_rent ( config) . await ?,
754- command_config. lamports ,
755- ) ;
756-
757- let transaction = Transaction :: new_signed_with_payer (
758- & instructions,
759- Some ( & payer. pubkey ( ) ) ,
760- & vec ! [ payer] ,
761- config. program_client . get_latest_blockhash ( ) . await ?,
762- ) ;
763-
764- let signature = process_transaction ( config, transaction) . await ?;
765-
766- Ok ( format_output (
767- config,
768- "CreateDefaultStake" . to_string ( ) ,
769- CreateStakeOutput {
770- pool_address,
771- stake_account_address,
772- signature,
773- } ,
774- ) )
775- }
776-
777674// display stake pool(s)
778675async fn command_display ( config : & Config , command_config : DisplayCli ) -> CommandResult {
779676 let minimum_pool_balance = quarantine:: get_minimum_pool_balance ( config) . await ?;
0 commit comments