Code Walkthrough Get Virtual Price

A beginner's guide to building a Vyper smart contract on a local network. This lesson covers how to use `get_xcp`, a function to calculate a constant product in a liquidity pool with more than 2 tokens. The lesson goes through how to calculate the constant product of `N` tokens, and then illustrates the logic of the `get_xcp` function with an example of a pool with 3 tokens.

1. Contract Overview
A high-level overview of Curve V2 contracts - This video explains the basics of Curve V2 and how users can interact with these contracts. The video focuses on the CurveTriCryptoOptimizedWETH contract, which is an AMM for three tokens: USDC, WBTC, and ETH. The video covers the functions users can call, including exchange, add_liquidity, remove_liquidity, and remove_liquidity_one_coin. Duration: 1min
2. Code Walkthrough Packed State Variables
An in-depth dive into packing and unpacking state variables in Vyper smart contracts. The lesson explores the "pack" and "unpack" functions, demonstrating how they optimize storage and reduce gas costs by storing multiple values within a single uint256 variable. It also covers the bitwise operators used to achieve this efficient data management technique. Duration: 3min
3. Code Walkthrough Price Scales
An introductory guide to Vyper smart contract development. The lesson covers the basics of setting up a Vyper development environment, using tools like Remix IDE and Titanoboa, deploying to different networks, and building your own smart contracts. Duration: 7min
4. Code Walkthrough A
A comprehensive Vyper Smart Contract & Python Course - A Beginner’s Guide to Smart Contract Development, Blockchain, and Building a Vyper Developer Career - Powered By AI. This course covers all the fundamentals of blockchain and Vyper, including setting up a development environment with Remix and moccasin, using AI and ChatGPT for assistance, and building practical projects like a simple ERC20 token and a lottery contract. The course culminates with a real-world challenge to help you learn how to get hired as a blockchain developer. Duration: 7min
5. Code Walkthrough Ramp A Gamma
An in-depth look at the `ramp_A_gamma` and `stop_ramp_A_gamma` Vyper functions for updating the A and gamma parameters within a smart contract. The lesson covers how these functions are designed to control the ramping of A and gamma, ensuring they can only be accessed and modified by the authorized factory admin. It also explains how to set future A and gamma values and how the `stop_ramp_A_gamma` function can be used to immediately stop the ramping process. Duration: 1min
6. Code Walkthrough Get Virtual Price
A beginner's guide to building a Vyper smart contract on a local network. This lesson covers how to use `get_xcp`, a function to calculate a constant product in a liquidity pool with more than 2 tokens. The lesson goes through how to calculate the constant product of `N` tokens, and then illustrates the logic of the `get_xcp` function with an example of a pool with 3 tokens. Duration: 5min
7. Exercise Price Scale
A comprehensive Vyper smart contract development course to help you kickstart your blockchain developer career. This course covers the fundamentals of Vyper, including its syntax, data structures, and functions. You will learn how to write, test, and deploy Vyper contracts. You'll also explore popular Vyper tools such as Remix, Web3.py, Titanoboa, and Moccasin. The course takes you through the entire process of deploying Vyper contracts to different testnets, such as Sepolia and ZKsync. This is a must-have course for anyone interested in becoming a Vyper smart contract developer! Duration: 1min
8. Solution Price Scale
A comprehensive guide to building a Vyper Smart Contract Lottery using Moccasin - This lesson covers deploying your lottery contract to different networks, including Tenderly, pyevm, and eravm. It also demonstrates how to write unit tests and fuzz tests to ensure your code's security and functionality. The lesson culminates in a challenge to build a robust and secure smart contract lottery with features such as entrance fees, winner selection, and prize distribution. Duration: 3min

Course Overview

About the course

What you'll learn

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

Course Description

Who is this course for?

  • Software Engineers
  • Web3 Developers
  • Finance Developers
  • AI Developers
  • Smart Contract Security Researchers

Potential Careers

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)

Meet your instructors

Tasuku Nakamura

Tasuku Nakamura

Founder at smartcontract.engineer

Smart contract engineer and educator.

Last updated on August 11, 2025