Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions solana/programs/stable-swapper/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
20 changes: 16 additions & 4 deletions solana/programs/stable-swapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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>,
Expand Down
Loading