Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 6629767

Browse files
committed
single-pool: rename program to spl_single_pool
1 parent 5988b6b commit 6629767

21 files changed

+83
-84
lines changed

Cargo.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

single-pool/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ solana-vote-program = "=1.16.16"
3030
spl-token = { version = "4.0", path="../../token/program", features = [ "no-entrypoint" ] }
3131
spl-token-client = { version = "0.7", path="../../token/client" }
3232
spl-associated-token-account = { version = "2.0", path="../../associated-token-account/program", features = [ "no-entrypoint" ] }
33-
spl-single-validator-pool = { version = "1.0.0", path="../program", features = [ "no-entrypoint" ] }
33+
spl-single-pool = { version = "1.0.0", path="../program", features = [ "no-entrypoint" ] }
3434

3535
[dev-dependencies]
3636
solana-test-validator = "=1.16.16"

single-pool/cli/src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use {
1313
},
1414
solana_remote_wallet::remote_wallet::RemoteWalletManager,
1515
solana_sdk::{pubkey::Pubkey, signer::Signer},
16-
spl_single_validator_pool::{self as single_pool, find_pool_address},
16+
spl_single_pool::{self, find_pool_address},
1717
std::{str::FromStr, sync::Arc},
1818
};
1919

@@ -90,7 +90,7 @@ pub enum Command {
9090
/// linked to the intended depository pool
9191
CreateDefaultStake(CreateStakeCli),
9292

93-
/// Display info for one or all single single-validator stake pool(s)
93+
/// Display info for one or all single-validator stake pool(s)
9494
Display(DisplayCli),
9595
}
9696

@@ -355,7 +355,7 @@ pub fn pool_address_from_args(maybe_pool: Option<Pubkey>, maybe_vote: Option<Pub
355355
if let Some(pool_address) = maybe_pool {
356356
pool_address
357357
} else if let Some(vote_account_address) = maybe_vote {
358-
find_pool_address(&single_pool::id(), &vote_account_address)
358+
find_pool_address(&spl_single_pool::id(), &vote_account_address)
359359
} else {
360360
unreachable!()
361361
}

single-pool/cli/src/main.rs

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ use {
1616
transaction::Transaction,
1717
},
1818
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,
2322
},
2423
spl_token_client::token::Token,
2524
};
@@ -106,7 +105,7 @@ async fn command_initialize(config: &Config, command_config: InitializeCli) -> C
106105
return Err(format!("{} is not a valid vote account", vote_account_address,).into());
107106
}
108107

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);
110109

