How shc-labs/dragonsmarket works
Dragons Market is a NEAR prediction-market application: users trade event Yes/No shares or short-window Up/Down rounds, then redeem or receive results after resolution. Proposed market results can be challenged and decided by a Dragon-holder jury; platform revenue also supports quarterly holder claims. The website, backend indexer/read API, contracts, and keeper form the core product, with agent access and an MCP interface as additional capabilities. The README documents the product stages; source excerpts establish selected backend and MCP calls, so unsampled runtime links are omitted.
Main entry points: keeper.mjs Keeper workers · read-api.ts Read API · engine.ts Chain ingestion · lib.rs Event markets
Components 23
On-chain products
- Event markets
contracts/market/src/lib.rs - Price rounds
contracts/rounds/src/lib.rs - Results and jury
contracts/oracle/src/lib.rs - Dragon Council
contracts/council/src/lib.rs
Backend services
- Backend API
backend/src/app.ts - Wallet sign-in
backend/src/auth.ts - Chain ingestion
backend/src/ingestion/engine.ts - Block preparation
backend/src/ingestion/block.ts - Indexed records
backend/src/ingestion/store.ts - Read API
backend/src/read-api.ts - Postgres
backend/src/database.ts - Agent operations
backend/src/agent-accounts.ts - Agent actions
backend/src/agent-actions.ts - Agent routing
backend/src/agent-routes.ts
User interfaces
- Website
web/app
Automation and agents
- Keeper workers
contracts/keeper/keeper.mjs - MCP interface
mcp/src/server.ts - MCP tools
mcp/src/tools.ts - MCP backend client
mcp/src/backend.ts
Other components
- Market participant
- NEAR chain
- NEAR Intents
- Dragon holders
Connections 25
- Market participant → Website: uses
README.md - Website → Event markets: trades shares
- Event markets → NEAR chain: executes on
README.md - Price rounds → NEAR chain: executes on
README.md - Results and jury → NEAR chain: executes on
README.md - Dragon Council → NEAR chain: executes on
README.md - NEAR Intents → Event markets: holds collateral
README.md - Dragon holders → Results and jury: votes on challenges
README.md - Keeper workers → NEAR chain: sends transactions
README.md - Keeper workers → Results and jury: advances finalization
README.md - Keeper workers → Price rounds: publishes prices
README.md - Keeper workers → Dragon Council: sweeps fees
README.md - Backend API → Read API: routes reads
backend/src/app.ts - Backend API → Wallet sign-in: serves sign-in
backend/src/main.ts - Chain ingestion → Block preparation: prepares blocks
backend/src/ingestion/engine.ts - Chain ingestion → Indexed records: commits blocks
backend/src/ingestion/engine.ts - Read API → Indexed records: reads index status
backend/src/read-api.ts - Read API → Postgres: queries records
backend/src/read-api.ts - Agent operations → Agent actions: uses actions
backend/src/agent-accounts.ts - Agent routing → Agent operations: dispatches requests
backend/src/agent-routes.ts - Agent routing → Agent actions: runs actions
backend/src/agent-routes.ts - MCP interface → MCP tools: builds tools
mcp/src/server.ts - MCP tools → MCP backend client: calls backend
mcp/src/tools.ts - Chain ingestion → NEAR chain: indexes finalized data
README.md - Read API → Market participant: serves indexed data
README.md