Flat Curve Market Maker on Youves: More Profits, Less Impermanent Losses
On 25 January, youves launched the Flat Curve MM for six tokens in three trading pairs. The Flat Curve’s main feature is swapping a large number of tokens with minimal impact on price.
This post explains how Flat Curve MM works, what you can swap on youves, and why this type of market maker is beneficial for liquidity providers.
What is a Flat Curve
Previously we explained the features of decentralized exchanges. Instead of an order book, they use automated market makers. These smart contracts calculate the exchange rate using a function that accounts for the available liquidity in the pool.
On centralised exchanges, the exchange rate depends on the liquidity in the order book. When buying an asset, the price changes in leaps and bounds, meaning that the user receives tokens first at one fixed price and then at another.
The graphs below are for greater clarity. They show how the exchange rate changes depending on transaction volume rather than the price dynamics in the actual pools.
There is no order book in DEXs, and an automated market maker determines the price of tokens. The most common AMMs are Constant Product Market Makers. The price change at the time of purchase has a parabolic curve.
The more tez you have to buy, the more USD you have to pay for each following tez. If the user wants to buy all the tez in the pool, the price of the last tez will tend towards infinity.
It is better to use a different formula for stabelcoins and synthetic assets with the same value: Y + X = K, the so-called Constant Sum Market Maker. For example, when swapping ctez for tez, the graph will look like a straight line: for each ctez the user will get one tez.
Although the ability to swap synthetic assets at a 1:1 exchange rate looks good, applying such a formula would run into a problem in practice. The exchange rate is not adjustable, which means that the price of the last tez will not tend towards infinity. As a result, at some point, the pool will run out of liquidity if enough one-sided trading happens.
The developers came up with the Flat Curve Market Maker concept to solve the rate and liquidity problems, which has a straight line for balanced reserves and a curve for imbalanced.
Flat Curve can use different formulas. For example, curve.fi uses one of these:
Arthur Breitman offered a simpler formula: U(x,y) = (x+y)⁸ – (x–y)⁸.
When swaps are calculated using this formula, the exchange rate in the pool initially deviates slightly from the target rate. As the transaction volume increases, there comes the point at which the exchange rate begins to rise actively. The last token in the pool will be worth infinitely more, as in the case of Constant Product MM. As a result, users swap assets at an adequate exchange rate and cannot entirely withdraw liquidity from the pool.
According to youves, a purchase of 75% of a balanced pool will alter the price only by 3%.
Flat Curve на youves
- stabelcoins: swap uUSD for wUSDC, kUSD, USDtz and back;
- wrapped bitcoin: swap uBTC for tzBTC, wwBTC.
In addition, tokens on youves can be swapped for tez, YOU, and uDEFI through Quipuswap pools. If the swap takes place via a Flat Curve, a corresponding notification appears.
If you swap 10,000 wUSDC for uUSD via Flat Curve, the price will alter by 0,2% of the market one.
If you do the same via the regular AMM, the price will alter by 21%.
Another Advantage of Flat Curve Market Maker
The DEXs works thanks to liquidity providers who put tokens into pools. For each swap in the pool, they receive fees and earn money. However, when the exchange rate of assets changes, the providers incur impermanent losses: at the time of withdrawal from the pool, their share may be worth less than the initial deposit.
Suppose Alice has deposited 100 tez and 300 uUSD ($600) in the pool, and her share in the pool is 10%. Users were putting uUSD into the pool and taking away tez until the exchange rate increased from 3 uUSD to about 6 uUSD.
The pool now has 705 tez and 4250 uUSD, and Alice’s share is 70.5 tez and 425 uUSD ($848). However, if she had not contributed to the pool, her 100 tez and 300 uUSD would now be worth $900. In effect, Alice is a $52 shortfall in profits, which is the impermanent loss. According to Nasdaq, half the liquidity providers of decentralised exchanges lose money.
In a Flat Curve pool with stabelcoins or other equivalent assets, the impermanent losses will be much more insignificant as the exchange rate changes much slower.
Subscribe and never miss updates from the world of Tezos: