Update docs

This commit is contained in:
kayibal
2025-02-05 00:23:40 -06:00
committed by Alan Höng
parent 08d2c7a82e
commit 5eb08acf82
2 changed files with 23 additions and 8 deletions

View File

@@ -9,8 +9,8 @@
//!
//! ## Alternative Module
//! If your protocol uses a vault-like contract to manage balances, or if pools are
//! registered within a singleton contract, refer to the `modules_singleton` module
//! for an appropriate alternative.
//! registered within a singleton contract, refer to the `ethereum-template-singleton`
//! substream for an appropriate alternative.
//!
//! ## Warning
//! This template provides a general framework for indexing a protocol. However, it is

View File

@@ -1,5 +1,19 @@
//! Template for Protocols with singleton contract
//!
//! This template provides a starting point for protocols that follow a singleton
//! pattern. Usually these protocols employ a fixed set of contracts instead of
//! deploying new contracts per component.
//!
//! ## Alternative Module
//! If your protocol uses individual contracts deployed with a factory to manage
//! components and balances, refer to the `ethereum-template-factory` substream for an
//! appropriate alternative.
//!
//! ## Warning
//! This template provides a general framework for indexing a protocol. However, it is
//! likely that you will need to adapt the steps to suit your specific use case. Use the
//! provided code with care and ensure you fully understand each step before proceeding
//! with your implementation
//!
use std::collections::HashMap;
use anyhow::Result;
@@ -78,10 +92,11 @@ fn store_protocol_tokens(map_protocol_components: BlockTransactionProtocolCompon
/// is decreased.
///
/// ## Note:
/// Changes are necessary if your protocol uses native ETH or your component burns or
/// - If your protocol emits events that let you calculate balance deltas more
/// efficiently you may want to use those instead of raw transfers.
/// - Changes are necessary if your protocol uses native ETH or your component burns or
/// mints tokens without emitting transfer events.
///
/// You may want to ignore LP tokens if your protocol emits transfer events for these
/// - You may want to ignore LP tokens if your protocol emits transfer events for these
/// here.
#[substreams::handlers::map]
fn map_relative_component_balance(params: String, block: eth::v2::Block, store: StoreGetInt64) -> Result<BlockBalanceDeltas> {