Exercise 1: Add Liq

A practical Solidity test to adding liquidity to Curve B1 - This lesson provides a practical example of adding liquidity to the Curve B1 pool using a Solidity test. You'll learn how to call the addLiquidity function, understand the inputs required, and write a test to verify the expected outcome.

1. Contract Calls
A visual explanation of how to add liquidity to a Curve B1AAMM - This video explains the process of adding liquidity to a Curve B1AAMM, using a StableSwap3Pool as an example. It covers the steps of calling the 'add_liquidity' function, specifying the amounts of different tokens, and receiving LP shares in return. Duration: 1min
2. Code Outline
A detailed breakdown of the add_liquidity function in StableSwap3Pool - This lesson walks through the steps of the add_liquidity function, covering calculations for imbalance fees, A parameter, and liquidity before and after adding tokens. It also explains how token balances are updated in memory and storage, and how liquidity provider shares are calculated and minted. Duration: 3min
3. Imbalance Fee
A visual explanation of the imbalance fee in Curve.fi - This lesson dives into the concept of imbalance fees in Curve, illustrating how the fee is calculated in a stable swap pool, and its role in rebalancing the pool to ensure fairness. Duration: 6min
4. Code Walkthrough Add Liq
A detailed breakdown of Curve B1's add liquidity function - The lesson covers the inputs, fees, and how the function determines the amount of LP tokens to mint based on the change in liquidity. Duration: 7min
5. Exercise 1: Add Liq
A practical Solidity test to adding liquidity to Curve B1 - This lesson provides a practical example of adding liquidity to the Curve B1 pool using a Solidity test. You'll learn how to call the addLiquidity function, understand the inputs required, and write a test to verify the expected outcome. Duration: 1min
6. Solution 1: Add Liq
A practical Solidity lesson on adding liquidity to Curve Stableswap. The lesson covers how to call the addLiquidity function from the IStableSwap3Pool interface, prepare the coins array with appropriate balances, and set the minLp parameter to ensure successful liquidity provision. Duration: 2min

Course Overview

About the course

What you'll learn

AMM math for Curve Stableswap

How to calculate swap amount and liquidity

Curve Stableswap contracts

How to implement a swap function

How to implement the add and remove liquidity functions

How to quantify liquidity pools

How to control the flatness of the curve

Course Description

Who is this course for?

  • Software Engineers
  • Financial Analysts
  • Web3 Developers
  • Smart Contract Security Researchers

Potential Careers

Smart Contract Engineer

$100,000 - $150,000 (avg. salary)

Blockchain Financial Analyst

$100,000 - $150,000 (avg. salary)

Smart Contract Auditor

$100,000 - $200,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