50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
use anchor_lang::prelude::*;
|
|
|
|
use crate::error::*;
|
|
use crate::state::*;
|
|
|
|
#[derive(Accounts)]
|
|
pub struct Serum3CancelOrder<'info> {
|
|
#[account(
|
|
constraint = group.load()?.is_ix_enabled(IxGate::Serum3CancelOrder) @ MangoError::IxIsDisabled,
|
|
)]
|
|
pub group: AccountLoader<'info, Group>,
|
|
|
|
#[account(
|
|
mut,
|
|
has_one = group,
|
|
constraint = account.load()?.is_operational() @ MangoError::AccountIsFrozen
|
|
// owner is checked at #1
|
|
)]
|
|
pub account: AccountLoader<'info, MangoAccountFixed>,
|
|
pub owner: Signer<'info>,
|
|
|
|
#[account(mut)]
|
|
/// CHECK: Validated inline by checking against the pubkey stored in the account at #2
|
|
pub open_orders: UncheckedAccount<'info>,
|
|
|
|
#[account(
|
|
has_one = group,
|
|
has_one = serum_program,
|
|
has_one = serum_market_external,
|
|
)]
|
|
pub serum_market: AccountLoader<'info, Serum3Market>,
|
|
/// CHECK: The pubkey is checked and then it's passed to the serum cpi
|
|
pub serum_program: UncheckedAccount<'info>,
|
|
#[account(mut)]
|
|
/// CHECK: The pubkey is checked and then it's passed to the serum cpi
|
|
pub serum_market_external: UncheckedAccount<'info>,
|
|
|
|
// These accounts are forwarded directly to the serum cpi call
|
|
// and are validated there.
|
|
#[account(mut)]
|
|
/// CHECK: Validated by the serum cpi call
|
|
pub market_bids: UncheckedAccount<'info>,
|
|
#[account(mut)]
|
|
/// CHECK: Validated by the serum cpi call
|
|
pub market_asks: UncheckedAccount<'info>,
|
|
#[account(mut)]
|
|
/// CHECK: Validated by the serum cpi call
|
|
pub market_event_queue: UncheckedAccount<'info>,
|
|
}
|