3/5
### Adding Liquidity to a Curve V2 Pool In this exercise, we will be adding liquidity to the USDC, WBTC, and WETH Curve V2 pool. In the setup, the contract is given 1,000 USDC and approves the pool contract to spend the USDC. This setup will allow us to add liquidity from the contract. The first exercise will call the `add_liquidity` function, which will add 1,000 USDC of liquidity to the pool contract. We will be writing our code inside the following function. ```javascript function test_add_liquidity() public { // Write your code here uint256 lpBal = pool.balanceOf(address(this)); assertGt(lpBal, 0, "lp = 0"); } ```
In this exercise, we will be adding liquidity to the USDC, WBTC, and WETH Curve V2 pool.
In the setup, the contract is given 1,000 USDC and approves the pool contract to spend the USDC. This setup will allow us to add liquidity from the contract.
The first exercise will call the add_liquidity
function, which will add 1,000 USDC of liquidity to the pool contract. We will be writing our code inside the following function.
A comprehensive introduction to adding liquidity to a Curve pool. The lesson explains how to set up a contract with 1,000 USDC to approve the pool contract to spend the funds. It then guides users through the process of adding liquidity to the pool contract and explains how to write code to complete the task.
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 July 2, 2025
Duration: 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 July 2, 2025