use crate::error::*; use crate::state::*; use anchor_lang::prelude::*; use anchor_spl::token::TokenAccount; #[derive(Accounts)] pub struct PerpLiqBaseOrPositivePnl<'info> { #[account( constraint = group.load()?.is_ix_enabled(IxGate::PerpLiqBaseOrPositivePnl) @ MangoError::IxIsDisabled )] pub group: AccountLoader<'info, Group>, #[account(mut, has_one = group, has_one = oracle)] pub perp_market: AccountLoader<'info, PerpMarket>, /// CHECK: Oracle can have different account types, constrained by address in perp_market pub oracle: UncheckedAccount<'info>, #[account( mut, has_one = group, constraint = liqor.load()?.is_operational() @ MangoError::AccountIsFrozen // liqor_owner is checked at #1 )] pub liqor: AccountLoader<'info, MangoAccountFixed>, pub liqor_owner: Signer<'info>, #[account( mut, has_one = group, constraint = liqee.load()?.is_operational() @ MangoError::AccountIsFrozen )] pub liqee: AccountLoader<'info, MangoAccountFixed>, // bank correctness is checked at #2 #[account(mut, has_one = group)] pub settle_bank: AccountLoader<'info, Bank>, #[account( mut, address = settle_bank.load()?.vault )] pub settle_vault: Account<'info, TokenAccount>, /// CHECK: Oracle can have different account types #[account(address = settle_bank.load()?.oracle)] pub settle_oracle: UncheckedAccount<'info>, }