Uniswap is a smart contract based token exchange that allows anyone to swap Ethereum-based tokens. While traditional exchanges require depositing funds to the exchange and then match orders via order books, Uniswap never takes custody of a trader’s funds and instead manages swaps through a system of smart contracts that run on the Ethereum blockchain.
The Ethereum-based protocol drew in an army of active traders, attracted billions of dollars worth of token liquidity, and built a decentralized exchange (DEX) that regularly facilitates hundreds of millions of dollars worth of token exchanges each day.
In this introductory post, we are going to explain exactly how the Uniswap protocol works (in simple terms), how the project’s native UNI token fits into the mix and finally tell you where you can chart and monitor real-time trading data from the Uniswap Exchange.
How does Uniswap 🦄 work?
The Uniswap exchange is an automated token exchange built on the Ethereum blockchain. It allows peer-to-peer trading (or swapping) of Ethereum-based ERC-20 tokens without the need of a third party or KYC checks. The popular DeFi protocol currently offers around 2000 trading pairs and as long as liquidity is provided, almost anything can be listed and traded on the Uniswap exchange.
In comparison to other centralized services, funds are never held by Uniswap. Instead, swaps are made directly from and to each trader’s wallet via a special type of Ethereum transaction.
On a centralized exchange, you typically (1) deposit tokens into the exchange, (2) place an order, (3) wait for the order to fill and (4) withdraw your tokens back into your own custody.
With Uniswap, traders (1) select two tokens they wish to trade, (2) review a proposed token swap rate, price slippage and an associated fee paid, (3) confirm a swap transaction that immediately settles the trade into the trader’s self-custodied wallet—a wallet where the trader has full control over the private keys.
Uniswap is run entirely by smart contracts and an automated market-making protocol instead of the typical order book model used by centralized token exchanges. Uniswap features a smooth frontend that interacts with a specialized smart contract to settle each trade.
All the trades are executed via reserves of tokens (called liquidity pools) combined with the automated market maker mechanism—an algorithm that keeps both sides of a market’s order book balanced. Anyone can bring liquidity into and out of these pools.
What are Uniswap liquidity pools?
Liquidity pools are essentially reserves of tokens that are locked inside Uniswap’s smart contracts and obtainable for traders to swap against.
These token reserves (liquidity pools) are filled by anyone willing to provide their assets as liquidity on the Uniswap protocol. Traders are incentivized to do this because they earn a yield. Traders staking funds into these smart contracts are known as Liquidity Providers. Liquidity Providers set the price of the pool by providing an equal value of both tokens into a pool that acts as a reserve behind an associated token swap market.
Example: Given the price of 1 ETH is equal to 300 DAI (DAI is a stable coin pegged to 1 USD). Bob wants to provide liquidity to the DAI:ETH pool. Bob needs to provide liquidity at a ratio of 1 ETH to 300 DAI to become a liquidity provider in the DAI:ETH pool. Bob could therefore stake 1 ETH and 300 DAI, 0.5 ETH and 150 DAI, 2 ETH and 600 DAI, etc in order to provide liquidity to the pool.
When liquidity is supplied to the pool, the liquidity provider (LP) receives special tokens called LP Tokens in proportion to how much liquidity they supplied into the pool. Liquidity Providers earn a portion of the 0.3% transaction fee (proportionally distributed amongst all the LP token holders) per every trade in the pool.
Token swap trading volume and pool liquidity data can all be tracked live on the Ethereum network. Currently the DAI:ETH pool has ~$170 million of token liquidity, with a 24 hour trade volume of around $17 million. Fees collected by liquidity providers in this pool totaled $53,689 over the last 24 hours.
In order for liquidity providers to get their staked assets back—plus any fees accrued while the assets were locked in the pool—Liquidity Providers must burn their LP tokens which then release their original staked assets from the Uniswap protocol.
Currently around $1.6 billion worth of tokens have been locked in Uniswap’s liquidity pools, with daily trading volumes typically exceeding $200 million a day, which generate about $1 million worth of fees per day.
Note: For more Uniswap analytics – check out this Dune Analytics Community Dashboard
Each asset transaction that the liquidity provider operates follows in a price adjustment made by a mathematical formula executed by a smart contract. This automation is referred to as the Automated Market Maker (AMM) mechanism, which we explain below.
What is an Automated Market Maker (AMM)?
When a swap is executed on the Uniswap protocol, the Automated Market Maker (AMM) is the type of smart contract that allows each trade to settle.
The AMM balances each trading pair and providing the price in any given Uniswap market. In contrast to other order book-based exchanges, there is no buy or sell on Uniswap. Instead, traders post quotes and execute token swaps via Uniswap’s Automated Market Maker smart contracts.
Uniswap’s Automated Market Maker uses a mathematical formula called a Constant Product Market Maker (CPMM) that makes sure that the product of the quantities of two tokens (x and y) supplied by the liquidity providers always remain the same (k) : [x*y=k]
Example: If we are looking at the current Liquidity Pool for DAI-ETH:
(x) is represented by the amount of ETH in the liquidity pool = 179,800
(y) is represented by the amount of DAI in the liquidity pool = 85,440,000
(k) is the product of ETH and DAI = 15,362,112,000,000
If a swap was executed in this market, the Constant Product (k) here must remain at 15.36 quadrillion, meaning for each ETH swapped for DAI—ETH is removed and DAI must be added back into the liquidity pool.
Example: If Bob buys ETH for DAI from the DAI-ETH pool:
(1) Bob will reduce the supply of ETH token and add more supply of DAI token.
(2) The price of ETH will increase (as he removes ETH from the liquidity pool) and the price of DAI will decrease (because he adds DAI to the liquidity pool).
The size of the trade will have an impact on the movement of the price in proportion to the amount of token contained in the reserves, which is why liquidity pools play a major key role in setting prices of the AMM. In other words, the bigger the pool is—in comparison to the trade—the smaller the impact on price – called slippage. See below for examples of slippage depending on trade size.
|ETH price||= 475.19$|
|ETH pool||= 179,800|
|DAI pool||= 85,440,000|
|Total Pool Liquidity||= $171,302,449|
|ETH pool portion||Price of ETH|
|Total in DAI||Slippage||DAI pool(y)||ETH pool(x)||Constant Product (k)|
Using the CPMM formula above, the pool can always provide liquidity and facilitate trade execution no matter the size of the incoming trades because this calculation asymptotically increases the price of the token.
What is the UNI token?
On the 16th of September 2020, Uniswap announced the launch of its own token, an Ethereum-based ERC-20 token under the ticker UNI. In creating this token the Uniswap team wanted to create a governance token that members of the community could use to propose and vote on changes to the protocol.
The release of the token was unique – the team did not run an ICO or any other type of token sale -but instead distributed the new token via an airdrop to any wallet that had previously used the Uniswap protocol.
Each eligible Ethereum wallet was airdropped 400 UNI tokens—worth ~$1200 based on the initial traded price of UNI.
What was the UNI token distribution?
In the creation of the new digital asset, a total supply of 1 billion UNI tokens were created with the following token distribution split: 60% for the community members, 21.51% to team members (4 year vesting period), 17.8% to investors (4 year vesting period) and finally 0.069% for advisors (4 year vesting period).
UNI token holders have the power to vote to bring new pools into the protocol or delegate their vote to a third party.
The UNI token can be used to control decisions for:
- Uniswap protocol governance – holders can vote over proposals that can help steer the future of the protocol.
- UNI community treasury – Managing the funds held in the UNI community treasury.
- The protocol fee switch – 0.05% of the fee would be collected by UNI token holders if activated.
- uniswap.eth ENS domain name – the Uniswap domain name in Ethereum’s name system
- Uniswap Default List – initiative to improve discoverability, reputation and trust in ERC20 tokens from the list.
- SOCKS liquidity tokens – a limited edition, dynamically priced pair of actual socks.
After the launch of the UNI token, the Uniswap team has no involvement in the protocol development or control over the way Uniswap works.
How are governance proposals managed?
Submitting a governance proposal requires holding 1 million UNI. UNI token votes can also be delegated or pooled together in voting blocks between wallets.
Passing a governance proposal requires a 7-day voting period, over which holders of 4% of UNI supply are to vote ’yes’ to reach quorum. Once a vote is complete, there’s a 2-day timelock* delay on execution.
Currently, there are three main forums used for Uniswap governance, each serving its own specific purpose:
|Gov.uniswap.org||A place for community members to coordinate on governance proposals and participate in discussion. |
As per the board rules, community members must register for an account before sharing or liking posts. New community members must enter 4 topics and read 15 posts over the course of 10 minutes before they are allowed to post anything.
|Snapshot||Snapshot is a voting interface that allows community members to signal sentiment off-chain. Votes on Snapshot are weighted by the number of UNI delegated to the address used to vote.|
|Governance Portal||The formal governance portal can be accessed directly through the Uniswap interface. This is where votes are delegated and cast.|
How are governance proposals passed?
There are three specific phases before a new proposal is passed on Uniswap:
- A “temperature check” to make sure there is enough interest to make changes.
- A “consensus check” in order to spark formal discussion around a proposal.
- A “governance proposal” which is put to a vote
The proposal should be related to the outcome from the phase 2 “Consensus Check” and can consist of one or multiple actions, up to a maximum of 10 “actions” per proposal.
If the proposer does not maintain their vote weight balance (equals to 1 million UNI) throughout the voting period of 7-days, the proposal may be cancelled by anyone.
Where can I chart and get alerts on Uniswap markets?
If you are looking to chart, analyze, and receive alerts on real-time data from the Uniswap exchange, you can now do so from the Cryptowatch web platform and our native Desktop app. Currently we have 117 live markets and order books available, with more pairs to be listed soon.
Have comments or questions about this blog post? Let us know below or tag us with any question @Cryptowat_ch on Twitter.