Skip to content

Commit

Permalink
program: allow closing oo for force closed markets (#997)
Browse files Browse the repository at this point in the history
Signed-off-by: microwavedcola1 <[email protected]>
  • Loading branch information
microwavedcola1 authored Aug 19, 2024
1 parent 3e92361 commit c1ea394
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ use crate::error::MangoError;
use crate::state::*;

pub fn serum3_close_open_orders(ctx: Context<Serum3CloseOpenOrders>) -> Result<()> {
let serum_market = ctx.accounts.serum_market.load()?;

//
// Validation
//
let mut account = ctx.accounts.account.load_full_mut()?;
// account constraint #1
require!(
account.fixed.is_owner_or_delegate(ctx.accounts.owner.key()),
account.fixed.is_owner_or_delegate(ctx.accounts.owner.key())
|| serum_market.is_force_close(),
MangoError::SomeError
);

let serum_market = ctx.accounts.serum_market.load()?;

// Validate open_orders #2
require!(
account
Expand Down

0 comments on commit c1ea394

Please sign in to comment.