Output
sf.substreams.foundational_store.v1.Entries
Package ref
evm-token-metadata-foundational-store@v0.1.1Run package
CLI
Run metadata_to_foundational_store from the command line.
substreams run evm-token-metadata-foundational-store@v0.1.1 metadata_to_foundational_store -e mainnetsubstreams auth or directly on thegraph.market (see docs).README
A Substreams module that extracts token metadata (name, symbol, decimals) from EVM blockchains and outputs it in a format compatible with the Substreams Foundational Store.
This project was created for use with the Substreams Foundational Store from StreamingFast, which provides a high-performance, multi-backend key-value storage system designed for Substreams data ingestion and serving.
The substream imports the ERC20 Metadata substream created by Pinax for the TokenAPI, extending it to output data in the Foundational Store format.
Entries with key-value pairs where values are google.protobuf.Any messagesThe substream outputs token metadata using the following protobuf structure:
syntax = "proto3";
package evm.token.metadata.v1;
message TokenMetadata {
bytes address = 1;
string name = 2;
string symbol = 3;
int32 decimals = 4;
}
Each TokenMetadata message is wrapped in a google.protobuf.Any and stored as the value in a Foundational Store Entry, with the token address as the key.
The substream processes two types of events:
The module outputs foundational_store.v1.Entries containing:
TokenMetadata message wrapped in google.protobuf.AnyThis format is optimized for ingestion by the Foundational Store sink.
wasm32-unknown-unknown target# Install WASM target if not already installed
rustup target add wasm32-unknown-unknown
# Generate protobuf bindings
make protogen
# Build the WASM module
cargo build --release --target wasm32-unknown-unknown
# Run the substream
substreams run substreams.yaml metadata_to_foundational_store -e <your-endpoint>
# Package for deployment
substreams pack substreams.yaml
├── proto/
│ ├── foundational-store.proto # Foundational Store definitions
│ └── token-metadata.proto # Token metadata structure
├── src/
│ ├── lib.rs # Main substream logic
│ ├── rpc.rs # RPC batch utilities
│ └── pb/ # Generated protobuf bindings
├── substreams.yaml # Substream manifest
└── Cargo.toml # Rust dependencies
substreams: Core substreams functionalityprost: Protobuf encoding/decodingprost-types: Well-known protobuf types (Any)substreams-ethereum: Ethereum RPC utilitiesThis project follows the same license as the foundational components it builds upon.
Modules
Output
sf.substreams.foundational_store.v1.Entries
Store value
bigint
Update policy
add