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

The StandaloneIntentExecutor enables self-contained intent execution without dependencies on external protocols like Compact or Permit2. Source: /src/executor/StandaloneIntent/StandaloneIntent.sol:50

Key Features

  • Chain-Agnostic Signatures: Multi-chain operations with signatures valid across networks
  • Direct Nonce Management: Account-level replay protection without external protocols
  • Gas Refund Support: Optional ERC20 or native ETH relayer compensation
  • Session Key Support: Integration with emissary-based validation for delegation
  • Single and Multi-Chain: Optimized execution paths for both use cases

Execution Modes

Multi-Chain Operations:
  • Chain-agnostic signatures work across different networks
  • Coordinated execution with operation hashes from other chains
Single-Chain Operations:
  • Chain-specific signatures (more gas efficient)
  • Simplified execution for operations on one chain
Gas Refund Variants:
  • No refund: Simple execution without relayer compensation
  • ERC20 refund: Pay relayer in any ERC20 token with configurable exchange rate
  • ETH refund: Optimized native ETH compensation (1:1 rate)

Structs

MultiChainOps

Multi-chain operations structure for standalone intent execution.
struct MultiChainOps {
    address account;
    uint256 chainIndex;
    bytes32[] otherChains;
    uint256 nonce;
    Types.Operation ops;
    bytes signature;
}
account
address
The account address that owns and signed these operations
chainIndex
uint256
Index position of current chain in the otherChains array
otherChains
bytes32[]
Array of operation hashes from other chains in the multi-chain intent
nonce
uint256
Nonce for replay protection
ops
Types.Operation
Operations to execute on the current chain
signature
bytes
EIP-712 signature from the account authorizing all operations

SingleChainOps

Single-chain operations structure for standalone intent execution.
struct SingleChainOps {
    address account;
    uint256 nonce;
    Types.Operation ops;
    bytes signature;
}
account
address
The account address that owns and signed these operations
nonce
uint256
Nonce for replay protection
ops
Types.Operation
Operations to execute on the current chain
signature
bytes
EIP-712 signature from the account authorizing the operations
SingleChainOps is ~850 gas cheaper than MultiChainOps due to simpler structure and standard EIP-712 hashing with chain ID.

GasRefund

Gas refund parameters for ERC20 token relayer compensation.
struct GasRefund {
    address token;
    uint256 exchangeRate;
    uint256 overhead;
}
token
address
ERC20 token address for gas refund (must not be Constants.NATIVE_TOKEN)
exchangeRate
uint256
Exchange rate: how many token units equal 1 ETH (scaled to 1e18)
overhead
uint256
Fixed gas overhead to add to the gas calculation (gas units)
For ERC20 refunds, the token address must NOT be Constants.NATIVE_TOKEN. Use the ETH refund functions for native token compensation.

Functions

executeMultichainOps

function executeMultichainOps(MultiChainOps calldata signedOps) external
Executes a batch of multi-chain operations after verifying signature and nonce, without gas refund.
signedOps
MultiChainOps
required
The MultiChainOps struct containing account, operations, nonce, and signature
Uses chain-agnostic EIP-712 signature validation (excludes chain ID from digest), allowing the same signature to be valid across different chains.

executeMultichainOpsWithGasRefund_ERC20

function executeMultichainOpsWithGasRefund_ERC20(
    MultiChainOps calldata signedOps,
    GasRefund calldata gasRefund,
    address gasRefundRecipient
) external returns (address account, uint256 nonce)
Executes multi-chain operations with ERC20 token gas refund for relayer compensation.
signedOps
MultiChainOps
required
The complete multi-chain operations structure with signature
gasRefund
GasRefund
required
The gas refund terms (ERC20 token, exchange rate, and overhead)
gasRefundRecipient
address
required
Address that will receive the gas refund payment (typically relayer)
Returns:
  • account (address): The account address that executed the operations
  • nonce (uint256): The nonce that was consumed during execution
Session key modes (EMISSARY_EXECUTION) require the account to call Paymaster.callbackAllowMaxAmount during execution to cap the refund amount and prevent exchange rate manipulation.

executeMultichainOpsWithGasRefund_ETH

function executeMultichainOpsWithGasRefund_ETH(
    MultiChainOps calldata signedOps,
    uint256 overhead,
    address gasRefundRecipient
) external returns (address account, uint256 nonce)
Executes multi-chain operations with native ETH gas refund for relayer compensation.
signedOps
MultiChainOps
required
The complete multi-chain operations structure with signature
overhead
uint256
required
The fixed gas overhead to add to the refund calculation (gas units)
gasRefundRecipient
address
required
Address that will receive the gas refund payment (typically relayer)
Returns:
  • account (address): The account address that executed the operations
  • nonce (uint256): The nonce that was consumed during execution
Owner signature modes save ~17-22k gas vs ERC20 variant by skipping the Paymaster intermediary and using direct ETH transfer. Exchange rate is hardcoded to 1:1.

executeSinglechainOps

function executeSinglechainOps(SingleChainOps calldata signedOps) external
Executes a single-chain intent after signature validation without gas refund.
signedOps
SingleChainOps
required
The complete single-chain operations structure with signature
Uses standard chain-specific EIP-712 signature validation (includes chain ID), making signatures NOT valid across different chains but ~850 gas cheaper than multi-chain variant.

executeSinglechainOpsWithGasRefund_ERC20

function executeSinglechainOpsWithGasRefund_ERC20(
    SingleChainOps calldata signedOps,
    GasRefund calldata gasRefund,
    address gasRefundRecipient
) external returns (address account, uint256 nonce)
Executes single-chain operations with ERC20 token gas refund for relayer compensation.
signedOps
SingleChainOps
required
The complete single-chain operations structure with signature
gasRefund
GasRefund
required
The gas refund terms (ERC20 token, exchange rate, and overhead)
gasRefundRecipient
address
required
Address that will receive the gas refund payment (typically relayer)
Returns:
  • account (address): The account address that executed the operations
  • nonce (uint256): The nonce that was consumed during execution

