Preface

For Web3, I think there are three most important historical moments: Bitcoin pioneered the decentralized system blockchain, Ethereum’s smart contracts gave imagination beyond blockchain payment, and UNI devolved financial privileges to the blockchain The clarion call of the Golden Age of Chains. From V1 to V4, from UNI X to UNI Chain, how far is UNI from the ultimate answer to Dex?

UNI V1: Prelude to the Golden Age

It is not that there were no on-chain exchanges before UNI, but after UNI, on-chain exchanges can be called decentralized exchanges (Dex). Many articles attribute the success of UNI to simplicity, security, privacy, the founder of AMM, etc. In fact, in my opinion, apart from simplicity, the success of UNI has little to do with other factors. Different from what most people are familiar with today, UNI is not the first on-chain exchange to adopt the AMM model. There was Bancor (the second largest fundraising ICO project in the history of blockchain) before UNI. Exchanges that adopt the order book model have already been around for a long time. UNI is neither the pioneer nor the only on-chain exchange that can achieve privacy and security. Why can UNI be a latecomer? Let’s first talk about Bancor, which was born earlier than UNI. This project was once the top-level on-chain exchange in the currency circle. The popular EOS RAM and IBO (B refers to the Bancor protocol) in the early years both used the algorithm or protocol provided by Bancor for asset issuance. The well-known Constant Product Market Maker (CPMM) was also pioneered by Bancor. As for why Bancor later lost to UNI, there are many opinions in the information I reviewed. Some said it was a US regulatory issue, others said that the user experience was not as simple as UNI, and more in-depth issues include comparison algorithms and protocol mechanisms. We won’t go into too much detail on these issues here because, in my understanding, the logic behind UNI’s ability to catch up is very simple. It is the first Dex project that meets the definition of DeFi. Adopting the AMM model was the only way to democratize market makers and asset issuance during that period. The on-chain order book model or the exchange that mixed on-chain and off-chain would never allow users to list tokens at will. On the other hand, using Investors are also unable to participate in market creation or provide liquidity to make profits, which leads to the common problems of lack of trading pairs and slow transaction matching in this type of projects. The failure of Bancor, which also uses the AMM model, lies in the rigidity of liquidity and the fact that token issuance requires the consent of the Bancor project side and the payment of currency listing fees. This project essentially still operates around the benefit decisions of centralized entities, and The "privilege" is not truly returned to the user.

The early version of UNI is indeed not easy to use in my eyes, and the short-term price fluctuates greatly (one of the inherent problems of CPMM is that the short-term price of the token can be manipulated by attackers through instantaneous large-amount transactions) , slippage caused by the inability to directly interchange between ERC20, high gas costs, no slippage protection, lack of various advanced features, etc. Although AMM solved the problems of Dex's lack of liquidity and slow transaction matching under the order book model at that time, it was destined to not be able to compete with Cex. There are not many early adopters of the V1 version, but its significance is historic. It is the first manifestation of financial democratization in Dex, an exchange with no currency listing threshold and an exchange where liquidity comes from the public. It is precisely because of the existence of UNI that meme coins are so popular today. Some projects without top-level team backgrounds can also shine on the chain. Once only some of the privileges of large financial institutions, today they also exist in everyone in the blockchain. corner.

Source: YBB Capital

UNI V2:DeFi Summer

The UNI V2 version was born in May 2020. Compared with today’s “DeFi behemoth”, the TVL of UNI V1 at that time was less than 40M. The improvements of the V2 version focus on the main shortcomings of V1, such as the short-term price manipulation mentioned above and the need to use Ethereum transfer for token exchange. In addition, a flash exchange mechanism is also introduced to improve the overall practicality. The most noteworthy thing in this version is UNI’s ideas on solving price manipulation. UNI first introduced a price determination mechanism at the end of the block, using the price of the last transaction of each block as the price of the block. That is to say, the attacker must complete the transaction at the end of the previous block and complete the arbitrage in the next block. To achieve this operation, the attacker must be able to complete selfish mining (that is, conceal the block and not broadcast it to the network) and mine two blocks in a row, otherwise the price will be corrected by other arbitrageurs, which is almost impossible to accomplish in actual operation. , the attack cost and difficulty are greatly increased. Another point is the introduction of time-weighted average price (TWAP). This mechanism does not simply take the average price of the last few blocks, but performs a weighted average based on the duration of each price. Let me make an analogy here, assuming that the prices of a certain token pair in the past three blocks are:

  • Block 1: price 10, duration 15 seconds

  • Block 2: price 12, duration 17 seconds

  • Block 3: Price 11, Duration 16 seconds

