Hemera Doc
  • 👋Welcome
    • Introduction
    • Quick Start
    • Account Centric Indexing Protocol
      • What is Account-Centric Indexing?
      • Why "account-centric" indexing?
      • The advantages of Account-Centric Indexing
      • What's next for account-centric indexing?
      • Why create a new protocol here?
      • The Hemera Network
        • Network Roles
        • Indexers
        • Validators
        • Proprietary models & knowledge
        • Proprietary data and labels
        • Smart Contracts
        • Key roadmap items
        • Supported blockchains
      • Example Hemera use cases
        • SocialScan Explorers
        • Anti-sybil UML algorithm
        • Ethereum long term DA
        • EVM chain history preservation
        • Ecosystem AI Agents
        • User-defined AI Agents
  • 👩‍💻Developer Resources
    • Smart Contract Developers
    • EVM-compatible chains
      • Blockchain explorers
      • SocialScan explorer API doc
      • Ecosystem AI Agents
    • Dapp developers
    • User-defined Agent creators
    • AVS Operator
  • 🖥️Hemera Indexer
    • Introduction
    • Installation
      • Prerequisites
      • Install & Run
      • Export Result
    • Configurations
    • Benchmark
    • Data Class
      • Raw Data Tables
        • Blocks
        • Transactions
        • Logs
        • Traces
      • Generated Tables
        • Contract Internal Transactions
        • ERC20 Token Transfers
        • Tokens
        • ERC20 Token Holders
        • ERC721 Token Transfers
        • ERC721 Token Holders
        • ERC1155 Token Transfers
        • ERC1155 Token Holders
        • Address Coin Balances
        • Address Token Balances
        • Address Current Token Balances
        • Daily Wallet Address Stats
        • Contracts
      • Other Tables
        • Inscriptions
        • Bridges
          • L1 to L2 Transactions
          • L2 to L1 Transactions
          • Optimistic Rollup Data Availability Batches
          • Optimistic Rollup State Batches
    • Use Cases
      • UniSwap V3
        • Data Class
        • Trigger and Function
        • Run & Query
      • ENS
        • Data Class
        • Trigger and Function
        • Run & Query
      • OpenSea
        • Data Class
        • Trigger and Function
        • Run & Query
      • Deposit to L2
        • Data Class
        • Trigger and Function
        • Run & Query
      • User Profile
  • UDFs - User Defined Functions
    • Introduction
    • Components of UDFs
    • Building User Defined Functions(UDF)
    • Testing and Running UDF
    • Troubleshooting and Support
    • Supported UDFs
    • FAQs
  • 😄About us
    • The story behind building Hemera
    • Partners & Backers
    • Partnership inquiries
    • Hemera Powered Explorers
    • Active Developer Hackathons
    • Developer Contribution
  • Documentation feedback
Powered by GitBook
On this page
  1. Developer Resources

Smart Contract Developers

PreviousUser-defined AI AgentsNextEVM-compatible chains

Last updated 4 months ago

Smart contract developers often need to analyze their data. Assuming you are a developer from EigenLayer, and your community is requesting a comprehensive dashboard on how each wallet addresses stake with EigenLayer, here are the steps you can follow to accomplish this using the Hemera Protocol.

Create your data model

To store the result, we can design a simple data model

class DailyWalletTokenStaking(BaseModel):
    date = Column(Date)
    wallet_address = Column(String)
    token_address = Column(String)
    balance = Column(Numeric)

Understand your smart contract data

You must include all the transactions/logs/traces, which may change your output data. For your use case, you need to identify all the staking balance changes.

If you understand your contract well, you should figure out that this transaction will trigger a user-staking balance change.

Method: depositIntoStrategy:

Design trigger event

To summarize, whenever you see a transaction that interacts with this specific address (EigenLayer: Strategy Manager) and calls this specific function (depositIntoStrategy) from your smart contract, you should update the user staking balance.

You can define this customized trigger within the indexer using this code.

# 0xe7a050aa is refering to the depositIntoStrategy
0x858646372CC42E1A627fcE94aa7A7033e7CF075A
(EigenLayer: Strategy Manager)
if transaction.to_address == "" and transaction.method_id == "0xe7a050aa":
    # call update_daily_wallet_token_staking
    update_daily_wallet_token_staking(transaction, logs, traces)

The trigger can be a method in transactions, topics from logs, or even an action from the trace.

Write customize code

Now we can add our code and update our data model when an event is triggered. The event will pass transaction data/logs/traces to you.

You can write your customized code and update the data model you design.

def update_daily_wallet_token_staking(
    transaction: Transaction, logs: Log[], traces: Trace[]
    ):
    # Get balance change from logs
    
    # Update model
    
    

Learn more about User Defined Functions: Building User Defined Functions(UDF)

👩‍💻
https://etherscan.io/tx/0x7269c2cf90779d82b3b53f6c997cabd25243cb60f6f136e8ce5a1e6d510d478e