executeSinglechainOpsWithGasRefund_ETH

function executeSinglechainOpsWithGasRefund_ETH(
    SingleChainOps calldata signedOps,
    uint256 overhead,
    address gasRefundRecipient
) external returns (address account, uint256 nonce)
Executes single-chain operations with native ETH gas refund for relayer compensation.
signedOps
SingleChainOps
required
The complete single-chain operations structure with signature
overhead
uint256
required
The fixed gas overhead to add to the refund calculation (gas units)
gasRefundRecipient
address
required
Address that will receive the gas refund payment (typically relayer)
Returns:
  • account (address): The account address that executed the operations
  • nonce (uint256): The nonce that was consumed during execution

isStandaloneIntentNonceConsumed

function isStandaloneIntentNonceConsumed(
    uint256 nonce,
    address account
) external view returns (bool used)
Checks if a nonce has been used for a specific account.
nonce
uint256
required
The nonce value to check
account
address
required
The account address that owns the nonce
Returns: bool - True if the nonce has been consumed, false otherwise

getCostInToken

function getCostInToken(
    uint256 _actualGasCost,
    uint256 _actualOpFeePerGas,
    uint256 _exchangeRate,
    uint256 _overhead
) public pure returns (uint256)
Converts gas costs from wei to token amount using an exchange rate.
_actualGasCost
uint256
required
The total wei spent on execution (gasUsed × tx.gasprice)
_actualOpFeePerGas
uint256
required
The current gas price in wei (tx.gasprice)
_exchangeRate
uint256
required
How many token units (in token decimals) equal 1 ETH (1e18 wei)
_overhead
uint256
required
The fixed gas overhead to add (gas units not captured by gasleft measurement)
Returns: uint256 - The gas cost denominated in tokens Formula: ((actualGasCost + (overhead × gasPrice)) × exchangeRate) / 1e18

Gas Refund Mechanism

Settlement Methods

The contract uses different settlement methods based on signature mode: Owner Signature Modes (EMISSARY, ERC1271, EMISSARY_ERC1271, ERC1271_EMISSARY):
  • ERC20: Via Paymaster.settleGasRefund
  • ETH: Direct transfer via executeSingleETHTransfer (~17-22k gas savings)
  • Trusted exchange rate from account owner
Session Key Modes (EMISSARY_EXECUTION, EMISSARYEXECUTION_ERC1271, ERC1271_EMISSARYEXECUTION):
  • ERC20: Via Paymaster.settleGasRefund_requireCallback
  • ETH: Via Paymaster.settleGasRefund_requireCallback
  • Requires callback protection to prevent exchange rate/overhead manipulation

Session Key Security

Session key modes require the account to call Paymaster.callbackAllowMaxAmount during execution to authorize the maximum refund amount. This prevents session keys from draining funds through inflated exchange rates or overhead values.

Gas Overhead

The contract accounts for ~55,000 gas overhead not captured by gasleft() measurement:
  • Function dispatch and calldata decoding
  • EIP-712 hashing for gas refund commitment
  • Reentrancy guard operations (TSTORE/TLOAD)
  • Settlement call overhead

Example Usage

// Execute multi-chain ops without gas refund
intentExecutor.executeMultichainOps(
    MultiChainOps({
        account: accountAddress,
        chainIndex: 0,
        otherChains: [chain1Hash, chain2Hash],
        nonce: 1,
        ops: operations,
        signature: userSignature
    })
);

// Execute with ERC20 gas refund
(address account, uint256 nonce) = intentExecutor.executeMultichainOpsWithGasRefund_ERC20(
    signedOps,
    GasRefund({
        token: usdcAddress,
        exchangeRate: 2000e6, // 1 ETH = 2000 USDC
        overhead: 100000 // additional 100k gas
    }),
    relayerAddress
);

// Execute single-chain with ETH refund (gas optimized)
(address account, uint256 nonce) = intentExecutor.executeSinglechainOpsWithGasRefund_ETH(
    signedOps,
    50000, // 50k gas overhead
    relayerAddress
);

Events

IntentExecuted
event
event IntentExecuted(address account, uint256 nonce)
Emitted when an intent is successfully executed.

Error Handling

InvalidSignature
error
Thrown when signature validation fails
InvalidGasToken
error
Thrown when Constants.NATIVE_TOKEN is used with ERC20 refund functions

EIP-712 Domain

The contract uses the following EIP-712 domain:
  • Name: “IntentExecutor”
  • Version: “v0.0.1”

Comparison: Multi-Chain vs Single-Chain

FeatureMulti-ChainSingle-Chain
Chain ID in signatureNo (chain-agnostic)Yes (chain-specific)
Cross-chain validityYesNo
Gas costHigher (~850 gas more)Lower (optimized)
Use caseCoordinated multi-chainSingle chain only
Struct complexityMore complexSimpler

Security Considerations

Chain-Agnostic Signatures: Multi-chain operations use signatures without chain ID in the digest, allowing the same signature across chains. Ensure operations are designed for this cross-chain validity.
Nonce Consumption: Nonces are consumed before signature validation (CEI pattern) to prevent partial state changes on validation failure.
Gas Refund Commitment: Gas refund parameters are included in the EIP-712 signature to prevent relayers from modifying refund terms after signing.
For single-chain operations, prefer executeSinglechainOps variants for better gas efficiency (~3.4% cheaper).

Build docs developers (and LLMs) love