QuantAMM

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

No way to adjust uplift fee without changing swap fee

Summary

Due to an oversight in code there is no way to adjust uplift fee without changing swap fee.

Vulnerability Details

Code excerpt from UpdateWeightRunner:

uint256 public quantAMMSwapFeeTake = 0.5e18;
function setQuantAMMSwapFeeTake(uint256 _quantAMMSwapFeeTake) external override {
require(msg.sender == quantammAdmin, "ONLYADMIN");
require(_quantAMMSwapFeeTake <= 1e18, "Swap fee must be less than 100%");
uint256 oldSwapFee = quantAMMSwapFeeTake;
quantAMMSwapFeeTake = _quantAMMSwapFeeTake; // @audit correctly changes swap fee
emit SwapFeeTakeSet(oldSwapFee, _quantAMMSwapFeeTake);
}
function getQuantAMMSwapFeeTake() external view override returns (uint256) {
return quantAMMSwapFeeTake; // @audit correctly returns swap fee
}
function setQuantAMMUpliftFeeTake(uint256 _quantAMMUpliftFeeTake) external{
require(msg.sender == quantammAdmin, "ONLYADMIN");
require(_quantAMMUpliftFeeTake <= 1e18, "Uplift fee must be less than 100%");
uint256 oldSwapFee = quantAMMSwapFeeTake;
quantAMMSwapFeeTake = _quantAMMUpliftFeeTake; // @audit also changes swap fee (but should be uplift fee)
emit UpliftFeeTakeSet(oldSwapFee, _quantAMMUpliftFeeTake);
}
function getQuantAMMUpliftFeeTake() external view returns (uint256){
return quantAMMSwapFeeTake; // @audit returns swap fee (but should be uplift fee)
}

Both setQuantAMMSwapFeeTake and setQuantAMMUpliftFeeTake change the same value quantAMMSwapFeeTake. And both getters return the same quantAMMSwapFeeTake value.

Impact

No way to adjust uplift fee separately.

Tools Used

manual review.

Recommendations

Add a second value quantAMMUpliftFeeTake and replace quantAMMSwapFeeTake in setQuantAMMUpliftFeeTake and getQuantAMMUpliftFeeTake.

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.

Support

FAQs

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

Give us feedback!