Skip to main content
ERC-7683 is the standard for cross-chain order protocols. Eco Routes implements this standard interface through two core contracts that handle the intent lifecycle across chains.

Architecture

Origin Chain: OriginSettler handles intent creation, signature verification, and fund escrow
Destination Chain: DestinationSettler manages intent fulfillment and proof generation

OriginSettler

Entry point for creating cross-chain intents on source chains. Implements EIP-712 signature verification with domain name “EcoPortal” and version “1”.

open()

Creates an intent directly onchain with atomic funding.
Process:
  1. Validates orderDataType matches ORDER_DATA_TYPEHASH
  2. Decodes OrderData from the order
  3. Calls _publishAndFund() to create intent and transfer funds
  4. Emits Open event with resolved order details

openFor()

Creates a gasless intent on behalf of a user using EIP-712 signatures.
Security Validations:
  • block.timestamp <= order.openDeadline
  • order.originSettler == address(this)
  • order.originChainId == block.chainid
  • orderDataType matches ORDER_DATA_TYPEHASH
  • Signature verification via _validateOrderSig()
Replay Protection: Built into _publishAndFund() through vault state checking (Initial, Funded, Withdrawn, Refunded).

Resolution Functions

Convert Eco-specific order data into ERC-7683 compliant format:
Resolution Process:
  1. Converts Reward structure into Output[] array (rewards and native ETH if present)
  2. Calculates routeHash, rewardHash, and intentHash
  3. Creates FillInstruction with encoded (route, rewardHash) as originData
Key Mappings:
  • user: orderData.reward.creator
  • originChainId: block.chainid
  • fillDeadline: orderData.routeDeadline
  • orderId: intentHash
  • minReceived: Reward outputs with origin chain IDs
  • fillInstructions[0].destinationSettler: orderData.routePortal

EIP-712 Signature

GaslessCrossChainOrder TypeHash:
Verification recovers signer using ECDSA and compares with order.user.

Abstract Method

Implementations handle vault creation, fund transfers, state checking, and excess ETH returns.

DestinationSettler

Handles intent fulfillment on destination chains.

fill()

Executes a cross-chain order on the destination.
Parameters:
  • orderId: Intent hash from origin chain
  • originData: Encoded (bytes route, bytes32 rewardHash)
  • fillerData: Encoded (address prover, uint64 source, bytes32 claimant, bytes proverData)
Execution:
  1. Decodes originData to extract route and rewardHash
  2. Emits OrderFilled(orderId, msg.sender)
  3. Decodes fillerData for prover details
  4. Calls fulfillAndProve() with decoded parameters

Abstract Method

Implementations execute route instructions and initiate proof generation atomically.

Data Types

OnchainCrossChainOrder

GaslessCrossChainOrder

OrderData

ResolvedCrossChainOrder

Output

FillInstruction

Integration Examples

Creating Direct Intent

Creating Gasless Intent

Fulfilling Intent

Error Handling

  • TypeSignatureMismatch(): OrderDataType doesn’t match ORDER_DATA_TYPEHASH
  • OpenDeadlinePassed(): Current time exceeds opening deadline
  • InvalidOriginSettler(): Order specifies wrong settler address
  • InvalidOriginChainId(): Order targets different chain
  • InvalidSignature(): Signature verification failed

Eco-Specific Implementation Notes

  1. Recipient Field: Output.recipient always zero address; actual claimant specified in fillerData at fulfillment
  2. ChainId Semantics: minReceived outputs use origin chainId (rewards claimed on source chain)
  3. FillInstruction.originData: Contains (route, rewardHash) tuple instead of complete intent
  4. Single Fill: Each order has exactly one fill instruction