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
ThePermit2IntentExecutor enables intent execution leveraging Uniswap’s Permit2 system for efficient token permission management with gasless approvals.
Source: /src/executor/Permit2Intent/Permit2Executor.sol:43
Key Features
- Gasless Token Approvals: Use EIP-712 structured signatures instead of on-chain approval transactions
- Nonce-Based Replay Protection: Efficient storage patterns for per-account nonce tracking
- EIP-1271 Validation: Support for both EOA and smart contract account signatures
- Cross-Chain Support: Origin and destination chain execution with Permit2 authorization
Execution Flow
- User signs a Permit2-compatible intent with token permissions and operations
- Arbiter calls
executePreClaimOpsWithPermit2Stubto execute pre-claim operations - Contract validates the signature against Permit2’s domain separator
- Nonce is consumed to prevent replay attacks
- Pre-claim operations are executed (e.g., token transfers, swaps)
- For cross-chain:
executeTargetOpsWithPermit2Stubexecutes on destination
Structs
EIP712Permit2Stub
Core Permit2 parameters for intent execution.Nonce for replay protection, unique per account
Expiration timestamp for the permit
EIP712Permit2MandateStub
Mandate-specific parameters for Permit2 intent execution on origin chain.Hash of input token details
Minimum gas required for execution of operations
Hash of target attributes (account, tokenOut, chain, expires)
Hash of destination operations to execute
Hash of qualifier data specific to this mandate
EIP712Permit2MandateDestinationStub
Mandate-specific parameters for Permit2 destination chain execution.Original sponsor address from the origin chain
Arbiter that facilitated the cross-chain transfer
Minimum gas required for pre-claim operations
Chain ID where the order was originally notarized
Hash of pre-claim operations from origin chain
Hash of input token details
Hash of qualifier data
Target parameters for fill validation
Target
Target chain fill parameters for Permit2 destination execution.Deadline timestamp for completing the fill
Hash of expected output tokens
Functions
executePreClaimOpsWithPermit2Stub
The user account that signed the intent and will execute operations
Core Permit2 parameters including nonce and expiration
Mandate-specific parameters including token and operation hashes
Array of operations to execute on the origin chain
EIP-712 signature from the account authorizing the operations
bytes32 - The computed Permit2 hash used for signature validation
The function immediately consumes the nonce to prevent replay attacks before validating the signature and executing operations.
executeTargetOpsWithPermit2Stub
The user account that signed the intent and will execute operations
Core Permit2 parameters including nonce and expiration
Mandate-specific parameters including token and operation hashes for destination
Array of operations to execute on the destination chain
EIP-712 signature from the account authorizing the operations
bytes32 - The computed Permit2 hash used for signature validation
isPermit2IntentNonceConsumed
The nonce value to check
The account address that owns the nonce
bool - True if the nonce has been consumed, false otherwise
Signature Validation
The contract uses EIP-712 signature validation with Permit2’s domain separator:Hash Computation
- Mandate Hash: Combines target attributes, operation hashes, and qualifier data
- Permit2 Hash: Combines mandate hash with Permit2-specific fields (token, arbiter, nonce, expires)
- Typed Data Digest: Wraps Permit2 hash with domain separator for final signature validation
Validation Modes
Supports multiple signature validation modes via theValidateSignature base contract:
- ERC1271: Direct signature validation
- EMISSARY: Session key validation
- Hybrid Modes: Fallback combinations for flexibility
Example Usage
Gas Optimization
Error Handling
Thrown when signature validation fails using any configured validation mode
Thrown when fill expiration has passed or chain validation fails
Thrown when
executeTargetOpsWithPermit2Stub is called by non-router addressSecurity Considerations
Benefits over Standard Approvals
- Gas Savings: No separate approval transaction needed
- Better UX: Single signature for approval + operation
- Granular Control: Per-intent token permissions instead of unlimited approvals
- Cross-Chain: Works seamlessly across chains with consistent signatures
Related
- IntentExecutor - Main executor contract
- CompactIntentExecutor - Compact protocol execution
- StandaloneIntentExecutor - Self-contained execution