Back
Project

DEX - Part 3

In Part 3 of the DEX course, we will wrap up the DEX series by learning to implement removing liquidity and swapping. After this series of lessons, we challenge you to build an even better DEX than Uniswap!

Languagesolidity
Skill LevelBeginner
Total Length1.7h

Intended Learners

Who’s This Course For

  • For developers who are interested in blockchain finance
  • For developers who are curious about decentralized exchanges
  • For developers who are looking to learn Solidity programming applications

Requirements

  • Basic understanding of exchanges and cryptocurrency concepts
  • Familiar with the ERC20 standard
  • Basic Solidity programming skills, with a recommendation to first complete Solidity foundational courses (at least Solidity 101 to 104)
  • Possess an Ethereum account, connected to both Mantle and a wallet, holding either Mantle tokens or test tokens (for those wishing to perform real on-chain operations, though deployment can also be done directly in a local environment if test tokens are not available)
  • Completed the content for courses DEX - 1 and DEX - 2

What You’ll Learn

  • Implementing liquidity removal, calculating the quantity of tokenB exchanged based on the amount of tokenA, and facilitating the swap between tokenA and tokenB
remove liquidity
swap

Syllabus

  • removeLiquidity - Section 1

    This section focuses on the process of burning LP tokens and subsequently calculating the corresponding reserve tokens from the liquidity pool.


  • removeLiquidity - Section 2

    We will learn how to conduct a transfer using the IERC20 interface and the importance of updating the reserves in the liquidity pool thereafter.


  • calculateAmountB

    Delving into the mechanics, this section will teach you how to determine the amount of tokenB that can be exchanged for a given amount of tokenA.


  • swapFromAToB - Section 1

    How can we go from tokenA to tokenB? This section covers swapping from tokenA to tokenB, including the calculation of exchangeable tokens and the subsequent update of reserves in the liquidity pool.


  • swapFromAToB - Section 2

    We learn how to transfer tokens.


  • swapFromBToA

    In this final section, we will develop and understand the swapFromBToA function, which enables the swapping of tokenB for tokenA, a crucial skill for users in this field.

practice

DEX - Part 3

29 lessons
Access on mobile and desktop