Overview
TheDestinationSettler contract implements the ERC-7683 destination chain settlement interface for Eco Routes Protocol. It handles intent fulfillment on destination chains by processing fill requests from solvers and executing the associated route instructions.
Contract Location: contracts/ERC7683/DestinationSettler.sol
ERC-7683 Compliance
This contract implements the destination-side of the ERC-7683 Cross-Chain Intent Settlement standard. It provides a standardizedfill() interface that solvers can call to fulfill intents that were opened on the origin chain.
Key Features
- Standardized Fill Interface: Implements ERC-7683
fill()method for universal solver integration - Flexible Prover Support: Supports multiple proof mechanisms via configurable prover addresses
- Cross-VM Compatibility: Uses
bytes32for cross-chain address representation - Atomic Fulfillment: Combines route execution and proof submission in a single transaction
- Event Emission: Emits
OrderFilledevent for off-chain indexing and monitoring
Core Functions
fill
Unique identifier for the order being filled (intent hash from origin chain)
Data emitted on the origin chain to parameterize the fill. This is ABI-encoded as
(bytes encodedRoute, bytes32 rewardHash) where:encodedRoute: ABI-encodedRoutestruct with execution instructionsrewardHash: Hash of theRewardstruct from the origin chain
Data provided by the filler to inform the fill or express preferences. This is ABI-encoded as
(address prover, uint64 source, bytes32 claimant, bytes proverData) where:prover: Address of the prover contract on this destination chainsource: Source chain ID where the intent was createdclaimant: Cross-VM compatible claimant identifier (can be converted to address)proverData: Additional data required by the chosen prover for proof submission
OrderFilled(bytes32 orderId, address solver)
- Decodes
originDatato extractencodedRouteandrewardHash - Emits
OrderFilledevent withorderIdand solver address (msg.sender) - Decodes
fillerDatato extract prover, source, claimant, and proverData - Calls
fulfillAndProve()to execute the route and submit proof
Abstract Methods
fulfillAndProve
The hash of the intent to fulfill (same as
orderId)The route information containing execution instructions (decoded from
originData)The hash of the reward details (used to reconstruct full intent hash)
Cross-VM compatible claimant identifier who will receive rewards on origin chain
Address of prover contract on the destination chain that will submit the proof
The source chain ID where the intent was created (for proof submission)
Additional data for message formatting and prover-specific requirements
- Validate that the route hasn’t been executed already
- Execute all calls in the
route.callsarray sequentially - Verify execution succeeded and handle any failures appropriately
- Submit proof to the prover contract for relay to origin chain
- Return execution results for off-chain verification
Events
OrderFilled
Hash of the fulfilled intent (unique order identifier)
Address that fulfilled the intent (
msg.sender of the fill() call)- Track which solvers are fulfilling orders
- Monitor order fulfillment rates and latency
- Verify that orders are being filled correctly
- Trigger subsequent actions in multi-leg workflows
Data Encoding Specifications
originData Encoding
TheoriginData parameter must be ABI-encoded as:
- Separates route execution data from reward verification data
rewardHashensures reward integrity without passing full reward struct- Reduces cross-chain data size while maintaining security
fillerData Encoding
ThefillerData parameter must be ABI-encoded as:
- Allows solvers to choose their preferred prover
- Supports cross-VM addresses via
bytes32encoding - Flexible
proverDatafor different proof mechanisms
Implementation Notes
Security Considerations
- Reentrancy Protection: Implementations should include reentrancy guards in
fulfillAndProve - Route Validation: Verify route deadline hasn’t passed before execution
- Proof Verification: Ensure proof is submitted successfully before considering fill complete
- Native Token Handling: Contract is payable to support routes requiring native tokens
Cross-VM Address Handling
The contract usesbytes32 for the claimant parameter to support cross-VM compatibility:
Prover Integration
The contract supports multiple prover types:- Message Bridge Provers: Use arbitrary message bridges (Hyperlane, LayerZero, etc.)
- Native Provers: Use chain-native proof mechanisms (OP Stack, Arbitrum, etc.)
- Local Provers: For same-chain testing and development
proverData formats. Consult the specific prover documentation for requirements.
Integration Guide
For Solvers
- Monitor Origin Chain: Listen for
Openevents fromOriginSettler - Extract Order Data: Get
orderIdandfillInstructions[0].originData - Prepare Fill Parameters:
- Use
originDatafrom theOpenevent - Encode
fillerDatawith your chosen prover and claimant address
- Use
- Execute Fill: Call
fill()with prepared parameters - Verify Completion: Check for
OrderFilledevent emission - Claim Rewards: Wait for proof to reach origin chain, then claim from vault
For Contract Implementers
- Inherit DestinationSettler: Create concrete contract extending this abstract contract
- Implement fulfillAndProve: Add your route execution and proving logic
- Add Security Checks: Include reentrancy protection, deadline validation, etc.
- Configure Provers: Set up supported prover contracts and validation
- Test End-to-End: Verify full flow from origin to destination and back
Example Implementation
Related
- OriginSettler - Settlement contract on origin chain
- Route Type - Route structure and execution instructions
- Reward Type - Reward structure and validation
- ERC-7683 Standard - Official EIP specification