QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: high
Valid

UpLift fees are applied on `depositAmount` instead of the upLifted (profit) value

Summary

The UpliftOnlyExample contract's withdrawal fee calculation applies fees on the total withdrawal amount rather than just the uplift value, contradicting the whitepaper specification and potentially causing users to receive less than their initial deposit value.

Vulnerability Details

In onAfterRemoveLiquidity(), the fee calculation is performed as:

feePerLP = (uint256(localData.lpTokenDepositValueChange) * (uint256(feeDataArray[i].upliftFeeBps) * 1e18)) / 10000;

The issue arises because this fee is then applied to the total withdrawal amount rather than just the uplift portion:

localData.feeAmount += (depositAmount * feePerLP);

Example scenario:

  1. User deposits 1e18 tokens

  2. Value increases to 2e18 (100% uplift)

  3. With 60% uplift fee, fee is calculated on entire 2e18

  4. User receives 8e17 tokens (less than initial 1e18 deposit)

This contradicts the whitepaper which states fees should only apply to "increase in value LPs have received over the value they would have if they had HODLed".

Impact

  • Loss of user funds below HODL value

  • Contradict the white paper

Tools Used

Manual review

Recommendations

1- Modify fee calculation to only apply to the uplift portion:

2- Add explicit checks to ensure withdrawal amount after fees cannot fall below initial deposit value

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_onAfterRemove_fees_are_applied_on_entire_amount

Likelihood: High, every withdraw with benefits. Impact: High, more fees taken and can even transform a benefit in loss.

Support

FAQs

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

Give us feedback!