event
index
Kathmandu Tezos protocol upgrade has introduced contract events, a new way to interact with smart contracts. This index allows indexing events using strictly typed payloads. From the developer's perspective, it's similar to the big_map
index with a few differences.
An example below is artificial since no known contracts in mainnet are currently using events.
contract: events_contract
tag: move
- callback: on_roll_event
contract: events_contract
tag: roll
- callback: on_other_event
contract: events_contract
Unlike big maps, contracts may introduce new event tags and payloads at any time, so the index must be updated accordingly.
async def on_move_event(
ctx: HandlerContext,
event: Event[MovePayload],
) -> None:
...
Each contract can have a fallback handler called for all unknown events so you can process untyped data.
async def on_other_event(
ctx: HandlerContext,
event: UnknownEvent,
) -> None:
...