Output
ngu.events.v1.NguEventserc1155_gaming_events
Package ref
erc1155-gaming-events@v1.0.1Run package
CLI
Run map_ngu_events from the command line.
substreams run erc1155-gaming-events@v1.0.1 map_ngu_events -e base-sepolia --start-block -1substreams auth or directly on thegraph.market (see docs).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.
Modules
Execution graph
Store value
bigint
Update policy
add
Inputs