QuantAMM

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

`maxTradeSizeRatio` Check Applied Incorrectly on Individual Token Balance Instead of Total Pool Balances

Summary

The maxTradeSizeRatio check in QuantAMMWeightedPool::onSwap() incorrectly applies the ratio limit to individual token balances rather than the total pool value, causing valid small trades to fail unnecessarily, especially in pools with multiple tokens.

Vulnerability Details

Current implementation:

File: QuantAMMWeightedPool.sol
279: if (request.kind == SwapKind.EXACT_IN) {
280: if (request.amountGivenScaled18 > request.balancesScaled18[request.indexIn].mulDown(maxTradeSizeRatio)) {
281: revert maxTradeSizeRatioExceeded();
282: }
293: } else {
294: // Cannot exceed maximum out ratio
295: if (request.amountGivenScaled18 > request.balancesScaled18[request.indexOut].mulDown(maxTradeSizeRatio)) {
296: revert maxTradeSizeRatioExceeded();
297: }

In an 8-token pool with equal weights:

  • Current: Trade limited to 30% of single token balance (3/10 * 1/8 = 3.75% of pool)

  • Intended: Trade should not exceed 30% of the pool

  • Result: Small trades that should be valid are blocked

Impact

  • Valid trades unnecessarily revert

  • Reduced pool liquidity utilization

Tools Used

Manual Review

Recommendations

Modify check to compare the trade as a fraction of the total pool balances or value

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!