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
$1000$
A tokens and
$1000$
XTZ in the pool,
$k=1000*1000=1000000.$
$20$
A tokens against some XTZ, without fees he would receive
$x$
XTZ such that :
$(1000+20)*(1000-x)=k=1000000$
$x = \frac{20000}{1020}≈19.608$
But since there are fees (see Price and Fees), the trader will actually receive:
${\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:
$f=\frac{3x}{10000}=0.006,$
$k$
slightly increases to:
$(1000 + 20)*(1000 − {\bar {x}} − f ) = 1000050$
However, still with
$1000$
A tokens and
$1000$
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.9972* 20)*(1000 − y) = k .$
$y=\frac{0,9972*20*1000 }{1000 + 0,9972*20}≈19.554$
$k$
$(1000 + 0.9997* 20)*(1000 − y) ≈ 1000049$ 