The protocol charges both a swapFee and an upliftFee, each managed through its own setter function. However, both setter functions update the same variable, quantAMMSwapFeeTake, leading to inaccuracies in fee handling.
By using the same variable for two different types of fees (upliftFee and swapFee), any updates to one fee will directly affect the other. This design prevents the quantAmmAdmin from setting distinct values for each fee, causing unintended fee configurations.
Let's review the Swapfee Setter Function.
Here, we set _quantAMMSwapFeeTake, which can also be configured using the setQuantAMMUpliftFeeTake function.
Consider the following scenario:
The quantAMM admin sets the upliftFee to 50%, resulting in _quantAMMSwapFeeTake = 0.5e18.
The quantAMM admin then sets the swapFee to 20%, updating _quantAMMSwapFeeTake = 0.2e18.
When a user removes liquidity, the getQuantAMMUpliftFeeTake function will return 0.2e18.
This creates a 30% fee loss for the protocol. However, on the flip side it also translates to a loss for the end user.
Using the same variable for both upliftFee and swapFee can result in a loss, either for the protocol or the end user.
Manual Review
To avoid conflicts and potential losses, create a dedicated variable for the swap fee (e.g., swapFeeBps) instead of reusing upliftFeeBps for multiple fee types.
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.