Uniswap protocol is a decentralized exchange (DEX) that makes it easier for users to swap an ERC-20 token for another ERC-20 token without the need for a centralized intermediary. With a DEX, traders do not have to deposit their tokens on an exchange and be exposed to the security risks of a centralized exchange. Users just need an Ethereum wallet like Metamask and they can immediately start swapping tokens. Users can then swap tokens directly without the need for an orderbook.
This works using an Automated Market Maker (AMM) where Liquidity Providers (LP) deposit tokens into the smart contract and this liquidity then provides a price quote to traders without relying on any professional market makers. Liquidity Providers are compensated with a 0.3% trading fee for providing liquidity on the protocol.
Remember, we should make clear the distinctions between the different areas of "Uniswap", some of which may confuse new users.
- Uniswap Labs: The company which developed the Uniswap protocol, along with the web interface.
- The Uniswap Protocol: A suite of persistent, non-upgradable smart contracts that together create an automated market maker, a protocol that facilitates peer-to-peer market making and swapping of ERC-20 tokens on the Ethereum blockchain.
- The Uniswap Interface: A web interface that allows for easy interaction with the Uniswap protocol. The interface is only one of many ways one may interact with the Uniswap protocol.
- Uniswap Governance: A governance system for governing the Uniswap Protocol, enabled by the UNI token.
Uniswap launched in November 2018, Uniswap created and awarded its own governance token, UNI, to past users of the protocol. There are currently three versions of the Uniswap protocol. v1 and v2 are open source and licensed under GPL. v3 is open source with slight modifications, which are viewable here.
Uniswap was created on November 2, 2018, by Hayden Adams, a former mechanical engineer at Siemens.
- “Vitalik did. I was originally going to call it Unipeg — a mixture between a Unicorn and a Pegasus.”
- When Karl first told Vitalik about the project he said: “Unipeg? it sounds more like a Uniswap”
Hayden Adam created Uniswap. He was influenced by multiple ideas from different sources.
- Alan Lu of Gnosis was the very first person to conceive of x*y=k market makers on Ethereum.
- Martin Koppleman of Gnosis told Vitalik about the idea.
- Vitalik saw its potential and began posting about it publicly. On his website: On Path Independence, and on Reddit: Let's run on-chain decentralized exchanges the way we run prediction markets.
- Automated liquidity protocol based on a “constant product formula”.
- Uniswap v2 enables the creation of arbitrary ERC20/ERC20 pairs, rather than supporting only pairs between ERC20 and ETH.
- Uniswap v3's concentrated liquidity allocated within a custom price range.
To understand how the Uniswap protocol differs from a traditional exchange, it is helpful to first look at two subjects:
How the Automated Market Maker design deviates from traditional central limit order book-based exchanges?
Most publicly accessible markets use a central limit order book style of exchange, where buyers and sellers create orders organized by price level that are progressively filled as demand shifts. Anyone who has traded stocks through brokerage firms will be familiar with an order book system.
The Uniswap protocol takes a different approach, using an Automated Market Maker (AMM), sometimes referred to as a Constant Function Market Maker, in place of an order book.
At a very high level, an AMM replaces the buy and sell orders in an order book market with a liquidity pool of two assets, both valued relative to each other. As one asset is traded for the other, the relative prices of the two assets shift, and a new market rate for both is determined. In this dynamic, a buyer or seller trades directly with the pool, rather than with specific orders left by other parties.
How permissionless systems depart from conventional permissioned systems?
The second departure from traditional markets is the permissionless and immutable design of the Uniswap protocol. These design decisions were inspired by Ethereum's core tenets, and our commitment to the ideals of permissionless access and immutability as indispensable components of a future in which anyone in the world can access financial services without fear of discrimination or counter-party risk.
Permissionless design means that the protocol's services are entirely open for public use, with no ability to selectively restrict who can or cannot use them. Anyone can swap, provide liquidity, or create new markets at will. This is a departure from traditional financial services, which typically restrict access based on geography, wealth status, and age.
The protocol is also immutable, in other words not upgradeable. No party is able to pause the contracts, reverse trade execution, or otherwise change the behavior of the protocol in any way. It is worth noting that Uniswap Governance has the right (but no obligation) to divert a percentage of swap fees on any pool to a specified address. However, this capability is known to all participants in advance, and to prevent abuse, the percentage is constrained between 10% and 25%.
The defining idea of Uniswap v3 is concentrated liquidity: liquidity that is allocated within a custom price range. In earlier versions, liquidity was distributed uniformly along the price curve between 0 and infinity.
The previously uniform distribution allowed trading across the entire price interval (0, ∞) without any loss of liquidity. However, in many pools, the majority of the liquidity was never used.
Consider stablecoin pairs, where the relative price of the two assets stays relatively constant. The liquidity outside the typical price range of a stablecoin pair is rarely touched. For example, the v2 DAI/USDC pair utilizes ~0.50% of the total available capital for trading between $0.99 and $1.01, the price range in which LPs would expect to see the most volume - and consequently earn the most fees.
With v3, liquidity providers may concentrate their capital to smaller price intervals than (0, ∞). In a stablecoin/stablecoin pair, for example, an LP may choose to allocate capital solely to the 0.99 - 1.01 range. As a result, traders are offered deeper liquidity around the mid-price, and LPs earn more trading fees with their capital. We call liquidity concentrated to a finite interval a position. LPs may have many different positions per pool, creating individualized price curves that reflect the preferences of each LP. More please visit: https://docs.uniswap.org/protocol/introduction