Package Logo
erc1155_gaming_events
erc1155_gaming_events@v1.0.1
Total Downloads
3
Published
yesterday
Publisher
User Avatar mcherneski

Readme

ERC-1155 Gaming Events Substreams Package

Overview

This Substreams package processes blockchain events from ERC-1155 gaming contracts on the Base Sepolia network. It extracts and classifies TransferSingle and TransferBatch events from gaming contracts, classifying them as mint, burn, transfer, stake, and unstake events.

Example Contracts:

  • Gaming Contract: 0x30464983F177baa4dCAAb693E58ebDD1B9a785c5
  • Staking Contract: 0xd72E2341002Fb873c4E0cEE0Dc6078CAeA93793c

Event Types

The package classifies events into the following categories:

Gaming Contract Events

  • mint: New tokens created (from = 0x0, to = user)
  • burn: Tokens destroyed (from = user, to = 0x0)
  • transfer: Tokens moved between users (from = user, to = user)

Staking Contract Events

  • stake: Tokens staked (from = 0x0, to = user)
  • unstake: Tokens unstaked (from = user, to = 0x0)
  • transfer: Staked tokens transferred (from = user, to = user)

Usage

Running Locally

# Build the package
substreams build

# Run the map module
substreams run map_ngu_events \
  --start-block=26954975 \
  --stop-block=26954985

Using the Published Package

# Run from the published package
substreams run ngu_events_v1.0.0 map_ngu_events \
  -e https://api.studio.thegraph.com/substreams/[PACKAGE_ID] \
  --start-block=26954975 \
  --stop-block=26954985

Output Format

The package outputs NguEvents protobuf messages containing:

message NguEvents {
  repeated NguEvent events = 1;
  uint64 total_count = 2;
  uint64 first_block = 3;
  uint64 last_block = 4;
}

message NguEvent {
  string event_type = 1;          // "mint", "burn", "transfer", "stake", "unstake"
  uint64 block_number = 2;
  string block_hash = 3;
  string transaction_hash = 4;
  uint64 transaction_index = 5;
  uint64 log_index = 6;
  uint64 timestamp = 7;
  string contract_address = 8;
  string contract_type = 9;       // "NGU_GLYPH" or "NGU_STAKED"
  EventData event_data = 10;
}

Configuration

Contract Addresses

The package is configured to monitor these example contracts on Base Sepolia:

  • Gaming Contract: 0x30464983F177baa4dCAAb693E58ebDD1B9a785c5
  • Staking Contract: 0xd72E2341002Fb873c4E0cEE0Dc6078CAeA93793c

Start Block

  • Initial Block: 26954975 (Base Sepolia deployment block)

Integration

This package is designed to work with:

  • Go gRPC Client: Consumes Substreams and forwards to Kinesis
  • AWS Lambda Processors: Process events for game logic
  • Real-time Gaming: Provides low-latency event processing

Performance

  • Event Processing: Real-time blockchain event extraction
  • Scalability: Handles high-volume gaming events
  • Reliability: Built-in Substreams reliability features

Development

Prerequisites

  • Rust 1.70+
  • Substreams CLI
  • Protocol Buffers compiler

Building

# Install dependencies
cargo build --release --target wasm32-unknown-unknown

# Build Substreams package
substreams build

Testing

# Test with small block range
substreams run map_ngu_events \
  --start-block=26954975 \
  --stop-block=26954980

License

This package is designed for ERC-1155 gaming applications.

Support

For issues or questions, please refer to the NumberGoUp documentation or create an issue in the repository.

Documentation

Modules

Maps icon
Maps

map
map_ngu_events

261f3ea5a3ac3d72b9176e3137e8d34af7ae6721
map map_ngu_events (
blocksf.ethereum.type.v2.Block
)  -> ngu.events.v1.NguEvents
substreams gui erc1155-gaming-events@v1.0.1 map_ngu_events
Stores icon
Stores

store
store_event_counts

cd140526aebe0cfe45d87860ef1f127f333788d0
store <add,bigint> store_event_counts (
)
substreams gui erc1155-gaming-events@v1.0.1 store_event_counts
Protobuf

Protobuf Docs Explorer

ngu.events.v1