Skip to content

Commit

Permalink
program: remove spot fee pool transfer (#800)
Browse files Browse the repository at this point in the history
* bigz/remove-spot-fee-pool-transfer

* CHANGELOG

---------

Co-authored-by: Chris Heaney <[email protected]>
  • Loading branch information
0xbigz and crispheaney authored Jan 5, 2024
1 parent e578e79 commit 2863b8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 2 additions & 26 deletions programs/drift/src/controller/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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::{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2863b8b

Please sign in to comment.