Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rhinestonewtf/warp-router/llms.txt
Use this file to discover all available pages before exploring further.
Welcome to Warp Router
The Warp Router is a sophisticated settlement orchestration system that enables atomic execution of complex DeFi operations across multiple protocols. It provides a unified interface for solvers and relayers to execute trades, manage liquidity, and settle orders through various settlement layers including TheCompact, Permit2, and cross-chain bridges.Quick Start
Get started with Warp Router integration in minutes
Architecture
Understand the three-layer routing system
API Reference
Explore the complete API documentation
Examples
View real-world integration examples
Key Features
Modular Architecture
Delegatecall-based adapter pattern separates routing logic from protocol-specific implementations
Gas Optimized
Advanced caching reduces gas costs by 20-40% for batch operations
Multi-Protocol
Native support for TheCompact, Permit2, and extensible cross-chain protocols
Atomic Execution
Ensures multiple operations execute atomically or revert entirely
Secure by Design
Cryptographic signatures and role-based access control protect user funds
Solver Friendly
Flexible solver context system for settlement-specific data
How It Works
The Warp Router implements a three-layer architecture that enables seamless integration of new protocols while maintaining consistent security guarantees:Router Layer
Handles operation routing, batching of settlement layers, and enforcement of atomicity. The Router validates signatures, manages adapter caching, and ensures all operations in a batch succeed or revert together.
Adapter Layer
Protocol-specific settlement logic executed via delegatecall. Adapters translate generic router calls into protocol-specific operations while inheriting the Router’s security context.
Operation Types
Fill Operations
Settlement operations that fulfill user orders by transferring assets and executing target operations. Fill operations require atomic signature validation from an authorized signer.src/router/core/RouterLogic.sol
Fill operations support advanced gas optimization through adapter caching and special selectors, reducing operational costs significantly.
Claim Operations
Resource unlock operations that claim user assets from protocols like TheCompact or Permit2. Claim operations can be executed independently without atomic signatures as they rely on protocol-level authorization.Why Warp Router?
Unified Settlement Interface
Unified Settlement Interface
Instead of integrating with multiple settlement protocols separately, Warp Router provides a single, consistent interface for executing operations across TheCompact, Permit2, and cross-chain bridges. This reduces integration complexity and maintenance overhead.
Gas Efficiency at Scale
Gas Efficiency at Scale
The Router’s adapter caching mechanism reuses adapter addresses for consecutive operations with the same selector, saving approximately 2,100 gas per cache hit. Special selectors bypass adapter lookup entirely, saving 2,600+ gas per operation. For batch operations, these optimizations compound to deliver 20-40% gas savings.
Battle-Tested Security
Battle-Tested Security
Every fill operation requires cryptographic signature validation from an authorized atomic signer, preventing unauthorized execution. Reentrancy protection via transient storage guards against common attack vectors. Role-based access control enables secure adapter lifecycle management.
Solver Flexibility
Solver Flexibility
The solver context system allows each operation in a batch to carry settlement-specific data. Solvers can specify token recipients, routing parameters, and execution preferences on a per-operation basis while maintaining batch atomicity.
Protocol Support
Warp Router currently supports:- TheCompact: Native integration with full support for pre-claim operations, gas stipends, and allocator interactions
- Permit2: Complete support for Permit2-based settlements with gasless token approvals
- Cross-chain: Extensible adapter system enables integration with any cross-chain bridge protocol
New protocol adapters can be added dynamically through the adapter management system without requiring router upgrades.
Gas Optimization Features
Adapter Caching
Consecutive operations using the same adapter reuse cached addresses, saving approximately 2,100 gas per cache hit by avoiding storage reads.Special Selectors
Built-in operations likesingleCall and multiCall bypass adapter lookup entirely, saving 2,600+ gas by avoiding both storage reads and delegatecalls.Optimized Encoding
Theoptimized_routeFill function accepts pre-encoded calldata arrays, reducing decoding overhead by 200-500 gas per element.Context Indexing
Efficient solver context consumption tracking ensures only relevant operations access context data, minimizing unnecessary array access.Next Steps
Integration Guide
Follow our step-by-step guide to integrate Warp Router into your solver or relayer
Architecture Deep Dive
Learn how the Router, Adapter, and Arbiter layers work together