Skip to content

Commit

Permalink
program: update for new drift version
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Aug 13, 2024
1 parent 90ff52f commit af5f2f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion programs/jit-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ default = []
anchor-lang = "0.29.0"
anchor-spl = "0.29.0"
bytemuck = { version = "1.4.0" }
drift = { git = "https://github.com/drift-labs/protocol-v2.git", rev = "v2.89.0", features = ["cpi", "mainnet-beta"]}
drift = { git = "https://github.com/drift-labs/protocol-v2.git", rev = "v2.92.0", features = ["cpi", "mainnet-beta"]}
static_assertions = "1.1.0"
ahash = "=0.8.6"
6 changes: 4 additions & 2 deletions programs/jit-proxy/src/instructions/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ pub fn jit<'c: 'info, 'info>(
None,
)?;

let (oracle_price, tick_size, min_order_size) = if market_type == DriftMarketType::Perp {
let (oracle_price, tick_size, min_order_size, is_prediction_market) = if market_type == DriftMarketType::Perp {
let perp_market = perp_market_map.get_ref(&market_index)?;
let oracle_price = oracle_map.get_price_data(&perp_market.amm.oracle)?.price;

(
oracle_price,
perp_market.amm.order_tick_size,
perp_market.amm.min_order_size,
perp_market.is_prediction_market()
)
} else {
let spot_market = spot_market_map.get_ref(&market_index)?;
Expand All @@ -83,11 +84,12 @@ pub fn jit<'c: 'info, 'info>(
oracle_price,
spot_market.order_tick_size,
spot_market.min_order_size,
false,
)
};

let taker_price =
match taker_order.get_limit_price(Some(oracle_price), None, slot, tick_size)? {
match taker_order.get_limit_price(Some(oracle_price), None, slot, tick_size, is_prediction_market)? {
Some(price) => price,
None if market_type == DriftMarketType::Perp => {
msg!("taker order didnt have price. deriving fallback");
Expand Down

0 comments on commit af5f2f4

Please sign in to comment.