Arcus: a term-rate order book for USDC lending
Arcus is a central limit order book for lending USDC, where orders are placed by interest rate and maturity. Nitish Kumar built it and demoed it at the Devcon 2024 hackathon. It trades yield, not price.
Problem
Arcus lets lenders and borrowers name the rate they want for a fixed term. The rate and maturity of a loan are the traded instrument: lenders and borrowers post orders at specific rates, and a matching engine crosses them the way an exchange crosses bids and asks.
Design
- Matching engine: Rust on Tokio.
- Settlement: Solidity contracts on Arbitrum.
- API: TypeScript and Node.js with WebSocket feeds, plus a PostgreSQL indexer.
- Frontend: React.
Each maturity has its own order book. The engine matches orders off-chain and submits results to the settlement contracts in batches.
Engine
- Rate ticks. Each book sits on array-indexed rate ticks one basis point apart, so finding a price level is a direct index lookup rather than a tree search.
- Fixed-point maths. Amounts and rates use U256 fixed-point arithmetic through ruint and alloy-primitives, the same 256-bit integer width as the EVM, instead of floating point. Matched rates convert to zero-coupon prices with P = e^(-rt).
- Atomic roll and spread orders. A user can roll a position from one maturity to another in a single order. The engine derives the implied forward rate between the two books and fills both legs or neither, so nobody is left holding half a roll.
- Batch clearing. Orders clear in batches rather than one at a time, which mitigates sandwich attacks because ordering inside a batch no longer decides the price a user gets.
- Live yield curve. The top of each book streams out, which together forms a live yield curve across maturities.
Correctness and testing
- Event sourcing. Every state change is written to an append-only write-ahead log. After a restart, deterministic replay rebuilds the books to an identical state hash.
- Property tests. proptest checks token conservation (matching never creates or destroys tokens) and clearing-price optimality over generated order flows.
- Benchmarks. criterion measures engine throughput.
Settlement
The Solidity layer on Arbitrum escrows collateral, mints ERC-1155 zero-coupon position tokens for each matched loan, accepts batch results from the engine, and routes to an AMM fallback. Contracts are tested with Foundry fuzz and invariant tests.
Stack
- Engine: Rust, Tokio, ruint, alloy-primitives, proptest, criterion
- Contracts: Solidity, Foundry, ERC-1155, Arbitrum
- Services: TypeScript, Node.js, WebSocket, PostgreSQL
- Frontend: React