Skip to content

Commit

Permalink
program: make it easier for jit fills (#835)
Browse files Browse the repository at this point in the history
* program: make it easier for jit fills

* CHANGELOG
  • Loading branch information
crispheaney committed Jan 24, 2024
1 parent 9e51138 commit a8871f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixes

- program: enable jit maker to fill same slot as taker placed ([#835](https://github.com/drift-labs/protocol-v2/pull/835))

### Breaking

## [2.55.0] - 2023-01-18
Expand Down
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(());
}

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

Expand Down

0 comments on commit a8871f1

Please sign in to comment.