QuantAMM

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

Fee Calculation Rounding Down Reduces Protocol Revenue in `UpliftOnlyExample`

Summary

The UpliftOnlyExample contract uses a rounding method in the fee calculation that may result in slightly reduced fee collection for the protocol. The use of mulDown in calculating fees rounds down the result, potentially leading to a small loss in revenue over time.

Vulnerability Details

The mulDown function rounds the result down to the nearest integer, discarding any fractional part of the fee. This rounding method can lead to the protocol collecting slightly less in fees than it would if the calculation were exact.

uint256 exitFee = localData.amountsOutRaw[i].mulDown(localData.feePercentage);

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L523

Impact

Over numerous transactions, the rounding down can accumulate to a non-trivial amount of lost fees, especially if the fee percentage is small and transaction volumes are high.

Tools Used

Manual Review

Recommendations

Consider the use of mulUp to capture fractional fees and maximize fee revenue.

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
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.