Skip to content

Commit

Permalink
program: make it easier for jit fills
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jan 24, 2024
1 parent 38a92a5 commit 888bf66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion programs/drift/src/math/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn is_maker_for_taker(
slot: u64,
) -> DriftResult<bool> {
// Maker and taker order not allowed to match if both were placed in the current slot
if slot == maker_order.slot && slot == taker_order.slot {
if slot == maker_order.slot && slot == taker_order.slot && !maker_order.is_jit_maker() {
return Ok(false);
};

Expand Down
5 changes: 5 additions & 0 deletions programs/drift/src/validation/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ fn validate_post_only_order(
valid_oracle_price: Option<i64>,
slot: u64,
) -> DriftResult {
// jit maker can fill against amm
if order.is_jit_maker() {
return Ok(());

Check warning on line 225 in programs/drift/src/validation/order.rs

View check run for this annotation

Codecov / codecov/patch

programs/drift/src/validation/order.rs#L224-L225

Added lines #L224 - L225 were not covered by tests
}

let limit_price =
order.force_get_limit_price(valid_oracle_price, None, slot, market.amm.order_tick_size)?;

Expand Down

0 comments on commit 888bf66

Please sign in to comment.