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

IntentExecutorAdapterGasRefund is a specialized adapter that extends the intent execution forwarding pattern to support gas refund functionality. It enables solvers to execute user intents while receiving compensation for gas costs directly from the user’s account. Source: src/adapters/IntentExecutorAdapterGasRefund.sol Inherits: AdapterBase

Key Features

  • Gas Refund Support: Solvers receive gas compensation in user-specified tokens
  • Multichain Support: Handles both multichain and single-chain operations with refunds
  • Signature Protection: Gas refund terms must be included in user’s signature
  • Memory-Safe Forwarding: Uses assembly for efficient calldata passthrough
This adapter expects exactly 20 bytes of relayer context containing the gas refund recipient address.

State Variables

EXECUTOR

address internal immutable EXECUTOR
The immutable address of the IntentExecutor contract that handles actual intent execution. Source: src/adapters/IntentExecutorAdapterGasRefund.sol:38

Constructor

constructor(address router, address executor)
Initializes the adapter with router and executor addresses.
router
address
required
The address of the Router contract that will call this adapter via delegatecall
executor
address
required
The address of the StandaloneIntentExecutor contract
Source: src/adapters/IntentExecutorAdapterGasRefund.sol:49

Internal Functions

_gasRefundRecipient

function _gasRefundRecipient() internal pure returns (address gasRefundRecipient)
Extracts the gas refund recipient address from the relayer context. Returns: The address that will receive gas refund tokens (ERC20 or native ETH) Validation: Requires exactly 20 bytes of relayer context Source: src/adapters/IntentExecutorAdapterGasRefund.sol:60-65

Fill Functions

handleFill_intentExecutor_executeMultichainOps_gasRefund

function handleFill_intentExecutor_executeMultichainOps_gasRefund(
    IStandaloneIntentExecutor.MultiChainOps calldata ops,
    IStandaloneIntentExecutor.GasRefund calldata gasRefund
) external onlyViaRouter returns (bytes4)
Handles multichain intent execution with gas refund to the solver.
ops
MultiChainOps
required
The multichain operations structure containing:
  • account: User’s smart account address
  • operations: Array of Target operations to execute
  • nonce: Unique nonce for replay protection
  • signature: User’s signature authorizing the execution and gas refund
gasRefund
GasRefund
required
The gas refund terms:
  • token: Address of ERC20 token (or address(0) for native ETH)
  • amount: Amount of tokens to refund to the solver
Returns: this.handleFill_intentExecutor_executeMultichainOps_gasRefund.selector Execution Flow:
  1. Extracts gas refund recipient from relayer context
  2. Forwards call to StandaloneIntentExecutor.executeMultichainOps_gasRefund
  3. Executor validates signature (must include gas refund terms)
  4. Executor processes operations across chains
  5. Executor transfers gas refund to the solver’s specified address
The gas refund terms must be included in the user’s signature to prevent manipulation by solvers.
Source: src/adapters/IntentExecutorAdapterGasRefund.sol:78-86

handleFill_intentExecutor_executeSingleChainOps_gasRefund

function handleFill_intentExecutor_executeSingleChainOps_gasRefund(
    IStandaloneIntentExecutor.SingleChainOps calldata ops,
    IStandaloneIntentExecutor.GasRefund calldata gasRefund
) external onlyViaRouter returns (bytes4)
Handles single-chain intent execution with gas refund to the solver.
ops
SingleChainOps
required
The single-chain operations structure containing:
  • account: User’s smart account address
  • operations: Array of Target operations to execute on this chain
  • nonce: Unique nonce for replay protection
  • signature: User’s signature authorizing the execution and gas refund
gasRefund
GasRefund
required
The gas refund terms (token and amount)
Returns: this.handleFill_intentExecutor_executeSingleChainOps_gasRefund.selector Execution Flow:
  1. Extracts gas refund recipient from relayer context
  2. Forwards call to StandaloneIntentExecutor.executeSingleChainOps_gasRefund
  3. Executor validates signature (must include gas refund terms)
  4. Executor processes operations on the current chain
  5. Executor transfers gas refund to the solver’s specified address
Gas Optimization: Single-chain execution is more gas-efficient than multichain for operations on one chain. Source: src/adapters/IntentExecutorAdapterGasRefund.sol:95-103

Interface Support

function supportsInterface(bytes4 interfaceId) public pure override returns (bool)
Returns true if the contract implements the given interface. Supported Interfaces:
  • handleFill_intentExecutor_executeMultichainOps_gasRefund.selector
  • handleFill_intentExecutor_executeSingleChainOps_gasRefund.selector
  • All interfaces from AdapterBase
Source: src/adapters/IntentExecutorAdapterGasRefund.sol:107-115

Adapter Tag

function ADAPTER_TAG() public pure override returns (bytes12)
Returns the adapter tag for this adapter. The tag is configured to NOT skip relayer context since this adapter requires the gas refund recipient address. Source: src/adapters/IntentExecutorAdapterGasRefund.sol:117-119

Relayer Context Format

The adapter expects exactly 20 bytes of relayer context:
Bytes 0-19: Gas refund recipient address (address)
Example relayer context construction:
address gasRefundRecipient = 0x1234...; // Solver's address
bytes memory relayerContext = abi.encodePacked(gasRefundRecipient);

Gas Refund Security Model

Critical Security Requirement: The gas refund terms (token and amount) MUST be included in the user’s signature.
The signature validation ensures that:
  1. Users explicitly authorize the gas refund amount
  2. Solvers cannot increase the refund amount
  3. Solvers cannot change the refund token
  4. The refund recipient is controlled by the solver (via relayer context)
Signature Structure: Users sign a hash that includes:
  • Account address
  • Operations to execute
  • Nonce for replay protection
  • Gas refund token and amount

Usage Example

// 1. Prepare gas refund terms (user signs this)
IStandaloneIntentExecutor.GasRefund memory gasRefund = IStandaloneIntentExecutor.GasRefund({
    token: 0xA0b86..., // USDC address
    amount: 5e6         // 5 USDC
});

// 2. Prepare relayer context with gas refund recipient
address solverAddress = 0x5678...;
bytes memory relayerContext = abi.encodePacked(solverAddress);

// 3. Prepare adapter calldata
bytes memory adapterCalldata = abi.encodeWithSelector(
    IntentExecutorAdapterGasRefund.handleFill_intentExecutor_executeMultichainOps_gasRefund.selector,
    multiChainOps,
    gasRefund
);

// 4. Call router with atomic signature
router.optimized_routeFill921336808(
    relayerContext,
    adapterCalldata,
    atomicSignature
);

Comparison with IntentExecutorAdapter

FeatureIntentExecutorAdapterIntentExecutorAdapterGasRefund
Gas Refund Support❌ No✅ Yes
Relayer ContextNone (skipped)20 bytes (gas refund recipient)
Signature RequirementsOperations onlyOperations + gas refund terms
Use CaseFree execution or external compensationOn-chain solver compensation