hybrid pool uses wrong non_optimal_mint_fee
The HybridPool contract uses the same non-optimal mint fee calculation as the constant product pool, but because the two pools use different AMM curves, the ideal balance differs. This could lead to incorrect fees being charged when liquidity providers deposit imbalanced amounts.
Submitted by broccoli
Impact
When an lp provider deposits an imbalance amount of token, a swap fee is applied. HybridPool uses the same _nonOptimalMintFee as constantProductPool; however, since two pools use different AMM curve, the ideal balance is not the same. ref: StableSwap3Pool.vy L322-L337
Stable swap Pools are designed for 1B+ TVL. Any issue related to pricing/fee is serious. I consider this is a high-risk issue
Proof of Concept
Recommended Mitigation Steps
Calculate the swapping fee based on the stable swap curve. refer to StableSwap3Pool.vy#L322-L337.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
Liquidity providers could be charged incorrect fees when depositing imbalanced amounts, which may lead to financial loss or unfair pricing.
What the attacker needed
Liquidity provider deposits imbalanced amounts
The fix
The fee should be calculated based on the stable swap curve, as done in Curve's StableSwap3Pool.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you add tokens to a liquidity pool in an unbalanced way, the pool charges a fee. This report says the fee formula used for one type of pool (hybrid) was copied from a different type (constant product), but the two types work differently, so the fee might be wrong. That could mean users pay too much or too little, which is a problem for a financial system.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.