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.
Overview
SingleCallAdapter is a minimal adapter that enables solvers to execute a single arbitrary contract call on behalf of users. It provides a gas-efficient way to perform individual operations without the overhead of batching logic.
Source: src/arbiters/multicall/SingleCallAdapter.sol
Inherits: AdapterBase, Caller
Use Cases
- Token Swaps: Execute a single DEX swap operation
- NFT Purchases: Buy a single NFT from a marketplace
- Contract Interactions: Call any single contract function
- Simple Operations: Any operation that doesn’t require batching
For multiple calls in a single transaction, use MultiCallAdapter instead.
Constructor
The address of the Router contract that will call this adapter via delegatecall
src/arbiters/multicall/SingleCallAdapter.sol:46
Fill Function
singleCall
Unique identifier for tracking this fill operation. Used in the
RouterFilled event for indexing and tracking.The account address associated with this fill. Emitted in the
RouterFilled event for tracking which user this fill is for.Packed calldata in the format:
[target(20 bytes)][callData(...)]- Bytes 0-19: Target contract address
- Bytes 20+: Calldata to forward to the target contract
this.singleCall.selector on success
Reverts: SingleCallFailed() if the call to the target contract fails
Execution Flow:
- Extracts target address from first 20 bytes of
packedData - Extracts calldata from remaining bytes
- Executes
target.call{value: msg.value}(calldata) - Emits
RouterFilled(nonce, sponsor)event - Returns function selector for verification
src/arbiters/multicall/SingleCallAdapter.sol:61-76
Packed Data Format
ThepackedData parameter uses a gas-efficient packed encoding:
Interface Support
singleCall.selector(0x…)- All interfaces from
AdapterBase
src/arbiters/multicall/SingleCallAdapter.sol:78-84
Adapter Tag
src/arbiters/multicall/SingleCallAdapter.sol:86-88
Events
RouterFilled
The unique identifier for this fill operation
The account address associated with this fill
Errors
SingleCallFailed
src/arbiters/multicall/SingleCallAdapter.sol:36
Gas Optimization
The SingleCallAdapter uses several gas optimization techniques:- Assembly Forwarding: Uses memory-safe assembly to forward calldata without re-encoding
- Packed Encoding: Avoids ABI encoding overhead for target address and calldata
- No Relayer Context: Skips relayer context parsing for additional gas savings
- Direct Execution: No intermediate calls to arbiters or validators
Usage Example
Security Considerations
Security Model:- Atomic Signature Required: Router enforces atomic fill signature validation
- Nonce Tracking: The
nonceparameter allows tracking of fill operations - Event Emission:
RouterFilledevent provides audit trail - Sponsor Association: Links fills to specific user accounts
- Validate the target contract address off-chain before signing
- Use nonces that prevent replay attacks
- Monitor
RouterFilledevents to ensure fills match expectations - Consider using MultiCallAdapter for complex operations requiring multiple steps
Comparison with MultiCallAdapter
| Feature | SingleCallAdapter | MultiCallAdapter |
|---|---|---|
| Number of Calls | 1 | Multiple (batched) |
| Gas Overhead | Lower | Higher (batching logic) |
| Complexity | Simple | Complex (JIT claims, token validation) |
| Use Case | Single operation | Complex multi-step operations |
| Relayer Context | None | Token recipient (20 bytes) |
Related Contracts
- AdapterBase - Base adapter functionality
- MultiCallAdapter - Multi-call batching for complex operations