DeFi
Browse all DeFi articles.
10 min read
Pragma Oracle
Pragma is an oracle protocol built for Starknet that brings off-chain price data on-chain.
12 min read
Switchboard Oracle on Solana: How to Read Price Feeds
Build a Solana program that reads the SOL/USD price from the Switchboard oracle: how jobs and feeds work, setting up a feed, and a client script on Devnet.
12 min read
Uniswap v3 Positions: How Liquidity Ranges Work
In Uniswap v3, liquidity providers open positions over a tick range instead of getting LP tokens. Learn how positions, fees, and the mint function work.
7 min read
Calculating the real reserves between two prices in the Uniswap V3 codebase
In previous chapters, we derived formulas to calculate the real reserves of tokens X and Y between two prices in a segment.
10 min read
The constant product formula in Uniswap v3
This chapter is optional. It introduces no fundamentally new concepts compared to the previous ones, but offers a different perspective on deriving real…
11 min read
Real reserves in Uniswap v3
In the last chapter, we introduced two new concepts: real reserves and virtual reserves.
12 min read
Real and virtual reserves in Uniswap v3
Uniswap v3 uses two types of reserves: real reserves and virtual reserves. Real reserves represent the actual amount of tokens present in a segment.
8 min read
Tickmath getSqrtRatioAtTick
This article explains how the getSqrtRatioAtTick() function in Uniswap V3 TickMath library works.
7 min read
Computing the Current Tick Given sqrtPriceX96
In the previous chapters, we saw that the protocol stores the square root of the price instead of the price itself.
7 min read
Uniswap V3 Factory and the Relationship Between Tick Spacing and Fees
In early chapters, we introduced the concept of ticks, which discretize the price curve.
6 min read
Tick limits in Uniswap V3
The smallest tick in Uniswap v3 is -887,272 and the largest tick is 887,272.
9 min read
Square Root Price in Uniswap V3
In Uniswap V2, the protocol tracks token reserves and derives the spot price, p_x=y/x, and total liquidity, L=xy, where x and y are the reserves of…