hackquest logo
 

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.

Language

Solidity

Total Length

1.7h

Part of Learning Track

Build on Ethereum + 1

What You’ll Learn

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

Syllabus

_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.