<!--
Sitemap:
- [Welcome to River](/index)
- [Asset-Backed Finance Primer](/concepts/finance-primer)
- [River for Lenders](/lenders/introduction)
- [Depositing](/lenders/depositing)
- [Earning: the Coupon](/lenders/earning)
- [The Accumulating Wrapper](/lenders/wrapper)
- [Withdrawals & Exits](/lenders/withdrawals)
- [Losses & Impairments](/lenders/losses)
- [FAQ](/lenders/faq)
- [Integrate with River](/integrate/get-started)
- [Wrapper Integration](/integrate/wrapper)
- [Class Token Integration](/integrate/class-token)
- [Contract Addresses](/integrate/addresses)
- [Protocol Architecture](/architecture)
- [Actors: Roles & Permissions](/technical/actors)
- [Proxies & Upgradeability](/technical/proxies)
- [Strategies & Reporters](/technical/strategies)
- [Glossary](/concepts/glossary)
- [Dual NAV & Exchange Rates](/accounting/dual-nav)
- [Settlement & Conservation](/accounting/settlement)
- [The Coupon Ledger](/accounting/coupon-ledger)
- [Wrapper Accounting](/accounting/wrapper)
- [Accounting Examples](/accounting/examples)
- [The Tiered Waterfall](/waterfall/)
- [Waterfall Scenarios](/waterfall/scenarios)
- [Security Model](/security)
- [Protocol Invariants](/technical/invariants)
- [List of Assumptions](/technical/assumptions)
- [External Entry Points](/technical/entry-points)
- [Governance](/governance)
- [Contract Reference](/reference/contracts)
- [River Engineering Standards](/reference/engineering-standards)
-->

# Contract Reference

Per-contract summaries: purpose, key entry points, and where the deep documentation lives. Full
signatures, parameters, and events are documented as NatSpec in the source — this page is the map,
not the mirror.

## Core

### `Structure` — `src/core/Structure.sol`

The deal's accounting brain. Class NAV ledgers, settlement (reporter deltas → waterfall →
conservation check), deposit servicing (optimistic pricing + subordination floor), exit processing
(conservative pricing, cash-bounded), and value-neutral strategy movements.
Deep dive: [Settlement & Conservation](/accounting/settlement).

### `ClassTokenBase` / `DistributingClassToken` — `src/core/`

The class share. Async deposit (`requestDeposit`/`cancelDeposit` + Structure-driven
`serviceDeposit`), lock-in-place queued redemption (`requestRedeem`/`cancelRedeem` + `fillExit`),
per-controller claim pools drained by standard `withdraw`/`redeem`, and the coupon layer
(`accrue`/`fund`/`claimCoupon`). Deep dives: [Class Token Integration](/integrate/class-token),
[The Coupon Ledger](/accounting/coupon-ledger).

### `CouponLedgerLib` — `src/libraries/CouponLedgerLib.sol`

Shared two-layer coupon math: monotonic accrual index, `rho`-priced interval funding, telescoped
`cumCashIndex`, O(1) claims. Storage/math only — callers own authorization, transfers, and events.

## Wrappers

### `DistributingVault4626` — `src/wrappers/DistributingVault4626.sol`

The accumulating wrapper. `wrap` (gross-priced, `minShares`), `requestUnwrap` (cash-first,
rationed, `minCash`, atomic when fully cash-covered), `claimUnwrap` (permissionless),
`cancelUnwrap`; exit-coupon clock; per-holder cash rations; own gate and access controls.
Deep dives: [Wrapper Integration](/integrate/wrapper), [Wrapper Accounting](/accounting/wrapper).

### `ControllerProxy` — `src/wrappers/ControllerProxy.sol`

Minimal EIP-1167 clone, one per `(holder, receiver)` exit bucket: the bucket's ERC-7540
controller identity on the class token. Holds no funds; relays only wrapper-instructed calls.

## Modules

### `TieredWaterfall` — `src/modules/`

Loss/recovery allocation policy with pari-passu seniority tiers: junior-tier-first losses,
senior-tier-first recoveries against an absorbed-loss ledger, residual gains to the junior tier.
Interest never routes here — it is off-chain, paid as coupon via the distributing class token.
Deep dive: [Tiered Waterfall](/waterfall).

### `FifoExitQueue` / `SelectiveExitQueue` — `src/modules/`

Owner-driven exit sequencers (`enqueue`/`cancel`/`take`) with anti-griefing bounds (minimum
redemption size, per-owner active-ticket cap). Sequencing only; no custody, no pricing.

### `AttestationVerifier` — `src/modules/AttestationVerifier.sol`

ECDSA verification for reporter attestations: signer allowlisting, digest construction.

### Gates — `IGate` + implementations

Per-token eligibility, consulted per action id (`DEPOSIT`, `WRAP`, `REDEEM`, `RECEIVE`); never on
claims/cancels. Action ids live in `src/types/GateActions.sol`.

## Strategies

### `Facility` + `FacilityReporter` — `src/strategies/facility/`

Borrowing-base credit facility (draw/repay within attested covenants) and its reporter
(nonce-monotonic, timestamped, signed marks of expected loss, realized loss, and collateral).
Deep dive: [Strategies & Reporters](/technical/strategies).

## Governance

### `RiverAccessControls`, `RiverGovAuthority`, `RiverPause` — `src/governance/`

Role registry, timelocked execution authority, and emergency pause.
Deep dive: [Timelock & Authority](/governance).

## Types

`src/types/`: `Roles.sol` (role ids), `GateActions.sol` (gate action ids), `Types.sol`
(`PricingMode`, `StrategyMetrics`, class/strategy configs).

## Status notes

`DistributingMasterToken` and `DistributingMasterVault4626` (`src/master-token/`) are
**proof-of-concept** allocator contracts, explicitly out of scope for the first release and
flagged as such in source. The forward-looking audit brief lives at
`docs/audit/business-requirements.md`.
