QuantAMM

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

The contract `UpliftOnlyExample` lacks of functions to manage or withdraw collected fees

Summary

The contract UpliftOnlyExample , the onAfterSwap function collects swap fees and sends them to address(this), but there are no mechanisms in place to withdraw or manage these fees within the contract.

Vulnerability Details

In contract UpliftOnlyExample , the onAfterSwap function collects swap fees and sends them to address(this):

uint256 quantAMMFeeTake = IUpdateWeightRunner(_updateWeightRunner).getQuantAMMUpliftFeeTake();
uint256 ownerFee = hookFee;
if (quantAMMFeeTake > 0) {
uint256 adminFee = hookFee / (1e18 / quantAMMFeeTake);
ownerFee = hookFee - adminFee;
address quantAMMAdmin = IUpdateWeightRunner(_updateWeightRunner).getQuantAMMAdmin();
_vault.sendTo(feeToken, quantAMMAdmin, adminFee);
emit SwapHookFeeCharged(quantAMMAdmin, feeToken, adminFee);
}
if (ownerFee > 0) {
_vault.sendTo(feeToken, address(this), ownerFee);
emit SwapHookFeeCharged(address(this), feeToken, ownerFee);
}

However, there are no mechanisms in place to withdraw or manage these fees within the contract. This results in the fees being indefinitely trapped in the contract, creating a situation where the fees accumulate without any provision for the owner or specific roles to access or redistribute them.

Impact

The impact is HIGH because fees will be locked in the contract and the likelihodd is HIGH, so the severity should be HIGH.

Tools Used

Manual Review

Recommendations

Consider adding following function:

/**
* @notice Withdraws the accumulated fees and sends them to the owner.
* @param feeToken The token with accumulated fees
*/
function withdrawFees(IERC20 feeToken) external onlyOwner{
uint256 feeAmount = feeToken.balanceOf(address(this));
if (feeAmount > 0) {
feeToken.safeTransfer(owner(), feeAmount);
emit HookFeeWithdrawn(address(this), feeToken, owner(), feeAmount);
}
}
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_ownerFee_cannot_be_withdrawn

Likelihood: High, every swap. Impact: High, funds are stuck.

Support

FAQs

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

Give us feedback!