DEV Community

alabulei1
alabulei1

Posted on

Saving Uniswap v1

New Ethereum compatible projects like the Oasis Ethereum ParaTime are choosing Uniswap v1 over v2 for good reasons. Few understand this. 🤔

In the world of software, a new release typically means improvements every user should upgrade to. 🎉 For Uniswap, however, v2 is simply different software than v1. Uniswap v2 is a complete rewrite with exciting new features, but the developers also made compromises in terms of cost, complexity, (de)centralization, and openness. 😿 As a result, for many users and developers, there are compelling reasons to stick with v1. I think the community should invest the effort to keep Uniswap v1 software maintained and viable. Now, let me explain.

A brief history

The idea of Automated Market Making (AMM) is not new. Bancor, one of the most successful ICO projects (in terms of money raised), is built on the idea of AMM. However, Bancor never took off because it needlessly complicated the user experience by bringing in a “smart token” into the system, which is great for the ICO but adds little value to the trading experience itself. Furthermore, while Bancor’s smart contracts are open source, its user interface application is never fully open making it difficult for outside developers to build or improve upon it.

Then comes Uniswap. Created by a young and ambitious developer in a rising programming language (Vyper), it laser-focused on the trader’s user experience. Uniswap v1 has a very simple AMM formula. It is easy to understand and use, with an intuitive UI. Uniswap v1 smart contracts are highly optimized for gas efficiency. Its entire code base is open source and easily reusable by developers in the community. I, as a developer and crypto user, loved Uniswap v1.

Then, comes Uniswap v2. It is an engineering achievement and designed to meet expectations of its investors and liquidity providers — as evident from the popularity of the UNI token. For users, it enables direct swapping between pairs of ERC-20 tokens as well as flash swaps in atomic transactions. But it also makes important compromises and sacrifices. In the rest of this article, I will make the case for continued v1 development by the community.

Centralization / Decentralization

The first page of the Uniswap v2 whitepaper reveals that, unlike v1, a centralized private key could take a percentage (0.05%) of the fee on every trade.

“there is a private key that has the ability to update a variable on the factory contract to turn on an on-chain 5-basis-point fee on trades.” — The Uniswap v2 whitepaper

This fee is sent to an address of the contract’s owner controls. The mere existence of an “owner” is uncomfortable in a project that champions decentralization.

Furthermore, Uniswap v2 apparently allows a centralized party to mint and distribute governance tokens for the entire project. While I appreciate UNI airdrop, it is a slippery slope toward centralization.

Gas cost

One of the best features of Uniswap v1 is its gas efficiency. That is especially important for users as Ethereum gas fees reach new heights during the DeFi boom.

However, Uniswap v2, with its complicated and inter-dependent smart contracts, costs much more in gas fees compared with v1. Uniswap v2 relies on smart contracts ranging from the Factory, Router (V2), Pair and Pair ERC20 contracts, along with a Library contract for common utilities. Let’s take the proxy contract as an example. The proxy contract on Uniswap v1 is 46 bytes, however, the same contract on Uniswap v2 is 4349 bytes. The increased complexity translates to inflated gas fees for users.

“I noticed the fees are a bit higher and it actually have me a notification to use v1 for my swap” - Comment from Reddit.

Now, to be fair, the added complexity does bring use of more features.

  • ERC-20 to ERC-20 swap and quick swap are nice-to-have features.
  • The pricing oracle is not relevant to me as an end-user.

As a user, I prefer the cheaper and simpler v1 when I just need to swap ERC-20 tokens against ETH.

i18n

Many non-English crypto users are dismayed to find that Uniswap v2 does not provide i18n support for non-English languages. Uniswap v1 already had decent i18n support, and this feature was actually removed in v2.

Fun fact: the Uniswap v1 i18n interface for non-English languages was contributed by Maggie Wang from CyberMiles.

As the crypto community grows more diverse, Uniswap’s regression to English-only does not bode well for its position as a worldwide DeFi leader.

Portability

The Uniswap v2 user interface (UI) is a complex JavaScript application. It is designed to deploy on Ethereum mainnet and various testnets. It requires a major effort to deploy the Uniswap v2 UI on any other Ethereum compatible blockchain as extensive code level changes must be made to modify hardcoded values such as the following.

  • The on-chain addresses and hash values of various important contracts, such as the Router.
  • The web3 gateway provider’s URL structure.
  • The chain ID of the host blockchain.
  • Token list locations.

In contrast, the Uniswap v1 UI code is much simpler and cleaner. It is easy to run the Uniswap v1 UI on an alternative Ethereum blockchain, such as the Oasis Ethereum ParaTime chain.

User interface

The Uniswap v2 UI was originally deployed with a toggle button where users could choose to use v1. Whilst the toggle did not actually fully allow the user to stay on v1 — i.e. functions in relation to liquidity would automatically default to operating partially via the V2 smart contracts, the toggle has since been removed. Put simply, the current “official” Uniswap UI is geared wholly and solely towards herding users to the v2 smart contracts and liquidity pools. Leaving the original v1 smart contracts on the sidelines.

What’s next

Most of Uniswap liquidity has moved to v2. According to data from the official Uniswap V1 analytics tool in later Oct 2020, there are just $4 million in liquidity on Uniswap v1, and 742 transactions in the past 24 hours. That is a fraction of the volume of Uniswap v2, which is $2.9 billion in liquidity and 137,255 transactions in the past 24 hours.

Uniswap V1 & V2

Due to the strong network effects of exchanges, there is probably no turning back on Ethereum mainnet, although I will miss v1’s simplicity and low fees.

However, on emerging Ethereum compatible blockchains, I believe many developers and users will still choose Uniswap v1 as the go-to DeFi exchange. The Uniswap v1 codebase should be revived and maintained by the community for this very purpose.

Top comments (2)

Collapse
 
joshh71390 profile image
joshh71390

hello, im reading this and i decided to just throw in a secondary word.

Im new to the dev world so take my words as very lightly but...

I think the 0.05 % fee is not a huge compromise...

Why do you think they have things like the MASSIVE code bug bounty / pay for people to build upon it / Have a core team of engineers that arent just cloning the repo. They made the repo.

Hosting something like this on godaddy 1 dollar a year shared hosting isnt going to be nearly as effient as whatever elaborate setup you can achieve with the money they raise off of this.

While the haunting thoughts of someone else making a meer 0 . 0 5 percent on a tool that he made and you wanted to use, then you should find another way to do that thing. Imagine a world that noone could make anymoney doing anything . there would be zero reason for ANYONE to be involved in crypto

Also. with decentrilization and such people use the word as a reason to say something is good or bad, for instance bit torrent file system. or ifps whatever... a huge argument people have why it might be better then say google servers / or amazon... they stay up when amazon is a central location.

lets go over the decentralized route. Say it breaks up ur file into 500 pieces and encrypts them to peoples computers... do you think some guy running a rasbery pi is going to be a more secure hhost than a company that if theyre servers are down your internet is probably also down . so it doesnt matter either way.

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Please write more articles about DeFi. It's such an interesting world of its own, but only few developers are involved in it.