QuantAMM

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

Incorrect Fee Calculation Due to Double Scaling

Summary

The UpliftOnlyExample contract contains a critical calculation error in the fee computation logic where an unnecessary scaling factor of 1e18 is applied, resulting in significantly inflated fees being charged to users.

Vulnerability Details

In the UpliftOnlyExample contract, when calculating fees based on LP token value changes, the code incorrectly applies an additional 1e18 scaling factor:

(uint256(localData.lpTokenDepositValueChange) * (uint256(feeDataArray[i].upliftFeeBps) * 1e18))

The lpTokenDepositValueChange should already represent the actual value change in the base units. By multiplying this with both upliftFeeBps and an additional 1e18 scaling factor, the resulting fee calculation becomes inflated by 1e18, leading to users being charged fees that are 1e18 times larger than intended.

Impact

Loss of funds. Users are being charged fees that are 1e18 times larger than intended, resulting in significant overcharging and potential loss of user funds when interacting with the protocol.

Tools Used

Manual Review

Recommendations

Remove the additional 1e18 scaling factor from the fee calculation:

// ... existing code ...
(uint256(localData.lpTokenDepositValueChange) * uint256(feeDataArray[i].upliftFeeBps))
// ... existing code ...

This change ensures that fees are calculated correctly based on the actual value change and the intended fee basis points, without applying an unnecessary scaling factor.

Updates

Lead Judging Commences

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

finding_Uplift_feePerLP_overscale_1e18_when_benefit

Likelihood: High, when benefit. Impact: High, exitFee will be too high, loss of funds or DoS removal.

Appeal created

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

Support

FAQs

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