open-standards/openpay/crates/op-crypto-extra/src/lib.rs
Transaction Science 68b8a2dbee ingest wave F: 3 crates · op-crypto-extra + smart-byte-acdc + eoc-memory
OpenPay (1 crate, 3751 LOC, 83 tests)
  op-crypto-extra      Extended crypto rails. Stablecoin catalog (USDC, USDT,
                       PYUSD, DAI, RLUSD, EURC, FDUSD — 26 deployments). L2
                       catalog (12 chains incl. Optimism, Arbitrum, Base,
                       zkSync Era, Polygon zkEVM, Linea, Scroll, Starknet).
                       CCTP v2 BurnMessage encode/decode + domain ids +
                       attestation. ERC-4337 UserOperation v0.7 +
                       PackedUserOperation. EIP-7702 set-EOA-code with RLP
                       signing preimage. Uniswap Permit2 single + batch
                       transfer EIP-712 hashes. EIP-2612 ERC-20 permit.
                       BOLT-11 bech32 invoices + LNURL decode. Bitcoin
                       PSBT v2 (BIP-370). Atomic-swap HTLC. Solana SPL /
                       Aleo / Aztec confidential-transfer sketches.

Smart Byte (1 crate, 2304 LOC, 30 tests)
  smart-byte-acdc      Authentic Chained Data Containers (KERI ecosystem).
                       Acdc + AcdcBuilder (targeted + untargeted) with SAID
                       derivation. JSON Schema 2020-12 validator with
                       oneOf partial-disclosure. TEL (RIP/VRT/ISS/REV)
                       with hash-chained verification. IPEX (apply/offer/
                       agree/grant/admit/spurn) chained by SAID. Edge
                       records (I2I/NI2I/DI2I) + EdgeGraph BFS traversal
                       with cycle detection. Selective disclosure with
                       full/none/subset plans + compact packing.
                       CredentialRegistry trait + InMemoryRegistry over
                       TEL. Composes with smart-byte-core + smart-byte-keri-witness.

EOC (1 crate, 1764 LOC, 16 tests)
  eoc-memory           Long-term memory primitives. Memory trait + MemoryKind +
                       EpisodeId. Episodic event log with TimeIndex range
                       queries. RDF-style Triple store with S/P/O indices.
                       Bounded attention-budget Scratchpad with
                       salience-weighted eviction. Rolling SummaryBuffer +
                       FIFO SlidingWindow. Dream-cycle consolidate()
                       (episodic → semantic). Ebbinghaus forgetting curve
                       with reinforcement. Retriever blending cosine
                       similarity + recency + saturating frequency.
                       MemGpt three-tier shape (Main/Recall/Archival).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 17:28:24 -04:00

93 lines
4.3 KiB
Rust

//! # `op-crypto-extra` — extended crypto rails
//!
//! `op-rails-crypto` is the minimum-viable production stablecoin
//! rail: USDC / EURC / PYUSD on a handful of chains, ERC-20
//! `transfer`, JSON-RPC broadcast, hot-wallet signer. This crate
//! covers the *rest* of the modern crypto-payments surface:
//!
//! - **Stablecoin catalog.** A canonical [`stable::Stablecoin`] enum
//! covering USDC, USDT, PYUSD, DAI, RLUSD, EURC, FDUSD and their
//! well-known deployments across Ethereum L1, the dominant
//! L2 stack (Optimism, Arbitrum, Base, zkSync Era, Polygon zkEVM,
//! Linea, Scroll, Starknet), Polygon PoS, and Solana.
//! - **L2 topology.** [`chains`] enumerates each L2 with its
//! EIP-155 chain id, parent settlement layer, finality model, and
//! a default public RPC. Used by operators that want to register
//! one EVM-rail gateway per chain without hard-coding the list.
//! - **Account abstraction.** [`erc4337`] models the ERC-4337
//! `UserOperation` (v0.7 packed layout) and EntryPoint hand-off;
//! [`eip7702`] models the EIP-7702 "set-code" authorization that
//! lets an EOA temporarily execute as a smart account.
//! - **Permits.** [`permit2`] encodes Uniswap's Permit2 transfer
//! intents (single + batch + `PermitWitnessTransferFrom`).
//! [`eip2612`] encodes the older ERC-2612 `permit(...)` typed
//! data for token approvals without on-chain `approve`.
//! - **Cross-chain.** [`cctp`] models Circle's CCTP v2 burn / mint
//! message (`depositForBurn` + Attestation + `receiveMessage`)
//! for native cross-chain USDC.
//! - **Lightning.** [`lightning`] parses BOLT-11 invoices (bech32
//! sanity-check + tagged-field walk) and validates LNURL
//! bech32-encoded URLs.
//! - **Bitcoin.** [`psbt`] is a thin PSBT v2 sketch (BIP-370
//! field layout — global / input / output map keys) suited for
//! round-tripping unsigned Bitcoin transactions through a
//! third-party signer.
//! - **Atomic swap.** [`htlc`] models the hash-time-lock contract
//! primitive used in cross-chain swaps (single-secret HTLC with
//! chain-agnostic field layout).
//! - **Confidential transfer.** [`confidential`] sketches the
//! structural surface of confidential-token transfers (Solana
//! confidential token / Aleo / Aztec) — the public field, the
//! ciphertext envelope, and the proof envelope — without
//! committing to a specific zk system.
//!
//! ## Scope
//!
//! Like `op-rails-crypto`, this crate is **rail-agnostic at the
//! chain level**. It does not bundle any chain SDK or signer. The
//! types model the *wire layout* of each primitive precisely enough
//! that an operator's signer / broadcaster can produce real
//! transactions; the broadcast itself happens elsewhere (operator's
//! KMS, Fireblocks, Lightning daemon, Bitcoin Core, etc.).
//!
//! ## What this crate does NOT do
//!
//! - **No signing.** Every primitive ends in a "build me the bytes
//! to be signed" boundary.
//! - **No bridging.** CCTP message construction is included
//! because it's a Circle-issued message format; live attestation
//! fetching against Circle's API is the operator's job.
//! - **No price feeds.** Stablecoins are 1:1 by design.
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
pub mod cctp;
pub mod chains;
pub mod confidential;
pub mod eip2612;
pub mod eip7702;
pub mod erc4337;
pub mod error;
pub mod htlc;
pub mod lightning;
pub mod permit2;
pub mod psbt;
pub mod stable;
pub use cctp::{CctpAttestation, CctpBurnMessage, CctpDomain, CctpMintReceipt};
pub use chains::{ChainId, ChainInfo, ChainKind, FinalityModel, L2Catalog, SettlementLayer};
pub use confidential::{ConfidentialSystem, ConfidentialTransfer, ProofEnvelope};
pub use eip2612::{Eip2612Permit, eip2612_digest};
pub use eip7702::{Eip7702Authorization, AuthorizationList};
pub use erc4337::{EntryPointVersion, PackedUserOperation, UserOperation, pack_user_op};
pub use error::{Error, Result};
pub use htlc::{HtlcContract, HtlcState, HtlcPreimage};
pub use lightning::{Bolt11Invoice, Bolt11Network, LnurlKind, lnurl_decode, parse_bolt11};
pub use permit2::{
Permit2BatchTransfer, Permit2SingleTransfer, Permit2TokenPermissions, Permit2Witness,
};
pub use psbt::{PsbtV2, PsbtV2Global, PsbtV2Input, PsbtV2Output};
pub use stable::{ChainAddress, Stablecoin, StablecoinDeployment};