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

# Contract Reads

> Query Capsule evidence, contributor state and other V3 contracts without a signer.

# Contract reads

Read-only contract calls are the most direct way to inspect current PressChain state. They require no signer and are suitable for public pages, backend verification, server rendering and indexer reconciliation.

## Evidence reads

A minimal ABI can include only the functions a feature needs:

```ts theme={null}
const evidenceAbi = [
  "function getEvidenceIds(bytes32 capsuleId) view returns (uint256[])",
  "function evidenceCountByCapsuleId(bytes32 capsuleId) view returns (uint256)",
  "function getEvidenceTally(uint256 evidenceId) view returns (tuple(uint256 supportCount,uint256 rejectCount,uint256 participationCount,uint8 status,bool finalized))",
  "function getEvidenceVote(uint256 evidenceId,address voter) view returns (tuple(bool exists,bool support,uint64 votedAt))"
];
```

These functions are present in `CapsuleEvidenceRegistryV3`.

## Contributor reads

```ts theme={null}
const contributorAbi = [
  "function getContributorIds(bytes32 capsuleId) view returns (uint256[])",
  "function contributorCountByCapsuleId(bytes32 capsuleId) view returns (uint256)",
  "function isCapsuleContributor(bytes32 capsuleId,address wallet) view returns (bool)",
  "function activeShareBpsByCapsuleId(bytes32 capsuleId) view returns (uint256)"
];
```

These functions are useful both for presentation and for transaction preflight.

## Read with ethers

```ts theme={null}
import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider("https://rpc.presschain.io", 77117002);
const evidence = new Contract(EVIDENCE_ADDRESS, evidenceAbi, provider);

const ids = await evidence.getEvidenceIds(capsuleId);
```

Load `EVIDENCE_ADDRESS` from the approved deployment manifest for the current environment. Do not copy an address from an old script or archived configuration.

## Pin a block for consistent exports

If several related reads must represent exactly one chain state, first resolve a block and execute all reads against that block tag. This is useful for audit exports or reproducible reports.

For ordinary interactive pages, `latest` is usually appropriate.

## Decode reverts

View calls can revert for missing or invalid records. When the ABI includes custom errors, decode them. The evidence registry defines errors such as `EvidenceMissing(uint256)` and `CapsuleMissing(bytes32)`.

A missing record should render as a domain-specific not-found state rather than a generic “RPC unavailable” message.

## Cache based on mutability

Immutable historical data can be cached aggressively. Current active flags, open tallies and role state require shorter caching or event-driven invalidation.

Do not cache a tally forever just because the underlying evidence artifact is immutable.
