FootballChain
Search
⌃K

FBC Swap

Swap

FBC Swap provides users a simple way to swap tokens on FootballChain via automated liquidity pools. In a swap, one token is sold to buy another token. The rate of the swap is determined by the AMM with the equation:
xy=kx*y=k
  • x = the number of A tokens
  • y = the number of B tokens
  • k is a constant
The trader is charged a 0.3% fee to make a swap.
Example:
A trader is swapping A token for B tokens. The trader sends 100 A tokens to the AMM. A 0.3% fee is applied and 0.3 A tokens are not included in the swap. The remaining 99.7 A tokens are swapped in the AMM to B tokens. Since the AMM will be losing B tokens, it must gain A tokens to keep k constant. The equation:
(1,000+99.7)(10y)=10,000(1,000+99.7)*(10-y)=10,000
Can be solved for y to give the number of B tokens that the trader will receive. The 0.3% fee of 0.3 A tokens are directly added to the liquidity pool reserves, slightly increasing the value of k.
Example of a swap on FBC Swap

Liquidity

FBC Swap offers users a simple way to provide liquidity for tokens on FootballChain via automated liquidity pools (LPs). To become a liquidity provider on FBC Swap, a user must deposit equal values of two tokens. In return, they receive FBC-LP tokens (FBC Swap Liquidity Pool tokens). FBC-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 FBC-LP tokens. Liquidity providers can also participate in "Real Yield" with supported LPs.

Creating a new LP on FBC Swap

Anyone can make a LP on FBC Swap, with any two tokens (on FootballChain) of their choice. When an LP is created, the creator sets the price of the tokens. The amount of FBC-LP (FBCLP) shares minted are based on the equation:
FBCLP=sqrt(xy)FBCLP=sqrt(x*y)
  • x = number of A tokens
  • y = number of B tokens
Creating a new LP on FBC Swap

Adding Liquidity to a FBC Swap LP

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
  • 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 FBC-LP tokens) when a liquidity provider enters or exits the LP. After sometime, swaps are made in the A/B LP, increasing the LP's k value. The change in k and number of outstanding shares can be used to calculate the number of FBC-LP tokens that get minted into the protocol fee vault.
The number of FBCLP tokens to minted for the protocol fee vault can be calculated by the equation:
FBCLP=s(sqrt(k2)sqrt(k1))/(5sqrt(k2)+sqrt(k1))FBCLP=s*(sqrt(k2)-sqrt(k1))/(5*sqrt(k2)+sqrt(k1))
  • s is the number of outstanding FBCLP tokens
  • k2 is the current k value of the LP
  • k1 is the k value of the LP at the last deposit/withdraw from the LP
Adding liquidity to a FBC Swap LP
A new liquidity provider deposits funds to the A/B FBC-LP. The liquidity provider-must deposit A and B tokens in the same proportion as the LP reserve.
The LP first mints FBC-LP tokens to the protocol fee vault, then calculates the number of FBC-LP tokens minted to the new liquidity provider with the equation:
FBCLP=x,depositeds/xFBCLP=x,deposited*s/x
  • x,deposited is equal to the number of A tokens deposited by the new liquidity provider
  • s is the number of outstanding FBC-LP shares (including the newly minted shares for the protocol fee vault)
  • x is the number of A tokens in the LP