# ⚗️Liquidity Pools

The Automated Market Maker (AMM) on Sobajaswap uses a variant of the Constant Product Market Maker formula, which is commonly known as the x*y = k formula. The formula is used to determine the price of tokens in a liquidity pool.

Here is the math formula of AMM on Sobajaswap:

For a liquidity pool with two tokens, token A and token B, the product of the number of tokens of each type remains constant:

* *

x is the number of token A in the pool

y is the number of token B in the pool

k is the constant product of x and y

The formula is used to calculate the price of token A in terms of token B, or vice versa:

Price of A in terms of B = y/x Price of B in terms of A = x/y

When a trade is made, the number of tokens in the pool changes, which changes the price of the tokens. The AMM algorithm calculates the new price based on the updated pool balance and the constant product value.

Sobajaswap's AMM uses this formula to determine the price of tokens in a liquidity pool, allowing for efficient and accurate pricing of tokens for trading.

The exchange rate between the two tokens is calculated as:

y' = y + (x * fee * y) / (x + (input - fee))

y' is the new amount of the output token in the pool after the swap

input is the amount of input token being swapped

fee is the fee charged by the ZkSync platform

This formula ensures that the swap is executed at a fair price and takes into account the liquidity of the pool, allowing for efficient and accurate pricing of tokens for trading.

**How to add liquidity pools ? **

**How to add liquidity pools ?**

**Step 1: Go to Pools Page **

**Step 1: Go to Pools Page**

Go to https://app.sobajaswap.com/#/pools page and connect your wallet

Click

**" + New Position "**on the right screen

**Step 2: Add Liquidity Pools**

**Step 2: Add Liquidity Pools**

**Select the tokens:**Select the tokens you want to add liquidity to. This typically involves choosing the input token and the output token and specifying the amount you want to add to the liquidity pool.**Check the exchange rate:**The DEX will then show you the current exchange rate between the two tokens, along with any fees associated with the transaction. Make sure to check the exchange rate and fees before proceeding with the transaction.**Approve the transaction:**If you are satisfied with the exchange rate and fees, approve the transaction by clicking the appropriate button on the DEX's website or app. This will initiate the transaction.**Wait for confirmation:**The transaction will then be processed by the Sobajaswap and confirmed on the blockchain. This typically takes a few minutes to complete, depending on the blockchain network and the amount of traffic on the network.**Receive the LP tokens:**Once the transaction is confirmed, you will receive LP (liquidity provider) tokens in your wallet. These tokens represent your share of the liquidity pool and can be used to withdraw your share of the pool at any time.

Last updated