Architecture Overview#
TetraFi is a non-custodial, compliance-first settlement protocol for institutional stablecoin OTC. Competing solvers bid on orders via sealed RFQ auctions. Funds never touch TetraFi's wallets - all settlement executes through on-chain escrow with atomic DvP.
Intent Execution Stack#
TetraFi is an intent coordination layer - it accepts user intents, runs competitive solver auctions, enforces compliance, and coordinates settlement. How solvers source liquidity is the solver's problem, not TetraFi's.
Protocol Stack
Typed SDK with RFQ submission, WebSocket quote streaming, and settlement tracking.
Async Python client for institutional trading desks and algorithmic strategies.
Embeddable React component for instant OTC swap integration.
Direct HTTP interface for any language - full endpoint coverage.
High-throughput Rust HTTP handlers for RFQ submission, quote retrieval, and order management.
Real-time quote streaming and event notifications to solvers and takers.
UCCP-based quote ranking with compliance filtering and fair pricing guarantees.
Maps token pairs to directed corridors and routes to qualified solver sets.
ERC-7683 StandardOrder parsing, validation, and lifecycle tracking.
Executes fills on destination chain OutputSettler contracts.
Watches for oracle proofs and triggers claim/refund on escrow.
Real-time price feeds with gas estimation for competitive quoting.
On-chain attestation storage. Per-chain deployment. Checked pre-trade.
Vendor adapters for Chainalysis, Elliptic, and other identity providers.
IVMS101 message construction and VASP-to-VASP transmission.
Append-only audit trail. Write-Once Read-Many for regulatory compliance.
Origin chain deposit locking. Two modes: Permit2Escrow and CompactEscrow (ResourceLock).
Destination chain fill recording. Resolves limit, dutch auction, and exclusive order types.
Cross-chain attestation verification via Hyperlane ISM integration.
Token approval infrastructure - gasless approvals and allocator-based locking.
| Layer | Concern | TetraFi Scope |
|---|---|---|
| Intent Expression (WHAT) | User declares desired outcome via ERC-7683 StandardOrder | Yes - accepts and validates |
| Orderflow Auction (WHO) | Solvers compete via RFQ or Dutch auction for best execution | Yes - runs auction, ranks quotes |
| Settlement Primitive (HOW) | ResourceLock, Permit2Escrow - orthogonal to intent format | Yes - coordinates settlement |
| Solver Liquidity | How solver sources funds - inventory, OTC, DEX, bridges | No - outside scope |
Each layer evolves independently. New settlement primitives or solver networks plug in without changing the intent format.
Protocol Economics#
Platform - All-in Cost
< 3 bps
$1M–$10M stablecoin transfers, under 10 min
Platform - TetraFi Take Rate
0.15–0.20 bps
~15–30% of execution fee
Solvers - Solver Share
70–85%
Maximizes competitive pool to compress spreads
Solvers - Settlement Guarantee
DvP
Funds leave escrow only once solver has verifiably delivered
Settlement Lifecycle#
Six stages: RFQ & Auction → Escrow Lock → Solver Fill → Oracle Proof → Claim / Refund → WORM Audit (Compliant path only).
See Settlement Flows for the canonical lifecycle with diagrams, state machine, and per-stage contract calls.
Settlement Intent (ERC-7683)#
ERC-7683 Open Intents Framework - TetraFi implements the open standard for cross-chain settlement intents. Any solver or application can interoperate using the same typed StandardOrder format, enabling a permissionless solver ecosystem.
Every trade is a typed StandardOrder - inputs on origin chain, desired outputs on destination chain. Orders are signed off-chain via EIP-712 and submitted on-chain to trigger escrow.
1interface StandardOrder {2 user: string; // Taker wallet3 originChainId: number; // Origin chain4 expires: number; // Refund deadline5 fillDeadline: number; // Solver must fill before this6 inputs: [string, string][]; // [token, amount] on origin7 outputs: MandateOutput[]; // Desired outputs on destination8}See Smart Contracts for full StandardOrder and MandateOutput interfaces.
Aggregator Pipeline#
The TetraFi aggregator (POST /api/v1/quotes) fans out each RFQ to all registered solvers simultaneously with configurable timeout and early termination (once min_quotes received). Quotes are ranked, the winning solver's settlement path is injected (Compliant or Direct based on API key presence), and the order is returned ready for on-chain submission.
Compliance Layer#
The ComplianceRegistry is an on-chain smart contract that stores compliance attestations for all participants. Both solvers and takers must have valid entries before trading.
Each attestation stores: jurisdiction, tier (Retail / Professional / Institutional), expiry, and KYC vendor hash. Non-compliant addresses are rejected at the contract level. Every trade generates an immutable WORM audit record - hash-chained, append-only, tamper-proof. See Compliance Architecture for full details including settlement path routing, Travel Rule, and KYC/KYB onboarding.
Cross-Chain Architecture#
TetraFi supports cross-chain settlement via ERC-7683 settlement intents:
InputSettler
Origin Chain
Locks taker's funds via escrow or ResourceLock
OutputSettler
Destination Chain
Records solver's fill and delivers funds to taker
Oracle
Cross-chain
Attests fill proof (Hyperlane, LayerZero, Wormhole, Polymer)
ComplianceRegistry
Per-chain
Validates participant KYC attestation on every chain
Supported Networks#
- Ethereum (mainnet + Sepolia testnet)
- Optimism (mainnet + Sepolia testnet)
- Base (mainnet + Sepolia testnet)
- Arbitrum (One mainnet + Sepolia testnet)
Cross-chain pairs are identified by corridor (e.g., ethereum-optimism) and must have solver coverage on both sides.
Oracles#
7 oracle implementations: Hyperlane (default for EVM L2 corridors), LayerZero, Wormhole (cross-VM), Polymer (ZK-proof), PolymerMapped, Broadcaster (ERC-7888), and Bitcoin (SPV). All implement the same IInputOracle interface - drop-in replacement per corridor.
See Cross-Chain Settlement for oracle comparison and corridor recommendations.
State Machine#
On-Chain Escrow State Machine
On-chain: None → Deposited → Claimed | Refunded (4 states, enforced by InputSettler contract).
Off-chain solver engine tracks a 9-state lifecycle for operational monitoring - from Discovered through Completed. Each transition emits a SolverEvent. See Settlement Flows for the full order lifecycle diagram.
Security Model#
TetraFi is non-custodial. The protocol operator never holds, controls, or has access to user funds. All fund movements are governed by smart contract logic.
| Security Property | Mechanism |
|---|---|
| DvP Atomicity | Both legs settle or neither does (oracle-attested escrow) |
| Non-custodial | Funds move directly between counterparties via escrow |
| Escrow Timeout | Automatic refund if fill deadline expires |
| Sealed Bids | EIP-712 typed signing prevents solver information leakage |
| On-Chain Compliance | ComplianceRegistry checks enforced at contract level |
Lock Types#
Three lock mechanisms for escrowing funds: ResourceLock (output-first via The Compact, 0xff), Permit2Escrow (input-first, 0x00), and EIP-3009Escrow (gasless stablecoins, 0x01). Funds are released only when the oracle proves the fill - or refunded on timeout.
See Settlement Flows for the full lock type comparison, settlement path routing, and order types.
See Also#
Lock types, order types, and cross-chain mechanics
InputSettler, OutputSettler, ComplianceRegistry reference
Cross-chain attestation implementations
RFQ auction, solver selection, Dutch fallback
Attestation model, pre-trade gate, evidence ledger
WORM ledger, storage tiers, workspace model