Contract events¶
event Tipped(address indexed from, address indexed to, uint256 amount, uint256 fee);
emit Tipped(msg.sender, to, msg.value, fee);
- Up to three
indexedparameters become topics (filterable); the rest is ABI-encodeddata. topic0iskeccak256("Tipped(address,address,uint256,uint256)")(not foranonymousevents).- Emit events before external calls (checks-effects-interactions).
Reading events¶
cast logs --from-block <n> --to-block <m> --address <contract> "Tipped(address indexed,address indexed,uint256,uint256)" --rpc-url "$RPC"
PQWERAI limits:
| Limit | Value |
|---|---|
eth_getLogs block range |
≤ 5000 blocks per request by default (--rpc.logs-max-range) |
eth_getFilterLogs |
disabled — use eth_getLogs or eth_getFilterChanges |
WebSocket eth_subscribe("logs") |
not available (HTTP only) — poll |
| Reorganisations | logs above g4_status.finalized_height can be removed; removed: true appears in filter results |
For history beyond a few thousand blocks, page through ranges or use the explorer API.
Sources at 72057fe3ec: developers/examples/patterns/src/TipJar.sol · developers/examples/first-contract/interact.sh
Found a problem? Report a documentation issue · Build testnet-rc1+72057fe3ec