What is UNI?
UNI is an ERC-20 token introduced by the decentralised exchage Uniswap in September 2020, and serves as the platform's native governance token.
Background and History
Uniswap is the leading decentralised exchange (DEX) and replaces the order book model with liquidity pools, which are used to make markets. Each Uniswap smart contract manages a liquidity pool made up of reserves of two ERC-20 tokens, facilitating the swapping of these tokens and the addition of liquidity without any order books or centralised parties. Users can swap between tokens and are charged a fee of 0.30%.
Pools of different assets are made available for trading where the exchange rate between tokens is determined algorithmically by the ratio of the amount of tokens in each pool. Uniswap runs on a simple equation, known as the constant product formula: x*y = k;
where x is the supply of one token, y is the supply of another token and k is constant.
For any transaction that increases the amount of tokens in one pool while reducing the amount of tokens in another pool, the price will change based on the ratio between the two. Arbitrage ensures that token prices on Uniswap are not undervalued or overvalued for an extended period.
Anyone can become a market maker by adding liquidity to certain pools for different ERC-20 tokens. Liquidity providers earn a share of the 0.30% fee for each transaction, with the share proportional to the ratio between the tokens the amount of tokens they pooled and the total supply of the pool. There may be less incentive to provide liquidity to the platform if there are a shortage of trades occurring on Uniswap.
The smart contracts act as an Automated Market Maker (AMM) making it possible to list and exchange assets without a centralised order book. Uniswap is the most successful application of AMMs, which is meant to provide liquidity regardless of the order size or the amount of funds in the pool.
AMMs were first proposed in 2016 by Ethereum co-founder Vitalik Buterin, inspired by the use of an on-chain market maker for decentralised predictions markets Augur and Gnosis, but applying the concept to a decentralised exchange. The foundational ideas behind Uniswap were also introduced by Nick Johnson in 2016 and Alan Lu of Gnosis in 2017.
The creator of Uniswap, Hayden Adams, previously worked as a mechanical engineer with Seimens but was laid off from his graduate job in July 2017. Adams' friend, Karl Floersch, suggested he work on Ethereum and learn how to code, also recommending an implementation of an AMM as described by Vitalik Buterin.
The leading DEX around the time was EtherDelta, which was based on an order book model, suffered from a lack of liquidity and a poor user experience. Adams learned how to create smart contracts, and with help from Pascal Van Hecke and Uciel Vilchis, the trio released the first demo in March 2018. Before the initial launch on Ethereum's mainnet, the smart contracts were audited by Runtime Verification.
From its conception in March 2018 to becoming the largest DEX by trading volume, an overview of the key events for Uniswap is provided below:
- March 2018 - First demo of Uniswap,
- July 2018 - $100,000 grant awarded to Uniswap by the Ethereum Foundation,
- October 23, 2018 - Uniswap whitepaper published,
- November 2, 2018 - Uniswap released to Ethereum mainnet,
- April 2019 - Seed round led by Paradigm,
- October 8, 2019 - Unipig was released, which is a scalable demo of Uniswap powered by Optimistic Rollups,
- November 2019 - Uniswap overtook IDEX in terms of monthly trading volume,
- March 2020 - Uniswap v2 core contracts whitepaper,
- March 2020 - Uniswap becomes largest DEX by trading volume,
- May 18, 2020 - Launch of Uniswap v2,
- September 1, 2020 - Total Value Locked in Uniswap breached $1 billion for the first time,
- September 17, 2020 - UNI token launched on Ethereum mainnet,
- September 18, 2020 - Price of UNI token reached all-time high of $8.40,
- September 31, 2020 - Uniswap's trading volume surpassed $15 billion in one month.
Uniswap overcomes the problem of the high spreads for illiquid assets. On order-book exchanges, there's not much incentive for professional market makers to provide liquidity on thinly traded assets. With AMMs anyone can provide deposit assets to a liquidity pool and earn a yield as a market maker. However, one drawback of the Uniswap model is that there may be substantial slippage for large orders, as when the quantity demanded increases, so does the price paid.
The AMM approach is also meant to reduce the potential for manipulation. Since there's no order book, you cannot see the orders of other traders. However, the price may be volatile if the amount of assets in a liquidity pool is not sufficient. Moreover, those providing liquidity may lose their yield if a large order moves the price and new trades do not replenish the liquidity pool.
The main principle that guides Uniswap is decentralisation. All of its smart contracts are open source and users can use the platform in a trustless manner without having to rely on a third party. Anyone can connect to a Uniswap contract via web3 and create custom apps on top of them. The DEX has built up a lot of trust in its protocol as it has never experienced a hack or a fatal bug in its contracts. Also, there is no centralised approval process and anyone can create a market just by providing liquidity, supporting smaller token communities.
Anyone running an Ethereum node can interact with contracts directly. For those who do not run a node, they can interact with Uniswap with web interfaces, trade aggregators, wallets or Dapps that have integrated Uniswap natively in their smart contracts. The team decentralised the hosting of the Uniswap Interface using the IPFS (InterPlanetary File System) in June 2020. The open-source Uniswap Interface is automatically deployed to IPFS every day and community members can pin the IPFS hashes to ensure availability.
In May 2020, Uniswap introduced v2 and came with several new features:
- Direct token swaps between different ERC-20 tokens while the first version only enabled swaps between ERC-20 tokens via ETH using a process known as ETH bridging. Wrapped Ether (WETH) is used instead of native ETH in the core contracts.
- Lower gas fees were also another improvement since direct ERC-20 to ERC-20 swaps halved gas fees for these transfers. Also, the contracts were re-written in Solidity to optimise contract execution and reduce gas fees.
- Price oracle functionality that allow time-weighted average pricing based on token pair prices at each block.
- Another major addition was support for non-standard ERC-20 tokens such as USDT and BNB, which means more potential liquidity pools for popular tokens.
- Finally, flash loans were another major feature introduced in v2, which allows users to borrow tokens from a Uniswap pool, perform some transaction with external services, and then pay back the borrowed tokens to the pool with a single transaction. Flash loans increased the number of arbitrage opportunities and have led to wider adoption.
The liquidity mining trend was sparked in summer 2020, kicked off by DeFi money market Compound with the release of its governance token, COMP. By August, the trading volume on Uniswap was up to $150 million and provided liquidity increased to $300 million on the back of the yield farming craze, with the DEX experiencing exponential growth in a short span of around two months.
By the end of August 2020, a clone of Uniswap emerged called SushiSwap, which added its own governance token and introduced its own revenue sharing scheme to the AMM model. SushiSwap forked Uniswap (which is possible since it is an open source project), added rewards for Uniswap's liquidity providers with its own token (i.e., SUSHI token) and eventually siphoned liquidity into the SushiSwap platform, in what is known as vampire mining.
Despite the launch of SUSHI token, liquidity and trading volume remained robust for Uniswap where both metrics have remained higher than prior to the launch of SushiSwap. In response to the vampire mining scheme, Uniswap released the UNI token in a strategic move to retain its position as the leading DEX and prevent a mass exodus of liquidity providers.
The UNI token is used in the protocol's on-chain governance system to ensure that the development of the DEX is eventually in the hands of the community. The Uniswap Governance Forum contains all discussions about governance proposals.
The initial governance parameters for proposals are:
- 1% of UNI total supply (delegated) to submit a governance proposal,
- 4% of UNI supply required to vote ’yes’ to reach quorum,
- 7-day voting period, and
- 2-day timelock delay on execution.
Economics
UNI Demand
UNI is a governance token, where holders are responsible for governing the protocol. Users can vote on each proposal or delegate their votes to a third party through the governance portal. Token holders can cast their vote to help steer the future direction of Uniswap, manage the funds held in the UNI community treasury, and determine the tokens that belong on the Uniswap default token list.
Another important aspect of UNI's utility is revenue sharing. The governance contract contains a fee switch which, if activated, will enable UNI holders to earn a portion of the protocol's fees (similar to the SUSHI fee model). The switch is subject to a 180-day timelock, giving investors and liquidity providers half a year to prepare for the shift to this new revenue sharing model if it occurs.
A vote on the fee switch vote may see the revenue sharing feature implemented by February 16, 2021, and the UNI token will accrue real value from the earnings of the decentralised exchange, which is currently the leading decentralised application in terms of annualised revenue.
UNI Supply
A total of 1 billion UNI tokens were minted at genesis and will become accessible over the course of four years.
The initial four-year allocation is as follows:
- 60% to Uniswap community members (amounting to 600 million UNI),
- 21.266% to team members and future employees with four-year vesting (212.66 million UNI),
- 18.044% to investors with four-year vesting (180.44 million UNI), and
- 0.69% to advisors with four-year vesting (6.9 million UNI).
Source: Uniswap.org
The token does not have a capped supply. The supply of UNI is inflationary with a fixed inflation rate. A perpetual inflation rate of 2% per year will be initiated after four years, ensuring continued participation and contribution to Uniswap at the expense of passive UNI holders.
After ten years of inflation, the allocation of UNI tokens will eventually be distributed as shown by the pie chart below, with 67.19% allocated to the community, 17.65% to the Uniswap team, 14.60% to investors and 0.57% to advisors:
Source: Uniswap.org
A total of 150 million UNI tokens were immediately available to be claimed by historical liquidity providers, users, and SOCKS redeemers/holders based on a snapshot ending September 1, 2020, at 12:00 am UTC.
Of these 150 million tokens:
- 49,166,400 UNI have been distributed to all 49,192 historical Liquidity Providers, accounting for liquidity on a per-second basis since the deployment of Uniswap v1. Rewards were weighted towards Liquidity Providers that provided liquidity when total liquidity was low.
- 100,613,600 UNI were distributed evenly to all 251,534 historical user addresses. Every address that has ever called the Uniswap v1 or v2 contracts received an airdrop of 400 UNI, and
- 220,000 UNI were allocated to SOCKS holders/redeems. Each address that has either redeemed SOCKS tokens for physical socks or owned at least one SOCKS token at the snapshot date received 1000 UNI.
With 15% of tokens already available to be claimed by historical users and liquidity providers, the governance treasury will retain 43% of the total supply (430 million UNI) to distribute on an ongoing basis through various programs such as contributor grants, community initiatives, liquidity mining, etc.
UNI will vest to the governance treasury on a continuous basis over four years.
- Year 1: 172 million UNI (40%)
- Year 2: 129 million UNI (30%)
- Year 3: 86 million UNI (20%)
- Year 4: 43 million UNI (10%)
Team, investor, and advisor UNI allocations will have tokens locked up on an identical schedule. The team have stated that they will not participate directly in the governance process, although they might delegate votes to protocol delegates without influencing their voting decisions.
A further 20 million UNI will be allocated to the community via liquidity mining across four pools. These pools enable anyone to farm UNI by providing liquidity: the pools are USDT/ETH, USDC/ETH, DAI/ETH and WBTC/ETH. A total of 5 million UNI tokens are allocated to each pool and were allocated to Liquidity Providers between September 18, 2020 and November 17, 2020 (with UNI distributed in proportional to the liquidity provided).
Pool subsidies are a defense against 'vampire mining' but they also weigh on UNI holders (as liquidity providers farm the token and may dump UNI onto the market, representing a constant source of selling pressure). New liquidity mining programs will have to be proposed and voted on by the community.
Technology
Uniswap V2 is described as a binary smart contract system, made up of two categories of contracts written in Solidity: Core and Periphery. The Core contracts provide safety guarantees with all participants of Uniswap while Periphery contracts interact with one or a number of core contracts.
The Core consists of a singleton factory and many pairs, which the factory is responsible for creating and indexing. The factory contains the generic bytecode that is used to power pairs and the main function is to create only one smart contract per unique token pair. The factory also contains logic to turn on the protocol fee switch.
The purpose of Pairs are to serve as automated market makers, keep track of pool token balances, and expose data which can be used to build decentralized price oracles.
Periphery contracts are designed to support domain-specific interactions with the core and are used for most purposes. The library provides a variety of convenience functions for fetching data and pricing. The router, which uses the library, fully supports all the basic requirements of a front-end offering trading and liquidity management functionality.
End users interact with the Uniswap protocol through the interface with in turn interacts with the underlying smart contracts. Developers can interact directly with the smart contracts and integrate Uniswap functionality into their own applications in a permissionless way without having to rely on intermediaries.
The main components of Uniswap v2 (swaps, pools, flash swaps and on-chain price feeds) are detailed below:
Swaps
To perform a swap, the user picks an input token and an output token. They specify an input amount, and the protocol calculates how much of the output token they’ll receive. The swap is executed, receiving the output token in their wallet immediately. At the most basic level, all swaps in Uniswap V2 happen within a single function 'swap'.
The exchange rate of the token is calculated based on the supply and demand of two tokens in the pool, with what is termed the constant product formula, i.e., x*y = k where k is a constant. Token values in a particular pair are calculated based on supply and demand, where the value moves along a curve of the formula, shown below. This is known as the constant product market maker, a variant of AMM. The AMM mechanism provides instant feedback on rates and slippage.
If there is large demand for B token and quantities in the pool are depleted, then the price will increase and move along the left side of the curve. However, if the B token has plenty of supply and no demand as compared to A token, the price will level out on the right side of the curve. Because of these mechanics, Uniswap relies on arbitrage trades to keep the value of the token in line with the rest of the market.
Pools
Each Uniswap liquidity pool is a trading venue for a pair of ERC-20 tokens. An initial price for the pool is set by the first liquidity provider and they are incentivised to deposit an equal value of both tokens. If the initial liquidity provider deposit assets at a different ratio, a profitable arbitrage opportunity then arises.
Liquidity providers must deposit pair tokens proportional to current price if they wish to add to an existing pool. If not, then their liquidity that is added may be arbitraged. Pools enable Uniswap to function without an order book to derive the price of an assets or to match buyers and sellers of tokens. A pool is just a smart contract operated by users calling functions on it. Swapping tokens is calling 'swap' on a Pool contract instance, while providing liquidity is calling 'deposit'.
v2 pairs accept tokens in the follow process: pairs check their token balances at the end of every interaction. Then, at the beginning of the next interaction, current balances are differenced against the stored values to determine the amount of tokens that were sent by the current interactor.
Flash swaps
Flash swaps allow users to withdraw up to the full reserves of any ERC-20 token on Uniswap and execute arbitrary logic at no upfront cost. as long as by the end of the transaction the user either pays for the withdrawn ERC-20 tokens with the corresponding pair tokens or return the withdrawn ERC-20 tokens along with a small fee. Flash swaps enable capital-free arbitrage.
On-chain Price Feeds
Uniswap v2 enables the creation of decentralised and manipulation-resistance on-chain price oracles. Every pair measures the market price at the beginning of each block (before any trades take place) and this price is expensive to manipulate since it is set by the last transaction in the previous block.
Any attackers will lose money to arbitraguers unless they can selfishly mine two blocks in a row, which has not been observed to date and is though to be extremely difficult. Cumulative price data is sotred on chain represeting the sume of the Uniswap price for every second in the full history of the contract. This variable can be used by external contracts to compute time-weighted average prices to provide protection from flash crashes or volatile market conditions, as well as offering a more reliable reflection of the value of a token relative to another token over time.
Technological Challenges
Scalability
Every trade on Uniswap is an on-chain transaction, the scalability of the decentralised exchange depends on the Ethereum blockchain. As gas fees rise, each Uniswap transaction becomes more expensive.
Uniswap v3 will address the scalability issue which has been in the research stage since February 2020 and is expected to be released in 2021. The team are actively studying various aspects of the v2 platform so they know what to fix for v3.
For Ethereum, one of the most promising near-term solution to the scalability challenge are Rollups. Rollups are a Layer 2 scaling solution that bundles transactions together and settles them on-chain with a single transaction. Optimistic rollups are a potential solution for Uniswap to combat high on-chain transaction fees.
Decentralisation
The Uniswap team have decided to main control over non-vested tokens but the exact vesting schedule has not been publicly announced. The UNI tokens allocated to the team, investors and advisors are also fully liquid and can be moved at any time since they are held in Externally Owned Accounts.
Despite no programmatic locks on the large quantity of UNI held by the team, it is most likely a safety precaution, i.e. in the event of an attack the team would be able to access all of their tokens. The Uniswap team, founders and investors are publicly known (unlike a lot of DeFi projects) and their reputation is on the line. Also, the threat of a fork should incentivise the founders to avoid transferring or selling their allocation of UNI tokens.
However, a decentralised protocol should not have to require trust from its users. Therefore, the Uniswap team have traded off decentralisation for control over the short-term, although this should gradually change over time. Eventually, their share will be diluted by the funds from the governance treasury, and control over the protocol will gradually transition to the community.
Also, the governance of the protocol depends on delegating a certain number of votes to initiate proposals and introduce changes. While the UNI token is distributed to a large number of Ethereum wallets, the risk is that entities with enough power to submit and/or pass proposals in the early stages may end up dominating the governance process, potentially affecting token holders and the utility of UNI itself.