1/5
## Understanding Concentrated Liquidity in Curve V2 In this lesson, we'll explore how Curve V2 enables concentrated liquidity by examining the relationship between token amounts and spot prices on various graphs. Initially, viewing the Curve V2 equation as a curve can make it difficult to visualize how it facilitates concentrated liquidity. To better understand this, we need to view Curve V2's Automated Market Maker (AMM) equation with the token amount on the horizontal axis, and the price of the token on the vertical axis. We�ll consider a simplified scenario with just two tokens, X and Y, where token X is ETH and token Y is wETH. When graphing the price and token amounts for different AMMs, we will begin with a constant sum AMM, where the two tokens are swapped at a 1:1 rate. For a constant sum AMM, the price is always equal to one, no matter the amount of ETH. Next, let's analyze the constant product AMM. With a constant product AMM, the price is high when the amount of token X is low and the price decreases when the amount of token X increases. Now, let�s take a look at Curve V1. When the amount of token in the pool is around the middle, the price is equal to one. As the amount of tokens either increases or decreases, it starts to look like the constant product AMM, curving at the top and the bottom. Lastly, let's analyze the Curve V2 graph, graphed in green. Curve V2 is an interesting graph, since it shares characteristics with both Curve V1 and constant product AMMs. When the token amount is closer to the middle, the price is close to one. But the pricing quickly becomes similar to the constant product. This is how Curve V2 achieves concentrated liquidity. For a narrow range of tokens, it prices the tokens close to one. Outside of this narrow range, the pricing quickly becomes similar to a constant product. In another lesson, we will discuss how to plot the spot prices of different AMMs. ```python plt.axhline(1, color = "grey") plt.plot(xs, ps_cp) #plt.plot(xs, ps_curve_v1) #plt.plot(xs, ps_curve_v2) plt.legend([ "constant sum", "constant product", #"curve v1", #"curve v2" ]) plt.xlim(2, 18) plt.ylim(0, 10) plt.grid(True) plt.show() ```
A comprehensive guide to building Vyper smart contracts, a beginner-friendly guide to smart contract development - The course will teach you how to build secure, reliable Vyper smart contracts and set you on your web3 development career path! We will learn how to build your own contracts, test them and deploy them on different networks, and even how to audit them. We will also explore some of the most powerful applications of Vyper, like NFTs, DeFi, and stablecoins!
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
AMM math for Curve Cryptoswap
How liquidity is concentrated
Price-repegging
How function calls interact with the AMM
Curve Cryptoswap state variables
How the function exchange works
How to swap tokens
How to add and remove liquidity
Math for Curve Cryptoswap’s internal price oracle
Implicit differentiation
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)
Last updated on May 15, 2025
DeFi Developer
Curve CryptoswapDuration: 4min
Duration: 1h 21min
Duration: 28min
Duration: 26min
Duration: 14min
Duration: 24min
Duration: 59min
Duration: 5min
Course Overview
About the course
AMM math for Curve Cryptoswap
How liquidity is concentrated
Price-repegging
How function calls interact with the AMM
Curve Cryptoswap state variables
How the function exchange works
How to swap tokens
How to add and remove liquidity
Math for Curve Cryptoswap’s internal price oracle
Implicit differentiation
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)
Last updated on May 15, 2025