Smartlink

Searchâ€¦

Decentralized Exchange

Staking

Smart Contract Audits

Bug Bounty

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.$

If a trader wants to trade * *

$20$

A tokens against some XTZ, without fees he would receive$x$

XTZ such that :$(1000+20)*(1000-x)=k=1000000$

This leads to:

$x = \frac{20000}{1020}â‰ˆ19.608$

${\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$

$(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 .$

This leads to

$y=\frac{0,9972*20*1000 }{1000 + 0,9972*20}â‰ˆ19.554$

â€‹

$k$

slightly increases to:$(1000 + 0.9997* 20)*(1000 âˆ’ y) â‰ˆ 1000049$

Each pool is decentralized and includes functionalities to swap tokens and manage liquidity, including adding and removing liquidity.

Export as PDF

Copy link