Agent Entry Points
Starting Agents
Startup Flow
Both agents follow the same startup pattern:Event Listener Pattern
All event listeners follow a safe wrapper that prevents unhandled rejections from crashing the agent:Transaction Queue Pattern
The market-maker uses a FIFO transaction queue to prevent nonce collisions when multiple events arrive simultaneously:enqueue(). The oracle has fewer concurrent operations but uses the same pattern for safety.
Adding a New Oracle Data Source
To add a new approved data source that the oracle can reference:1. Update the validation prompt in compute.ts
2. Include it in market metadata at creation
The frontend already allows market creators to specify up to 5 custom sources. These get stored in the 0G Storage metadata blob and are read by the oracle at resolution time.3. No contract changes needed
Sources are entirely off-chain data stored in 0G Storage. The contracts only store the metadata root hash.Testing Compute and Storage Integrations
Manual testing with test scripts
Unit testing agent logic
Agent logic (excluding 0G dependencies) can be tested with mocks:Logging Format
All log output uses structured JSON via thelogger module. Every entry includes:
Config System
Thecfg() helper in agent/src/shared/config.ts provides typed, validated env var access: