QuantAMM

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

Users are unable to remove liquidity from the vault when `poolData.poolConfigBits.shouldCallAfterRemoveLiquidity() == true` and the pool is disabled for donations.

Summary

When attempting to remove liquidity from the vault, the operation fails if the pool is configured to call after removing liquidity and donations are disabled.

Links to Affected Code

Vulnerability Details

Finding Description and Impact

The function UpliftOnlyExample.sol#L557~L566, which is invoked when adding liquidity to the vault, contains the following code:

// 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
})
);

However, if the pool is disabled for donations, the above call will revert due to the following code snippet in PoolConfigLib.sol:

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

Consequently, users are unable to remove liquidity from the vault when poolData.poolConfigBits.shouldCallAfterRemoveLiquidity() == true and config.supportsDonation() == false.

Recommended Mitigation Steps

To resolve this issue, the code should be modified to ensure that the call from the hook to add liquidity does not revert 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.