Then the value at the end of block 3 is: 10 * 15 + 12 * 17 + 11 * 16 = 488. If you want to calculate the TWAP of these three blocks, it is 488 / (15 + 17 + 16) ≈ 11.11. Through this weighted average, short-term price fluctuations have less impact on the final TWAP, and attackers need to continue to manipulate prices for a longer period of time to affect TWAP, which makes the attack more costly and difficult.

This idea can also be regarded as an effective way to combat MEV in the early stage. In addition, it also makes AMM safer and more reliable. UNI has gradually become the mainstream choice for Dex on the chain. After talking about internal improvements, let’s talk about external reasons. UNI’s rise during this period actually also had a certain amount of luck. A key event occurred in June 2020, which officially opened the golden era of blockchain, which we later often referred to as DeFi Summer. The cause of this incident was that the lending platform Compound Finance began to reward Comp tokens to borrowers and lenders, and other projects followed suit, thus bringing about stacked investment opportunities called "yield farming" or "liquidity mining" (today's Point In fact, it is a rogue version of liquidity mining). As a Dex with extremely low threshold for currency listing and the ability to proactively add liquidity, UNI is naturally the first choice to host various copycat projects for mining. The situation when “gold miners” break through the threshold is like the California gold rush in the mid-19th century, crazy. The infusion of liquidity has allowed UNI to secure the top spot in DeFi (the peak TVL of UNI V2 exceeded US$10 billion on April 29, 21). At this point, DeFi has become famous and blockchain has begun to enter the mainstream.

Image source: DeFiLlama

UNI V3: Starting the long road to fight against Cex

UNI has been the standard answer for AMM-type Dex since the V2 version. It can be said that the core architecture of 99% of similar projects of that era was almost the same as UNI. At this time, the enemy in UNI's heart may no longer be Dex, but Cex. Compared with the efficiency of centralized exchanges, a big problem with AMM is the low utilization rate of funds. For ordinary users, providing liquidity for non-stable currency trading pairs involves a huge risk of impermanent losses, such as in 20 - In the DeFi Summer at the beginning of 21, it is common for principal to return to zero in order to obtain liquidity mining income. If you want to continue to make profits in LP, the best choice is naturally stablecoin trading pairs, such as DAI-U, etc., which results in a considerable part of the funds in TVL not having much practical effect. On the other hand, the liquidity of V2 is evenly covered in all price ranges from 0 to ∞. Even if some price ranges never occur, liquidity is also covered in them. This is a manifestation of low fund utilization in V2.

To solve this problem, UNI introduced Concentrated Liquidity in the V3 version. Unlike V2, where liquidity is evenly distributed throughout the price range, V3 allows LPs to concentrate their funds in a specific price range of their choice. LP funds are only used within price ranges, rather than spread across the entire price curve. This allows LPs to provide the same depth of liquidity with less capital, or a greater depth of liquidity with the same capital. This approach should be particularly beneficial for stablecoin trading pairs that trade within a narrow range.

But in specific cases, the results of V3 are not as good as imagined. The reality is that most people will choose to provide liquidity within the range of expected price fluctuations. This means that these high-yield areas will be flooded with funds, causing capital accumulation, while other areas will still lack liquidity. Although the capital utilization efficiency of individual LPs has improved, the distribution of overall funds is still uneven and will not significantly improve the problem of low capital utilization efficiency in V2. In terms of liquidity efficiency, it is not as good as the price box proposed by Trader Joe during the same period; in terms of stablecoin pair trading optimization, it is not as good as Curve. And with the advent of Layer 2, Dex, which is mainly based on the order book model, is likely to occupy a high position again. At this time, UNI had not yet realized its dream of conquering Cex, but instead fell into the embarrassment of a "midlife crisis."

UNI V4: Ten Thousand Hooks Interpretation

UNI V4 is a major update that was carried out two years after V3. This has been analyzed in more detail in our past research reports. I will only briefly state it here. Compared with the V3 version two years ago, the core of V4 lies in its pursuit of customization and efficiency. The V3 version needs to introduce a centralized liquidity mechanism to improve capital utilization efficiency, but trading positions require LPs to accurately select price ranges, which has certain limitations and may easily face the problem of insufficient liquidity under extreme market conditions. In comparison, the Curve protocol and Trader Joe’s mentioned above offer better options.

The updated advantage of the V4 version is to achieve the best balance between customizability and efficiency, in order to achieve accuracy and capital utilization that exceed both. The most important Hooks (also smart contract) mechanism gives developers unprecedented flexibility, allowing developers to insert custom logic at key points in the liquidity pool life cycle (such as before/after transactions, LP deposits/withdrawals) . This allows developers to create highly customized liquidity pools, such as supporting time-weighted average market makers (TWAMM), dynamic fees, on-chain price orders, and interaction with lending protocols.

On the other hand, V4 adopts Singleton's singleton structure to replace the Factory-Pool architecture that V1 has used to this day. It concentrates all liquidity pools in one smart contract, allowing developers to build more Lego bricks. This greatly reduces the gas cost of creating liquidity pools and cross-pool transactions (by 99%), and introduces the "Flash Accounting" system to further optimize gas efficiency. As an update at the end of the 23-year bear market, UNI V4 has greatly restored its position of gradually being at a disadvantage in the AMM competition. But the high degree of customization of V4 also brings some problems. For example, developers need to have greater technical skills to take full advantage of the Hooks mechanism, and they need to be carefully designed to avoid security vulnerabilities. In addition, highly customized liquidity pools may also lead to market fragmentation and reduce overall liquidity. All in all, V4 represents an important direction in the development of DeFi protocols - highly customized and efficient automated market maker services.

Source: YBB Capital

UNI Chain: Toward the most efficient

UNI Chain is a major update announced recently, and it also symbolizes that the future direction of Dex may be to become a public chain (but what puzzles me is that UNI Chain is not an application chain). UNI Chain is built on Optimism's OP Stack. The core goal of the chain is to improve transaction speed and security through innovative mechanisms, and ultimately capture the value of the protocol itself to reward UNI token holders. Its core innovation is reflected in three aspects:

  1. Verifiable block construction: Utilizing Rollup-Boost technology in cooperation with Flashbots, combined with the Trusted Execution Environment (TEE) and Flashblocks mechanism, to achieve fast, secure and verifiable block construction, reduce MEV risks, increase transaction speed and provide rollback protection;

  2. UNIchain Verification Network (UVN): Incentivizes verifiers to participate in block verification through UNI token pledge, solves the risk of centralization of a single sequencer, and improves network security;

  3. Intent-driven interaction model (ERC-7683): ​​Simplifies the user experience, automatically selects the optimal cross-chain transaction path, solves the problems of liquidity fragmentation and inter-chain interaction complexity, and is compatible with OP Stack and non-OP Stack chains.

Simply put, it is MEV-resistant, decentralized sorter, and intent-centered user experience. UNI becoming a member of the super chain will undoubtedly make the OP alliance stronger again. However, this is bad news for Ethereum in the short term. The departure from the core protocol (UNI accounts for 50% of Ethereum’s transaction fees) will once again make it worse for the fragmented Ethereum. But in the long term, this may be an important opportunity to verify the Ethereum rental model.

Conclusion

At present, as the performance of infrastructure exceeds the capacity of DeFi applications, more and more Dex are beginning to turn to the order book model. No matter how simple AMM is, it only needs an order book model with high performance, and the capital utilization rate of AMM will never be higher than that of the order book. So will AMM disappear in the future? Some people think that AMM is just a product of a special era, but I think AMM has become a totem of Web3. As long as memes exist, AMM will exist; as long as bottom-up demand exists, AMM will exist. One day in the future, we may see UNI being surpassed, or even UNI launching an order book, but I believe this totem will remain forever.

On the other hand, today's UNI has also begun to become more centralized, and was "vetoed" by a16z in terms of governance. It charges fees on the front end without informing the community. One thing we have to admit is that the way Web3 develops is deviating from human nature and reality. How we want to coexist with these suddenly growing giants is a question we all must think about.

References
UNIswap Documentation

Re-examining the Bancor algorithm and why cw is an invalid design

UNI swapX R&D: Summarize the V1-3 development link and interpret the principle innovation and challenges of the next generation DEX

UNI swap: from zero to infinite

YBB Capital: Farewell to Fork Swap, is UNIswap V4 entering the era of "The Romance of Ten Thousand Hooks"?

[Disclaimer] There are risks in the market, so investment needs to be cautious. This article does not constitute investment advice, and users should consider whether any opinions, views or conclusions contained in this article are appropriate for their particular circumstances. Invest accordingly and do so at your own risk.

  • This article is reproduced with permission from: (Shenchao TechFlow)

  • Original author: YBB Capital Researcher Zeke