Uniswap and the AMM model



The second post on DeFi protocols’ analysis is dedicated to Uniswap, the precursor of Decentralized exchanges (DEX) in DeFi. 

Uniswap is an exchange protocol: it allows users in the Ethereum ecosystem to exchange some tokens for others. 

Marinus van Reymerswaele – The Money Changers

The protocol solves the same problem addressed by Coinbase and Binance, but it does so in a way peculiar to the DeFi ecosystem: in a decentralized, permissionless fashion and adopting an Automated Market Making paradigm. Essentially the protocol fully automates the token exchange services, without involving a third party to facilitate the transactions among users (like Coinbase or Binance).

To date, Uniswap is the biggest DEX in circulation: it has approximately 60% of the DEX market share and a market cap of over $10B (07-08-2021).

Uniswap went live in November 2018 and epitomized the first automated market maker in the ethereum ecosystem, a model that then became ubiquitous and sparked a number of Uniswap clones (SushiSwap, PankakeSwap, MoonSwap).

Order book VS AMM

The first thing to understand before deep diving into UniSwap is the mechanics of an AMM and the differences with the traditional liquidity providers mechanics, also called “order book” exchanges.

An order book exchange is the traditional exchange model where users trade against other users: each user places an order, there is a list of open buy and sell orders for a specific trading pair placed by users, and the exchange matches the buy and sell orders.

The order book is like a marketplace where users can place an order that remains in the book till it is filled or canceled.

This type of exchange is run by a centralized entity which coordinates the activities, provides incentive schemes, and usually runs some market making activities to close the bid-ask spread – allowing the smooth functioning of the exchange. Binance and Coinbase are the most famous examples of Centralized Exchanges in Cyrpto (CEXs).

The order book model has proven to be efficient only if there are many buy and sell orders that guarantee a sufficient liquidity of the exchange process. If this condition is not guaranteed, then it can be hard to find a matching order to conclude the transaction. 

To solve this constant liquidity issue, Decentralized Finance exchanges have embraced a different model: Automated Market Making (AMM).

AMM exchanges are the dominant model in DeFi and represent a completely different paradigm: users don’t trade against other users, they trade against a liquidity pool and the price is determined by a mathematical formula.

The liquidity pool is made of users, called Liquidity Providers, who decide to deposit their tokens in a pool in exchange for a Liquidity Pool Tokens, a share of the pool profits plus they receive project tokens (governance tokens of the project that they can eventually sell).

The main benefits of the AMM exchanges are: decentralization, permissionlessness – nobody has to approve participation to the exchange – and continuous liquidity, as no counterpart is needed to trade.

How does Uniswap work?

As previously mentioned, UniSwap is the most popular AMM exchange in DeFi and it has seen an explosive growth in the last 12 months, following the explosion of the DeFi movement. UniSwap’s protocol revolves around a few core concepts: Swaps, Pools and Flash Swaps.


Swaps are essentially a way to trade ERC-20 tokens for other ERC-20 tokens. Swaps happen between a pair of tokens, two different tokens types. The mechanic is extremely simple. The user selects:

  1. the token type to trade,
  2. the token type to receive,
  3. it defines the amount of tokens that wants to trade 

Based on these 3 inputs, the protocol calculates the prices based on a mathematical formula and returns the price to pay. Being an AMM, the Uniswap protocol doesn’t look for an order placed in its order book to fill the new order, it simply prices the trade based on the Constant Product Formula.

The constant product formula (x*y=k) is the algorithm used to determine the price, and essentially makes sure that trading any amount of either asset changes the liquidity pool so that the product x*y remains equal to the constant k. This formula is represented as an hyperbola in the cartesian axis and it has the property of always having liquidity for both assets at any prices, as it asymptotically approaches the axis but never touches them.

I strongly recommend this super interesting blogpost by Dmitriy Berenzon on Constant Function Market makers to deep dive on the formula.


Another core concept of Uniswap is the Liquidity pool

