Lesson 4: Assignments & Exercises

Assignments and Practical Exercises

Assignment 1:

  • Write a brief essay explaining the differences between require, revert, and assert, and provide scenarios where each is appropriate.

Exercise 1:

  • Create a smart contract implementing a simple banking system with functions for deposit and withdrawal. Use require statements for validating conditions.

Exercise 2:

  • Modify the above contract to include events for each deposit and withdrawal action. Test the contract to ensure that events are emitted correctly.


This lesson will help you understand how to make your smart contracts more reliable and informative through proper error handling and the use of events. These concepts are essential for creating robust and user-friendly smart contracts. Once you've completed this lesson, you'll have a deeper understanding of how to manage errors and provide feedback to users and front-end applications.

Last updated