> ## 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.

# Disputes

> Challenging and correcting AI resolutions through decentralized voting.

The dispute system provides human oversight over AI-powered market resolutions. While [Claude 4.5 Sonnet](https://openrouter.ai/anthropic/claude-sonnet-4.5) resolves markets automatically, stakeholders can challenge outcomes they believe are incorrect and vote to override the AI's determination.

> [!NOTE]
>
> This mechanism ensures that market outcomes reflect reality, even if the AI makes an error in analyzing evidence or applying resolution criteria.

***

## When Disputes Occur

A dispute can be initiated when:

1. A market has been **resolved by the AI** with a proposed outcome
2. A participant believes the AI's determination is **incorrect**
3. The dispute window is still **open**

> [!WARNING]
>
> Disputes require staking collateral. If the dispute is found to be invalid (the AI was correct), the staker's bond may be slashed.

***

## Dispute Lifecycle

**1. Voting**

The dispute is open for votes. Stakeholders cast weighted votes for or against the dispute.

* Voting weight is based on position size
* Threshold: >50% of pool weight must vote to activate
* Duration: Defined by protocol parameters

**2. Active**

The dispute threshold has been met. Discussion and evidence gathering occur.

* Messages can be posted on-chain
* Messages can be boosted with stake
* Voting continues

**3. Resolved**

The dispute period has ended. The final outcome is determined by vote weight.

* If dispute wins: Original outcome is overturned
* If dispute loses: Original outcome stands
* Redemption is enabled

**4. Expired**

The voting period ended without reaching the threshold.

* Original resolution stands
* No changes to outcome

***

## Dispute Data Structure

| Field | Type | Description |
| - | - | - |
| `market_address` | `string` | The market being disputed |
| `status` | `string` | `voting`, `active`, `resolved`, `expired` |
| `opened_at` | `number` | When the dispute was created |
| `total_pool_weight` | `number` | Total staked weight in the pool |
| `votes_for_dispute` | `number` | Weight voting to overturn |
| `vote_percentage` | `number` | Percentage of votes for dispute |
| `message_count` | `number` | Number of discussion messages |
| `resolved_by` | `string` | Resolver wallet (if resolved) |
| `final_outcome` | `number` | Final outcome index (if resolved) |

***

## Voting

To vote on a dispute, a user must have a position in the market. Their voting weight equals their position value.

> [tab] SDK
>
> ```typescript theme={"dark"}
> const [globalState] = sdk.orica.pda.globalState();
> const [position] = sdk.orica.pda.position(marketAddress, userPubkey);
>
> const voteIx = await sdk.disputes.buildVoteForDispute(
>   userPubkey,
>   marketAddress,
>   position,
>   globalState
> );
> ```

> [tab] API Response
>
> ```json theme={"dark"}
> {
>   "total_votes": 42,
>   "total_weight": 15000000,
>   "votes": [
>     {
>       "user_address": "ABC...",
>       "weight": 5000000,
>       "weight_usdc": 5.0,
>       "timestamp": 1704067200
>     }
>   ]
> }
> ```

***

## Messages

Dispute discussions happen on-chain via messages. Messages are weighted by the author's position and can be boosted by other participants.

### Posting a Message

```typescript theme={"dark"}
const messageHash = await generateMessageHash(content);

const postIx = await sdk.disputes.buildPostMessage(
  userPubkey,
  marketAddress,
  positionAddress,
  globalStateAddress,
  Array.from(messageHash),
  content,
  null // Parent message (null for top-level)
);
```

### Boosting a Message

Boosting signals agreement and increases a message's visibility.

```typescript theme={"dark"}
const boostIx = await sdk.disputes.buildBoostMessage(
  userPubkey,
  marketAddress,
  messagePubkey,
  positionAddress
);
```

***

## Message Sorting

Messages are sorted by **total weight** (author weight + boost amount) by default. This surfaces the most credible arguments.

```bash theme={"dark"}
curl "https://api.orica.markets/disputes/MARKET_ADDRESS/messages?sort_by=weight"
```

Alternative: `sort_by=timestamp` for chronological order.

***

## Fetching Disputes

```bash All Disputes theme={"dark"}
curl "https://api.orica.markets/disputes?status=voting"
```

```bash Single Dispute theme={"dark"}
curl "https://api.orica.markets/disputes/MARKET_ADDRESS"
```

```bash Dispute Votes theme={"dark"}
curl "https://api.orica.markets/disputes/MARKET_ADDRESS/votes"
```

```bash Dispute Messages theme={"dark"}
curl "https://api.orica.markets/disputes/MARKET_ADDRESS/messages"
```

***

## Next Steps

> [card] [Resolution](https://docs.orica.markets/guides/resolution.md)
>
> Learn about the resolution process.

> [card] [API Reference](https://docs.orica.markets/api-reference/rest/disputes.md)
>
> Full dispute endpoint documentation.


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