Skip to content

Commit

Permalink
add payer to settle funds expired
Browse files Browse the repository at this point in the history
  • Loading branch information
binyebarwe committed Aug 21, 2023
1 parent bffb10e commit 6231107
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use anchor_spl::token::{Token, TokenAccount};
pub struct SettleFundsExpired<'info> {
#[account(mut)]
pub close_market_admin: Signer<'info>,
#[account(mut)]
pub payer: Signer<'info>,
#[account(
mut,
has_one = market,
Expand Down Expand Up @@ -52,7 +54,7 @@ pub struct SettleFundsExpired<'info> {
impl<'info> SettleFundsExpired<'info> {
pub fn to_settle_funds_accounts(&self) -> SettleFunds<'info> {
SettleFunds {
owner: self.close_market_admin.clone(),
owner: self.payer.clone(),
open_orders_account: self.open_orders_account.clone(),
market: self.market.clone(),
market_authority: self.market_authority.clone(),
Expand Down
2 changes: 2 additions & 0 deletions programs/openbook-v2/tests/cases/test_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ async fn test_close_market_admin() -> Result<(), TransportError> {
price_lots,
account_1,
account_2,
payer,
..
} = TestContext::new_with_market(TestNewMarketInitialize {
close_market_admin_bool: true,
Expand Down Expand Up @@ -365,6 +366,7 @@ async fn test_close_market_admin() -> Result<(), TransportError> {
let settle_funds_expired_ix = SettleFundsExpiredInstruction {
close_market_admin,
market,
payer,
open_orders_account: account_2,
market_base_vault,
market_quote_vault,
Expand Down
4 changes: 3 additions & 1 deletion programs/openbook-v2/tests/program_test/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ impl ClientInstruction for SettleFundsInstruction {
#[derive(Clone)]
pub struct SettleFundsExpiredInstruction {
pub close_market_admin: TestKeypair,
pub payer: TestKeypair,
pub open_orders_account: Pubkey,
pub market: Pubkey,
pub market_base_vault: Pubkey,
Expand All @@ -835,6 +836,7 @@ impl ClientInstruction for SettleFundsExpiredInstruction {
let market: Market = account_loader.load(&self.market).await.unwrap();
let accounts = Self::Accounts {
close_market_admin: self.close_market_admin.pubkey(),
payer: self.payer.pubkey(),
open_orders_account: self.open_orders_account,
market: self.market,
market_authority: market.market_authority,
Expand All @@ -852,7 +854,7 @@ impl ClientInstruction for SettleFundsExpiredInstruction {
}

fn signers(&self) -> Vec<TestKeypair> {
vec![self.close_market_admin]
vec![self.close_market_admin, self.payer]
}
}

Expand Down

0 comments on commit 6231107

Please sign in to comment.