1/5
## Setting Up Foundry for Exercises This course will have some exercises using Foundry, so we will explain the setup procedure for the exercises. The first step is to navigate to the Github repository called "defi-reth". Then you need to `git clone` the repository by clicking on the code to obtain the correct URL, then within the terminal, you will need to type: ```bash git clone followed by this URL ``` Once we `git clone` the repository, open it with a code editor. Then click on the "README" file to show you how to set up Foundry to complete the exercises. To set up Foundry, the first step is to go into the Foundry directory. Open the terminal, and then change the directory: ```bash cd foundry ``` Once inside the Foundry folder, build the project by typing: ```bash forge build ``` This will compile all the contracts and install any dependencies. There is one more step to do within this folder. The exercises will execute against the Mainnet network, so we need to provide a Mainnet RPC URL. We can store the Mainnet URL in a file called `.env`. ```bash .env ``` To do the exercise, all you need to do is fill out the `FORK_URL`. When you execute the Forge test, set this URL as the environment variable. The rest of the variables you see here are used to run Forge scripts, and this is an optional setting. Next, I'll explain the folder structure for the exercises. Under "Foundry", then under "source", you'll see two folders that will interest you: "exercises" and "solutions". "Exercises" will contain incomplete code where you will write your code and then execute the test. In the test folder, you'll see that these tests are executed with the contracts from the exercises folder. If you're feeling stuck or just want to see the solutions, you can click on the "solutions" folder to see the actual solution, or if you want to run the test against the solutions, then change the file path from "exercises" to "solutions". To do the exercises, we're back inside the Github repository "defi-reth", and then click on the README file. There will be sections where it says "Foundry Exercises". For example, let's click on one, "Foundry Exercise to add Liquidity to Balancer". This will take you to another README file where it will instruct you on what to do for the exercise. After you've completed the code and you're ready to test, copy the test command and then execute it inside your terminal. When you do so, make sure that you set the `FORK_URL` as an environment variable.
A comprehensive guide to setting up the Foundry testing environment for smart contract development. The lesson explains the necessary steps to clone the provided repository, build the project, and run the tests. It also covers setting up the environment variables needed for the tests to run successfully. The lesson then guides viewers through the folder structure and showcases the exercises, which provide incomplete code to complete and test. The lesson concludes by explaining how to access the solutions for those who need assistance.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
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)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on March 26, 2025
Stay in the loop with the latest Rocket Pool updates and connect with over 5,000 developers in the community.
Solidity Developer
Rocket Pool rETH IntegrationDuration: 4min
Duration: 48min
Duration: 57min
Duration: 30min
Duration: 7min
Duration: 23min
Duration: 6min
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
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)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on March 26, 2025