The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Exploring Foundry: Students Share Their Learning Journey Week 10

The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.

A Cohort 9 student recaps week 10, when the class learned Foundry for testing smart contracts, including cheat codes that simulate time and other addresses. They describe two tasks, an NFT marketplace using signed orders and a Merkle tree airdrop for whitelisted addresses, and say they prefer Foundry to the tool used before.

Not by We Them Media Channel: Web3Bridge. Published Thursday 9 November 2023.

Titles are the owner’s. It plays from their channel.

Transcript

This transcript may contain errors. This video belongs to Web3Bridge. Letters mark each change of speaker.

These are the speakers’ own words. We have not checked their claims.

0:09 A: Web3 Bridge Cohort 9, sponsored by Base.

0:11 B: So, um, this is my week 10 as a student of Web3 Bridge Cohort 9. It was like the founders said, the shaggy week. So week 10 was the beginning of- we introduced Foundry testing by another mentor.

0:31 C: Foundry is an development environment that's used for smart contracts. Up until this moment, we have used Adax. We also started testing, unit testing Foundry. This allowed us to test for different test cases in our smart contracts, and there were some cheat codes that enabled us to like test And manipulate some situations like the time, which was like being in the trap, the, um, how we could like prank addresses, we could prank, um, private keys as well. And this, while I was testing, like, I kind of found some bugs that I never expected I could see.

1:18 D: He shock you? Yeah,

1:21 C: I told my people to stop testing and I found some bugs, and that was really interesting.

1:26 E: Foundry is a tool that helps us build smart contracts. So Foundry is just like ADAT. ADAT is also a tool for building smart contracts, but ADAT was built with JavaScript. So that means for after you write your Solidity code, for you to use scripting and testing, you have to use JavaScript or TypeScript. But then Foundry gives you a better thing to work with because you code in Solidity, you can also test with Solidity, and also deploy scripts with Solidity. And this was what we explored last week. We were able to learn how to test with Foundry and also the scripting part. But In the test part, we also learned about some cheat codes which Foundry gives us, and those cheat codes come with a library, VM, and that library gives us access to impersonating users, pranking users to make transactions with their addresses, and also, um, like a lot of other things you can do In simulation, because what testing gives us is like a simulated environment where you can do anything. You can try to prank somebody, try to act like you're Vitalik on the blockchain.

2:55 D: Are you serious? Wow, wow, wow, wow, that's so crazy!

3:05 E: So that you can be able to test your smart contracts and test different conditions in your smart contracts. And it was fun learning how to use Foundry, and I think on my personal preference, I prefer Foundry to others.

3:21 B: We were given a task. We worked on about 2 different tasks. The first task we were given was, um, like kind of a marketplace where people can come place like orders, a great order for their NFTs. And then people can come buy an NFT from the marketplace. Yeah, so that, um, that was really enlightening. So we talked about, like I said, signature, where you are- before you have to create an order, you have to sign the message. And when, like, that message is to be verified before you can add your NFT to the marketplace. The second task we did was the Miku Kind of tasks where we have a list of whitelisted addresses that can come and claim tokens, ERC-20 tokens. We work with a MEKO airdrop in which we, we have the scripts and a list of addresses that are qualified for a particular airdrop.

4:21 F: So we run the scripts that allows us to generate a MEKO node. For the list of addresses, generating the leaves and nodes for us. So we wrote a Foundry, a smart contract using Foundry that allows, that only allows the list of addresses to qualify for our particular airdrop. So we were, the whole point of using the whitelisted addresses or using the Merkle trees is to be able to compare The whitelisted addresses and the set of addresses that we want to get our airdrop. So if someone comes to our dApp that we built or our contract and wants to get our airdrop, when he connects, he or she connects his wallet, then it has to be the wallet that is whitelisted. If not, they won't be able to claim our airdrop.

5:13 C: And it was amazing knowing how to build this thing, how to build our an ad hoc contract from scratch. It was so amazing.

5:23 B: I also wrote the test for both tasks. The test was really nice because I basically, I took like the whole, like 24 hours, doing the whole thing without like an hour of sleep just to like complete that task. And it was really enlightening and interesting and sigh of relief. I look forward to what we can rely on, and I know Web3 Bridge has a lot to offer, and we'll shake it. Thank you very much.

5:53 A: Web3 Bridge Cohort 9, sponsored by Base.

More from this hub

Something wrong, or a video you want off this page? Write to wethem.xyz@gmail.com and it is fixed or taken down within 48 hours.