The UpdateWeightRunner contract has an issue where the uplift fee and swap fee mechanisms are incorrectly sharing the same state variable quantAMMSwapFeeTake, causing setter functions to overwrite one another when called and thus causing incorrect fees to be set.
The contract attempts to manage two distinct fee types - swap fees and uplift fees. However, the implementation uses a single state variable quantAMMSwapFeeTake for both purposes.
As it can be seen setQuantAMMSwapFeeTake sets the quantAMMSwapFeeTake (which here is the desired behaviour)
But on the contrary, the function setQuantAMMUpliftFeeTake also sets the same variable quantAMMSwapFeeTake
It can also be observed that both getQuantAMMUpliftFeeTake and getQuantAMMSwapFeeTake return quantAMMSwapFeeTake.
Therefore, this is problematic since the swap fee and the uplift fee are distinct;
Swap fee is taken as % of total swap fee that is allocated to the protocol for running costs WHILE
Uplift fee is taken from LP's profit when they remove liquidity from the pool.
Based on this clear distinction, the fees should therefore be separately tracked and NOT the same variable to avoid confusion.
All contract deployments are properly done.
Quantamm admin calls setQuantAMMUpliftFeeTake in order to set say a 10% uplift fee for the LPs when they withdraw.
Quantamm also admin calls setQuantAMMSwapFeeTake in order to set say a 2% fee for the swaps.
Since both swaps and uplifts use the same fees variable either the LPs (when withdrawing liquidity) or the users (when swapping) will get higher fees (incur loss) or low fees (unfair advantage) depending on which setter function and which percent the admin set.
The protocol cannot maintain different values for swap fees and uplift fees meaning that any update to uplift fees will overwrite swap fees. This makes the protocol's fee structure to be broken.
Manual Review
Add a separate state variable for uplift fee.
Fix the setter function below.
Fix the getter function below.
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.