Skip to content

Latest commit

 

History

History
154 lines (120 loc) · 9.86 KB

curve-v2.md

File metadata and controls

154 lines (120 loc) · 9.86 KB

Curve v2

How to use this

Prerequisites

  • Advanced Solidity developer
  • Experience with Foundry
  • Knowledge of Curve V1
  • Basic understanding of DeFi
  • Python (optional)

Tools

Topics

Check out the videos on Cyfrin Updraft for each lesson.

Section 1 - Intro

This section explains what the course will teach, who the course is for and how to do the exercises

  • Course intro
  • Lead instructor
  • Setup repo

Section 2 - Math

This section explains the math of Curve V2's AMM, how liquidity is concentrated and how the AMM decides to repeg the pool's liquidity at a different price.

Section 3 - Contract overview

Here you will learn about what functions to call to interact with the AMM. You will also learn about how state variables such as A, gamma and price_scale are stored.

Section 4 - Exchange

This section explains how the function exchange works, how to call to swap tokens, followed by exercises to simulate a swap.

Section 5 - Add liquidity

This section explains how the function add_liquidity is implemented, how to add liquidity, followed by a exercise.

Section 6 - Remove liquidity

There are 2 ways to remove liquidity (remove_liquidity and remove_liquidity_one_coin). This section will explain how both functions work, followed by exercises.

Section 7 - Price repeg

Curve V2 has an internal price oracle that decides to re-concentrate liquidity when the internal price and the current price deviates significantly. This section explains the math of how the internal price oracle track prices the function that is responsible for repegging (tweak_price).

Section 8 - Footnote

Footnote on how the spot price of AMM such as constant sum, constant product, Curve V1 and V2 can be calculated by a mathematical technique called implicit differentiation.

Resources