QuantAMM

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

Single Storage Variable Used for Both Swap and Uplift Fees

Summary

The UpdateWeightRunner contract incorrectly uses the same storage variable quantAMMSwapFeeTake for both swap fees and uplift fees, leading to incorrect fee calculations in the UpliftOnlyExample contract.

Vulnerability Details

In UpdateWeightRunner:

  • Both setQuantAMMUpliftFeeTake() and setQuantAMMSwapFeeTake() modify the same storage variable quantAMMSwapFeeTake

  • getQuantAMMUpliftFeeTake() returns quantAMMSwapFeeTake

In UpliftOnlyExample:

  • Line 331: Retrieves uplift fee using getQuantAMMUpliftFeeTake()

  • Line 519: Uses the same function for swap fee calculations

This means both uplift fees and swap fees will always be identical, which is likely not the intended behavior, (evidenced from the two setter and getter functions too)

Impact

  • Incorrect fee calculations as uplift fees and swap fees cannot be set independently

Tools Used

Manual Review

Recommendations

1- Add separate storage variable for uplift fees:

uint256 public quantAMMUpliftFeeTake;
uint256 public quantAMMSwapFeeTake;

2- Update getter functions to return correct variables:

function getQuantAMMUpliftFeeTake() external view returns (uint256) {
return quantAMMUpliftFeeTake;
}
function getQuantAMMSwapFeeTake() external view returns (uint256) {
return quantAMMSwapFeeTake;
}

3- Ensure setter functions modify their respective variables

Updates

Lead Judging Commences

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

finding_quantAMMSwapFeeTake==quantAMMUplfitFeeTake

Likelyhood: High, calling setters or getters Impact: Low/Medium, both getters return `quantAMMSwapFeeTake` and `setQuantAMMUpliftFeeTake` modify `quantAMMUplfitFeeTake`. Real impact: those 2 values will be always the same.

Appeal created

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

finding_quantAMMSwapFeeTake==quantAMMUplfitFeeTake

Likelyhood: High, calling setters or getters Impact: Low/Medium, both getters return `quantAMMSwapFeeTake` and `setQuantAMMUpliftFeeTake` modify `quantAMMUplfitFeeTake`. Real impact: those 2 values will be always the same.

Support

FAQs

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

Give us feedback!