DEX - Part 2

In Part 2 of the DEX course, we will pick up from where we left off in part 1 and continue to build a liquidity pool and implement “add liquidity” functionality.

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


  • 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 course DEX - 1

What You’ll Learn

  • Initialization of contracts, construction of liquidity pools, and calculation of LP tokens.
add liquidity


  • _addLiquidity - Section 1

    Learn to calculate the LP tokens and mint them using ERC20 functions, focusing on the integration of token minting processes.

  • _addLiquidity - Section 2

    In this section, we will update our variables and transfer the tokens to the liquidity pool, ensuring proper allocation and management of resources.

  • MockToken

    This section is dedicated to testing the '_addLiquidity' function, using MockToken to simulate real-world scenarios and validate functionality.

  • addLiquidity - Section 1

    Learn the direct process of adding liquidity to the pool, focusing on the mechanics of liquidity injection.

  • addLiquidity - Section 2

    In this section, we will add a proportional amount of tokenB relative to the amount of tokenA, exploring the balancing of token contributions.

  • addLiquidity - Section 3

    This section covers the process of injecting all of token B and a certain amount of token A into the liquidity pool, focusing on diverse liquidity scenarios.


DEX - Part 2

23 lessons
Access on mobile and desktop