Create Core Contract
Install Forge from Foundry and add the modular contract framework:
Add the Thirdweb modular contracts to foundry.toml under remappings:
- Create a new file in the - srcfolder called- CounterCore.sol, and inherit the- Corecontract.- Note 
 The- Corecontract is the base contract that needs to be inherited for this contract to be recognized as a core contract.
- Implement the - getSupportedCallbackFunctionsfunction. The Core contract is abstract because this function is not implemented. To avoid compilation errors, declare the function with an empty body for now.
- Define a function to increment a counter. 
- Introduce the - _beforeIncrementfunction to use the- beforeIncrementcallback from a module to achieve this, we'll introduce the interface- BeforeIncrementCallback- Note 
 Callback functions are hook-like functionalities that can be used before or after the main functionality of a core contract.
 In this example, the- beforeIncrementcallback is executed before the main increment functionality.
- Implement the - getSupportedCallbackFunctionsand- supportsInterfacefunctions to expose which callback functions and interfaces this core contract supports.
This guide will help you create a core contract that can increment a counter with optional callback functions for additional modular functionality.