Skip to main content

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

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

Constructor

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

Internal Functions

_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

Handles multichain intent execution with gas refund to the solver.
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
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

Handles single-chain intent execution with gas refund to the solver.
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
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

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

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:
Example relayer context construction:

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

Comparison with IntentExecutorAdapter