# Liquidity

FluxSwap offers users a simple way to provide liquidity for tokens on Fuse network via automated liquidity pools (LPs). To become a liquidity provider on FluxSwap, a user must deposit equal values of two tokens. In return, they receive FLUX-LP tokens (FluxSwap Liquidity Pool tokens). FLUX-LP tokens represent a proportional share of the given LP and liquidity providers may claim their underlying tokens anytime. Liquidity providers receive a 0.25% fee for every swap that is made in their pair. The 0.25% fee is directly added back to the LP, increasing the value of FLUX-LP tokens. Liquidity providers can also participate in yield farming with supported LPs.

Anyone can make an LP on FluxSwap, with any two tokens (on Fuse) of their choice. When an LP is created, the creator sets the price of the tokens. The amount of FLUX-LP(FSLP) shares minted is based on the equation:

$$
FSLP=sqrt(x∗y)
$$

Where _x_ = number of $AAA tokens and _y_ = number of $BBB tokens. Figure 1 shows a diagram of a liquidity provider creating a new liquidity pool with tokens $AAA and $BBB.

![Figure 1. Creating a new LP on FluxSwap.](https://4154754380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2p8rAkJ6cN4hCyXKifY%2Fuploads%2FTDhQLGoiu3In7GfkJO9B%2FCopy%20of%201%20\(1\).png?alt=media\&token=ebffa63e-19a7-4a7a-b6c9-a8231500dd1a)

Swap fees are directly accumulated in the LP. For each swap, a 0.3% fee is charged to the trader in the token they are selling. This is added to the LP and slightly increases the LP's _k_ value with every swap. 5/6 of the 0.3% fee goes to the liquidity providers and 1/6 of the 0.3% swap fee goes to the protocol fee vault. The protocol fee vault only receives their fees (in the form of FLUX-LP tokens) when a liquidity provider enters or exits the LP. After some time, swaps are made in the $AAA/$BBB LP, increasing the LP's _k_ value. The change in _k_ and number of outstanding shares can be used to calculate the number of FLUX-LP tokens that get minted into the protocol fee vault. The number of FSLP tokens to minted for the protocol fee vault can be calculated by the equation:

$$
FSLP=s∗(sqrt(k2)−sqrt(k1))/(5∗sqrt(k2)+sqrt(k1))
$$

Where _s_ is the number of outstanding FSLP tokens, _k2_ is the current _k_ value of the LP, and _k1_ is the _k_ value of the LP at the last deposit/withdrawal from the LP. Figure 2 shows a diagram of a liquidity provider depositing $AAA and $BBB tokens to the LP from Figure 1, after a swap has been made.

![Figure 2. Adding liquidity to a FluxSwap LP.](https://4154754380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2p8rAkJ6cN4hCyXKifY%2Fuploads%2FvrP3CwI008Uop54Iob6c%2FCopy%20of%201%20\(3\).png?alt=media\&token=5a81c6bc-1e4d-4f60-be35-413a1c85638d)

In Figure 2, a new liquidity provider deposits funds to the $AAA/$BBB FLUX-LP. The liquidity provider must deposit $AAA and $BBB tokens in the same proportion as the LP reserve. In the example above, the liquidity provider must deposit 0.00827 $BBB tokens for every 1 $AAA token they wish to deposit. The LP first mints FLUX-LP tokens to the protocol fee vault, then calculates the number of FLUX-LP tokens minted to the new liquidity provider with the equation:

$$
FSLP = x,deposited ∗ s/x
$$

Where _x, deposited_ is equal to the number of $AAA tokens deposited by the new liquidity provider, _s_ is the number of outstanding FLUX-LP shares (including the newly minted shares for the protocol fee vault), and _x_ is the number of $AAA tokens in the LP.
