---
# System prepended metadata

title: AMM Research

---

# AMM Research

x * y = k

Ra - # of Tokens of A present in the Liquidity Pool
Rb - # of Tokens of B present in the Liquidity Pool

Δa - Number of Tokens of A the trader has given to the exchange
Δb - Number of Tokens of B the trader has given to the exchange

𝚫a - Number of Tokens of A trader received from the exchange
𝚫b - Number of Tokens of B trader received from the exchange

Formular: Ra * Rb = k


( Ra + Δa - 𝚫a)( Rb + Δb - 𝚫b ) = k [Constant]

( 1000 + 1000 - Δb  )(50 ) = 50,000

We have two tokens A and B. 

LP

A | B
1000 | 50

=> k = 1000 * 50 = 50,000

Kien want to swap 5 tokens of B for ? A. (need to find 𝚫a)

( 1000 + 0 - 𝚫a)(50 + 5 - 0) = 50,000

𝚫a = 90.90

=> Swap 5 tokens of B => receive 90.90 A

LP is

A | B
909.1 | 55 

=> k still 50,000



Add transaction fee
( Ra + 𝛾Δa - 𝚫a)( Rb + 𝛾Δb - 𝚫b ) = k [Constant]

Fee 0.3% => 𝛾 = 1 - 0.3 = 0.97


( 1000 + 0 - 𝚫a)(50 + 0.97*5 - 0) = 50,000

𝚫a = 65.42
88.42


=> Swap 5 tokens of B => receive 88.42 A

=> A = 1000 - 88.42 = 911.58

k = (911.58 X 55) = 50136.9

136.9

50136.9




Swap 5 tokens of B => receive 88.42 A (LP)
A/B B/A



HOubi
5 B => 90.42 A
B/A rẻ => 

Oracle ???


Blockchain A



Blockchain B