QuantAMM

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

[M-1] Incorrect change of state variable

Summary

In the UpdateWeightRunner Contract, we are setting two different types of protocol fees: one for swapping and the other for withdrawal. However, in the setQunatAMMUpliftFeeTake() function, we are setting the fee for Swapping, which is incorrect.

Vulnerability Details

The quantAMMSwapFeeTake state variable is being changed in two functions: setQuantAMMSwapFeeTake and setQuantAMMUpliftFeeTake. Both functions are made to change distinct state variables, but they are changing the same state variable. However, the quantAMMSwapFeeTake should only be changed by the setQuantAMMSwapFeeTake function.

AFFECTED CODE:

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;
emit UpliftFeeTakeSet(oldSwapFee, _quantAMMUpliftFeeTake);
}
function getQuantAMMUpliftFeeTake() external view returns (uint256){
@> return quantAMMSwapFeeTake;
}

Impact

Incorrect Settings can lead to financial loss to both the users and the platform.

Tools Used

Manual Review

Recommendations

Add another state variable called quantAMMUpliftFeeTake and change the state variable in the setQuantAMMUpliftFeeTake function.

+ uint256 public quantAMMUpliftFeeTake = 0.5e18;
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;
+ quantAMMUpliftFeeTake = _quantAMMUpliftFeeTake;
emit UpliftFeeTakeSet(oldSwapFee, _quantAMMUpliftFeeTake);
}
function getQuantAMMUpliftFeeTake() external view returns (uint256){
- return quantAMMSwapFeeTake;
+ return quantAMMUpliftFeeTake;
}
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.