Skip to content

Commit

Permalink
explanatory comment
Browse files Browse the repository at this point in the history
  • Loading branch information
skrrb committed Jan 1, 2024
1 parent 6ef79ad commit 0b044f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions programs/openbook-v2/src/instructions/place_take_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,18 @@ pub fn place_take_order(ctx: Context<PlaceTakeOrder>, 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)
Expand Down

0 comments on commit 0b044f3

Please sign in to comment.