@@ -106,8 +106,8 @@ fn command_create_pool(
106
106
pool_fee_account. pubkey( )
107
107
) ;
108
108
109
- let pool_account = Keypair :: new ( ) ;
110
- println ! ( "Creating stake pool {}" , pool_account . pubkey( ) ) ;
109
+ let stake_pool_keypair = Keypair :: new ( ) ;
110
+ println ! ( "Creating stake pool {}" , stake_pool_keypair . pubkey( ) ) ;
111
111
112
112
let validator_list = Keypair :: new ( ) ;
113
113
@@ -117,7 +117,7 @@ fn command_create_pool(
117
117
let pool_fee_account_balance = config
118
118
. rpc_client
119
119
. get_minimum_balance_for_rent_exemption ( spl_token:: state:: Account :: LEN ) ?;
120
- let pool_account_balance = config
120
+ let stake_pool_account_lamports = config
121
121
. rpc_client
122
122
. get_minimum_balance_for_rent_exemption ( get_packed_len :: < StakePool > ( ) ) ?;
123
123
let empty_validator_list = ValidatorList :: new ( max_validators) ;
@@ -127,14 +127,16 @@ fn command_create_pool(
127
127
. get_minimum_balance_for_rent_exemption ( validator_list_size) ?;
128
128
let total_rent_free_balances = mint_account_balance
129
129
+ pool_fee_account_balance
130
- + pool_account_balance
130
+ + stake_pool_account_lamports
131
131
+ validator_list_balance;
132
132
133
133
let default_decimals = spl_token:: native_mint:: DECIMALS ;
134
134
135
135
// Calculate withdraw authority used for minting pool tokens
136
- let ( withdraw_authority, _) =
137
- find_withdraw_authority_program_address ( & spl_stake_pool:: id ( ) , & pool_account. pubkey ( ) ) ;
136
+ let ( withdraw_authority, _) = find_withdraw_authority_program_address (
137
+ & spl_stake_pool:: id ( ) ,
138
+ & stake_pool_keypair. pubkey ( ) ,
139
+ ) ;
138
140
139
141
if config. verbose {
140
142
println ! ( "Stake pool withdraw authority {}" , withdraw_authority) ;
@@ -161,8 +163,8 @@ fn command_create_pool(
161
163
// Account for the stake pool
162
164
system_instruction:: create_account (
163
165
& config. fee_payer . pubkey ( ) ,
164
- & pool_account . pubkey ( ) ,
165
- pool_account_balance ,
166
+ & stake_pool_keypair . pubkey ( ) ,
167
+ stake_pool_account_lamports ,
166
168
get_packed_len :: < StakePool > ( ) as u64 ,
167
169
& spl_stake_pool:: id ( ) ,
168
170
) ,
@@ -192,7 +194,7 @@ fn command_create_pool(
192
194
// Initialize stake pool account
193
195
spl_stake_pool:: instruction:: initialize (
194
196
& spl_stake_pool:: id ( ) ,
195
- & pool_account . pubkey ( ) ,
197
+ & stake_pool_keypair . pubkey ( ) ,
196
198
& config. owner . pubkey ( ) ,
197
199
& validator_list. pubkey ( ) ,
198
200
& mint_account. pubkey ( ) ,
@@ -212,7 +214,7 @@ fn command_create_pool(
212
214
) ?;
213
215
let mut signers = vec ! [
214
216
config. fee_payer. as_ref( ) ,
215
- & pool_account ,
217
+ & stake_pool_keypair ,
216
218
& validator_list,
217
219
& mint_account,
218
220
& pool_fee_account,
@@ -599,17 +601,17 @@ fn command_list(config: &Config, stake_pool_address: &Pubkey) -> CommandResult {
599
601
return Err ( "No accounts found." . to_string ( ) . into ( ) ) ;
600
602
}
601
603
602
- let mut total_balance : u64 = 0 ;
604
+ let mut total_lamports : u64 = 0 ;
603
605
for ( pubkey, lamports, stake_state) in accounts {
604
- total_balance += lamports;
606
+ total_lamports += lamports;
605
607
println ! (
606
608
"Stake Account: {}\t Vote Account: {}\t {}" ,
607
609
pubkey,
608
610
stake_state. delegation( ) . expect( "delegation" ) . voter_pubkey,
609
611
Sol ( lamports)
610
612
) ;
611
613
}
612
- println ! ( "Total: {}" , Sol ( total_balance ) ) ;
614
+ println ! ( "Total Stake : {}" , Sol ( total_lamports ) ) ;
613
615
614
616
Ok ( ( ) )
615
617
}
@@ -638,11 +640,11 @@ fn command_update(config: &Config, stake_pool_address: &Pubkey) -> CommandResult
638
640
639
641
let mut instructions: Vec < Instruction > = vec ! [ ] ;
640
642
641
- for chunk in accounts_to_update. chunks ( MAX_ACCOUNTS_TO_UPDATE ) {
643
+ for accounts_chunk in accounts_to_update. chunks ( MAX_ACCOUNTS_TO_UPDATE ) {
642
644
instructions. push ( spl_stake_pool:: instruction:: update_validator_list_balance (
643
645
& spl_stake_pool:: id ( ) ,
644
646
& stake_pool. validator_list ,
645
- & chunk ,
647
+ & accounts_chunk ,
646
648
) ?) ;
647
649
}
648
650
@@ -912,6 +914,8 @@ fn command_set_owner(
912
914
}
913
915
914
916
fn main ( ) {
917
+ solana_logger:: setup_with_default ( "solana=info" ) ;
918
+
915
919
let matches = App :: new ( crate_name ! ( ) )
916
920
. about ( crate_description ! ( ) )
917
921
. version ( crate_version ! ( ) )
@@ -1280,8 +1284,6 @@ fn main() {
1280
1284
}
1281
1285
} ;
1282
1286
1283
- solana_logger:: setup_with_default ( "solana=info" ) ;
1284
-
1285
1287
let _ = match matches. subcommand ( ) {
1286
1288
( "create-pool" , Some ( arg_matches) ) => {
1287
1289
let numerator = value_t_or_exit ! ( arg_matches, "fee_numerator" , u64 ) ;
@@ -1297,61 +1299,71 @@ fn main() {
1297
1299
)
1298
1300
}
1299
1301
( "create-validator-stake" , Some ( arg_matches) ) => {
1300
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1301
- let vote_account = pubkey_of ( arg_matches, "vote_account " ) . unwrap ( ) ;
1302
- command_vsa_create ( & config, & pool_account , & vote_account )
1302
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1303
+ let vote_account_address = pubkey_of ( arg_matches, "vote_account_address " ) . unwrap ( ) ;
1304
+ command_vsa_create ( & config, & stake_pool_address , & vote_account_address )
1303
1305
}
1304
1306
( "add-validator" , Some ( arg_matches) ) => {
1305
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1307
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1306
1308
let stake_account = pubkey_of ( arg_matches, "stake_account" ) . unwrap ( ) ;
1307
1309
let token_receiver: Option < Pubkey > = pubkey_of ( arg_matches, "token_receiver" ) ;
1308
- command_vsa_add ( & config, & pool_account, & stake_account, & token_receiver)
1310
+ command_vsa_add (
1311
+ & config,
1312
+ & stake_pool_address,
1313
+ & stake_account,
1314
+ & token_receiver,
1315
+ )
1309
1316
}
1310
1317
( "remove-validator" , Some ( arg_matches) ) => {
1311
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1318
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1312
1319
let stake_account = pubkey_of ( arg_matches, "stake_account" ) . unwrap ( ) ;
1313
1320
let withdraw_from = pubkey_of ( arg_matches, "withdraw_from" ) . unwrap ( ) ;
1314
1321
let new_authority: Option < Pubkey > = pubkey_of ( arg_matches, "new_authority" ) ;
1315
1322
command_vsa_remove (
1316
1323
& config,
1317
- & pool_account ,
1324
+ & stake_pool_address ,
1318
1325
& stake_account,
1319
1326
& withdraw_from,
1320
1327
& new_authority,
1321
1328
)
1322
1329
}
1323
1330
( "deposit" , Some ( arg_matches) ) => {
1324
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1331
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1325
1332
let stake_account = pubkey_of ( arg_matches, "stake_account" ) . unwrap ( ) ;
1326
1333
let token_receiver: Option < Pubkey > = pubkey_of ( arg_matches, "token_receiver" ) ;
1327
- command_deposit ( & config, & pool_account, & stake_account, & token_receiver)
1334
+ command_deposit (
1335
+ & config,
1336
+ & stake_pool_address,
1337
+ & stake_account,
1338
+ & token_receiver,
1339
+ )
1328
1340
}
1329
1341
( "list" , Some ( arg_matches) ) => {
1330
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1331
- command_list ( & config, & pool_account )
1342
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1343
+ command_list ( & config, & stake_pool_address )
1332
1344
}
1333
1345
( "update" , Some ( arg_matches) ) => {
1334
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1335
- command_update ( & config, & pool_account )
1346
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1347
+ command_update ( & config, & stake_pool_address )
1336
1348
}
1337
1349
( "withdraw" , Some ( arg_matches) ) => {
1338
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1350
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1339
1351
let withdraw_from = pubkey_of ( arg_matches, "withdraw_from" ) . unwrap ( ) ;
1340
1352
let pool_amount = value_t_or_exit ! ( arg_matches, "amount" , f64 ) ;
1341
1353
let stake_receiver: Option < Pubkey > = pubkey_of ( arg_matches, "stake_receiver" ) ;
1342
1354
command_withdraw (
1343
1355
& config,
1344
- & pool_account ,
1356
+ & stake_pool_address ,
1345
1357
pool_amount,
1346
1358
& withdraw_from,
1347
1359
& stake_receiver,
1348
1360
)
1349
1361
}
1350
1362
( "set-owner" , Some ( arg_matches) ) => {
1351
- let pool_account = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1363
+ let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
1352
1364
let new_owner: Option < Pubkey > = pubkey_of ( arg_matches, "new_owner" ) ;
1353
1365
let new_fee_receiver: Option < Pubkey > = pubkey_of ( arg_matches, "new_fee_receiver" ) ;
1354
- command_set_owner ( & config, & pool_account , & new_owner, & new_fee_receiver)
1366
+ command_set_owner ( & config, & stake_pool_address , & new_owner, & new_fee_receiver)
1355
1367
}
1356
1368
_ => unreachable ! ( ) ,
1357
1369
}
0 commit comments