Skip to main content

store

Attribute Macro store 

Source
#[store]
Expand description

Marks a function as a Substreams store handler, generating the necessary WASM boilerplate.

§Panic Handling

Panics in handlers are trapped by the Substreams Engine and reported as deterministic errors back to the user. This includes any explicit panic!() calls in your handler.

§Options

The macro accepts the following comma-separated options:

OptionDescription
keep_empty_outputPrevents calling substreams::skip_empty_output()

Note: The testable option is not currently supported for store handlers.

§Usage

use substreams::store::StoreAddInt64;

#[substreams::handlers::store]
fn store_transfers(transfers: pb::Transfers, store: StoreAddInt64) {
    // store logic
}

Store handlers must not return a value. The writable store parameter is automatically instantiated by the macro.