chainAbi
helper allows you to trigger your listener on any contract that matches a specific ABI signature. This is incredibly powerful for monitoring activity across all instances of a particular standard, like ERC-721 or Uniswap V3 pools, without needing to list every contract address explicitly.
onBurnEvent
handler for any contract on Ethereum that matches the UniswapV3Pool
ABI. The UniswapV3Pool$Abi()
is a helper struct that is automatically generated from that ABI file.
chainGlobal
helper creates triggers that are not tied to any specific contract or ABI. This can be used to set up block-level handlers with onBlock
for tasks that need to run once per block, such as creating periodic data snapshots, calculating time-weighted averages, or performing end-of-block settlements.
The framework provides a built-in abstract contract, Raw$OnBlock
, for this purpose.
First, implement the onBlock
handler and register the trigger in the Triggers
contract.
Next, add Raw$OnBlock
to your listener’s inheritance list.
Raw$OnCall
and Raw$OnLog
, allowing you to create global triggers for every function call or every event log on a chain.
Swap
event on a pool tells you a swap occurred, but you need to call the pool contract directly to get its current slot0
state. Solidity interfaces allow your listener to do this.
interfaces
directory (e.g., listeners/src/interfaces/
) and define the interface in a new .sol
file.
Stack too deep
errors, refer to the Listener Errors guide.@custom:index
annotation directly above the event
definition in your Solidity listener.
<index_name>
: A unique name for your index.<INDEX_TYPE>
: The type of index to create (e.g., BTREE
).(<columns>)
: A comma-separated list of columns to include in the index. These names must exactly match the parameter names in your event
definition, including case.pool
, block_number
, and to_address
columns.
@custom:index
lines. This is useful when your API queries the same table in different ways.
BTREE
is the default and most common type, suitable for a wide range of queries.
Type | Use Case |
---|---|
BTREE | The default and most versatile index type. Good for equality and range queries on sortable data (= , > , < , BETWEEN , IN ). |
HASH | Useful only for simple equality comparisons (= ). |
BRIN | Best for very large tables where columns have a natural correlation with their physical storage order (e.g., timestamps). |
GIN | An inverted index useful for composite types like array or jsonb . It can efficiently check for the presence of specific values within the composite type. |
GIST
and SP-GIST
index types, they are not practically usable in Sim IDX as they require data types (like geometric types) that are not generated from Solidity events.sim build
command automatically validates your index definitions. If it detects an error in the syntax, it will fail the build and provide a descriptive error message.
For example, if you misspell a column name:
Error: Cannot find column(s): 'block_numbr' in event PositionOwnerChanges