The main problem of decentralized finance

published on 01 May 2022

Article by @leo5imon

The information provided in this article does not constitute investment advice, financial advice, or any other sort of advice and you should not treat any of the website's content as such. Do your own research and remember this information is provided for educational purposes only.

Mental models are very useful to understand new concepts like DeFi (decentralized finance): one of them is called "First Principle", I first heard about it from Tetranode.

The idea is to start studying a new concept from an "atomic" point of view, i.e. starting from the lowest entity, and then try to comprehend the solutions considered at each level.

Indeed, some of you are currently trying to understand DeFi : its implications, why it is so useful and most importantly, where to invest. The trouble is, as explained above, that there are several levels of depth to understanding it.

You can either start from an external point of view, by finding the new DEXes (Decentralized Exchange) or by following the advice of Twitter influencers. Otherwise, you apply the "First Principle" - i.e. start from the atomic part of the problem, to understand what the directions for DeFi's evolution will be. This is what I will focus on in this article.

To start, we need to understand the evolution of DeFi and its purpose.

The idea is to allow, in a decentralized and independent way, to exchange one's tokens for others. On centralized exchanges or traditional finance, two models are generally used: the order-book aka CLOB (purchase - sale at a certain price) or OTC (Over-The-Counter) sales / RFQ (request for quotation).

Order-book example
Order-book example

The order-book is what you experience on Coinbase or Binance: you put a sell price, a quantity and the order is added to the stack / filled when there is a match on the other side. It's a very efficient model, but unsustainable on a blockchain like Ethereum, as it would generate huge costs to make it all run.

Also (and we will be looking at this later), such a model requires market-makers to make it efficient. For smaller projects, the order-book would be empty very quickly and nobody would be able to buy the tokens. To check this, you just have to look at the volume of some tokens still listed on Binance, which are almost dead.

