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
Permit2Arbiter serves as the integration layer with Uniswap’s Permit2 protocol, enabling arbiters to execute token transfers using cryptographic signatures instead of traditional allowances.Permit2 is a token approval management protocol that allows users to grant token spending permissions through signatures rather than on-chain approvals, providing better UX and gas efficiency.
Key Benefits
- Eliminates approval transactions: No need for separate approval transactions before token transfers
- Batch token transfers: Transfer multiple tokens with a single signature
- Fine-grained control: Precise permissions with nonces and deadlines
- Gas efficiency: Signature-based transfers eliminate separate approval gas costs
- Enhanced security: Battle-tested signature validation with time-bounded permissions
Integration with Router Ecosystem
- Processes token inputs from cross-chain orders using signature-based permissions
- Converts order token data into Permit2-compatible permission structures
- Handles witness-based transfers where mandate hashes serve as additional validation
- Enables seamless token unlocking as part of cross-chain settlement flows
Constructor
The address of the Permit2 SignatureTransfer contract on the current network. Must be the canonical Permit2 deployment to ensure signature compatibility and security.
The permit2 address cannot be changed after deployment. Verify it matches the official Permit2 deployment for the target network. The address is different on each network but maintains the same interface.
State Variables
PERMIT2
This immutable interface provides access to Permit2’s signature transfer functionality, enabling secure token transfers through cryptographic signatures rather than allowances. Used for all signature-based token unlocking operations in the arbiter system.
Token Unlocking
_unlockPermit2
Processes token inputs from a cross-chain order by converting them into Permit2-compatible permission structures and executing signature-authorized transfers. The mandate hash serves as a witness to provide additional validation that the transfer is part of a valid cross-chain settlement operation.
Execution Flow
Convert token data
Converts order token data (id/amount pairs) into Permit2 TokenPermissions. This transforms
[token_id, amount] pairs into proper token addresses and amounts.Create permit structure
Creates SignatureTransferDetails specifying the depositor as recipient. Constructs a PermitBatchTransferFrom with order nonce and expiry.
Parameters
The cross-chain order containing token inputs, sponsor, nonce, and expiry details. The
tokenIn array contains [token_id, amount] pairs that get converted to token addresses.The signature from the order sponsor authorizing the Permit2 token transfer. Must be a valid EIP-712 signature over the permit data and mandate witness.
The hash of the cross-chain mandate serving as witness data for additional validation. This proves the transfer is part of a legitimate cross-chain settlement operation.
The address that will receive the transferred tokens. Typically the settlement contract or final recipient depending on the settlement flow.
Security Features
The function enables secure token transfers where:Sponsor pre-signed permission
Sponsor pre-signed permission
The sponsor (token owner) has pre-signed permission for the transfer through their EIP-712 signature.
Mandate witness validation
Mandate witness validation
The mandate hash proves the transfer is part of a valid cross-chain order, providing an additional layer of security beyond basic token permissions.
Recipient validation
Recipient validation
The depositor receives the tokens as specified in the settlement, ensuring funds go to the intended recipient.
Replay protection
Replay protection
Nonce prevents replay attacks and expiry ensures time-bounded permissions, protecting against stale or reused signatures.
Permit2 Data Structures
TokenPermissions
SignatureTransferDetails
PermitBatchTransferFrom
permitted: Array of token permissionsnonce: Unique identifier preventing replay attacksdeadline: Expiration timestamp for the permit
Witness Type String
The witness type string is used for EIP-712 signature validation with additional witness data:The witness mechanism provides additional validation beyond basic token permissions. The mandate hash is included in the EIP-712 signature, cryptographically linking the token transfer to the specific cross-chain settlement operation.
Example Usage
Here’s how Permit2Arbiter is used in a typical settlement flow:Gas Optimization
Security Considerations
Comparison with CompactArbiter
- Permit2Arbiter
- CompactArbiter
Best for:
- Simple token transfers
- Gas-optimized flows
- Straightforward settlement operations
- Signature-based permissions
- No pre-claim operation complexity
- Lower gas overhead
- Direct token transfers
Source Code Reference
Location:/src/base/arbiter/Permit2Arbiter/Permit2Arbiter.sol:42