16
16
transaction:: Transaction ,
17
17
} ,
18
18
solana_vote_program:: { self as vote_program, vote_state:: VoteState } ,
19
- spl_single_validator_pool:: {
20
- self as single_pool, find_default_deposit_account_address, find_pool_address,
21
- find_pool_mint_address, find_pool_stake_address, instruction:: SinglePoolInstruction ,
22
- state:: SinglePool ,
19
+ spl_single_pool:: {
20
+ self , find_default_deposit_account_address, find_pool_address, find_pool_mint_address,
21
+ find_pool_stake_address, instruction:: SinglePoolInstruction , state:: SinglePool ,
23
22
} ,
24
23
spl_token_client:: token:: Token ,
25
24
} ;
@@ -106,7 +105,7 @@ async fn command_initialize(config: &Config, command_config: InitializeCli) -> C
106
105
return Err ( format ! ( "{} is not a valid vote account" , vote_account_address, ) . into ( ) ) ;
107
106
}
108
107
109
- let pool_address = find_pool_address ( & single_pool :: id ( ) , & vote_account_address) ;
108
+ let pool_address = find_pool_address ( & spl_single_pool :: id ( ) , & vote_account_address) ;
110
109
111
110
// check if the pool has already been initialized
112
111
if config
@@ -122,8 +121,8 @@ async fn command_initialize(config: &Config, command_config: InitializeCli) -> C
122
121
. into ( ) ) ;
123
122
}
124
123
125
- let mut instructions = single_pool :: instruction:: initialize (
126
- & single_pool :: id ( ) ,
124
+ let mut instructions = spl_single_pool :: instruction:: initialize (
125
+ & spl_single_pool :: id ( ) ,
127
126
& vote_account_address,
128
127
& payer. pubkey ( ) ,
129
128
& quarantine:: get_rent ( config) . await ?,
@@ -190,7 +189,7 @@ async fn command_reactivate_pool_stake(
190
189
// the only reason this check is skippable is for testing, otherwise theres no reason
191
190
if !command_config. skip_deactivation_check {
192
191
let current_epoch = config. rpc_client . get_epoch_info ( ) . await ?. epoch ;
193
- let pool_stake_address = find_pool_stake_address ( & single_pool :: id ( ) , & pool_address) ;
192
+ let pool_stake_address = find_pool_stake_address ( & spl_single_pool :: id ( ) , & pool_address) ;
194
193
let pool_stake_deactivated = quarantine:: get_stake_info ( config, & pool_stake_address)
195
194
. await ?
196
195
. unwrap ( )
@@ -204,8 +203,10 @@ async fn command_reactivate_pool_stake(
204
203
}
205
204
}
206
205
207
- let instruction =
208
- single_pool:: instruction:: reactivate_pool_stake ( & single_pool:: id ( ) , & vote_account_address) ;
206
+ let instruction = spl_single_pool:: instruction:: reactivate_pool_stake (
207
+ & spl_single_pool:: id ( ) ,
208
+ & vote_account_address,
209
+ ) ;
209
210
let transaction = Transaction :: new_signed_with_payer (
210
211
& [ instruction] ,
211
212
Some ( & payer. pubkey ( ) ) ,
@@ -240,7 +241,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
240
241
let provided_pool_address = command_config. pool_address . or_else ( || {
241
242
command_config
242
243
. vote_account_address
243
- . map ( |address| find_pool_address ( & single_pool :: id ( ) , & address) )
244
+ . map ( |address| find_pool_address ( & spl_single_pool :: id ( ) , & address) )
244
245
} ) ;
245
246
246
247
// from there we can determine the stake account address
@@ -259,7 +260,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
259
260
quarantine:: get_stake_info ( config, & stake_account_address) . await ?
260
261
{
261
262
let derived_pool_address =
262
- find_pool_address ( & single_pool :: id ( ) , & stake. delegation . voter_pubkey ) ;
263
+ find_pool_address ( & spl_single_pool :: id ( ) , & stake. delegation . voter_pubkey ) ;
263
264
264
265
if let Some ( provided_pool_address) = provided_pool_address {
265
266
if provided_pool_address != derived_pool_address {
@@ -314,7 +315,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
314
315
return Err ( format ! ( "Pool {} has not been initialized" , pool_address) . into ( ) ) ;
315
316
}
316
317
317
- let pool_stake_address = find_pool_stake_address ( & single_pool :: id ( ) , & pool_address) ;
318
+ let pool_stake_address = find_pool_stake_address ( & spl_single_pool :: id ( ) , & pool_address) ;
318
319
let pool_stake_active = quarantine:: get_stake_info ( config, & pool_stake_address)
319
320
. await ?
320
321
. unwrap ( )
@@ -327,7 +328,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
327
328
return Err ( "Activation status mismatch; try again next epoch" . into ( ) ) ;
328
329
}
329
330
330
- let pool_mint_address = find_pool_mint_address ( & single_pool :: id ( ) , & pool_address) ;
331
+ let pool_mint_address = find_pool_mint_address ( & spl_single_pool :: id ( ) , & pool_address) ;
331
332
let token = Token :: new (
332
333
config. program_client . clone ( ) ,
333
334
& spl_token:: id ( ) ,
@@ -352,8 +353,8 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
352
353
. base
353
354
. amount ;
354
355
355
- let instructions = single_pool :: instruction:: deposit (
356
- & single_pool :: id ( ) ,
356
+ let instructions = spl_single_pool :: instruction:: deposit (
357
+ & spl_single_pool :: id ( ) ,
357
358
& pool_address,
358
359
& stake_account_address,
359
360
& token_account_address,
@@ -423,7 +424,7 @@ async fn command_withdraw(config: &Config, command_config: WithdrawCli) -> Comma
423
424
}
424
425
425
426
// now all the mint and token info
426
- let pool_mint_address = find_pool_mint_address ( & single_pool :: id ( ) , & pool_address) ;
427
+ let pool_mint_address = find_pool_mint_address ( & spl_single_pool :: id ( ) , & pool_address) ;
427
428
let token = Token :: new (
428
429
config. program_client . clone ( ) ,
429
430
& spl_token:: id ( ) ,
@@ -484,8 +485,8 @@ async fn command_withdraw(config: &Config, command_config: WithdrawCli) -> Comma
484
485
] ;
485
486
486
487
// perform the withdrawal
487
- instructions. extend ( single_pool :: instruction:: withdraw (
488
- & single_pool :: id ( ) ,
488
+ instructions. extend ( spl_single_pool :: instruction:: withdraw (
489
+ & spl_single_pool :: id ( ) ,
489
490
& pool_address,
490
491
& stake_account_address,
491
492
& stake_authority_address,
@@ -570,8 +571,8 @@ async fn command_create_metadata(
570
571
571
572
// and... i guess thats it?
572
573
573
- let instruction = single_pool :: instruction:: create_token_metadata (
574
- & single_pool :: id ( ) ,
574
+ let instruction = spl_single_pool :: instruction:: create_token_metadata (
575
+ & spl_single_pool :: id ( ) ,
575
576
& pool_address,
576
577
& payer. pubkey ( ) ,
577
578
) ;
@@ -641,8 +642,8 @@ async fn command_update_metadata(
641
642
unreachable ! ( ) ;
642
643
}
643
644
644
- let instruction = single_pool :: instruction:: update_token_metadata (
645
- & single_pool :: id ( ) ,
645
+ let instruction = spl_single_pool :: instruction:: update_token_metadata (
646
+ & spl_single_pool :: id ( ) ,
646
647
& vote_account_address,
647
648
& authorized_withdrawer. pubkey ( ) ,
648
649
command_config. token_name ,
@@ -717,8 +718,8 @@ async fn command_create_stake(config: &Config, command_config: CreateStakeCli) -
717
718
) ;
718
719
}
719
720
720
- let instructions = single_pool :: instruction:: create_and_delegate_user_stake (
721
- & single_pool :: id ( ) ,
721
+ let instructions = spl_single_pool :: instruction:: create_and_delegate_user_stake (
722
+ & spl_single_pool :: id ( ) ,
722
723
& vote_account_address,
723
724
& stake_authority_address,
724
725
& quarantine:: get_rent ( config) . await ?,
@@ -755,7 +756,7 @@ async fn command_display(config: &Config, command_config: DisplayCli) -> Command
755
756
let pools = config
756
757
. rpc_client
757
758
. get_program_accounts_with_config (
758
- & single_pool :: id ( ) ,
759
+ & spl_single_pool :: id ( ) ,
759
760
RpcProgramAccountsConfig {
760
761
filters : Some ( vec ! [ RpcFilterType :: Memcmp ( Memcmp :: new_raw_bytes(
761
762
0 ,
@@ -813,15 +814,15 @@ async fn get_pool_display(
813
814
return Err ( format ! ( "Pool {} does not exist" , pool_address) . into ( ) ) ;
814
815
} ;
815
816
816
- let pool_stake_address = find_pool_stake_address ( & single_pool :: id ( ) , & pool_address) ;
817
+ let pool_stake_address = find_pool_stake_address ( & spl_single_pool :: id ( ) , & pool_address) ;
817
818
let available_stake =
818
819
if let Some ( ( _, stake) ) = quarantine:: get_stake_info ( config, & pool_stake_address) . await ? {
819
820
stake. delegation . stake - quarantine:: get_minimum_delegation ( config) . await ?
820
821
} else {
821
822
unreachable ! ( )
822
823
} ;
823
824
824
- let pool_mint_address = find_pool_mint_address ( & single_pool :: id ( ) , & pool_address) ;
825
+ let pool_mint_address = find_pool_mint_address ( & spl_single_pool :: id ( ) , & pool_address) ;
825
826
let token_supply = config
826
827
. rpc_client
827
828
. get_token_supply ( & pool_mint_address)
0 commit comments