A model was needed to make decentralized exchanges without requiring a lot of transactions. The first project (not exactly, well, it's complicated) to introduce this model was Uniswap with their formula: (x * y = k) - aka "Constant Product Market Maker" - CPMM.

The idea is that there are liquidity pools of two tokens (ETH and USDC for example). If there are 10 ETH and 30 000 USDC in this pool, we would have x = 10, y = 30 000 so 10 * 30 000 = k = 300 000. Here we have a price of 3 000 USDC for 1 ETH.

Liquidity on Uniswap
Liquidity on Uniswap

Let’s assume a trader, Alice,  wants to buy 1 ETH from this pool. By making this trade, we have a pool of 9 ETH. Calculating via the formula, we have : 300 000 (k) / 9 (x) = 33 333 (y). The old y = 30,000, calculating the difference with the new one, we get: $3333, which is the price Alice will have to pay to get this ETH.

We can see that the price impact is huge: in a single exchange, the price rose from $3000 to $3333, an increase of 10%.

Another formula to calculate the price impact (and I promise to stop the calculations afterwards) is: Price impact = trade size / liquidity * 100 * 2. In this case, we get : 3000 (trade) / 60 000 (liquidity) * 100 * 2 = 10%.

Balance changes in Uniswap
Balance changes in Uniswap

However, $60 000 of liquidity is no small amount for a project that is just starting out, especially in a weak market (bear or crab market). Now that the basics are covered, I'll take you to the founder's side, where liquidity is king.

As a creator of a crypto project, you will want to make it as easy as possible for your users to trade your tokens (for 2 years, DEXes has been the go-to method). As you have understood, you will need your token, as well as a "quotation" pair (ETH, USDC, USDT, etc.) for the exchange. Unfortunately, it is often difficult for a small project to get enough liquidity to support large exchanges ($100 000 or more).

Imagine this time Bob who has come up with a revolutionary idea for his crypto project. He wants to raise $3M to fund his ideas and its development. So he offers tokens for a cheap price in exchange for "real" money (stablecoins). With the 3M, he uses half of it to pay his team, part to pay for an audit , and he has 1M left (very unusual) to add to his liquidity pool.

As seen above, we have a $2M pool in BOBTOKEN - USDC for example. Calculating via the formula "Price impact = trade size / liquidity * 100 * 2", we see that a sale of $100,000 (by someone who participated in the fundraising) triggers a 10% drop in price. This is enough to panic most buyers and cause a series of sales, further affecting the price of the token.

To avoid this scenario, Synthetix, and later Compound, theorized "liquidity mining". The idea is simple - but effective: everyone adding liquidity to Uniswap will receive SNX / COMP tokens "for free". The idea is to allow the user to take care of the liquidity aspect, whilst lowering the selling pressure of the token.

Synthetix Liquidity Mining
Synthetix Liquidity Mining

This idea kicked off the DeFi summer in 2020 and this system, called "Pool 2" is still very much in fashion for projects. The problem is that this liquidity is subject to the so-called "impermanent loss" - an intermittent loss of money if the price of the two tokens is no longer correlated.

On the other side, the entrepreneur behind the project spends way more via his token than the liquidity it attracts - and this is mercenary liquidity: if the price of the token drops, the "liquidity providers" will go off to find better opportunities.

Mercenary liquidity also leads to a sell pressure of the token, which becomes a so-called "farm & dump" token, returning to the first situation we discussed.

This is how DeFi 1.0 attempted to address this issue.

DeFi 1.0 tokens, according to Index Coop
DeFi 1.0 tokens, according to Index Coop

Now that you understand the basics, I will introduce some potential answers - and explain some investment theses I have for 2022.

I don't think there will be a one-size fits all answer to this liquidity problem, but rather several.

To categorize the different liquidity models, one could say that Uniswap v2 or Sushiswap, "classic" AMMs, are at the furthest left of the spectrum, with automatic liquidity (no need for a market maker on top), yet very inefficient from a capital perspective. This is one of the best models for a high-cost blockchain like Ethereum, but not necessarily for more scalable and cheaper blockchains.

At the opposite end of the spectrum are the CLOBs (Central Limit Order Book), classic order books "à la" Binance or FTX.

They are also found on cheap blockchains such as Solana or Optimism. This is a very efficient model, but it generally requires market-makers to be more effective. If you take a look at the order books on platforms like MEXC, you will understand the value of an AMM. It is a very efficient model from a capital point of view, but it requires a lot of time and knowledge to be optimized.

In addition, alternative models exist:

  • OTC (Over the counter - person-to-person selling) - for example, I want to sell 100 000 AAVE tokens, but I don't want to nuke the price of the token. I can trade it peer-to-peer via an OTC platform, to someone who is more optimistic than I am about the price of the token.
  • RFQ (Request for quotation) – it is a system that allows you to use the services of market-makers to offer competitive prices, via various public and private platforms.

However, these models are usually very specific and do not apply to all tokens and depend on different factors.

At the center of the spectrum mentioned above, there are more capital efficient models, with the famous Uniswap v3. The main idea is the concentration of liquidity: in a classic ETH-USDC pair, the ETH can be worth $0 as well as $10000. A "classic" AMM allows liquidity to be deployed in a range of [0,+ ∞], allowing ETH to be traded even if it reaches a price of several million.

Don’t get me wrong here, I really like Ethereum, but these prices are not realistic , and we have plenty of time to see it coming (although it would be a nice surprise). That's why Uniswap v3 allows you to concentrate your liquidity on smaller ranges. With Ethereum at $3500, make a band of [$3000,$4000] for example, which makes the liquidity more distributed and therefore efficient.

This change requires more active management, as the price of crypto assets is very volatile and if your LPs are outside the price band (<$3000 or >$4000), you no longer make money on them.

Another way to explore this model is to use an oracle (Chainlink for example) and use it to concentrate liquidity around a price point. For example, you could use a smart contract to get the ETH price at a certain time, create an LP of -$100 / +$100 around it and get almost instant liquidity - and far more efficiently than most DEXes.

This is what the Integral project has chosen to do, allowing for some of the best liquidity for large movements through DEXes. Curve v2 has also chosen an approach in this style, with the use of a TWAP (Time-Weighted Average Price) instead of a Chainlink type oracle.

After several months, it quickly became apparent that the Uniswap v3 innovation had won the DEXes war. Indeed, Sushi has started to offer a derivative with Trident, Curve v2 as well, and we see replicas arriving on many blockchains, especially Solana with Orca and its Whirlpools update.

Exchanges architectures
Exchanges architectures

With less liquidity, Uniswap handles more volume than its competitors.

But the impermanent loss is always there - and some studies show that most people adding liquidity lose money. In reality, only market-makers manage to play their cards right.

There are several possible solutions to this problem:

The first of these is the "Curve" model, which has added mechanisms around its token to ensure a constant and attractive return to users who add liquidity. The trouble with this model is that it depends mainly on the market and the protocols that wish to participate in the infamous "Curve Wars". If they stop playing, the mechanics break down and the liquidity disappears, as in the Pool 2 system we saw earlier.

The second solution is to successfully automate and make Uniswap v3's liquidity providers composable. One of the changes introduced in v3 is to transform LPs, the tokens received when someone adds liquidity, into NFTs. Indeed, if someone adds liquidity between [$0,$3000], it will not be worth the same as liquidity between [$3000,$3100], which implies that it is non-fungible.

Unfortunately, this prevents protocols like Synthetix or Compound from rewarding users who add tokens by giving them native governance tokens (SNX / COMP).

The leader in this field is Arrakis Finance (ex Gelato Finance), which focuses on composability and allows users to receive LP tokens - and thus rewards - as in the days of Uniswap v2.

One of its competitors, Gamma Strategies, offers the same solution, but using machine learning to optimize LP positions in real time, depending on the market.

It is an interesting solution that is more efficient than Curve v2 and more automated than Uniswap v3, but it is very data intensive and may involve errors.

Finally, another solution is called Tokemak - and to understand Tokemak, one must first understand the background of its creator, Carson Cook (a.k.a. Liquidity Wizard).

He first got a PhD in physics and electrical engineering (this will be important for the rest of the story), then worked at McKinsey in Fintech services. In 2016, he joined the blockchain ecosystem and founded a market-making company called Fractal in 2018.

After three years of dedicated service on centralized and decentralized exchanges, he saw the opportunity to create an automated protocol to make his company's skills available to a wider audience.

He founded Tokemak, a decentralized liquidity protocol - and Membrane, an OTC trading protocol.

To grasp the impact of Tokemak and how it is positioned: some believe that Tokemak seeks to become a DEX and compete with Uniswap. Others think it is simply a market-maker on Ethereum. The truth is that Tokemak is looking to become the AWS of blockchain.

Infrastructure layers
Infrastructure layers

Amazon Web Services is the Amazon service that revolutionized computing. When companies were buying their expensive servers and configuring them themselves, Amazon thought, "What if we bought servers, configured them to be as efficient as possible, and made them available to everyone ?"

The results? Cheaper, more efficient servers that have allowed many companies to focus on the quality of their product - rather than on trivial details like their servers.

Similarly, Tokemak can be seen as the AWS of liquidity and wants to allow projects to save on their liquidity acquisition costs, by generalizing market-making via a single protocol.

Uniswap v3 is the fusion of an AMM and a CLOB. Tokemak is located at the center of the liquidity solutions. We have liquidity mining on the left, with leased and temporary liquidity. On the other side of the spectrum is Olympus Pro, which seeks to acquire this liquidity via a bond system. This model has a much longer-term view, but also has flaws.

Tokemak, on the other hand, uses rented liquidity, but gradually buys it back via the LP fees it earns, to own its liquidity and reach its final stage, called the Singularity.

Liquidity duration and costs
Liquidity duration and costs

The main concept of Tokemak is to link liquidity independently: in a traditional DEX model, you have pairs: AAVE-USDC for example.

Unfortunately, if someone thinks the price of the AAVE token is going to go up, they are not incentivized to offer liquidity because of the impermanent loss.

If Alice has $10 000 of AAVE, she will have to sell $5 000 to buy USDC, only to receive a tiny return on it, which she will lose almost instantly if the price of AAVE goes up (or down) too much.

And needless to say, with small amounts, it is not economically viable on the Ethereum blockchain.

For its part, Tokemak uses an age-old technique: socializing losses. The idea is that, outside a black swan event, it is almost impossible for everyone to withdraw their tokens from the pools at the same time - and a significant percentage will always remain.

The protocol will then create "reactors" of tokens called "base assets": SUSHI, OHM, AAVE, etc., as well as "reactors" of "quote assets": ETH, USDC, FRAX, USDT, etc.

Tokemak then groups these tokens between a "base" and a "quote", via a voting system: the more Tokemak you own, the more influence you have on the direction of the reactors. If AAVE has half the votes, it has half the liquidity of the "quote assets". It then deploys these pairs on designated AMMs via a vote beforehand (Uniswap, Sushi, Curve, etc.) and gets the fees from the transactions to buy back its own liquidity, as well as to protect from impermanent loss.

For the average user, Tokemak offers :

  • Reactors that allow returns on a single token, which protects against the impermanent loss discussed above.
  • Reactors with "quote assets" with attractive returns, on the ETH or USDC for example.
  • A liquidity steering, where you can use your $TOKE to select the pool with the best liquidity, via voting and game theory.

Protocols have a clear incentive to obtain $TOKE to guide liquidity and increase the depth of their pools, in the manner of Curve and the CRV war.

Alchemix - an innovative DeFi protocol - is one of the first to experiment with the Tokemak system. Based on their experience, sourcing liquidity for stablecoins costs $1 of governance token emissions to get from $5 to $10 in liquidity.

To get $100m liquidity for their alUSD stablecoin, it takes about $10m of ALCX issuance. For ETH, it's even cheaper.

But to get liquidity for governance tokens like ALCX, it is usually 1:1, i.e. Alchemix has to pay $100m per year to have a liquidity pool with $100m of depth.

And it's not even bought liquidity: if issuance stops, the liquidity disappears by half in the next 30 days.

By switching to a Tokemak pool, Alchemix will be able to reduce its liquidity emissions by over 86% per year. At the current ALCX price, that's $130M saved by the DAO. And this is a problem that is common to almost all projects, so the market for this is huge.

How does this change play out?

Previously, Alchemix offered a pool on their site - allowing you to stake your Sushiswap LPs on the platform. In exchange, they offered 50% returns per year on it.

From now on, the user has to stake his ALCX on Tokemak. In exchange, he receives a token named tALCX, which he then stakes on Alchemix to obtain the same return as before.

The difference is that instead of giving 50% of the yield, Alchemix receives 30% of the yield from Tokemak - in $TOKE tokens. With these, they can direct liquidity and make the pool even more competitive. Behind that, they only need to offer 20% yield, and the number of tokens in staking is much higher because there is no longer the problem of impermanent loss.

The strength of Tokemak is that it is as neutral as possible and does not compete with the DEXes it feeds. On the contrary, it is located one level above these DEXes and directs liquidity to them. The latter could also become players in the ecosystem, seeking to use its liquidity to avoid unprofitable "liquidity mining", such as the one offered by Sushi to attract liquidity.

In a much more distant future, one could even imagine blockchains using Tokemak to increase their liquidity, allowing a drastic increase in TVL.

I told you about the Tokemak founder's experience in market-making: centralizing liquidity to a protocol like this has a lot of advantages.

One of these is the ability to use more advanced techniques to optimize liquidity and positions. Tokemak has already announced that they are working with Gamma Strategies to benefit from their knowledge and algorithms around LPs on Uniswap v3 - and a partnership at this level is a win-win for both protocols.

Even more advanced techniques may be tried to combat impermanent loss, such as hedging via options as offered by Squeeth → https://medium.com/opyn/hedging-uniswap-v3-with-squeeth-bcaf1750ea11

It is highly likely that the DeFi ecosystem will evolve enormously in the next few years, with access to blockchains with much lower costs, enabling a change in the current paradigm.

Some options such as JIT seem interesting to me, where participants are able to add liquidity on Uniswap v3 in the same block as the user's swap. Indeed, via MEV, some bots are able to detect large swaps, add liquidity to the pair in question and then remove it in the same block.

The end result is a better swap for the user and high costs for the creator of this "Just-On-Time" liquidity.

Will this solution become widespread on alt-chains? Or will the CLOB model make a comeback?

Time will tell, but I hope this article has given you a detailed understanding of the issues and problems associated with liquidity in this ecosystem.

-  🇺🇸 refinements by @0x_Groova -

Read more

English 🇺🇸🇬🇧