Math Fee Equation

A comprehensive explanation on how fees for liquidity providers are calculated in Uniswap V3. This lesson covers how fees are calculated in a single swap and then builds upon the concepts to show you how to calculate fees collected over multiple swaps.

DeFi Developer

Uniswap V3

1. Math Fee Equation
A comprehensive explanation on how fees for liquidity providers are calculated in Uniswap V3. This lesson covers how fees are calculated in a single swap and then builds upon the concepts to show you how to calculate fees collected over multiple swaps. Duration: 6min
2. Fee Growth
A detailed explanation of Uniswap V3 Fee - Fee Growth. This lesson digs deeper into Uniswap V3 Fee - Fee Growth, providing a visual explanation of how fee growth works. The instructor explains the concept of fee growth, demonstrates how to visualize it on a graph, and discusses the impact of different swap events on the fee growth. Duration: 4min
3. Graph Fee Growth
An animated explanation of fee growth on Uniswap V3. The lesson covers liquidity and fee growth, as well as the impact of token swaps on fee growth. Duration: 1min
4. Fee Growth Inside
A detailed exploration of fee growth calculations within Uniswap V3. This lesson covers how to calculate fee growth within a given tick range, even when the fee growth extends beyond the tick range. Duration: 5min
5. Graph Fee Growth Inside
An animated explanation of fee growth inside in Uniswap v3. This lesson covers the mechanics of how fee growth inside works, demonstrating the interaction of liquidity, tick movements, and fee growth inside. The animation shows how fee growth inside is affected by different types of swaps. Duration: 3min
6. Fee Growth Outside
A detailed explanation of Uniswap V3's fee growth outside mechanism. The lesson covers how Uniswap V3's fee growth outside is initialized and how it is updated during each tick. Duration: 2min
7. Fee Growth Below
A comprehensive guide to Uniswap V3 Fee Growth, including how fee growth below and above tick i are calculated. The lesson covers definitions of key variables and algorithms, as well as examples to illustrate the concepts. Duration: 13min
8. Fee Growth Above
A comprehensive guide to calculating Uniswap V3 fees, which are the fees accrued from trading activity. The lesson covers the calculation of fee growth above, which is the total amount of trading fees that were accrued from trading activity when the price was above the given tick. It will then relate fee growth above to the fee growth outside, which is the cumulative fee growth accrued from trading activity from the time of the last update. Duration: 11min
9. Fee Position
A detailed explanation of how fee growth works inside Uniswap V3 liquidity positions. This lesson breaks down how to calculate the fee growth inside of a liquidity position between two ticks, the current fee growth minus the fee growth at the position's creation. The lesson then examines how to calculate the amount of fees earned for a position given the position's liquidity. Duration: 3min
10. Code Walkthrough Fee Growth
A technical look at the code relevant for calculating liquidity growth in Uniswap V3 - This lesson explores the logic for fee growth calculation both outside and inside a liquidity position. The code is explained for how the fee growth is initialized, updated, and calculated. Duration: 3min

Course Overview

About the course

What you'll learn

Concentrated liquidity and derive its equations

Uniswap V3 math

How to calculate the spot price of tokens

Single and multi position swapping

Factory contract architecture

How to calculate liquidity requirements

Uniswap V3 fee algorithm

Flash loans

TWAP price oracle

Course Description

Who is this course for?

  • Software Engineers
  • Financial Analysts
  • Web3 Developers
  • Finance developers
  • Smart Contract Security Researchers

Potential Careers

Smart Contract Auditor

$100,000 - $200,000 (avg. salary)

Blockchain Financial Analyst

$100,000 - $150,000 (avg. salary)

DeFi Developer

$75,000 - $200,000 (avg. salary)

Smart Contract Engineer

$100,000 - $150,000 (avg. salary)

Web3 developer

$60,000 - $150,000 (avg. salary)

Web3 Developer Relations

$85,000 - $125,000 (avg. salary)

Meet your instructors

Tasuku Nakamura

Tasuku Nakamura

Founder at smartcontract.engineer

Smart contract engineer and educator.

Last updated on May 15, 2025