Skip to main content

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

IntentExecutorAdapter is a gas-optimized adapter contract that implements a transparent forwarding pattern for intent execution requests. It acts as a proxy between the router and the actual intent executor, minimizing gas overhead through memory-safe assembly operations. Source: src/adapters/IntentExecutorAdapter.sol Inherits: AdapterBase

Forwarding Pattern

The adapter uses memory-safe assembly for calldata forwarding to achieve minimal gas overhead, typically saving 200-500 gas per call compared to high-level Solidity forwarding patterns. It handles three types of intent execution patterns:
  • Compact intent execution (ERC-7683 style)
  • Permit2 intent execution (with token approvals)
  • Standalone multichain intent execution
  • Standalone single-chain intent execution
This adapter does not consume any relayerContext data. It uses ADAPTER_TAG with setSkipRelayerContext() flag.

State Variables

EXECUTOR

address internal immutable EXECUTOR
The immutable address of the intent executor contract that handles actual execution.

Function Selectors

Cached function selectors for gas efficiency:
bytes4 internal constant PERMIT2_INTENT_SELECTOR = 
    IPermit2IntentExecutor.executeTargetOpsWithPermit2Stub.selector;

bytes4 internal constant COMPACT_INTENT_SELECTOR = 
    ICompactIntentExecutor.executeTargetOpsWithCompactStub.selector;

bytes4 internal constant STANDALONE_INTENT_SELECTOR = 
    IStandaloneIntentExecutor.executeMultichainOps.selector;

bytes4 internal constant STANDALONE_SINGLE_CHAIN_INTENT_SELECTOR = 
    IStandaloneIntentExecutor.executeSinglechainOps.selector;

Errors

ForwardingToExecutorFailed

error ForwardingToExecutorFailed()
Thrown when the forwarding call to the intent executor fails. This indicates that the underlying executor either reverted or ran out of gas. The original revert reason is not preserved to maintain gas efficiency.

Constructor

constructor(address router, address executor)
Initializes the IntentExecutorAdapter with router and executor addresses.
router
address
The address of the router contract that will call this adapter
executor
address
The address of the intent executor contract that will handle forwarded calls

Fill Functions

handleFill_intentExecutor_handleCompactTargetOps

function handleFill_intentExecutor_handleCompactTargetOps(
    bytes calldata executorCalldata
)
    external
    payable
    onlyViaRouter
    returns (bytes4)
Handles compact intent execution by forwarding to the executor. Called by the router to execute compact-style intents following the ERC-7683 standard for cross-chain intent execution.
executorCalldata
bytes
The ABI-encoded parameters for the compact intent execution, typically containing target operations, token amounts, and execution context
Returns:
selector
bytes4
The function selector of this function to confirm successful handling
Execution Flow:
  1. Router receives compact intent execution request
  2. Router calls this function with encoded parameters
  3. Function forwards to executor.executeTargetOpsWithCompactStub(parameters)
  4. Executor processes compact intent and executes target operations
Function Selector: this.handleFill_intentExecutor_handleCompactTargetOps.selector Gas Optimization: Optimized forwarding saves gas compared to traditional proxy patterns

handleFill_intentExecutor_handlePermit2TargetOps

function handleFill_intentExecutor_handlePermit2TargetOps(
    bytes calldata executorCalldata
)
    external
    payable
    onlyViaRouter
    returns (bytes4)
Handles Permit2-based intent execution by forwarding to the executor. Uses Permit2 for token approvals, enabling gasless token approvals through signed permits.
executorCalldata
bytes
The ABI-encoded parameters for the Permit2 intent execution, including permit signatures, token details, and target operations
Returns:
selector
bytes4
The function selector of this function to confirm successful handling
Execution Flow:
  1. User signs Permit2 permit for token transfer
  2. Router receives intent execution request with permit signature
  3. Router calls this function with encoded permit and parameters
  4. Function forwards to executor.executeTargetOpsWithPermit2Stub(parameters)
  5. Executor validates permit signature and executes target operations
