Skip to content

Commit

Permalink
+ Add cleanup_position_stop_loss
Browse files Browse the repository at this point in the history
+ Add cleanup_position_take_profit
  • Loading branch information
Adrena-Corto committed Oct 27, 2024
1 parent c06a93a commit 05d1740
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"sablier"
]
}
70 changes: 70 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ mod adrena_abi {
) -> Result<()> {
Ok(())
}

pub(crate) fn cleanup_position_stop_loss(cx: Context<CleanupPositionStopLoss>) -> Result<()> {
Ok(())
}

pub(crate) fn cleanup_position_take_profit(
cx: Context<CleanupPositionTakeProfit>,
) -> Result<()> {
Ok(())
}
}

#[derive(Accounts)]
Expand Down Expand Up @@ -405,3 +415,63 @@ pub struct LiquidateLong<'info> {
#[account(address = SABLIER_THREAD_PROGRAM_ID)]
sablier_program: AccountInfo<'info>,
}

#[derive(Accounts)]
pub struct CleanupPositionStopLoss<'info> {
/// #1
#[account(mut)]
pub caller: Signer<'info>,
/// #2
#[account(mut)]
pub owner: AccountInfo<'info>,
/// #3
pub transfer_authority: AccountInfo<'info>,
/// #4
pub cortex: AccountLoader<'info, Cortex>,
/// #5
pub pool: AccountLoader<'info, Pool>,
/// #6
#[account(mut)]
pub position: AccountLoader<'info, Position>,
/// #7
pub custody: AccountLoader<'info, Custody>,
/// #8
#[account(mut)]
pub stop_loss_thread: AccountInfo<'info>,
/// #9
#[account(mut)]
pub take_profit_thread: UncheckedAccount<'info>,
/// #10
#[account(address = SABLIER_THREAD_PROGRAM_ID)]
sablier_program: AccountInfo<'info>,
}

#[derive(Accounts)]
pub struct CleanupPositionTakeProfit<'info> {
/// #1
#[account(mut)]
pub caller: Signer<'info>,
/// #2
#[account(mut)]
pub owner: AccountInfo<'info>,
/// #3
pub transfer_authority: AccountInfo<'info>,
/// #4
pub cortex: AccountLoader<'info, Cortex>,
/// #5
pub pool: AccountLoader<'info, Pool>,
/// #6
#[account(mut)]
pub position: AccountLoader<'info, Position>,
/// #7
pub custody: AccountLoader<'info, Custody>,
/// #8
#[account(mut)]
pub take_profit_thread: AccountInfo<'info>,
/// #9
#[account(mut)]
pub stop_loss_thread: UncheckedAccount<'info>,
/// #10
#[account(address = SABLIER_THREAD_PROGRAM_ID)]
sablier_program: AccountInfo<'info>,
}

0 comments on commit 05d1740

Please sign in to comment.