QuantAMM

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

multiple rounding down during fee calculations in `onAfterRemoveLiquidity()` cause value leakage

Summary

Multiple consecutive rounding down operations during fee distribution in UpliftOnlyExample::onAfterRemoveLiquidity(), including a critical division rounding, cause cumulative value leakage over time, resulting in lost revenue for both the protocol and LPs.

Vulnerability Details

The contract performs multiple rounding down operations when calculating and distributing fees:

1- Initial division rounding down when setting fee percentage:

localData.feePercentage = (localData.feeAmount) / bptAmountIn;

2- Second rounding down when calculating exit fee:

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

3- Third rounding down when calculating admin fee portion:

localData.accruedQuantAMMFees[i] = exitFee.mulDown(localData.adminFeePercent);

4- And last calculation with two consecutive rounding downs:

minBptAmountOut: localData.feeAmount.mulDown(localData.adminFeePercent) / 1e18,

Impact

  • leakage of value on the long run

Tools Used

Manual Review

Recommendations

its better to round Up for fee calculations, cause it cost nothing for the user withdrawing, but leaks value on the long run for the admin

Updates

Lead Judging Commences

n0kto Lead Judge 11 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.

Give us feedback!