Architecture
Origin Chain:OriginSettler handles intent creation, signature verification, and fund escrowDestination 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 on-chain with atomic funding.- Validates
orderDataTypematchesORDER_DATA_TYPEHASH - Decodes
OrderDatafrom the order - Calls
_publishAndFund()to create intent and transfer funds - Emits
Openevent with resolved order details
openFor()
Creates a gasless intent on behalf of a user using EIP-712 signatures.block.timestamp <= order.openDeadlineorder.originSettler == address(this)order.originChainId == block.chainidorderDataTypematchesORDER_DATA_TYPEHASH- Signature verification via
_validateOrderSig()
_publishAndFund() through vault state checking (Initial, Funded, Withdrawn, Refunded).
Resolution Functions
Convert Eco-specific order data into ERC-7683 compliant format:- Converts
Rewardstructure intoOutput[]array (rewards + native ETH if present) - Calculates
routeHash,rewardHash, andintentHash - Creates
FillInstructionwith encoded(route, rewardHash)asoriginData
user:orderData.reward.creatororiginChainId:block.chainidfillDeadline:orderData.routeDeadlineorderId:intentHashminReceived: Reward outputs with origin chain IDsfillInstructions[0].destinationSettler:orderData.routePortal
EIP-712 Signature
GaslessCrossChainOrder TypeHash:order.user.
Abstract Method
DestinationSettler
Handles intent fulfillment on destination chains.fill()
Executes a cross-chain order on the destination.orderId: Intent hash from origin chainoriginData: Encoded(bytes route, bytes32 rewardHash)fillerData: Encoded(address prover, uint64 source, bytes32 claimant, bytes proverData)
- Decodes
originDatato extract route and rewardHash - Emits
OrderFilled(orderId, msg.sender) - Decodes
fillerDatafor prover details - Calls
fulfillAndProve()with decoded parameters
Abstract Method
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_TYPEHASHOpenDeadlinePassed(): Current time exceeds opening deadlineInvalidOriginSettler(): Order specifies wrong settler addressInvalidOriginChainId(): Order targets different chainInvalidSignature(): Signature verification failed
Eco-Specific Implementation Notes
- Recipient Field:
Output.recipientalways zero address; actual claimant specified infillerDataat fulfillment - ChainId Semantics:
minReceivedoutputs use origin chainId (rewards claimed on source chain) - FillInstruction.originData: Contains
(route, rewardHash)tuple instead of complete intent - Single Fill: Each order has exactly one fill instruction
