# AMM

## Automated Market Makers

An **Automated Market Maker (AMM)** is a protocol consisting of a set of smart contracts that enables automatic price discovery and exchange of tokens, designed to power decentralized exchanges (DEXs).

Unlike traditional exchanges that leverage the order book design, AMMs adopt a unique structure called **liquidity pools** for matching and executing trades. Liquidity pools are reserves of both tokens in each trading pair that allow traders to exchange tokens from the pool at a deterministic price, based on mathematical formulas. Liquidity pools are funded by **liquidity providers (LPs)** who deposit tokens at a given rate. The pool creation and liquidity provision are fully permissionless, which allows for automatic price discovery and listing of any token on Gnoland.&#x20;

<figure><img src="https://1737588250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzhHIRYhJhsVkjaycRq4b%2Fuploads%2FCqueprGKKrHin0tJqVsX%2FAMM.png?alt=media&#x26;token=732a2599-85b0-4050-ac54-1ebb02b8d769" alt=""><figcaption></figcaption></figure>

## LP Tokens

Once liquidity providers deposit tokens into a pool, they receive newly minted **Liquidity Pool Tokens (LP Tokens)** as a certificate of their deposit. The LP Tokens represent the liquidity provider's share of the pool, and their underlying tokens change dynamically as the quantities of tokens in a liquidity pool fluctuate with each trade.

LP Tokens are designed to automatically capture swap fees of the pool. Liquidity pools charge swap fees by extracting a pre-determined portion from the output of each trade.

When liquidity providers wish to redeem the deposit, they must submit their LP Tokens to the liquidity pool contract, which returns tokens in the pool proportional to the share of the submitted LP Tokens. The LP Tokens get burnt upon redemption of the deposit. As LP Tokens are transferrable, they can be traded in secondary markets or used as collateral to borrow assets. it's important to keep the LP Tokens safe, as there is no way to recover your deposit without submitting them.

## Impermanent Loss

**Impermanent loss (IL)** refers to a decrease in the net worth of LP Tokens relative to the initial deposit. As the AMM is designed to hold the equal value of both tokens in a pool, the pool is left with more amount of tokens that have decreased in price relative to the opposite side of the pair and less amount of tokens that have increased in price. Swap fees and liquidity staking rewards exist to mitigate the impermanent loss of liquidity providers.

The greater the change in price, the higher the impermanent loss a liquidity provider will experience. The change in total equity value can be plotted on a graph, as shown below.

<figure><img src="https://1737588250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzhHIRYhJhsVkjaycRq4b%2Fuploads%2FzAWb1AsjZZFPfS4lpSPN%2FAMM.png?alt=media&#x26;token=8057e55d-b799-4cd6-ade5-41fef48ffc8a" alt=""><figcaption></figcaption></figure>
