1/5
### Setting up Foundry and Finding Exercises In this lesson, we'll explain how to set up Foundry to complete exercises and where to find the exercises and solutions. First, navigate to the Github repository, advanced-defi-2024. Then, clone the repo. You can do that by clicking the Code button and copying the git URL. Next, in your terminal, use the following command: ```bash git clone [URL] ``` Once cloned, navigate to the README and scroll down to find a link called “Uniswap V3”. Click on that link, and a new page appears that contains the resources for the course. In particular, we want to show what the exercises look like. Scroll down, and you will see an item similar to: “Exercise 1 - single pool exact input.” Clicking on this will show the exercise. Inside the contract, you can find the instructions for how to complete the exercise. Once you have filled out the code, you can execute the Foundry test to check your answer. If you get stuck, you can check the solutions. Notice the folder structure. Click on the folder, uniswap-v3. Here you will see two folders: exercises and solutions. The exercises folder contains incomplete solidity files, where you must complete the code to finish the task. The solutions folder contains the completed contracts. Finally, we will show you where to find the instructions to set up Foundry for this course. Go back to advanced-defi-2024 and then, under the README, scroll to the link called “Exercises and solutions.” Clicking on this will take you to a section called “Exercises and solutions”. Here, you will find the instructions on how to set up the tests for Foundry. Essentially, you will need to use the following command: ```bash forge build ``` This command will install dependencies and initialize the Foundry project. Additionally, you will need to set up the fork URL for the RPC URL to the Mainnet network. Below are some test commands to execute. You can execute the exercises or the solutions: ```bash forge test --fork-url $FORK_URL \ --match-path test/[name of DeFi protocol]/exercise: \ --match-test name_of_test \ -vvv ``` ```bash forge test --fork-url $FORK_URL \ --match-path test/[name of DeFi protocol]/solution: \ --match-test name_of_test \ -vvv ```
A detailed guide to navigating a GitHub repo for Solidity smart contract exercises. The lesson covers how to clone the repo, locate the exercise files, set up Foundry for testing, and run the exercises, including how to find and check the solutions.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on February 26, 2025
Solidity Developer
Uniswap V3Duration: 3min
Duration: 10min
Duration: 41min
Duration: 7min
Duration: 35min
Duration: 49min
Duration: 22min
Duration: 1h 43min
Duration: 11min
Duration: 1h 03min
Duration: 12min
Duration: 51min
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on February 26, 2025