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 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.
Examples
Scenario 1: Concentrated Liquidity 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_rateswap_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 * protocol_fee_reateprotocol_fee = 1.0 *10% = 0.10 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.10 = 0.90 USDC
Scenario 2: Limit Order Liquidity 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_rateswap_fee = 1000 * 0.1% = 1.0 USDC
This swap fee is distributed between the limit order providers and the protocol (see below).
2. Liquidity Providers Incentives and Protocol Fee
The liquidity providers' fee equals the swap fee minus the 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 * protocol_fee_reateprotocol_fee = 1.0 * 10% = 0.10 USDC
olp_fee = swap_fee - protocol_feeolp_fee = 1.0 - 0.10 = 0.9 USDC olp_fee goes to limit orders providers at the price point where the swap is executed.
Scenario 3: Closing a filled limit order
1. Limit order output amount
output_amount = input_amount * order_execution_price * fill_rateoutput_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 - protocol_fee)olp_fee ≈ 0.01 * (100% - 10%) = 0.009 SOL
3. Total output amount received upon closing the limit order
total_output_amount = output_amount + olp_feetotal_output_amount = 10 + 0.009 = 10.009 SOL
Last updated