From 0b044f365d785bd6f39fa2a14c09e15cc9e8edf1 Mon Sep 17 00:00:00 2001 From: skrrb Date: Mon, 1 Jan 2024 12:46:15 +0100 Subject: [PATCH] explanatory comment --- .../openbook-v2/src/instructions/place_take_order.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/programs/openbook-v2/src/instructions/place_take_order.rs b/programs/openbook-v2/src/instructions/place_take_order.rs index 0a36ac5cf..83264205b 100644 --- a/programs/openbook-v2/src/instructions/place_take_order.rs +++ b/programs/openbook-v2/src/instructions/place_take_order.rs @@ -59,17 +59,18 @@ pub fn place_take_order(ctx: Context, order: Order, limit: u8) - ctx.remaining_accounts, )?; + // place_take_orders doesnt pay to referrers + let makers_rebates = taker_fees - referrer_amount; + let (deposit_amount, withdraw_amount) = match side { Side::Bid => { - let total_quote_including_fees = - total_quote_taken_native + taker_fees - referrer_amount; + let total_quote_including_fees = total_quote_taken_native + makers_rebates; market.base_deposit_total -= total_base_taken_native; market.quote_deposit_total += total_quote_including_fees; (total_quote_including_fees, total_base_taken_native) } Side::Ask => { - let total_quote_discounting_fees = - total_quote_taken_native - taker_fees + referrer_amount; + let total_quote_discounting_fees = total_quote_taken_native - makers_rebates; market.base_deposit_total += total_base_taken_native; market.quote_deposit_total -= total_quote_discounting_fees; (total_base_taken_native, total_quote_discounting_fees)