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
SameChainArbiter handles the core settlement logic for orders where both origin and execution occur on the same blockchain. It provides atomic settlement guarantees while supporting both Compact and Permit2 protocols with their respective validation and execution patterns.SameChainArbiter is whitelisted as a trusted contract in the IntentExecutor, enabling gas optimization where target operations can be executed without additional signature validation.
Architecture
Same-Chain Settlement Processing
The arbiter implements the critical resource unlock and execution phase of same-chain settlement. It works in coordination with SameChainAdapter, which pre-funds recipients before calling the arbiter.Dual Protocol Support
- Compact Protocol
- Permit2 Protocol
Compact Protocol Flow:
- Validates complex signatures and metadata (otherElements, allocatorData)
- Executes pre-claim operations with allocated gas stipends
- Handles notarized chain validation and resource unlock
- Supports multi-step operations and complex authorization patterns
Constructor
The Router contract address that will call this arbiter. Used for access control to ensure only authorized settlement requests.
The Compact protocol contract address for resource unlocking and validation. Handles the core authorization and token claim logic for Compact orders.
The AddressBook contract containing protocol configuration and addresses. Provides centralized configuration for protocol contracts and parameters.
Compact Protocol Settlement
handleCompact_NotarizedChain
This function assumes notarized chain execution for all multichain intents that require same-chain settlement. Exogenous chain claims are not implemented for simplicity.
Settlement Flow
Pre-claim validation and execution
Validates order signatures and metadata using
_compactPreClaimOps. Executes any pre-claim operations (approvals, setup calls) with allocated gas stipend. Generates mandate hash for subsequent resource unlock validation.Resource unlock and depositing
Calls
_unlockNotarizedChain to validate signatures against mandate hash. Unlocks user’s input tokens from the Compact protocol contracts. Transfers input tokens to the specified relayer (solver’s recipient address).Target operation execution
Executes user-specified target operations using SmartExecutionLib. Operations run without requiring additional signatures (mandate-based execution). Typically includes swaps, transfers, or other token operations on user’s behalf.
Target operations are only executed when ALL conditions are met:
- Target operations are specified (non-empty)
- Recipient equals sponsor (self-execution pattern)
- Target operations are NOT using execution emissary pattern
- Signature mode match: target ops sig mode equals pre-claim ops sig mode, OR pre-claim ops are empty
Parameters
Complete order specification including tokens, operations, deadlines, and metadata. Contains all information needed for settlement validation and execution.
Container for required signatures including notarized claim sig and optional pre-claim sig. Used to validate user authorization for the settlement.
Array of additional order element hashes for complex multi-element orders. Typically empty for single-element same-chain settlements.
Protocol-specific data for the Compact allocator contract. Contains parameters needed for resource allocation and validation.
Address where input tokens will be deposited after successful unlock. Typically the solver’s address or a solver-controlled withdrawal contract.
Returns
The address of the order sponsor who authorized this settlement.
The nonce value from the order used for replay protection and tracking.
Permit2 Protocol Settlement
handlePermit2
The Permit2 flow is optimized for straightforward token operations where the complexity of pre-claim operations and gas stipends is unnecessary, providing significant gas savings.
Settlement Flow
Pre-claim validation
Validates order signatures using
_permit2PreClaimOps for Permit2-specific requirements. Generates mandate hash for subsequent resource unlock without complex pre-claim operations. Skips gas stipend allocation and complex setup operations for efficiency.Resource unlock and depositing
Calls
_unlockPermit2 with simplified signature validation against mandate hash. Unlocks user’s input tokens directly from Permit2 protocol contracts. Transfers input tokens to the specified relayer address without intermediate steps.Parameters
Complete order specification including tokens, operations, and metadata. Same structure as Compact but typically with simpler target operations.
Container for required signatures, primarily the notarized claim signature. Permit2 typically requires fewer signatures than full Compact protocol.
Address where input tokens will be deposited after successful unlock. Receives tokens directly from Permit2 unlock without intermediate processing.
Returns
The address of the order sponsor who authorized this settlement.
The nonce value from the order used for replay protection and tracking.
Security Model
Access Control
Access Control
Only Router can call arbiter functions via the
onlyRouter modifier. This prevents unauthorized settlement attempts and ensures proper validation flow.Signature Security
Signature Security
All user signatures validated before any asset movements or operations occur. Maintains cryptographic proof of user authorization throughout settlement.
Atomic Execution
Atomic Execution
Either entire settlement succeeds or reverts completely. If validation fails, the entire transaction reverts including pre-funding.
Trusted Executor Model
Trusted Executor Model
SameChainArbiter is whitelisted as a trusted contract in the IntentExecutor. This enables target operations to execute without additional signature validation after successful resource unlock, reducing gas costs while maintaining security.
Errors
OrderExpired
fillDeadline. Settlement operations validate that order.fillDeadline >= block.timestamp before processing.
Events
SameChainTargetOpsNotHandled
Source Code Reference
Location:/src/arbiters/samechain/SameChainArbiter.sol:81