EventLogger
Utility contract for human‑readable protocol logs. Core contracts can push compact, tagged bytes that indexers decode off‑chain. This keeps on‑chain events small while enabling rich UIs and debugging without changing core event schemas.
UUPS‑upgradeable, ownable, pausable. Only allowed emitters may log. Reading is public.
Responsibilities
- Maintain an allow‑list of authorized emitters (Escrow/Consensus/Registry/etc.).
- Emit a single canonical event carrying tag, emitter, and opaque bytes.
- Avoid coupling to any single contract’s schema—indexers own the decoding.
Interface
Writes
log(bytes32 tag, bytes data)— onlyAllowedEmitter. EmitsLogged(tag, msg.sender, data).
Reads/Admin
isAllowed(address emitter) → boolsetAllowed(address emitter, bool allowed)— onlyOwner; EmitsAllowedSet(emitter, allowed)pause()/unpause()— onlyOwner- UUPS
upgradeTo/upgradeToAndCall(...)— onlyOwner
Event
event Logged(
bytes32 indexed tag,
address indexed emitter,
bytes data
);Tag conventions (suggested)
0x46494E414C5A...→"FINAL"(finalization summaries)0x524546554E44...→"REFUND"0x51554F52554D...→"QUORUM"0x4552524F52...→"ERROR"
Tags are arbitrary; choose short ASCII strings left‑padded/truncated into 32 bytes.
Typical payload shapes (off‑chain)
Decoding is performed by indexers; for reference:
-
Finalize summary (
tag = FINAL){ requestId: bytes32, apiId: bytes32, seqNo: uint256, providerTs: uint64, contentHash: bytes32, msgHash: bytes32, votes: uint256 } -
Refund summary (
tag = REFUND){ requestId: bytes32, apiId: bytes32, reason: uint8, amount: uint256 } -
Quorum progress (
tag = QUORUM){ requestId: bytes32, candidate: bytes32, // msgHash votes: uint256 }
Use CBOR or compact JSON; indexers should hash payload bytes to a stable key alongside
blockNumber/logIndexfor deduping.
Integration tips
- Treat
EventLoggeras supplemental—your primary state comes from core events on Escrow/Consensus/Registry. - Keep
datacompact (< 1–2 kB). Large payloads belong in off‑chain storage referenced bycontentHash. - Add the logger address to your indexer and subscribe to
Logged(tag, emitter, data)for richer dashboards and alerting.
Admin & security notes
- Only trusted system contracts should be allowed emitters; avoid EOAs unless absolutely necessary.
- Pausing the logger does not affect core protocol flows; it merely suppresses supplemental logs.
- Upgrades should remain backward‑compatible with the
Loggedevent to avoid breaking indexers.
Minimal ABI (readers)
[
{"type":"event","name":"Logged","inputs":[
{"name":"tag","type":"bytes32","indexed":true},
{"name":"emitter","type":"address","indexed":true},
{"name":"data","type":"bytes","indexed":false}
]},
{"type":"function","stateMutability":"view","name":"isAllowed","inputs":[{"name":"emitter","type":"address"}],"outputs":[{"type":"bool"}]}
]Out of scope for this page
- Contract addresses & ABIs → Architecture → Addresses & ABIs
- Core state/events → see APIEscrow, APIConsensus, AccessRegistry
- Node staking/slashing → NodeRegistry
Last updated on