Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn handle_claim_admin_fees(context: Context<ClaimAdminFeesAccountConstraints
pub struct ClaimAdminFeesAccountConstraints<'info> {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
has_one = admin,
)]
pub config: Account<'info, Config>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn handle_initialize_pool(
pub struct InitializePoolAccountConstraints<'info> {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
)]
pub config: Box<Account<'info, Config>>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn handle_swap_tokens(
pub struct SwapTokensAccountConstraints<'info> {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
)]
pub config: Account<'info, Config>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub fn handle_withdraw_liquidity(
pub struct WithdrawLiquidityAccountConstraints<'info> {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
)]
pub config: Account<'info, Config>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn handle_claim_admin_fees(
#[derive(Accounts)]
pub struct ClaimAdminFeesAccountConstraints {
#[account(seeds = [CONFIG_SEED],
bump, address = pool_config.config)]
bump = config.bump, address = pool_config.config)]
pub config: BorshAccount<Config>,

#[account(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn handle_initialize_pool(
pub struct InitializePoolAccountConstraints {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
)]
pub config: BorshAccount<Config>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub fn handle_swap_tokens(
#[derive(Accounts)]
pub struct SwapTokensAccountConstraints {
#[account(seeds = [CONFIG_SEED],
bump, address = pool_config.config)]
bump = config.bump, address = pool_config.config)]
pub config: BorshAccount<Config>,

#[account(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub fn handle_withdraw_liquidity(
pub struct WithdrawLiquidityAccountConstraints {
#[account(
seeds = [CONFIG_SEED],
bump,
bump = config.bump,
)]
pub config: BorshAccount<Config>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct ChopTreeAccountConstraints<'info> {
#[account(
mut,
seeds = [b"player".as_ref(), player.authority.key().as_ref()],
bump,
bump = player.bump,
)]
pub player: Account<'info, PlayerData>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub struct ChopTreeAccountConstraints {
#[account(
mut,
seeds = [b"player".as_ref(), player.authority.as_ref()],
bump,
bump = player.bump,
)]
pub player: BorshAccount<PlayerData>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct TransferHookAccountConstraints<'info> {
/// CHECK: ExtraAccountMetaList Account,
#[account(seeds = [b"extra-account-metas", mint.key().as_ref()], bump)]
pub extra_account_meta_list: UncheckedAccount<'info>,
#[account(mut, seeds = [b"counter", owner.key().as_ref()], bump)]
#[account(mut, seeds = [b"counter", owner.key().as_ref()], bump = counter_account.bump)]
pub counter_account: Account<'info, CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct TransferHookAccountConstraints {
/// CHECK: ExtraAccountMetaList Account,
#[account(seeds = [b"extra-account-metas", mint.address().as_ref()], bump)]
pub extra_account_meta_list: UncheckedAccount,
#[account(mut, seeds = [b"counter", owner.address().as_ref()], bump)]
#[account(mut, seeds = [b"counter", owner.address().as_ref()], bump = counter_account.bump)]
pub counter_account: BorshAccount<CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct TransferHookAccountConstraints<'info> {
/// CHECK: ExtraAccountMetaList Account,
#[account(seeds = [b"extra-account-metas", mint.key().as_ref()], bump)]
pub extra_account_meta_list: UncheckedAccount<'info>,
#[account(mut, seeds = [b"counter"], bump)]
#[account(mut, seeds = [b"counter"], bump = counter_account.bump)]
pub counter_account: Account<'info, CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct TransferHookAccountConstraints {
/// CHECK: ExtraAccountMetaList Account,
#[account(seeds = [b"extra-account-metas", mint.address().as_ref()], bump)]
pub extra_account_meta_list: UncheckedAccount,
#[account(mut, seeds = [b"counter"], bump)]
#[account(mut, seeds = [b"counter"], bump = counter_account.bump)]
pub counter_account: BorshAccount<CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct TransferHookAccountConstraints<'info> {
token::authority = owner,
)]
pub sender_wsol_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
#[account(seeds = [b"counter"], bump)]
#[account(seeds = [b"counter"], bump = counter_account.bump)]
pub counter_account: Account<'info, CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct TransferHookAccountConstraints {
token::authority = owner,
)]
pub sender_wsol_token_account: InterfaceAccount<TokenAccount>,
#[account(seeds = [b"counter"], bump)]
#[account(seeds = [b"counter"], bump = counter_account.bump)]
pub counter_account: BorshAccount<CounterAccount>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct SwitchAccountConstraints<'info> {
#[account(
has_one=admin,
seeds=[b"admin-config"],
bump,
bump = admin_config.bump,
)]
pub admin_config: Account<'info, AdminConfig>,

Expand Down Expand Up @@ -45,9 +45,7 @@ pub fn handle_switch(accounts: &mut SwitchAccountConstraints, on: bool, bump: u8
Ok(())
}

// admin_config is validated via `seeds=[b"admin-config"], bump` - Anchor
// re-derives it and fails if it doesn't match, so storing AdminConfig.bump
// isn't strictly needed to validate `admin_config` inside `Switch` (the
// bump field on AdminConfig is still populated on creation to satisfy the
// 'every PDA struct stores its bump' rule and save derivation cost in any
// future call sites).
// admin_config is validated via `seeds=[b"admin-config"], bump =
// admin_config.bump`. `configure_admin` stores the canonical bump at creation
// (from `context.bumps`), so reusing it here turns the check into a single
// `create_program_address` instead of the search a bare `bump` would run.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct TransferHookAccountConstraints<'info> {
/// sender transfer switch
#[account(
seeds=[wallet.key().as_ref()],
bump,
bump = wallet_switch.bump,
)]
pub wallet_switch: Account<'info, TransferSwitch>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct SwitchAccountConstraints {

/// admin config
#[account(seeds=[b"admin-config"],
bump)]
bump = admin_config.bump)]
pub admin_config: BorshAccount<AdminConfig>,

/// the wallet (sender) transfer switch
Expand All @@ -42,9 +42,7 @@ pub fn handle_switch(accounts: &mut SwitchAccountConstraints, on: bool, bump: u8
Ok(())
}

// admin_config is validated via `seeds=[b"admin-config"], bump` - Anchor
// re-derives it and fails if it doesn't match, so storing AdminConfig.bump
// isn't strictly needed to validate `admin_config` inside `Switch` (the
// bump field on AdminConfig is still populated on creation to satisfy the
// 'every PDA struct stores its bump' rule and save derivation cost in any
// future call sites).
// admin_config is validated via `seeds=[b"admin-config"], bump =
// admin_config.bump`. `configure_admin` stores the canonical bump at creation
// (from `context.bumps`), so reusing it here turns the check into a single
// `create_program_address` instead of the search a bare `bump` would run.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct TransferHookAccountConstraints {
/// sender transfer switch
#[account(
seeds=[wallet.address().as_ref()],
bump,
bump = wallet_switch.bump,
)]
pub wallet_switch: BorshAccount<TransferSwitch>,
}
Expand Down
Loading