Swap
fi.woo.org
Decentralized exchanges (DEXes) have experienced rapid growth in the past 12 months, with DEX monthly volume exceeding $162 billion in May 2021. Instead of order books, most DEXes have adopted the automated market maker (AMM) design to bootstrap passive and algorithmic liquidity into liquidity pools. This approach enables takers to immediately trade against the AMM with any size. AMMs typically have low volume-to-liquidity ratios, from roughly 5% to 80%. To compensate liquidity providers (LPs) for impermanent loss, traders typically pay a fixed fee up to 0.3% distributed proportionally to the amount of liquidity LPs provide. The trading fee, coupled with gas fees that vary across networks, makes the cost of trading on DEXes much higher than centralized exchanges (CEXes). In contrast, CEXes typically charge no more than 0.1% fee and can go as low as a rebate or negative fee.
Uniswap v3 enables “concentrated liquidity” that allows LPs to concentrate their capital into narrower price ranges, which would result in higher volume-to-liquidity ratios. However, in order to achieve this LPs need to actively shift their liquidity in line with current trading priced. Failure to do this may result in fewer fees earned and sharper impermanent loss.
The Proactive Market Making (PMM) algorithm, first introduced by DODO, is another approach proven to be highly performant and capital-efficient via its on-chain generation of order book. WOO Network created private liquidity pools in DODO utilizing its PMM algorithm and became one of the best liquidity sources on BSC and Polygon. WOOFi Pools have on average over 500% volume-to-liquidity ratio, which proved DeFi trading can be much more efficient with professional market makers versus AMMs.
WOOFi Swap is a decentralized exchange using a brand new on-chain market making algorithm called Synthetic Proactive Market Making (sPMM), which is designed for professional market makers to provide on-chain liquidity in a way that better simulates the price, spread and depth of the order book in centralized liquidity sources. According to recent tests, the sPMM can achieve higher capital efficiency (i.e. volume-to-liquidity ratio) than all other DEXes on the market, which enables lower swap fees of 0.1% across all pairs. Upon launch, Kronos Research will be the first market maker for WOOFi Swap, while relying on Wootrade as the centralized liquidity source.
As a result, WOOFi Swap users do not need to pay exorbitant fees and can enjoy deep liquidity on-chain that rivals centralized exchanges. In addition, as WOOFi Swap will be implemented on multiple blockchains, users will be able to get the same trade execution across many networks without worrying about the slippage due to less liquidity on certain blockchains comparing to Ethereum mainnet.

Synthetic Proactive Market Making (sPMM)

sPMM is the core algorithm powering the WOOFi Swap, which provides the best way to simulate a CEX order book in a DEX liquidity pool.
WOOFi Swap vs CEX order book
The sPMM works as follows:
WOOFi Swap gets the order book data from the centralized exchange and estimates a trade price using mid-price, spread and slippage. Define mid-price 
p0p_0
and spread 
ss
:

p0=(pbid+pask)/2p_0=(p_{bid}+p_{ask})/2
s=(paskpbid)/p0s=(p_{ask}-p_{bid})/p_0
If a user wants to buy the minimum amount of base tokens, the executed price will be:

p=pask=p0(1+s/2)p=p_{ask}=p_0*(1+s/2)
We defien
ΔQ\Delta Q
as the amount of quote token and
ΔB\Delta B
as the amount of base token. If a user wants to buy more base tokens, slippage will be applied and the average buy price will be:

p=ΔQ/ΔB=pask(1+slippage)p=\Delta Q/\Delta B=p_{ask}*(1+slippage)
Slippage is determined by overall market liquidity across centralized exchanges. Generally speaking, if a user trades two orders of one pair with the same USD notional value, they should have similar slippage. Assuming that quote token is a USD stable coin, we can define the liquidity coefficient
kk
:

k=slippage/ΔQk=slippage/\Delta Q
The average buy price is:

p=ΔQ/ΔB=pask(1+kΔQ)p=\Delta Q/\Delta B=p_{ask}*(1+k*\Delta Q)
We can get the sell price in the same way. The final formula is:
  • Basic sell function:

sellBase(ΔB)=ΔQ=ΔBp/(1+kΔBp)sellBase(ΔB) = ΔQ = ΔB * p / (1+k*ΔB*p)
  • Basic buy function:

sellQuote(ΔQ)=ΔB=ΔQp1/(1+kΔQ)sellQuote(ΔQ) = ΔB = ΔQ * p^{-1} / (1 + k*ΔQ)
In the situation that one user sells some base tokens and another user wants to take the other side of the trade, AMMs apply the inverse of the sell base function to calculate how many quote tokens to be sent to the user, which means the liquidity provider has to pay negative slippage to the arbitrageur to bring the balance of the pool back. WOOFi Swap provides more flexibility in the rebalance strategy by adjusting the rebalance coefficient 
r(0r1)r (0\leq r\leq 1)
. When
r=1r=1
 the full slippage will be paid to the arbitrageur, and when 
r=0r=0
no slippage will be paid:
  • Reverse sell function:

reverseSellBase(ΔB)=ΔBp/(1kΔBpr)reverseSellBase(\Delta B) = \Delta B * p / (1-k*\Delta B*p*r)
  • Basic buy function:
reverseSellQuote(ΔQ)=ΔQp1/(1kΔQr)reverseSellQuote(\Delta Q) = \Delta Q * p^{-1} / (1 - k * \Delta Q * r)

Custom On-chain Market Data Feed

Oracle providers, such as Chainlink, have become key infrastructure of the DeFi ecosystem by pushing off-chain price data on-chain. However, in order to simulate the order book from centralized exchanges without sacrificing capital efficiency, more data than just price are needed. Along with the sPMM algorithm, WOOFi Swap uses a custom on-chain market data feed that contains multiple parameters i.e. mid-price
pp
, spread
ss
, and liquidity coefficient
kk
. This allows WOOFi Swap to accurately reflect the order book of the centralized liquidity source and provide competitive price quotes for traders.
The mid-price
pp
is updated at 0.1% price deviation to provide a much more granular price quote on-chain. The spread
ss
and liquidity coefficient
kk
are time-weighted average values using historical data, so they are updated less frequently but can be updated immediately if market volatility rises.

Single Asset Pool

Instead of having an asset pool for each trading pair, WOOFi Swap uses a single pool design that holds and manages all the assets including multiple base tokens and one quote token. This design further improves the volume-to-liquidity ratio and saves on gas fees for users.
Also, the sPMM auto rebalances the assets in the pool by providing more favorable quotes to traders who send assets that are low in liquidity to the pool.
On the initial launch, WOOFi Swap supports stable coin as the quote token, main assets on each chain as the base tokens, and more assets will be continually added.

Future Work

In the alpha stage, WOOFi Swap will start with limited liquidity to accommodate smaller trades. And the focus will be on optimizing the user experience and stability, monitoring the performance in the production environment before sizing up the liquidity, and adding more sources of order flows through aggregator integration. After the alpha stage, WOOFi Swap will be expanded to more blockchain networks and support more assets. We will also be looking to add utilities to WOO token and yield opportunities for users.

More Information

Last modified 7d ago