# Payment and State Channels

Documentation for on-chain payment channels, optional generic state channels, and external protocol integration.

---

## Index

| Doc | Description |
|-----|-------------|
| [STATE_CHANNELS_VS_PAYMENT_CHANNELS.md](STATE_CHANNELS_VS_PAYMENT_CHANNELS.md) | Definitions: state vs payment channels; what this repo provides. |
| [PAYMENT_CHANNELS_ARCHITECTURE.md](PAYMENT_CHANNELS_ARCHITECTURE.md) | Architecture: Mainnet/Chain-138, tether and mirror, data flow. |
| [EXTERNAL_PROTOCOL_INTEGRATION.md](EXTERNAL_PROTOCOL_INTEGRATION.md) | When to use Connext, Raiden, Statechannels.org; links and integration notes. |
| [PRE_DEPLOYMENT_RECOMMENDATIONS.md](PRE_DEPLOYMENT_RECOMMENDATIONS.md) | Security, ops, testing, and deployment checklist. |
| [WATCHTOWER_AND_INDEXER.md](WATCHTOWER_AND_INDEXER.md) | Optional watchtower and indexer for channels. |
| [GAPS_AND_ADDITIONAL_TASKS.md](GAPS_AND_ADDITIONAL_TASKS.md) | Gaps, additional tasks, and code still needed (checklist and priorities). |
| [GAS_REPORT.md](GAS_REPORT.md) | Gas costs from channel unit tests. |
| [FUTURE_WORK.md](FUTURE_WORK.md) | Future work: virtual channels, ERC20, upgradeability. |

---

## Deployment

| Doc | Description |
|-----|-------------|
| [../deployment/PAYMENT_CHANNELS_DEPLOYMENT.md](../deployment/PAYMENT_CHANNELS_DEPLOYMENT.md) | Deploy PaymentChannelManager (and optional GenericStateChannelManager) to Mainnet and Chain-138. |
| [../operations/CHANNEL_INCIDENT_RUNBOOK.md](../operations/CHANNEL_INCIDENT_RUNBOOK.md) | Incident runbook: pause, unpause, replace admin. |

---

## Contracts (this repo)

- **PaymentChannelManager** – Payment channels: open, fund, cooperative/unilateral close, challenge window (newest state wins). ETH only. Deploy via `script/DeployPaymentChannelManager.s.sol`.
- **GenericStateChannelManager** (optional) – State channels: same flow but settlement includes a `stateHash` so off-chain state (e.g. game, attestation) is attested when closing. Deploy via `script/DeployGenericStateChannelManager.s.sol`.

External protocols (Connext, Raiden, Statechannels.org) are linked from the dApp and from [EXTERNAL_PROTOCOL_INTEGRATION.md](EXTERNAL_PROTOCOL_INTEGRATION.md).
