# jftochka/quid architecture

> Architecture diagram of the GitHub repository jftochka/quid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jftochka/quid
- Repository: https://github.com/jftochka/quid

## Overview

QU!D combines leveraged and prediction-market products across EVM and Solana with an oracle-based depeg/dispute process. The principal resolution flow assembles claims and evidence, dispatches them through the CRE oracle pipeline, and returns a verdict; a separate CRE workflow gathers price history for depeg analysis. The keeper monitors EVM positions and market lifecycles, while the Solana program handles prediction-market functionality and Pyth-backed pricing. README-described liquidity and court capabilities are represented at their enclosing product directories because their contract sources were not present in the supplied tree; frontend implementation was not sampled.

Main entry points: [`keeper/oracle-cre/main.go`](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/main.go) (CRE handlers), [`keeper/my-workflow/main.go`](https://github.com/jftochka/quid/blob/main/keeper/my-workflow/main.go) (Depeg analysis), [`keeper/keeper.ts`](https://github.com/jftochka/quid/blob/main/keeper/keeper.ts) (EVM keeper), [`keeper/oracle-cre/pipeline.go`](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/pipeline.go) (Resolution pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_oracle["Oracle resolution"]
  node_oracle_entry["CRE handlers<br/>[main.go]"]
  node_oracle_pipeline["Resolution pipeline<br/>[pipeline.go]"]
  node_verdict["Resolution verdict<br/>[main.go]"]
  node_history_analysis["Depeg analysis<br/>[main.go]"]
  node_blob_storage["Evidence blob access<br/>[storage.go]"]
end

subgraph group_evm["EVM products"]
  node_evm_contracts["EVM markets and liquidity"]
  node_court["Court arbitration"]
  node_keeper["EVM keeper<br/>[keeper.ts]"]
end

subgraph group_solana["Solana markets"]
  node_solana_program["Prediction markets<br/>[etc.rs]"]
  node_ticker_map["Ticker and feed map<br/>[tickers.ts]"]
  node_ticker_source["Pyth feed mapping<br/>[etc.rs]"]
end

subgraph group_web["Web and state"]
  node_web_app["Web application<br/>[page.tsx]"]
  node_confidence_api["Confidence API<br/>[route.ts]"]
  node_mongo[("MongoDB")]
end

node_claimant(("Claim submitter"))
node_cre(("Chainlink CRE"))
node_markets(("Price vendors"))

node_claimant -->|"submits claim"| node_oracle_entry
node_oracle_entry -->|"dispatches session"| node_oracle_pipeline
node_oracle_pipeline -->|"encodes result"| node_verdict
node_cre -->|"triggers workflow"| node_history_analysis
node_history_analysis -->|"fetches prices"| node_markets
node_history_analysis -->|"writes verdict"| node_evm_contracts
node_oracle_entry -.->|"downloads evidence"| node_blob_storage
node_keeper -->|"monitors and calls"| node_evm_contracts
node_keeper -->|"tracks lifecycle"| node_court
node_ticker_source -->|"maps feed accounts"| node_solana_program
node_web_app -->|"requests confidences"| node_confidence_api
node_confidence_api -->|"reads and writes"| node_mongo

click node_oracle_entry "https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/main.go"
click node_oracle_pipeline "https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/pipeline.go"
click node_verdict "https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/main.go"
click node_history_analysis "https://github.com/jftochka/quid/blob/main/keeper/my-workflow/main.go"
click node_blob_storage "https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/storage.go"
click node_evm_contracts "https://github.com/jftochka/quid/tree/main/evm/lib/aave-v3-origin"
click node_court "https://github.com/jftochka/quid/tree/main/evm/lib/aave-v3-origin"
click node_keeper "https://github.com/jftochka/quid/blob/main/keeper/keeper.ts"
click node_solana_program "https://github.com/jftochka/quid/blob/main/svm/programs/quid/src/etc.rs"
click node_ticker_map "https://github.com/jftochka/quid/blob/main/src/lib/tickers.ts"
click node_ticker_source "https://github.com/jftochka/quid/blob/main/svm/programs/quid/src/etc.rs"
click node_web_app "https://github.com/jftochka/quid/blob/main/src/app/page.tsx"
click node_confidence_api "https://github.com/jftochka/quid/blob/main/src/app/api/confidences/route.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_oracle_entry,node_oracle_pipeline,node_verdict,node_history_analysis,node_blob_storage toneBlue
class node_evm_contracts,node_court,node_keeper toneAmber
class node_solana_program,node_ticker_map,node_ticker_source toneMint
class node_web_app,node_confidence_api,node_mongo toneRose
class node_claimant,node_cre,node_markets toneIndigo
```

## Components

### Oracle resolution

- [CRE handlers](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/main.go): `keeper/oracle-cre/main.go`
- [Resolution pipeline](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/pipeline.go): `keeper/oracle-cre/pipeline.go`
- [Resolution verdict](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/main.go): `keeper/oracle-cre/main.go`
- [Depeg analysis](https://github.com/jftochka/quid/blob/main/keeper/my-workflow/main.go): `keeper/my-workflow/main.go`
- [Evidence blob access](https://github.com/jftochka/quid/blob/main/keeper/oracle-cre/storage.go): `keeper/oracle-cre/storage.go`

### EVM products

- [EVM markets and liquidity](https://github.com/jftochka/quid/tree/main/evm/lib/aave-v3-origin): `evm/lib/aave-v3-origin`
- [Court arbitration](https://github.com/jftochka/quid/tree/main/evm/lib/aave-v3-origin): `evm/lib/aave-v3-origin`
- [EVM keeper](https://github.com/jftochka/quid/blob/main/keeper/keeper.ts): `keeper/keeper.ts`

### Solana markets

- [Prediction markets](https://github.com/jftochka/quid/blob/main/svm/programs/quid/src/etc.rs): `svm/programs/quid/src/etc.rs`
- [Ticker and feed map](https://github.com/jftochka/quid/blob/main/src/lib/tickers.ts): `src/lib/tickers.ts`
- [Pyth feed mapping](https://github.com/jftochka/quid/blob/main/svm/programs/quid/src/etc.rs): `svm/programs/quid/src/etc.rs`

### Web and state

- [Web application](https://github.com/jftochka/quid/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Confidence API](https://github.com/jftochka/quid/blob/main/src/app/api/confidences/route.ts): `src/app/api/confidences/route.ts`
- **MongoDB**

### Other components

- **Claim submitter**
- **Chainlink CRE**
- **Price vendors**

## Connections

- Claim submitter → CRE handlers: submits claim
- CRE handlers → Resolution pipeline: dispatches session
- Resolution pipeline → Resolution verdict: encodes result
- Chainlink CRE → Depeg analysis: triggers workflow
- Depeg analysis → Price vendors: fetches prices
- Depeg analysis → EVM markets and liquidity: writes verdict
- CRE handlers → Evidence blob access: downloads evidence
- EVM keeper → EVM markets and liquidity: monitors and calls
- EVM keeper → Court arbitration: tracks lifecycle
- Pyth feed mapping → Prediction markets: maps feed accounts
- Web application → Confidence API: requests confidences
- Confidence API → MongoDB: reads and writes
