RaycashDocs
Protocol

Architecture

System architecture diagram and layer-by-layer walkthrough.

Raycash is composed of five layers, each with a clear responsibility. Contracts in higher layers depend on contracts in lower layers, but never the reverse.

System Architecture

Layer-by-Layer

Cleartext Layer

Standard ERC-20 tokens (e.g. USDC) that users already hold. These are the tokens that get wrapped into confidential tokens.

Deposit Layer

Enables counterfactual deposits — users send cleartext ERC-20 tokens to a pre-computed CREATE2 address before any contract exists there. The wrapper's operator later calls initWrap(), which deploys the depositor contract via CREATE2, sweeps the tokens, and records the deposit.

  • RaycashDepositor — Minimal contract deployed by the wrapper via CREATE2. Holds tokens at a deterministic address until the wrapper deploys it and calls sweep() to pull tokens back. Only the deploying wrapper can call sweep().

Confidential Token Layer

Converts cleartext tokens into FHE-encrypted confidential tokens using the ERC-7984 standard. The wrapper integrates the depositor factory directly — there is no separate factory contract.

  • RaycashWrapper — Concrete child of ERC7984AsyncWrapper (abstract base for async wrapping). Full-featured wrapper with operator-gated initWrap, 3 hooks, integrated CREATE2 depositor factory, two-phase wrap/unwrap, and hash-preimage withdrawal. Operator-gated initWrap() deploys depositors and records deposits atomically.

Hook Layer

Separates custody (immutable wrapper) from policy (configurable hooks). Hooks enforce compliance rules like KYC verification without modifying core token logic.

  • RaycashKycHook — Checks KYC attestation at transfer (mint and P2P)

Attestation Layer

On-chain KYC verification using the Ethereum Attestation Service (EAS). A single authorized attester creates and revokes KYC attestations. Hooks query attestation status to enforce compliance.

Application Layer

Higher-level contracts that build on confidential tokens.

  • CardChargesEscrow — Passive escrow that receives confidential token transfers and settles them to card networks through the wrapper's unwrap flow

Was this page helpful?

On this page