Skip to main content

Uniswap Protocol

Uniswap allows users to trustlessly trade (swap) ERC20 tokens or stablecoins.

Uniswap is an automated liquidity protocol powered by a constant product formula and implemented in a system of non-upgradeable smart contracts on the Ethereum blockchain.

Resources

Concepts

At it core Uniswap uses the Constant Product Market Maker Model to enable the following services:

  • Trading
  • Arbitrage
  • Savings
  • Flash Loans

Data Oracle for ERC20 Token Prices

History

Three releases to product evolution, the last providing more sophistication to control of liquidity. See liquidity wars.

  • Range Orders
  • Liquidity: To enable a swap there must enough of two assets to support the requested volume.

As an incentive to provide liquidity a fee of 0.3% for each trade is given to those liquidity providers as incentive.

Transfer logic governs the resulting exchange rate where the logic is designed to preserve liquidity by accounting for:

  • the volume of the requested trade
  • available liquidity of the two underlying tokens
tip

The greater the liquidity available at a given price, the lower the price impact for a given swap size

caution

The lesser the liquidity available, the higher the price impact

Traditionally this is achieved using order book model.

Function

Runs on Ethereum so trades in ERC-20 tokens.

Liquidity Pools (Type of Smart Contract) must have at least 2 tokens or coins.

There are no restrictions to which tokens can be added.

If no contracts for a token pair exist yet, anyone can create one using the factory

Anyone can subsequently provide liquidity to a pool.

Investing Strategy

How to use v3 on multiple platforms

Risk

How to automate trading at lower risk.

Business Model

As of August 2021, the company made over $1 billion from the combined protocol fees from V2 and V3.

Primarily operates under an e-commerce business model. Uniswap has reserves of the governance token UNI and sells the token periodically to cover maintenance and other expenses.

It is unclear if the company takes a portion of the transaction fee

TODO: Investigate code in V3 if money extracted from protocol fees, by charging for every transaction. Between 0.05 percent and 1% of the overall fees???

Governance

See intro to UNI for background and purpose

How to vote and Forum gov.uniswap.org for ideas to vote on.

21.266% of the initial four-year allocation of UNI will be held by team members and future employees.

As the tokens are distributed over this period, the value of Uniswap's collective holding will increase.

What is Uniswap UNI and should you buy it?

note

Arriving in v3 UNI governance has the option to apply a transaction fee

Toolset:

Team:

Depending on which tier offers the best deal for each trade, transaction fee paid to liquidity providers are based on a three-tier system of:

  • 0.05%
  • 0.3%
  • 1%

These fees are added to the liquidity pool by default, but providers can redeem them at any time.

The protocol fees are zero when a liquidity pool is setup.

  • Protocol fees are generated as transactions occur in that pool
  • Uniswap only receives a small portion of the total from these payments

Protocol fees do not apply to every pool.

  • Fees are only activated for certain pools by the company
  • Revenue gained by certain pools can be much higher

The Uniswap corporation also makes profits from it's own tokens. These are not openly traded like other cryptocurrencies.

backed by the crypto hedge fund Paradigm. This means the platform does not make any money per se, with all fees user-controlled and collected by traders who provide liquidity.

Competitors

  • PANCAKESWAP (CAKE): PancakeSwap is an Automated Market Maker, and Decentralized Exchange made on the Binance Smart Chain that requires no KYC. The project received funding from Binance as a part of the company’s DeFi acceleration program on the Binance Smart Chain.

Source Code

Documentation

Repositories

RepositoriesNotes
v2-coreCore Logic, Heavily Audited
v2-peripheryExternal Interface
v2-subgraph

Pricing Oracle

Fair Market Value (FMV) of Time Weighted Average Price (TWAP)

Smart Contract Programmer - Pricing

Flow

Uniswap v3: More complex to understand than v3.

Learning Path

Web3 Blockchain Developer

SessionNotes
03Oracle Bit Math??
04Why SafeTransfer?
05Use subgraph to store event data decentralised but off-chain to improve UI/UX, Indexed events??
06
07