Cyclos: A Concentrated Liquidity Market Maker On Serum Order Books

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Cyclos: A Concentrated Liquidity

Market Maker on Serum Order


Books
Shardul Aeer
shardul@cyclos.io

July 31, 2021

I. Abstract • Orderbooks instead of liquidity pools


for swaps: A swap operation consists of
Cyclos market maker brings Uniswap v3 [1] a buy/sell order and a settle instruction
style concentrated liquidity to Serum’s Central combined in a single transaction. Instead
Limit Order Book (CLOB) [2]. It offers higher of trading against fragmented liquidity
capital efficiency for liquidity providers (LPs) pools, traders gain access to ecosystem
and improves liquidity utilization percentage wide liquidity and order flow.
on Serum. • Algorithmic liquidity: Raydium and
Bonfida bots have fungible liquidity pools
similar to CPMMs. Trades don’t happen
II. Constant product vs against them, rather the pool liquidity
orderbook based market makers is used for placing Serum orders. This
opens the door for algorithmic trading
Traditional exchanges use orderbooks to strategies. Raydium prices orders accord-
match buyers with sellers. However ing to the Fibonacci sequence, while Bon-
Ethereum’s low throughput and high fees fida lets users pick from various bot strate-
make orderbooks impractical, necessitating gies like RSI and MACD.
the development of constant product market • Profits and rebates over fees: Since
makers (CPMMs). They replace orderbooks trades happen against Serum, market
with a mathematical formula for swaps, given makers cannot charge a direct fee for
by the equation swaps. Rather the market maker earns
from the bid-ask spread [5] and Serum’s
x.y = k (1) maker rebate.This is passed to the liquid-
ity providers in proportion of their share.
In CPMMs, liquidity is provided by the pub- • Discrete instead of continuous liquid-
lic, who deposit token pairs and earn fees on ity: The constant product formula forms
swaps. a continuous curve. Whereas orderbooks
But throughput is not a constraint on high have discrete minimum increments called
speed blockchains like Solana. Project Serum ticks.
has pioneered on-chain orderbooks, opening • Need of an off-chain crank: CPMMs pro-
a new frontier for market makers. Notable ex- vide passive infinite liquidity along the
amples are Raydium [3] and Bonfida trading x.y = k curve. But orders on a CLOB
bots [4]. need to be actively refreshed. Such mar-
Orderbook based market makers differ from ket makers can be viewed as trading bots.
CPMMs in the following aspects: • Orderbooks make limit orders possible:

1
V IMPLEMENTATION

The AMM benefits from orders placed by V. Implementation


spot traders and other protocols. At the
same time Serum gives a commission to LPs select a price range supply a token pair.
websites hosting its DEX UI. Liquidity is evenly distributed between ticks
falling in the price range. For an A/B market
In other aspects Raydium and Bonfida bots for a given user:
mimic the constant product curve.
1. Sell orders (A → B) are placed in the
1. Liquidity is provided from (0, ∞), al- range [tick market , tick max ]
though orders are only placed near the
market price. Orders are refreshed as the 2. Buy orders (B → A) are placed in the
price changes. range [tick min , tick market ]

2. LPs get fungible LP tokens for depositing Aggregate liquidity at each tick for each
tokens. user is found and combined orders placed.

III. Concentrated liquidity i. Create position


Uniswap v3 improves upon the CPMM pro- LPs select a price range and token amounts
tocol, letting users construct individualized to deposit. An NFT is issued to represent the
price curves of their choice. Trades happen position. The entered data is mapped to the
against the combined liquidity of all individ- NFT address.
ual curves.
create_position(
1. Concentrated liquidity brings capital ef- min_tick,
ficiency: Earlier, liquidity was distributed max_tick,
from (0, ∞). A large portion of this liq- amount_A,
uidity was never utilized. LPs now get amount_B
to bind their liquidity in definite price )
ranges.

2. Non-fungible liquidity: Since positions


are unique, they are represented by non-
ii. Remove position
fungible tokens (NFTs) instead of fungible The token balances corresponding to the NFT
LP tokens. address are transferred to the user. The NFT
is then burned.
IV. Cyclos vs Uniswap v3 remove_position(nft_address)
By building upon a CLOB, Cyclos differs from
Uniswap v3 in the following aspects:
iii. Run crank
1. No multiple fee tiers: Since swaps hap-
pen against Serum, Cyclos cannot charge The crank function is periodically called to re-
a fee from users. Rather users earn a por- fresh orders. The mid-price of the market is
tion of trading profits and maker rebate. found from Serum’s smart contract, so that or-
ders can be placed around it.
2. Compounding fees: Use of a crank en-
ables trading profits to be reinvested into refresh_orders_crank()
orders.

2 2
REFERENCES

1. Settle any Serum orders which are 3. CYS token staking: LPs can stake CYS
present. Find the order share of users tokens to obtain benefits such as:
and update their balances. A percentage
of sale proceeds are withheld as protocol (a) Swap fee discounts
fee. (b) A portion of swap fees is used for
open market buyback of CYS tokens,
2. Orders will be placed 5 ticks ahead and which are distributed amongst the
5 ticks behind the current market price. stakers.
Buy orders will be placed behind the tick,
and sell orders ahead. 4. Buy and burns: Another portion of swap
fees is used for buy and burn of CYS
3. To calculate order volume Vt at a tick,
tokens, to deflate supply and increase
loop through user data:
value.
(a) Initially Vt = 0
(b) Let T represent a tick. Let Tmin to
Tmax be price range selected by a References
user. Tmkt is the market value pro-
vided by the crank call. If the be- [1] Hayden Adams et al. Uniswap v3
low condition is satisfied, proceed to core white paper. https://uniswap.org/
the next steps. Otherwise skip to the whitepaper-v3.pdf.
next user.
[2] Serum Foundation. White paper.
https://projectserum.com/serum_
Tmkt ϵ[ Tmin , Tmax ] (2)
white_paper.pdf.
(c) The tick volume Vtuser for this user is
[3] Raydium Team. Raydium proto-
calculated and added to Vt .
col litepaper. https://raydium.io/
For buy orders add B Vtuser , where VB
Raydium-Litepaper.pdf.
is the user’s total volume of B tokens
[4] Bonfida. Bonfida trading bots. https://
user VB bots.bonfida.com/.
B Vt = (3)
Tmkt − Tmin + 1
[5] Wikipedia. Bid-ask spread. https://en.
For sell orders add A Vtuser , where VA
wikipedia.org/wiki/Bid-ask_spread.
is the user’s total volume of A tokens

user VA
A Vt = (4)
Tmax − Tmkt + 1
(d) Once Vt for all users is found, place
the order on Serum.

VI. Cyclos token


Cyclos has a native token CYS on Solana
blockchain with the following uses:

1. Governance: Voting on proposals.


2. Liquidity mining incentives: CYS tokens
can be earned by staking LP position
NFTs.

3 3

You might also like