Category: Uniswap v2

Uniswap V2: Calculating the Settlement Price of an AMM Swap
Uniswap V2: Calculating the Settlement Price of an AMM Swap This article explains how to determine the price settlement of a trading pair in an Automated Market Maker (AMM). It…

How Uniswap V2 computes the mintFee
How Uniswap V2 computes the mintFee Uniswap V2 was designed to collect 1/6th of the swap fees to the protocol. Since a swap fee is 0.3%, 1/6th of that is…

Uniswap v2 router code walkthrough
Uniswap v2 router code walkthrough The Router contracts provide a user-facing smart contract for safely minting and burning LP tokens (adding and removing liquidity) safely swapping pair tokens They add…

UniswapV2Library Code Walkthrough
UniswapV2Library Code Walkthrough UniswapV2Library The Uniswap V2 Library simplifies some interactions with pair contracts and is used heavily by the Router contracts. It contains eight functions that are not state-changing,.…

How the TWAP Oracle in Uniswap v2 Works
How the TWAP Oracle in Uniswap v2 Works What exactly is “price” in Uniswap? Suppose we have 1 Ether and 2,000 USDC in a pool. This implies that the price…

Checklist for building a Uniswap V2 clone
Checklist for building a Uniswap V2 clone It’s very educational to rebuild Uniswap v2 from scratch using modern Solidity (or Huff if you really want to do it in hard…

Uniswap V2 Mint and Burn Functions Explained
Uniswap V2 Mint and Burn Functions Explained The lifecycle of Uniswap V2 is someone mints LP tokens (supplies liquidity, i.e. tokens to the pool) for the first time, then a…

Breaking Down the Uniswap V2 Swap Function
Breaking Down the Uniswap V2 Swap Function Uniswap V2’s swap function is cleverly designed, but many devs find its logic counterintuitive the first time they encounter it. This article explains…