Because the call in _addLiquidity forwards the entire balances of the 3 stablecoins without checking the ratio.
between the 3, less liquidity is minted than what should be wanted. Furthermore, an attacker can abuse this arbitrage the forwarded balances if the discrepancy is large enough.
For example, suppose the contract holds $10K each of usdc, usdt, dai. An attacker deposits $100K worth of DAI
and get credited with $100K worth of shares in the protocol. Liquidity is added, but since the ratio is now skewed
11:1:1, a lot less liquidity is minted by the stableswap algorithm to the protocol. The attacker can now arbitrage the curve pool for an additional profit.
There doesnt even need to be an attacker, just an unbalanced amount of user deposits will also lead to lower liquidity minted.
Adding liquidity should probably be managed more manually, it should be added in equal proportion to the curve pool balances, not the contract balances.
gpersoon commented:
GalloDaSballo (judge) commented:
BobbyYaxis (yAxis) noted:
