What is Uniswap

What is Uniswap

By D3F1 | DeFi Box | 6 Jul 2020


ab5d2935509d9cd7047e5172cbf9e1caa01986d474464847d77b4e2138c2d3b4.png

Uniswap describes itself as an “Automated Liquidity Protocol” on its homepage. Put simply, it is a decentralized exchange protocol that allows users to swap ERC20 tokens in a trustless manner or add liquidity to the protocol reserves to earn a commission.

The platform is a decentralized exchange (DEX) built on top of the Ethereum blockchain and it is one of the most widely used products out of the DeFi industry as it provides a way to trade cryptocurrency in a completely non-custodial manner as all swaps occur on-chain.

The key distinction between Uniswap and other DeFi products is the fact that Uniswap is trying to combat the problem of low liquidity in the industry by allowing everybody to provide liquidity rather than relying on an order book that matches buyers and sellers.

The way this works is entirely to do with the architecture behind the Uniswap protocol itself. As mentioned, it is built on top of the Ethereum blockchain through a set of smart contracts that allow liquidity providers to come and deposit cryptocurrency to add liquidity to the protocol. Liquidity providers must provide an equivalent amount of ETH to the ERC-20 token that they would like to add liquidity.

If the token that a liquidity provider wishes to add is not already listed, they can go ahead and make their own exchange pool to create an entirely new market on Uniswap without the need for any permission.

aa350b87d5a9cd7ff940c69899b57380d6952cad2b6881aba05a5c2f7f4fa3f7.png

The goal of Uniswap is completely in line with the entire DeFi ethos as it aims to lower the barriers of entry to financial participation as well as removing any central point of failure. 

How Does It Work?

Uniswap works by creating markets automatically and this allows users to come and trade tokens through the markets that are created. Its pricing model is known as the Constant Product Market Maker Model that uses an equation to set prices on the exchange for each individual liquidity reserve.

The equation is simple; x * y = k

x= quantity of ETH tokens

y= quantity of ERC20 tokens

k= constant value

This equation uses the balance between the ERC20 tokens and ETH tokens to determine the price of a token through the supply and demand. If a user buys an ERC20 token with ETH, the supply of the ETH token will increase whilst the supply of the ERC20 token will decrease, which leads to an increase in the price of the ERC20 token.

The Uniswap protocol itself consists of two smart contracts; An Exchange Contract and a Factory Contract - both written in Vyper smart contract programming language.

Each liquidity reserve for an ERC-20 token has its own separate exchange contract on the protocol. This exchange contract holds both the ERC-20 token and an equal reserve of ETH. 

The factory contracts are used to deploy any new exchange contracts for ERC20 tokens that do now already have an exchange contract or a liquidity reserve on the Uniswap protocol.

These two smart contracts provide the backbone that allows anyone to provide liquidity in any ERC20 market. Traders can then come and use these liquidity reserves to make trades on the Uniswap platform. 

The History of Uniswap

Founded by Hayden Adams in November of 2017 after he was laid off from his first job as a Mechanical Engineer at Siemens the year before. Adams would introduce Uniswap publically by posting the following tweet announcing the launch of Uniswap to his, at the time, 200 followers;

At the time, Adams had been working on a Proof-of-Concept for his product in which he wrote his very first smart contract and created a website as an interface;

9bb2afa461efcf0149e5ec489b1bf2c30c7a50eb329dbf6691a5d9c475d28c26.png

You can still see the original Uniswap design here.

The thing that stood out to Adams which was different from other DEX’s at the time was that the user interface of Uniswap was much less cluttered than that of competition. Somehow, the simple interface of Uniswap felt so much more intuitive to Adams than the other exchange interfaces that were built with traders in mind.

Adams knew there was an audience, like himself, that would gladly prefer a much more simple interface to trade coins.

At the time, the platform would only work for a single ETH/ERC20 pair and for one liquidity provider - a severe problem that Adams had to fix next. 

These two problems were fixed by January 2018, however, Adams was financially struggling at the time. Being unemployed a few months, his crypto stash was quickly dwindling.

In April 2018 he set off for South Korea to head to the Deconomy 2018 event - without an entrance ticket. Luckily, he managed to meet Vitalik Buterin who advised him to apply for an Ethereum grant and suggested re-writing the smart contracts in the coding language Vyper. 

As you could imagine, Adams immediately began to re-write the smart contracts after returning home.

By May 2018, Adams had decided he wanted to take Uniswap to full completion and mapped out everything that needed to be finished. He then applied for an Etheruem Foundation grant of $50,000 after receiving a quote from Runtime Verification to review and refactor the code for Uniswap.

Uniswap would receive this grant from the Ethereum Foundation in July 2018. Adams would immediately contact Runtime Verification and get the code up to scratch.

Adams would work like a mad man to get Uniswap up and functioning as quickly as possible. By November 2nd, 2018, on the final day of Devcon 4, the Uniswap smart contracts were deployed on the Ethereum mainnet and uniswap.io and uniswap.exchange were deployed.

Team Behind Uniswap

Hayden Adams - Founder

1d5800b71aea845d8d71798b3f6b91c780979887158c4e5ba20dfc3a8408647f.png

Previous Experience;

  • Vista Wearable (Mechanical Engineer)
  • Siemens (Engineer)

Hayden Adams is a Mechanical Engineer from Brooklyn, New York, who founded Uniswap. Adams studied at Stony Brook University from 2012 until 2016 in which he graduated with a B.E. in Mechanical Engineering. During his time at university, Adams would gain experience as a researcher for Columbia University Medical Center and a Mechanical Engineering Intern at Vista Wearable Inc.

Upon graduating, Adams would take a role as an Engineer at Siemens in Melville, New York. As mentioned earlier, Adams would be laid off during July 2017 and would go on to found Uniswap in October of the same year.

Features & Use Cases

Uniswap allows users to do the following;

c747d84a979ab26fe592edf5fc56af710ab1bafbd1c62aacffeacdf203f53af1.png

  • Swap tokens
  • Send tokens
  • Add/Remove liquidity
  • Adding new liquidity reserve
  • Flash Swaps

The Uniswap protocol also allows developers to easily integrate the Uniswap exchange feature into their own applications just by adding a simple line of code.

Let us go through each of the features of Uniswap and explain them in a little more detail.

Swapping Tokens

Swapping tokens is one of the main features of Uniswap. Users simply have to head to the main interface to be presented with the following screen;

45df05b11f3169f2ee15fa2a278dad14476989b12b8005315c4dc6deab74721e.png

This allows users to easily swap tokens through a user-friendly interface. Just simply select the coin you would like to swap from and the token you wish to receive and hit swap. 

The exchange charges a flat fee of 0.3% for the exchange on both sides.

Users can trade between the following options;

  • ETH to ERC20 trade - 0.3% ETH fee
  • ERC20 to ETH trade - 0.3 ERC20 fee
  • ERC20 to ERC20 - 0.3% ETH fee + 0.3% ERC20 FEE (for each swap)

Sending Tokens

Hitting the “Send” tab on the interface allows users to easily send cryptocurrency to any address. Simply select the cryptocurrency to send and enter the destination wallet address and hit send;

fe3be35fff2d21a345167286c300134c5ec99990496b4f38d1ec24a219f1d737.png

Adding Liquidity

Anybody can add liquidity to any reserve on the Uniswap protocol and earn from the 0.3% fee generated from each trade. 

When a user adds liquidity to a pool, a Uniswap liquidity token (ERC20 compliant) is minted which represents the amount of pool share the liquidity provider owns. The amount of fee revenue paid to the liquidity provider is based on the number of liquidity tokens they own. 

To remove liquidity from the pool the liquidity provider must burn these liquidity tokens.

To add liquidity the user heads over to the “Pool” page and Joins A Pool.

85cb5c63eb35e2f5e64544a0452215d9ea97de927f824e08615f2a1d97b01f75.png

The user simply has to enter the amount of ERC-20 liquidity they would like to add and the equivalent amount in ETH will also show up.

Adding New Liquidity Reserves

Adding a new liquidity reserve is similar to joining a pool, however, the user creates the reserve pool themselves because it was not previously available.

Flash Swaps

Flash swaps are a feature on Uniswap that allows the user to take out loans that are repaid in one single transaction. Aave is the first-ever DeFi platform to introduce Flash Swaps. These Flash Swaps (A.K.A Flash Loans) are executed optimistically which means if the token can be requested and send to an address before payment is collected - so long, as the payment occurs before the end of the transaction.

Put simply, Flash Swaps allow users to take out uncollateralized loans which can be used for any purpose so long as the Flash Swap is borrowed and repaid in the same transaction.

As you can imagine, a strong grasp on coding is required to take out a Flash Swap on Uniswap and it is not accessible to everybody. This is because there is no interface available to conduct the Flash Swap just yet which means that it has to be executed through code.

Milestones

Since launching Uniswap in November 2017, the largest milestone by far is the launch of Uniswap V2 in May 2020;

This upgrade introduced key stability and performance improvements to the entire platform. The interface for V2 was also upgraded to bring a new feel to the Uniswap dashboard. The V2 upgrade allowed for direct token-to-token swaps without the need for going through an intermediary ETH swap. 

V2 also saw the introduction of flash swaps into the Uniswap protocol. 

In April 2020, the largest cryptocurrency exchange in the world, Coinbase, announced that they would be investing $1.1 million worth of USDC into the Uniswap USDC liquidity pool in the hope to encourage growth in USDC and DeFi;

The Uniswap protocol was still performing very well even before the V2 upgrade. For example, in March 2020, the Uniswap exchange had seen the highest volume relative to all of the other DeFi DEX protocols that are available;

The following image shows a visualization of how popular Uniswap was relative to the rest of the DeFi industry in April and May 2020;

8b929948084fbe3ea962a841389be396dc841b304d11eb0aef8d8ce31abc778d.png

The image shows that Uniswap was the largest DeFi protocol during April and May 2020. It was closely followed by Kybe, Maker, and Augur.

In fact, by June 2020, Uniswap actually managed to conduct over $445 million trades on Uniswap - in one month alone;

In that same month, the liquidity providers earned over $1.3 million in fees which equates to $16 million a year. To compare, Hayden also included the fact that in June 2020 all the BTC miners combined earned $12 million in TX fees. This shows that, although the profit for Uniswap liquidity providers is still less than BTC miners, the profits are still increasing over time;

Conclusion

Uniswap is one of the leading projects to come out of the entire DeFi industry. Whilst other DeFi DEX’s provide complex trading interfaces with highly specialized trading tools, Uniswap decides to go in the totally opposite direction by releasing an interface that would be easy for anybody to use.

The entire protocol is one of the main centerpieces of the entire DeFi world. The protocol allows users to lend and trade whilst at the same time earning revenues from any liquidity provided.

 


D3F1
D3F1

Yet another defi fan


DeFi Box
DeFi Box

DeFi world in a nutshell.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.