Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

program: make it easier for jit fills #835

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading