The UpdateWeightRunner contract incorrectly uses the swap fee state variable (quantAMMSwapFeeTake) to manage uplift fees, leading to potential fee calculation errors in the UpliftOnlyExample contract. This confusion between uplift fees and swap fees could result in incorrect fee distributions and protocol revenue accounting.
The uplift fee is designed to be a separate protocol fee for running costs, distinct from the swap fee. This is evidenced by:
Comments indicating it's for "uplift only withdrawal fee hooks"
Separate getter and setter functions specifically for uplift fees
Usage in UpliftOnlyExample contract's withdrawal and swap hooks
The contract incorrectly manages uplift fees by:
Incorrect State Variable Usage in Setter:
UpdateWeightRunner.sol#L141-L148
Incorrect Getter Implementation:
UpdateWeightRunner.sol#L151-L153
Impact in UpliftOnlyExample Contract
The issue manifests in two critical functions in UpliftOnlyExample:
In onAfterRemoveLiquidity:
UpliftOnlyExample.sol#L519
Here, the contract retrieves what it thinks is the uplift fee but actually gets the swap fee, leading to incorrect fee calculations during liquidity removal.
In onAfterSwap:
UpliftOnlyExample.sol#L331
The swap function uses the wrong fee rate for calculating protocol revenue share.
Fee Calculation Errors:
Incorrect fee amounts being charged to users during withdrawals
Wrong distribution of fees between protocol admin and pool owner
Potential revenue loss for either the protocol or liquidity providers
Manual Review
To fix this, the contract should:
Add a dedicated state variable for uplift fee:
Modify the setter to use the correct variable:
Fix the getter to return the correct fee:
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.