Uniswap users don’t trade against other people’s orders, they trade against a liquidity pool: a pot of money put together by a group of users, called liquidity providers, who offer the service of providing liquidity in exchange for a share of the liquidity pool fees (Liquidity Pool Tokens) plus governance tokens (Uniswap tokens).

Pools are very important not only because they are the source of the funds traded, but also because they directly impact the trading price. Indeed, each trading pair (for example ETH-DAI) in Uniswap is a smart contract that manages two liquidity pools – in the example, a liquidity pool of ETH and a liquidity pool of DAI. To price the trade, the constant product formula algorithm evaluates the reserves available in the two pools and makes sure that the formula is respected. So the amount of tokens in the pools determines the price that the users will pay.

Flash Swaps

This is a very powerful feature of Uniswap as a user can essentially withdraw up to the entire amount of ERC20 present in a liquidity pool and use it without paying any upfront cost. 

At the end of the usage, the user will have to either pay for the withdrawn ERC20 tokens with the corresponding pair tokens or return the withdrawn ERC20 tokens along with a small fee.

This feature can be used to do arbitrage with minimal capital upfront and really opens a lot of trading opportunities, even though it is not clear to me how much the feature is used yet. 

Uniswap Version 3 

Over the last months the discussion around Uniswap has been pretty intense, as the protocol is working to finalize its latest version: V3. Uniswap is not an upgradable project so it can’t progressively upgrade its logic, but it has to release an entirely new version and V3 has been publicly discussed for very long.

The new version will build on top of the core elements mentioned above and it will work to offer an even better service in the AMM exchanges sphere.

I won’t touch on this point further, as this is beyond the scope of this post but you can start your research here.

Business model, volumes & main competitors

Uniswap’s business model is very simple: the protocol takes a cut of each trade, specifically 0.3%. This fee is split into 2 components: 0.25% is given to the Liquidity pools that facilitated the trade, the other 0.05% is eventually reserved for a Uniswap fund. It is ‘eventually’ reserved because this is an on/off fee that the protocol governance can decide to apply or not (currently is off).

Uniswap is clearly the market leader in the space of Decentralized Exchanges: it accounts for more than 60% of the market share in this segment, with volumes 4-5 times bigger than its main competitor SushiSwap (a clone protocol of Uniswap).

In the wider scheme of exchanges, Uniswap volumes are still an order of magnitudes smaller than the biggest exchange in circulation, Binance, but its volumes are already approaching those of Coinbase, the famous exchange that went public a few weeks ago. 

There is anyway a big difference versus centralized exchanges: the cost structure of Uniswap (and of a DEX in general) is much much lower than a centralized exchange, bringing software economics to an industry (the financial one) that so far was only scratched by the internet. This opens up huge opportunities for those operating in the space, but I will discuss this in a further post.


As the last step of my investigation, I decided to test Uniswap’s permissionless nature. For this purpose I created a new token, called Kudos Token, and then listed it on Uniswap.

Kudos is essentially a token that you can send to experts that give you advice as a reward or Kudos: I decided to build it to then introduce it within the Fintech Product Guild, by distributing it to the guilders.

I used an online tutorial in the process and you can find here the Kudos Token contract (Kovan Testnet). Then I proceeded with the listing on Uniswap, which took a few seconds (tx details on Kovan) and literally zero hussle. 

The experience was great: nobody had to approve my listing and I could simply do it with a laptop, an internet connection and an ethereum address. 

Overall, using Uniswap I really felt I was using a piece of technology from the future: it embodies a new paradigm of financial interaction that is orders of magnitudes faster than any traditional finance application. I’m more and more convinced that these protocols represent the future of finance.


  • AMM vs Order book – LINK
  • Uniswap whitepaper – LINK
  • Uniswap whitepaper V3 – LINK
  • DEX dashboard on Dune Analytics – LINK
  • Uniswap VS Coinbase VS Binance – LINK
  • Token creation tutorial – LINK
  • Listing token to Uniswap – LINK

About the author

Giorgio Giuliani
By Giorgio Giuliani