Decoded Logs
Decoded events logs on Base.
Using Decoded Logs
In general, we recommend using this combination of params
and params_keys_mapping
on all of your production pipelines, since it guarantees that your query won’t break if the field names ever change
Logs are decoded via topic0, but they do not specify the name of the params. As a result, there may be inconsistencies in the decoded params field while the underlying values is correct.
Field name changes over time are influenced by contract ABIs used during log decoding. We prioritize contract-specific ABIs but may fallback to generic ABIs. Historical records aren't retroactively updated to maintain query consistency.
Using Params Key Mapping
Using Uniswap v3 Swap() event params as an example, we first reference the params field:
Then look at the params_keys_mapping
:
From there, rewrite the query using params[params_keys_mapping[index]]
syntax:
Table Columns
Column Name | Description |
---|---|
block_number | The length of the chain, in blocks. |
block_timestamp | The time when the block that contains this log was included on the blockchain. |
block_hash | Unique identifier of the block that includes this log. |
address | The address of the contract that emitted this log. |
name | Log event name. |
params | Decoded parameters in JSON format. |
data | Unindexed data containing further information of the event, encoded in hex. |
topic0 | The keccak256 hash of a flattened event signature string. |
topic1 | First indexed topic of the event. |
topic2 | Second indexed topic of the event |
topic3 | Third indexed topic of the event. |
transaction_from_address | The address of the sending party of this transaction. |
transaction_to_address | The address of the receiving party of this transaction. |
transaction_hash | Unique identifier of the transaction that this log belongs to. |
transaction_index | The position of this transaction in the block that it belongs to. The first transaction has index 0. |
log_index | The position of this log in the block that it belongs to. The first log has index 0. |
signature | Event log signature. |
params_keys_mapping | Mapping of parameter keys in decoding. |
interface_id | Interface ID. |
_created_at | Timestamp of the entry creation. |
_updated_at | Timestamp of the entry update. |
Last updated