2. Getting Started
Practical guide to write an indexing component.
Before integrating, ensure you have a thorough understanding of the protocol’s structure and behavior. Key areas to focus on include:
Contracts and Their Roles: Identify the contracts involved in the protocol and the specific roles they play. Understand how they impact the behavior of the component you're integrating.
Conditions for State Changes: Determine which conditions, such as oracle updates or particular method calls, trigger state changes (e.g. price updates) in the protocol.
Component Addition and Removal: Check how components are added or removed within the protocol. Many protocols either use a factory contract to deploy new components or provision new components directly through specific method calls.
Once you have a clear understanding of the protocol's mechanics, you can proceed with the implementation.
Next Steps
Proceed with Substream Package Structure: This document will provide you with a clear understanding of the deliverables and how to structure your package. Then, begin implementing the recommended handlers or adjust the structure to fit your specific needs.
Read About Tracking Components: This is essential for protocols that use factory contracts, as it outlines how to track new components effectively.
Normalize Relative ERC20 Balances: If you’re working with relative balance changes instead of absolute values, familiarize yourself with the suggested approach for normalizing balances.
Track Contract Storage: For cases where you need to monitor the storage of specific contracts, consider using the techniques in the Tracking Contract Storage guide.
Set Up and Run Tests: Make use of the comprehensive testing suite for end-to-end testing of your Substreams modules.
Last updated