Skip to content

Commit 3a6f0f7

Browse files
committed
wip
1 parent 8e9829f commit 3a6f0f7

File tree

1 file changed

+34
-0
lines changed
  • programs/drift/src/instructions

1 file changed

+34
-0
lines changed

programs/drift/src/instructions/user.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ use crate::state::fulfillment_params::openbook_v2::OpenbookV2FulfillmentParams;
6767
use crate::state::fulfillment_params::phoenix::PhoenixFulfillmentParams;
6868
use crate::state::fulfillment_params::serum::SerumFulfillmentParams;
6969
use crate::state::high_leverage_mode_config::HighLeverageModeConfig;
70+
use crate::state::lp_pool::{Constituent, LPPool};
7071
use crate::state::margin_calculation::MarginContext;
7172
use crate::state::oracle::StrictOraclePrice;
7273
use crate::state::order_params::{
@@ -4026,6 +4027,19 @@ pub fn handle_end_swap<'c: 'info, 'info>(
40264027
Ok(())
40274028
}
40284029

4030+
#[access_control(
4031+
fill_not_paused(&ctx.accounts.state)
4032+
)]
4033+
pub fn handle_lp_pool_swap<'c: 'info, 'info>(
4034+
ctx: Context<'_, '_, 'c, 'info, LPSwap<'info>>,
4035+
in_market_index: u16,
4036+
out_market_index: u16,
4037+
limit_price: Option<u64>,
4038+
reduce_only: Option<SwapReduceOnly>,
4039+
) -> Result<()> {
4040+
Ok(())
4041+
}
4042+
40294043
#[derive(Accounts)]
40304044
#[instruction(
40314045
sub_account_id: u16,
@@ -4688,3 +4702,23 @@ pub struct UpdateUserProtectedMakerMode<'info> {
46884702
#[account(mut)]
46894703
pub protected_maker_mode_config: AccountLoader<'info, ProtectedMakerModeConfig>,
46904704
}
4705+
4706+
#[derive(Accounts)]
4707+
pub struct LPSwap<'info> {
4708+
pub state: Box<Account<'info, State>>,
4709+
pub lp_pool: AccountLoader<'info, LPPool>,
4710+
4711+
#[account(mut)]
4712+
pub in_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
4713+
#[account(mut)]
4714+
pub out_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
4715+
4716+
#[account(mut)]
4717+
pub in_constituent: AccountLoader<'info, Constituent>,
4718+
#[account(mut)]
4719+
pub out_constituent: AccountLoader<'info, Constituent>,
4720+
4721+
pub authority: Signer<'info>,
4722+
4723+
pub token_program: Interface<'info, TokenInterface>,
4724+
}

0 commit comments

Comments
 (0)