Fees and Incentives

Overview

Fees in Fusion AMM are a critical component, distributed uniquely based on the interaction type. This section outlines how fees are calculated and allocated across different scenarios.

Swap Fees

Swapping assets in a FusionPool incurs fees determined by the fee_rate field in the FusionPool account. This rate apply uniformly, whether the swap interacts with concentrated liquidity or limit order liquidity, ensuring consistent fee calculations across pool types.

Limit Orders

Limit orders incur fees only when closed, not when opened, and are paid in the output token. The fee is calculated using the order_protocol_fee_rate field in the FusionPool account.

Beyond enabling precise price trading, limit orders provide liquidity for swaps, earning fees when trades execute at their specific price point (tick). These earned fees, like incurred fees, are collected upon closure and are accrued at the order’s exact price, not the entire tick.

Concentrated Liquidity

Swaps in FusionPools generate fees for concentrated liquidity positions, similar to other CLMMs. Limit orders, being highly concentrated at a single price, increase price resistance when contributing liquidity, impacting swap dynamics. To ensure fairness, Fusion AMM allocates a portion of fees from swaps interacting with limit order liquidity to concentrated liquidity position owners. Let's call the ratio between these type of fees: Concentrated Liquidity/Limit Orders Rebate Ratio. These fees, tracked as clp_reward_rate in a FusionPool account, prevent penalization of position owners resulting from increased price resistance limit order prices.

Examples

Scenario 1: Concentrated Liquidity Swap

  • Liquidity Pool: SOL/USDC

  • Swap direction: USDC -> SOL

  • Swap Input Amount: 1000 USDC

  • Pool Price: 150.00 USDC per SOL

  • Swap Fee Rate: 0.1%

  • Protocol Fee Rate: 10%

  • Liquidity: concentrated liquidity is only used for the swap

1. Swap Fee

Total fees paid by the user who executed the swap in the form of the input token:

swap_fee = input_amount * fee_rate

swap_fee = 1000 * 0.1% = 1.0 USDC

2. Liquidity Providers Incentives and Protocol Fee

The protocol fee is deducted from the swap fee amount, then transferred to the DefiTuna Staking program and distributed proportionally among TUNA token holders.

protocol_fee = swap_fee * order_protocol_fee_reate

protocol_fee = 1.0 * 20% = 0.20 USDC

The liquidity providers' incentive is equal to the swap fee minus the protocol fee. It goes to concentrated liquidity positions active at the tick where the swap occurs.

clp_fee = swap_fee - protocol_fee

clp_fee = 1.0 - 0.20 = 0.80 USDC

Scenario 2: Limit Order Liquidity Swap

  • Liquidity Pool: SOL/USDC

  • Swap direction: USDC -> SOL

  • Swap Input Amount: 1000 USDC

  • Pool Price: 150.00 USDC per SOL

  • Swap Fee Rate: 0.1%

  • Order Protocol Fee Rate: 20%

  • Concentrated Liquidity Providers Reward Rate: 20%

  • Liquidity: the current price is exactly at the tick price, and only limit order liquidity is used for the swap

1. Swap Fee

Total fees paid by the user who executed the swap in the form of the input token:

swap_fee = input_amount * fee_rate

swap_fee = 1000 * 0.1% = 1.0 USDC

This swap fee is distributed between limit order and concentrated liquidity providers (see below).

2. Liquidity Providers Incentives and Protocol Fee

The liquidity providers' fee equals the swap fee minus the protocol fee. It is distributed between limit order liquidity providers (OLD) and concentrated liquidity providers (CLP) according to the pool's CLP reward rate and order protocol fee.

The protocol fee is deducted from the swap fee amount, then transferred to the DefiTuna Staking program and distributed proportionally among TUNA token holders.

protocol_fee = swap_fee * order_protocol_fee_reate

protocol_fee = 1.0 * 20% = 0.20 USDC

clp_fee = (swap_fee - protocol_fee) * clp_reward_rate
olp_fee = (swap_fee - protocol_fee) * (1 - clp_reward_rate)

clp_fee = (1.0 - 0.20) * 20% = 0.16 USDC olp_fee = (1.0 - 0.20) * (100% - 20%) = 0.64 USDC clp_fee goes to concentrated liquidity positions active at the tick where the swap occurs. olp_fee goes to limit orders at the price point where the swap is executed.

Scenario 3: Closing a filled limit order

  • Liquidity Pool: SOL/USDC

  • Limit Order Direction: USDC -> SOL

  • Limit Order Size: 1500 USDC

  • Limit Order Execution Price: 150.00 USDC per SOL

  • Swap Fee Rate: 0.1%

  • Limit Order Protocol Fee Rate: 20%

  • Concentrated Liquidity Providers Reward Rate: 10%

  • Fill Rate: 100% (the limit order is fully filled)

1. Limit order output amount

output_amount = input_amount * order_execution_price * fill_rate

output_amount = 1500 / 150 * 100% = 10 SOL

The output amount is not the final amount the user will receive when the order is closed. Fees and rewards must be applied to calculate the final amount.

2. Limit Order Liquidity Provider Reward

The limit order liquidity provider's reward is a portion of the swap fee paid by users executing trades. See Scenario 1: Concentrated Liquidity Swap for a detailed explanation.

olp_fee = swap_fee * (1 - order_protocol_fee) * (1 - clp_reward_ratio)

olp_fee ≈ 0.01 * (100% - 20%) * (100% - 10%) = 0.0072 SOL

3. Total output amount received upon closing the limit order

total_output_amount = output_amount + olp_fee

total_output_amount = 10 + 0.0072 = 10.0072 SOL

Last updated