5/5
### Curve V2 Swap Exercise 1 Here is our first exercise for swapping with Curve V2 AMM. The exercise is located under the following path: test > curve-v2 > exercises > Curve2Swap.test.sol Okay, let's take a look at our first exercise. For this exercise we're going to be using the Curve V2 pool, that has: USDC WBTC WETH So for our first exercise, we need to call get_dy, to calculate the amount of USDC for swapping one WETH to USDC. And we can write our code here: ```javascript uint256 dy = 0; ```
Here is our first exercise for swapping with Curve V2 AMM. The exercise is located under the following path:
test > curve-v2 > exercises > Curve2Swap.test.sol
Okay, let's take a look at our first exercise.
For this exercise we're going to be using the Curve V2 pool, that has:
USDC
WBTC
WETH
So for our first exercise, we need to call get_dy, to calculate the amount of USDC for swapping one WETH to USDC. And we can write our code here:
A comprehensive guide to building smart contracts using Vyper. The lesson covers the basics of Vyper syntax and structure, deployment to Remix, and using AI prompts for development. It also includes local development and testing using tools like Moccasin and Titanoboa, as well as a crash course in Python for beginners. This hands-on course also delves into building an ERC20 token and a raffle smart contract.
Previous lesson
Previous
Next lesson
Next
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 August 11, 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 August 11, 2025