From 2863b8b6b1cae23edb35af54ccba36efdd4fbec8 Mon Sep 17 00:00:00 2001 From: bigz_Pubkey <83473873+0xbigz@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:44:36 -0500 Subject: [PATCH] program: remove spot fee pool transfer (#800) * bigz/remove-spot-fee-pool-transfer * CHANGELOG --------- Co-authored-by: Chris Heaney --- CHANGELOG.md | 1 + programs/drift/src/controller/orders.rs | 28 ++----------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b60a3a6c..72879d4fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features - program: increase full perp liquidation threshold ([#807](https://github.com/drift-labs/protocol-v2/pull/807)) +- program: remove spot fee pool transfer ([#800](https://github.com/drift-labs/protocol-v2/pull/800)) ### Fixes diff --git a/programs/drift/src/controller/orders.rs b/programs/drift/src/controller/orders.rs index ebcae2053..c0913295c 100644 --- a/programs/drift/src/controller/orders.rs +++ b/programs/drift/src/controller/orders.rs @@ -15,8 +15,7 @@ use crate::controller::position::{ PositionDirection, }; use crate::controller::spot_balance::{ - transfer_spot_balance_to_revenue_pool, update_spot_balances, - update_spot_market_cumulative_interest, + update_spot_balances, update_spot_market_cumulative_interest, }; use crate::controller::spot_position::{ decrease_spot_open_bids_and_asks, increase_spot_open_bids_and_asks, @@ -31,8 +30,7 @@ use crate::math::amm_jit::calculate_amm_jit_liquidity; use crate::math::auction::{calculate_auction_params_for_trigger_order, calculate_auction_prices}; use crate::math::casting::Cast; use crate::math::constants::{ - BASE_PRECISION_U64, FEE_POOL_TO_REVENUE_POOL_THRESHOLD, FIVE_MINUTE, ONE_HOUR, PERP_DECIMALS, - QUOTE_SPOT_MARKET_INDEX, + BASE_PRECISION_U64, FIVE_MINUTE, ONE_HOUR, PERP_DECIMALS, QUOTE_SPOT_MARKET_INDEX, }; use crate::math::fees::{determine_user_fee_tier, ExternalFillFees, FillFees}; use crate::math::fulfillment::{ @@ -4122,20 +4120,6 @@ pub fn fulfill_spot_order_with_match( false, )?; - let fee_pool_amount = get_token_amount( - base_market.spot_fee_pool.scaled_balance, - quote_market, - &SpotBalanceType::Deposit, - )?; - - if fee_pool_amount > FEE_POOL_TO_REVENUE_POOL_THRESHOLD * 2 { - transfer_spot_balance_to_revenue_pool( - fee_pool_amount - FEE_POOL_TO_REVENUE_POOL_THRESHOLD, - quote_market, - &mut base_market.spot_fee_pool, - )?; - } - let fill_record_id = get_then_update_id!(base_market, next_fill_record_id); let order_action_explanation = if maker.orders[maker_order_index].is_jit_maker() { OrderActionExplanation::OrderFilledWithMatchJit @@ -4327,14 +4311,6 @@ pub fn fulfill_spot_order_with_external_market( &SpotBalanceType::Deposit, )?; - if fee_pool_amount > FEE_POOL_TO_REVENUE_POOL_THRESHOLD * 2 { - transfer_spot_balance_to_revenue_pool( - fee_pool_amount - FEE_POOL_TO_REVENUE_POOL_THRESHOLD, - quote_market, - &mut base_market.spot_fee_pool, - )?; - } - let ExternalFillFees { user_fee: taker_fee, fee_to_market,