Skip to content

Commit

Permalink
Merge pull request #200 from openbook-dex/feature/settle-delegate
Browse files Browse the repository at this point in the history
allows the delegate to settle funds
  • Loading branch information
binyebarwe authored Dec 18, 2023
2 parents 77e066c + 6812804 commit 269cd09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions programs/openbook-v2/src/accounts_ix/settle_funds.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::error::OpenBookError;
use crate::state::*;
use anchor_lang::prelude::*;
use anchor_spl::token::{Token, TokenAccount};
Expand All @@ -11,8 +12,8 @@ pub struct SettleFunds<'info> {

#[account(
mut,
has_one = owner,
has_one = market,
constraint = open_orders_account.load()?.is_owner_or_delegate(owner.key()) @ OpenBookError::NoOwnerOrDelegate
)]
pub open_orders_account: AccountLoader<'info, OpenOrdersAccount>,
#[account(
Expand All @@ -30,12 +31,14 @@ pub struct SettleFunds<'info> {
pub market_quote_vault: Account<'info, TokenAccount>,
#[account(
mut,
token::mint = market_base_vault.mint
token::mint = market_base_vault.mint,
constraint = user_base_account.owner == open_orders_account.load()?.owner
)]
pub user_base_account: Account<'info, TokenAccount>,
#[account(
mut,
token::mint = market_quote_vault.mint
token::mint = market_quote_vault.mint,
constraint = user_quote_account.owner == open_orders_account.load()?.owner
)]
pub user_quote_account: Account<'info, TokenAccount>,
#[account(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct SettleFundsExpired<'info> {
#[account(
mut,
token::mint = market_quote_vault.mint,
constraint = user_base_account.owner == open_orders_account.load()?.owner
constraint = user_quote_account.owner == open_orders_account.load()?.owner
)]
pub user_quote_account: Account<'info, TokenAccount>,
#[account(
Expand Down

0 comments on commit 269cd09

Please sign in to comment.