← Index
Source: docs/zsub/hacking-instructions-2/dex-1.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

DEFI Crash Course: DEX Exercise 1 - Chocolate Factory

Intro

This exercise will get you working with the Uniswap V2 Factory and Router Smart Contracts.

You will deploy a new token, create a pair for it with ETH, and create helper functions to add / remove liquidity and swap tokens.

Eventually, you'll have to write some tests to make sure everything works.

Note: This exercise is executed on an Ethereum mainnet Fork block number 15969633.Everything is already configured in the hardhat.config.js file

Ethereum MAINNET Addresses

Accounts

Tasks

Task 1 - Contract Creation

Complete all the open TODOs in Chocolate.sol.

Task 2 - Tests

Complete all the open TODOs in test/dex-1/tests.js

Deployment

Deployer Adds Liquidity

User Swapping

Deployer Removes Liquidity