The issue arises when users attempt to add liquidity with an amount less than _MINIMUM_TRADE_AMOUNT, causing the transaction to revert. This constraint is not checked in the UpliftOnlyExample.sol#onAfterRemoveLiquidity() function, potentially leading to failed operations in boundary cases.
Users are unable to add liquidity if the amount is less than _MINIMUM_TRADE_AMOUNT. This is evident from the following code snippet:
However, the UpliftOnlyExample.sol#onAfterRemoveLiquidity() function does not account for this constraint:
https://github.com/Cyfrin/2024-12-quantamm/blob/main/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L537
This is the minted BPT amount when the operation is proportional:
https://github.com/Cyfrin/2024-12-quantamm/blob/main/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L542
As shown above, there is no check for minBptAmount, which is the BPT amount minted when the kind is AddLiquidityKind.PROPORTIONAL.
In the Vault contract:
https://github.com/Cyfrin/2024-12-quantamm/blob/main/pkg/vault/contracts/Vault.sol#L631
In boundary cases, a legitimate user's call may be reverted.
Adjust the logic in UpliftOnlyExample to prevent adding liquidity to the admin when minBptAmount < _MINIMUM_TRADE_AMOUNT.
Likelihood: Medium, when fees are below the _MINIMUM_TRADE_AMOUNT. Impact: Low/Medium, DoS of withdrawal but could be mitigated adding funds or waiting for more benefits.
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.