Protocol Fee

Portion of trading, lending, or withdrawal fees retained by the protocol treasury rather than distributed to liquidity providers.

Protocol fees are charges taken by a DeFi protocol for its own treasury or token holders, separate from fees paid to liquidity providers. These fees fund development, create value for governance token holders, and ensure protocol sustainability.

Fee Structure Examples

Uniswap V3

  • Swap fee: 0.01% - 1% (goes to LPs)
  • Protocol fee: Optional, up to 1/4 of swap fee
  • Controlled by governance

Balancer V2

  • Swap fee: Pool-specific (goes to LPs)
  • Protocol fee: Percentage of swap fees to treasury
  • Flash loan fee: 0.01% (fully to protocol)

Aave V3

  • Interest spread between borrowers and lenders
  • Protocol takes portion of interest payments
  • Liquidation bonus split with protocol

Fee Calculation

1// Example fee split
2uint256 totalFee = swapAmount * feeRate / 10000;
3uint256 protocolFee = totalFee * protocolFeePercentage / 10000;
4uint256 lpFee = totalFee - protocolFee;

Security Considerations

Fee manipulation: Attackers may try to avoid or extract fees through:

  • Flash loan arbitrage timing
  • Sandwich attacks around fee changes
  • Rounding exploitation on small amounts

Admin risk: Protocol fee changes can affect LP profitability and TVL.

Accounting errors: Fee calculation bugs can lead to fund loss or trapped value.

Fee Collection Patterns

Direct Collection

Fees collected immediately during swaps/operations.

Accrual Model

Fees accumulate and are claimed periodically (reduces gas costs).

Yield-Bearing

Protocol fee tokens are wrapped into yield-bearing assets.

Audit Focus Areas

  1. Verify fee calculations don't have rounding issues
  2. Check fee changes can't be front-run
  3. Ensure fee collection doesn't create reentrancy vectors
  4. Validate fee caps and governance controls
  5. Test edge cases: zero fees, maximum fees, fee changes mid-operation

Need expert guidance on Protocol Fee?

Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.

Get a Quote

oog
zealynx

Subscribe to Our Newsletter

Stay updated with our latest security insights and blog posts

© 2024 Zealynx