lessonΒ·25 minΒ·Chapter 2 of 3
Modifiers & Events
Modifiers add reusable preconditions to functions. The classic example: `modifier onlyOwner() { require(msg.sender == owner, 'Not owner'); _; }`. The `_;` placeholder marks where the modified function's body executes. Events are logged on the blockchain and can be monitored by off-chain applications: `event Transfer(address indexed from, address indexed to, uint256 value);`. Indexed parameters can be filtered in logs, up to 3 per event.
π‘ Key Takeaway
This lesson covers the fundamental concepts. Make sure you understand these before moving to the next chapter.