111110
// check if the pool has already been initialized
112111
if config
@@ -122,8 +121,8 @@ async fn command_initialize(config: &Config, command_config: InitializeCli) -> C
122121
.into());
123122
}
124123

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(),
127126
&vote_account_address,
128127
&payer.pubkey(),
129128
&quarantine::get_rent(config).await?,
@@ -190,7 +189,7 @@ async fn command_reactivate_pool_stake(
190189
// the only reason this check is skippable is for testing, otherwise theres no reason
191190
if !command_config.skip_deactivation_check {
192191
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);
194193
let pool_stake_deactivated = quarantine::get_stake_info(config, &pool_stake_address)
195194
.await?
196195
.unwrap()
@@ -204,8 +203,10 @@ async fn command_reactivate_pool_stake(
204203
}
205204
}
206205

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+
);
209210
let transaction = Transaction::new_signed_with_payer(
210211
&[instruction],
211212
Some(&payer.pubkey()),
@@ -240,7 +241,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
240241
let provided_pool_address = command_config.pool_address.or_else(|| {
241242
command_config
242243
.vote_account_address
243-
.map(|address| find_pool_address(&single_pool::id(), &address))
244+
.map(|address| find_pool_address(&spl_single_pool::id(), &address))
244245
});
245246

246247
// from there we can determine the stake account address
@@ -259,7 +260,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
259260
quarantine::get_stake_info(config, &stake_account_address).await?
260261
{
261262
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);
263264

264265
if let Some(provided_pool_address) = provided_pool_address {
265266
if provided_pool_address != derived_pool_address {
@@ -314,7 +315,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
314315
return Err(format!("Pool {} has not been initialized", pool_address).into());
315316
}
316317

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);
318319
let pool_stake_active = quarantine::get_stake_info(config, &pool_stake_address)
319320
.await?
320321
.unwrap()
@@ -327,7 +328,7 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
327328
return Err("Activation status mismatch; try again next epoch".into());
328329
}
329330

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);
331332
let token = Token::new(
332333
config.program_client.clone(),
333334
&spl_token::id(),
@@ -352,8 +353,8 @@ async fn command_deposit(config: &Config, command_config: DepositCli) -> Command
352353
.base
353354
.amount;
354355

355-
let instructions = single_pool::instruction::deposit(
356-
&single_pool::id(),
356+
let instructions = spl_single_pool::instruction::deposit(
357+
&spl_single_pool::id(),
357358
&pool_address,
358359
&stake_account_address,
359360
&token_account_address,
@@ -423,7 +424,7 @@ async fn command_withdraw(config: &Config, command_config: WithdrawCli) -> Comma
423424
}
424425

425426
// 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);
427428
let token = Token::new(
428429
config.program_client.clone(),
429430
&spl_token::id(),
@@ -484,8 +485,8 @@ async fn command_withdraw(config: &Config, command_config: WithdrawCli) -> Comma
484485
];
485486

486487
// 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(),
489490
&pool_address,
490491
&stake_account_address,
491492
&stake_authority_address,
@@ -570,8 +571,8 @@ async fn command_create_metadata(
570571

571572
// and... i guess thats it?
572573

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(),
575576
&pool_address,
576577
&payer.pubkey(),
577578
);
@@ -641,8 +642,8 @@ async fn command_update_metadata(
641642
unreachable!();
642643
}
643644

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(),
646647
&vote_account_address,
647648
&authorized_withdrawer.pubkey(),
648649
command_config.token_name,
@@ -717,8 +718,8 @@ async fn command_create_stake(config: &Config, command_config: CreateStakeCli) -
717718
);
718719
}
719720

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(),
722723
&vote_account_address,
723724
&stake_authority_address,
724725
&quarantine::get_rent(config).await?,
@@ -755,7 +756,7 @@ async fn command_display(config: &Config, command_config: DisplayCli) -> Command
755756
let pools = config
756757
.rpc_client
757758
.get_program_accounts_with_config(
758-
&single_pool::id(),
759+
&spl_single_pool::id(),
759760
RpcProgramAccountsConfig {
760761
filters: Some(vec![RpcFilterType::Memcmp(Memcmp::new_raw_bytes(
761762
0,
@@ -813,15 +814,15 @@ async fn get_pool_display(
813814
return Err(format!("Pool {} does not exist", pool_address).into());
814815
};
815816

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);
817818
let available_stake =
818819
if let Some((_, stake)) = quarantine::get_stake_info(config, &pool_stake_address).await? {
819820
stake.delegation.stake - quarantine::get_minimum_delegation(config).await?
820821
} else {
821822
unreachable!()
822823
};
823824

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);
825826
let token_supply = config
826827
.rpc_client
827828
.get_token_supply(&pool_mint_address)

single-pool/cli/src/output.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use {
55
serde_with::{serde_as, DisplayFromStr},
66
solana_cli_output::{display::writeln_name_value, QuietDisplay, VerboseDisplay},
77
solana_sdk::{pubkey::Pubkey, signature::Signature},
8-
spl_single_validator_pool::{
9-
self as single_pool, find_pool_mint_address, find_pool_mint_authority_address,
8+
spl_single_pool::{
9+
self, find_pool_mint_address, find_pool_mint_authority_address,
1010
find_pool_mpl_authority_address, find_pool_stake_address,
1111
find_pool_stake_authority_address,
1212
},
@@ -113,27 +113,30 @@ impl VerboseDisplay for StakePoolOutput {
113113
writeln_name_value(
114114
w,
115115
" Pool stake address:",
116-
&find_pool_stake_address(&single_pool::id(), &self.pool_address).to_string(),
116+
&find_pool_stake_address(&spl_single_pool::id(), &self.pool_address).to_string(),
117117
)?;
118118
writeln_name_value(
119119
w,
120120
" Pool mint address:",
121-
&find_pool_mint_address(&single_pool::id(), &self.pool_address).to_string(),
121+
&find_pool_mint_address(&spl_single_pool::id(), &self.pool_address).to_string(),
122122
)?;
123123
writeln_name_value(
124124
w,
125125
" Pool stake authority address:",
126-
&find_pool_stake_authority_address(&single_pool::id(), &self.pool_address).to_string(),
126+
&find_pool_stake_authority_address(&spl_single_pool::id(), &self.pool_address)
127+
.to_string(),
127128
)?;
128129
writeln_name_value(
129130
w,
130131
" Pool mint authority address:",
131-
&find_pool_mint_authority_address(&single_pool::id(), &self.pool_address).to_string(),
132+
&find_pool_mint_authority_address(&spl_single_pool::id(), &self.pool_address)
133+
.to_string(),
132134
)?;
133135
writeln_name_value(
134136
w,
135137
" Pool MPL authority address:",
136-
&find_pool_mpl_authority_address(&single_pool::id(), &self.pool_address).to_string(),
138+
&find_pool_mpl_authority_address(&spl_single_pool::id(), &self.pool_address)
139+
.to_string(),
137140
)?;
138141

139142
writeln_name_value(w, " Available stake:", &self.available_stake.to_string())?;

single-pool/cli/tests/test.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use {
2323
vote_instruction::{self, CreateVoteAccountConfig},
2424
vote_state::{VoteInit, VoteState, VoteStateVersions},
2525
},
26-
spl_single_validator_pool::{self as single_pool},
2726
spl_token_client::client::{ProgramClient, ProgramRpcClient, ProgramRpcClientSendTransaction},
2827
std::{path::PathBuf, process::Command, str::FromStr, sync::Arc, time::Duration},
2928
tempfile::NamedTempFile,
@@ -122,9 +121,9 @@ async fn start_validator() -> (TestValidator, Keypair) {
122121
upgrade_authority: Pubkey::default(),
123122
},
124123
UpgradeableProgramInfo {
125-
program_id: single_pool::id(),
124+
program_id: spl_single_pool::id(),
126125
loader: bpf_loader_upgradeable::id(),
127-
program_path: PathBuf::from("../../target/deploy/spl_single_validator_pool.so"),
126+
program_path: PathBuf::from("../../target/deploy/spl_single_pool.so"),
128127
upgrade_authority: Pubkey::default(),
129128
},
130129
]);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../../target/deploy/spl_single_pool.so

single-pool/js/packages/classic/tests/fixtures/spl_single_validator_pool.so

Lines changed: 0 additions & 1 deletion
This file was deleted.

single-pool/js/packages/classic/tests/transactions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function startWithContext(authorizedWithdrawer?: PublicKey) {
7676

7777
return await start(
7878
[
79-
{ name: 'spl_single_validator_pool', programId: SinglePoolProgram.programId },
79+
{ name: 'spl_single_pool', programId: SinglePoolProgram.programId },
8080
{ name: 'mpl_token_metadata', programId: MPL_METADATA_PROGRAM_ID },
8181
],
8282
[

single-pool/program/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "spl-single-validator-pool"
2+
name = "spl-single-pool"
33
version = "1.0.0"
44
description = "Solana Program Library Single-Validator Stake Pool"
55
authors = ["Solana Labs Maintainers <[email protected]>"]

0 commit comments

Comments
 (0)