diff --git a/solana/programs/stable-swapper/src/constants.rs b/solana/programs/stable-swapper/src/constants.rs index cc9397b..bb5262e 100644 --- a/solana/programs/stable-swapper/src/constants.rs +++ b/solana/programs/stable-swapper/src/constants.rs @@ -27,3 +27,6 @@ pub const TOKEN_VAULT_SEED: &[u8] = b"token_vault"; /// Seed for vault token account PDA pub const VAULT_TOKEN_ACCOUNT_SEED: &[u8] = b"vault_token_account"; + +/// Seed for address whitelist PDA +pub const ADDRESS_WHITELIST_SEED: &[u8] = b"address_whitelist"; diff --git a/solana/programs/stable-swapper/src/lib.rs b/solana/programs/stable-swapper/src/lib.rs index 2f08e5c..e1bcd4c 100644 --- a/solana/programs/stable-swapper/src/lib.rs +++ b/solana/programs/stable-swapper/src/lib.rs @@ -14,10 +14,6 @@ use utils::*; declare_id!("pqgqKahpG1y2wsgxFhzaAnkV1cL9vk8MSg9qm4q646F"); -// NOTE: The previously deployed whitelist PDA (seeded b"address_whitelist") is orphaned -// on devnet/mainnet after whitelist removal. Its rent is intentionally forfeited; adding a -// close_whitelist instruction is not worth the complexity for the small amount involved. - #[program] pub mod stable_swapper { use super::*; @@ -173,6 +169,11 @@ pub mod stable_swapper { require!(amount_in > 0, LiquidityError::InvalidAmount); require!(min_amount_out > 0, LiquidityError::InvalidAmount); + // Whitelist enforcement is permanently deprecated. `whitelist` stays in this + // instruction's account list (see the field below) purely so already-encoded + // callers/indexers built against the pre-deprecation `swap` signature keep working; + // nothing reads or writes it anymore. + // Check that neither token is disabled require!( !ctx.accounts.in_vault.disabled, @@ -907,6 +908,17 @@ pub struct Swap<'info> { #[account(mut)] pub user: Signer<'info>, + /// Deprecated whitelist PDA. Kept only so the account list matches the + /// pre-deprecation `swap` signature that existing callers/indexers already encode; + /// its data is never read. On mainnet this resolves to the orphaned whitelist account + /// left behind by the original removal; on fresh deployments it need not exist at all. + /// CHECK: seeds-verified PDA address only; deliberately not deserialized. + #[account( + seeds = [ADDRESS_WHITELIST_SEED], + bump + )] + pub whitelist: UncheckedAccount<'info>, + pub token_program: Program<'info, Token>, pub associated_token_program: Program<'info, AssociatedToken>, pub system_program: Program<'info, System>,