*Week 14 at Blockfuse Labs: Building a School Management System and an NFT Marketplace with Foundry*
In Week 14 at Blockfuse Labs, I worked on building a School Management System and an NFT Marketplace using Foundry. Here's a summary of my experience:
*Discovering Foundry*
Foundry is a powerful tool for smart contract development that allows for faster testing, debugging, and deployment. I learned how to use Forge and Cast, two main tools in Foundry, to build, test, and deploy smart contracts.
*School Management System*
I built a School Management System smart contract that allows admins to register students and assign grades. The contract uses a mapping to store student data, including their name and grade.
*Testing in Foundry*
I wrote tests for the School Management System contract using Solidity. Foundry allows for writing tests directly in Solidity, making it easy to test smart contracts. I used cheatcodes like `vm.prank` and `vm.expectRevert` to test different scenarios.
*NFT Marketplace*
I also built an NFT Marketplace contract that allows users to mint, list, and buy NFTs. The contract uses the ERC721 standard and allows owners to list their NFTs for sale.
*Testing the NFT Marketplace*
I wrote tests for the NFT Marketplace contract using Solidity. I tested different scenarios, including minting and listing NFTs, buying NFTs, and ensuring that only owners can list their NFTs.
*Foundry Commands*
I used several Foundry commands to build, test, and deploy my contracts. Some of the commands I used include:
- `forge build`: Compiles contracts
- `forge test`: Runs tests
- `forge test -vvv`: Runs tests with detailed logs
- `cast call`: Calls a contract function
- `cast send`: Sends a transaction
*Conclusion*
By the end of Week 14, I had gained hands-on experience building and testing smart contracts with Foundry. I learned how to use Forge and Cast, write tests in Solidity, and deploy contracts to the blockchain. I'm excited to continue exploring the capabilities of Foundry and building more complex smart contracts.