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

> How to participate in dispute voting.

When a market resolution is contested, stakeholders can vote to potentially overturn the outcome. Your voting power is proportional to your position in the market.

***

## Voting Mechanics

**1. Dispute Opens**

After a market is resolved, any participant can initiate a dispute. A dispute window opens for voting.

**2. Cast Your Vote**

If you have a position in the market, you can vote. Your vote weight equals your position value.

**3. Threshold Check**

If votes exceed 50% of total pool weight, the dispute becomes "active" and can proceed to resolution.

**4. Final Decision**

The dispute is resolved by authorized resolvers who consider the evidence and votes.

***

## Vote Weight

Your voting power is determined by your position's value:

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

> [!NOTE]
>
> Users with larger positions have more influence. This aligns incentives—those with more at stake have more say.

***

## Voting via SDK

```typescript theme={"dark"}
// Derive necessary PDAs
const [globalState] = sdk.orica.pda.globalState();
const [position] = sdk.orica.pda.position(marketAddress, wallet.publicKey);

// Build vote instruction
const voteIx = await sdk.disputes.buildVoteForDispute(
  wallet.publicKey,
  marketAddress,
  position,
  globalState
);

// Send transaction
const tx = new Transaction().add(voteIx);
await sendAndConfirmTransaction(connection, tx, [wallet]);
```

***

## Voting Rules

| Rule | Description |
| - | - |
| One vote per user | You can only vote once per dispute |
| Weight locked at vote time | Your weight is calculated when you vote |
| Votes are final | Cannot change or withdraw votes |
| No minimum weight | Any position holder can vote |

***

## Checking Vote Status

### Has User Voted?

```typescript theme={"dark"}
const [dispute] = sdk.disputes.pda.dispute(marketAddress);
const vote = await sdk.disputes.fetchDisputeVote(dispute, userPubkey);

if (vote) {
  console.log("Already voted with weight:", vote.weight.toString());
} else {
  console.log("Has not voted");
}
```

### Get All Votes

```typescript theme={"dark"}
const [dispute] = sdk.disputes.pda.dispute(marketAddress);
const votes = await sdk.disputes.fetchDisputeVotes(dispute);

let totalWeight = new BN(0);
for (const { account } of votes) {
  totalWeight = totalWeight.add(account.weight);
}

console.log("Total votes:", votes.length);
console.log("Total weight:", totalWeight.toString());
```

***

## Threshold Calculation

The dispute threshold is 50% of the total pool weight:

```typescript theme={"dark"}
const dispute = await sdk.disputes.fetchDispute(marketAddress);

const threshold = dispute.totalPoolWeight.div(new BN(2));
const votesNeeded = threshold.sub(dispute.votesForDispute);

if (votesNeeded.lten(0)) {
  console.log("Threshold reached!");
} else {
  console.log("Votes needed:", votesNeeded.toString());
}
```

***

## Via API

```bash theme={"dark"}
# Get dispute status
curl https://api.orica.markets/disputes/MARKET_ADDRESS

# Get all votes
curl https://api.orica.markets/disputes/MARKET_ADDRESS/votes
```

Response includes:

* `total_votes`: Number of voters
* `total_weight`: Sum of all vote weights
* `vote_percentage`: Percentage toward threshold


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