QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

User cannot remove liquidity from vault when `poolData.poolConfigBits.shouldCallAfterRemoveLiquidity() == true` and pool is disabled for donation.

Summary

User cannot remove liquidity from vault when poolData.poolConfigBits.shouldCallAfterRemoveLiquidity() == true and pool is disabled for donation.
https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L557

Vulnerability Details

UpliftOnlyExample.sol#L557~566 which is called when adding liquidity to vault is as follows.

// Donates accrued fees back to LPs.
_vault.addLiquidity(
AddLiquidityParams({
pool: localData.pool,
to: msg.sender, // It would mint BPTs to router, but it's a donation so no BPT is minted
maxAmountsIn: localData.accruedFees, // Donate all accrued fees back to the pool (i.e. to the LPs)
minBptAmountOut: 0, // Donation does not return BPTs, any number above 0 will revert
kind: AddLiquidityKind.DONATION,
userData: bytes("") // User data is not used by donation, so we can set it to an empty string
})
);

But the pool is disabled for donation.
In that case, above call is reverted by following code snippet.

File: PoolConfigLib.sol
function requireDonationEnabled(PoolConfigBits config) internal pure {
if (config.supportsDonation() == false) {
revert IVaultErrors.DoesNotSupportDonation();
}
}

Impact

As a result, user cannot remove liquidity from vault when the pool is configured with poolData.poolConfigBits.shouldCallAfterRemoveLiquidity() == true and config.supportsDonation() == false.

Tools Used

Manual review

Recommendations

We have to modify codes so that the call from hook to add liquidity is not reverted even if config.supportsDonation() == false.

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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