Function Selector: this.handleFill_intentExecutor_handlePermit2TargetOps.selector
Permit2 signature validation is handled by the executor, not this adapter.

handleFill_intentExecutor_executeMultichainOps

function handleFill_intentExecutor_executeMultichainOps(
    bytes calldata executorCalldata
)
    external
    payable
    onlyViaRouter
    returns (bytes4)
Handles standalone multichain intent execution by forwarding to the executor. Processes cross-chain operations without the additional abstractions of Compact or Permit2 patterns.
executorCalldata
bytes
The ABI-encoded parameters for the multichain operation execution, containing cross-chain operation details and execution parameters
Returns:
selector
bytes4
The function selector of this function to confirm successful handling
Execution Flow:
  1. Router receives multichain operation request
  2. Router calls this function with encoded operation parameters
  3. Function forwards to executor.executeMultichainOps(parameters)
  4. Executor processes multichain operations across target chains
Function Selector: this.handleFill_intentExecutor_executeMultichainOps.selector

handleFill_intentExecutor_executeSinglechainOps

function handleFill_intentExecutor_executeSinglechainOps(
    bytes calldata executorCalldata
)
    external
    payable
    onlyViaRouter
    returns (bytes4)
Handles standalone single-chain intent execution by forwarding to the executor. Simpler than multichain intents as they only require chain-specific signature validation.
executorCalldata
bytes
The ABI-encoded parameters for the single-chain operation execution, containing operation details and execution parameters
Returns:
selector
bytes4
The function selector of this function to confirm successful handling
Execution Flow:
  1. Router receives single-chain operation request
  2. Router calls this function with encoded operation parameters
  3. Function forwards to executor.executeSinglechainOps(parameters)
  4. Executor processes operations on the current chain
Function Selector: this.handleFill_intentExecutor_executeSinglechainOps.selector

Interface Support

supportsInterface

function supportsInterface(bytes4 selector) 
    public 
    pure 
    override 
    returns (bool supported)
Implements ERC-165 interface detection to declare support for the four intent execution handlers.
selector
bytes4
The 4-byte interface selector to check for support
Returns:
supported
bool
True if the selector is supported by this contract. Supported selectors:
  • handleFill_intentExecutor_handleCompactTargetOps.selector
  • handleFill_intentExecutor_handlePermit2TargetOps.selector
  • handleFill_intentExecutor_executeMultichainOps.selector
  • handleFill_intentExecutor_executeSinglechainOps.selector
  • Any selectors supported by AdapterBase

Adapter Tag

ADAPTER_TAG

function ADAPTER_TAG() external pure override returns (bytes12)
Returns the adapter tag with skipRelayerContext flag set. Returns:
adapterTag
bytes12
Constants.DEFAULT_ADAPTER_TAG.setSkipRelayerContext()
This indicates that the adapter does not consume relayer context data, allowing the Router to skip context appending for gas savings.

Gas Optimization

The adapter uses AdapterCalldataPassthroughLib for efficient calldata forwarding:
EXECUTOR.passthrough(SELECTOR, executorCalldata);
This assembly-based approach:
  • Saves 200-500 gas per call compared to high-level Solidity
  • Uses zero-copy calldata forwarding with calldatacopy
  • Minimizes memory allocation
  • Properly propagates revert data from executor
The passthrough library is memory-safe and properly manages the free memory pointer to ensure compatibility with Solidity’s memory model.

Security Considerations

  • Only callable via Router delegatecall (enforced by onlyViaRouter)
  • Executes in Router’s context with access to Router’s storage and balance
  • All external calls go to the trusted EXECUTOR address set at construction
  • Revert data from executor is properly propagated

Usage Example

// Router calls adapter with intent execution request
router.execute(
    intentExecutorAdapter,
    abi.encodeWithSelector(
        intentExecutorAdapter.handleFill_intentExecutor_handleCompactTargetOps.selector,
        executorCalldata
    )
);

// Adapter forwards to executor efficiently
// executor.executeTargetOpsWithCompactStub(decodedParams)

Build docs developers (and LLMs) love