💡

Concepts

AMM - Constant product formula

An AMM, or automated market maker, is a type of decentralized exchange that utilizes smart contracts to automatically match buy and sell orders for a particular asset. One common formula used by AMMs is the constant product formula, which defines the relationship between the prices of two assets in a liquidity pool.
In the constant product formula, the product of the prices of the two assets in the liquidity pool is kept constant. For example, if the price of Asset A is X and the price of Asset B is Y, the constant product formula would dictate that the product of X and Y should remain constant.
When a user wants to buy or sell an asset on an AMM, they can do so by adding liquidity to the pool in the form of the asset they want to sell and/or the asset they want to buy. This creates a liquidity pool of both assets that can be used to match incoming buy and sell orders.
For example, if a user wants to sell Asset A and buy Asset B, they can add liquidity to the pool in the form of Asset A. When another user wants to buy Asset A and sell Asset B, the AMM can automatically match these orders using the liquidity in the pool.
The prices of the assets in the liquidity pool are adjusted based on the constant product formula to ensure that the product of the two prices remains constant. For example, if the demand for Asset A increases, the price of Asset A may rise, which would cause the price of Asset B to fall in order to maintain the constant product.
Liquidity providers earn a share of the trading fees generated by the AMM based on their contribution to the liquidity pool. This can incentivize users to add liquidity to the pool and help ensure that there is sufficient liquidity to match incoming orders.

AMM - Concentrated Liquidity

On a decentralized exchange that utilizes concentrated liquidity pools, users can deposit liquidity into specific price ranges where it can be used to facilitate trades. This allows users to have more control over where their liquidity is being used and potentially earn a share of the trading fees generated by the exchange.
When a user wants to trade an asset, they can submit an order to the decentralized exchange. If there is sufficient liquidity in one of the price ranges within the desired price range, the exchange can automatically match the order using the liquidity in that range.
The exchange may adjust the prices of the assets in the price ranges based on supply and demand to ensure that there is sufficient liquidity to match incoming orders. For example, if the demand for an asset increases, the price of the asset may rise, which could cause the exchange to adjust the prices of the assets in the price ranges to ensure that there is sufficient liquidity to match the increased demand.
Users who provide liquidity to the price ranges may earn a share of the trading fees generated by the exchange based on their contribution to the liquidity pool. This can incentivize users to deposit liquidity into the price ranges and help ensure that there is sufficient liquidity to match incoming orders.