QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Incorrect Fee Calculation Penalizes Multi-Position Users

Summary

The protocol's fee calculation mechanism fails to properly offset losses against profits across multiple positions, resulting in users paying fees even when experiencing net losses. This design flaw disincentivizes users from creating multiple positions, potentially reducing overall pool liquidity.

Vulnerability Details

The current fee calculation system processes each position independently, leading to suboptimal fee calculations

Consider this scenario:

  1. Position 0: +10 (profit), 20% fee rate

  2. Position 1: -100 (loss), 20% fee rate

Current behavior:

  • Net position: -90 (significant loss)

  • Fees charged: 2 (10 * 20% from profitable position)

  • User pays fees despite overall loss

This creates several issues:

  1. Users pay fees even when experiencing net losses

  2. Multiple positions are disadvantaged compared to single positions

  3. Liquidity providers are discouraged from diversifying positions

  4. Pool liquidity is reduced due to disincentivized participation

Impact

Loss of funds - Users pay excessive fees and receive reduced returns due to improper fee calculation across multiple positions.

Tools Used

Manual Review

Recommendations

Implement a weighted average fee calculation that considers net profits/losses:

This solution:

  1. Considers total profit/loss across all relevant positions (positions that are being used to remove liquidity)

  2. Applies fees only on net profits

  3. Uses weighted average fee rates based on position sizes

  4. Eliminates the penalty for holding multiple positions

Updates

Lead Judging Commences

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.