> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orica.markets/llms.txt
> Use this file to discover all available pages before exploring further.

# Dispute Model

> Complete reference for Dispute-related data structures.

The Dispute system includes multiple related models for tracking challenges to market resolutions.

***

## Dispute Schema

```typescript theme={"dark"}
interface Dispute {
  // Identifier
  market_address: string;       // The market being disputed
  
  // State
  status: DisputeStatus;        // Current status
  opened_at: number;            // When dispute was created
  created_at: number;           // Creation timestamp
  activated_at: number | null;  // When threshold was met
  
  // Voting
  total_pool_weight: number;    // Total staked weight
  votes_for_dispute: number;    // Weight voting to overturn
  vote_percentage: number;      // Percentage for dispute
  
  // Discussion
  message_count: number;        // Number of messages
  
  // Resolution (null until resolved)
  resolved_by: string | null;
  final_outcome: number | null;
  resolution_metadata_uri: string | null;
  resolved_at: number | null;
}
```

***

## Dispute Status

```typescript theme={"dark"}
type DisputeStatus = "voting" | "active" | "resolved" | "expired";
```

| Status | Description |
| - | - |
| `voting` | Accepting votes, threshold not yet met |
| `active` | Threshold met (>50%), discussion ongoing |
| `resolved` | Final outcome determined |
| `expired` | Voting period ended without threshold |

***

## DisputeVote Schema

```typescript theme={"dark"}
interface DisputeVote {
  market_address: string;   // Market being disputed
  user_address: string;     // Voter's wallet
  weight: number;           // Vote weight (base units)
  weight_usdc: number;      // Vote weight (USDC)
  timestamp: number;        // When vote was cast
  signature: string;        // Transaction signature
}
```

***

## DisputeMessage Schema

```typescript theme={"dark"}
interface DisputeMessage {
  pubkey: string;              // On-chain message account
  market_address: string;      // Market being disputed
  author: string;              // Author's wallet
  parent_message: string | null; // Parent for threading
  content: string;             // Message text
  
  // Weights
  author_weight: number;       // Author's position weight
  boost_amount: number;        // Total boosts received
  total_weight: number;        // author_weight + boost_amount
  
  is_admin: boolean;           // If author is admin
  timestamp: number;           // When posted
  message_index: number;       // Index for PDA derivation
}
```

***

## MessageBoost Schema

```typescript theme={"dark"}
interface MessageBoost {
  message_pubkey: string;    // Message being boosted
  market_address: string;    // Market context
  booster: string;           // Booster's wallet
  amount: number;            // Boost amount (base units)
  amount_usdc: number;       // Boost amount (USDC)
  timestamp: number;         // When boosted
}
```

***

## Weight Calculation

Voting and message weights are derived from position sizes:

$$
weight = \sum_{i=0}^{n} position\_shares_i \times price_i
$$

This ensures that users with larger positions have proportionally more influence in dispute resolution.

***

## Example: Full Dispute

```json theme={"dark"}
{
  "market_address": "ABC123...",
  "status": "active",
  "opened_at": 1704067200,
  "created_at": 1704067200,
  "activated_at": 1704153600,
  "total_pool_weight": 15000000000,
  "votes_for_dispute": 8500000000,
  "vote_percentage": 56.67,
  "message_count": 12,
  "resolved_by": null,
  "final_outcome": null,
  "resolution_metadata_uri": null,
  "resolved_at": null
}
```

***

## Example: Message with Boosts

```json theme={"dark"}
{
  "pubkey": "Msg123...",
  "market_address": "ABC123...",
  "author": "User456...",
  "parent_message": null,
  "content": "The resolution is incorrect. Here is evidence: ...",
  "author_weight": 5000000000,
  "boost_amount": 2500000000,
  "total_weight": 7500000000,
  "is_admin": false,
  "timestamp": 1704153600,
  "message_index": 0
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.