How Vortex works
Vortex is an automated market maker (AMM) liquidity protocol. Instead of a classic order book, a factory smart contract creates liquidity pool smart contracts for each pair.
This means the first person that adds liquidity to a pair also creates the unique pool for that particular pair.
The pools keep track of the liquidity added and removed at all times.
For a given liquidity pool, each pool uses the function x * y = k to maintain a curve along which trades can happen, with x and y indicating the quantity of the tokens, and k a scalar (invariant).
Fig.1: The function x * y = k
When someone trades, it is equivalent to moving on the curve and the prices adjust accordingly to maintain the value of ‘k.’
When you swap a token, you’re trading against the pool and it doesn’t require a matching order from another user.
For example, if there are
A tokens and
XTZ in the pool,
If a trader wants to trade
A tokens against some XTZ, without fees he would receive
XTZ such that :
This leads to:
x=20000102019.608x = \frac{20000}{1020}≈19.608
But since there are fees (see Price and Fees), the trader will actually receive:
xˉ=9972100020100001020=997210000x19.553{\bar {x}}=\frac{9972*1000*20}{10000*1020}=\frac{9972}{10000} x≈19.553
Since the fees remain in the pool as long as liquidity providers do not withdraw liquidity besides the fees to the Smartlink Treasury and towards $SMAK token buy back and burn which together are worth:
slightly increases to:
(1000+20)(1000xˉf)=1000050(1000 + 20)*(1000 − {\bar {x}} − f ) = 1000050
However, still with
A tokens and
XTZ in the reserve, if a trader wants to trade 20 XTZ against some A tokens, he would receive y A tokens such that:
(1000+0.997220)(1000y)=k.(1000 + 0.9972* 20)*(1000 − y) = k .
This leads to
y=0,99722010001000+0,99722019.554y=\frac{0,9972*20*1000 }{1000 + 0,9972*20}≈19.554
slightly increases to:
(1000+0.999720)(1000y)1000049(1000 + 0.9997* 20)*(1000 − y) ≈ 1000049
Click on the picture to zoom in:
Each pool is decentralized and includes functionalities to swap tokens and manage liquidity, including adding and removing liquidity.
Last modified 11d ago
Copy link