The two main risks inherent to AMMs are slippage and impermanent loss (IL).
The constant product function xy = k forms a hyperbola when plotting two assets, which creates the desirable property of always having liquidity as prices approach infinity on both sides of the spectrum. While this may be true, the available reserve of asset A will approach zero as the trade size of asset B approaches infinity. This results in slippage, i.e., the tendency of prices to move against a trader’s actions as the trader absorbs liquidity - the larger the trade, the greater the slippage.
Put another way, slippage is the difference between the expected price of an order and the price when the order actually executes. It can be exacerbated by price volatility, as traders affect the price in different directions at the same time. Slippage is reduced as more liquidity is added to a pool, since its depth is measured by the k constant.
Impermanent loss occurs when you provide liquidity to a pool, and price divergence between your deposited assets occured compared to when you deposited them. The bigger this divergence is, the more you are exposed to IL.
Consider an example where Alice deposits 1 $AAA and 100 $BBB in a liquidity pool, and let 1 $BBB = 1 USD (a stablecoin). Since SaucerSwap is a constant product market maker protocol, the deposited token pair needs to be of equivalent value. This means that the price of 1 $AAA is 100 $BBB and the dollar value of Alice’s deposit is 200 $BBB at the time of deposit.
In addition, assume there is a total of 10 $AAA and 1000 $BBB in the pool - funded by other liquidity providers. So, Alice has a 10% share of the pool, and the total liquidity is 10,000 USD.
Next, say that the price of $AAA increases to 400 $BBB. While this is happening, arbitrageurs are incentivized to add $BBB and withdraw $AAA from the pool until the reserve ratio reflects the current market price. It is important to remember that the price of the assets in the pool is determined by their reserve ratio, so while liquidity remains constant in the pool (10,000 USD), the ratio of the assets in it changes.
Since 1 $AAA is now 400 $BBB, the reserve ratio ratio has changed. As a result of arbitrage trading, there are now 5 $AAA and 2000 $BBB in the pool.
Alice now decides to withdraw her funds. As we know from earlier, she’s entitled to a 10% share of the pool. She can, therefore, withdraw 0.5 $AAA and 200 $BBB, totaling 400 USD. One would think that she profited since her initial deposit was worth 200 USD. However, if she simply held her 1 $AAA and 100 $BBB, the combined dollar value of these holdings would now be 500 USD.
We can see that Alice would have been better off by holding these assets in a wallet rather than depositing them into the liquidity pool. If Alice had kept her assets in the pool, her loss would be impermanent. The moment she withdrew these assets, the losses were realized, hence the loss is permanent. Note that this does not account for interest accrued on her LP tokens from swap fees and interest earned from staking, which may have negated the losses and made liquidity provision profitable.
Lastly, it is important to understand that IL occurs no matter which direction the price changes. The only thing IL is concerned with is the price divergence relative to the time of deposit.