Architecture Overview
An overview of the Eco Routes architecture.
Routes
Routes addresses the challenge of fragmented cross-chain liquidity by providing users the ability to request the fulfillment of actions on other chains, with a focus on stablecoin sends / swaps. For the Beta launch, Eco has released the Eco-Routes system on Optimism, Base, Mantle, Arbitrum and Polygon. This version supports cross-chain transfers of stablecoins and like-kind assets between these chains.
Participants
Routes relies on an intent based architecture, where users specify the actions they want to happen on another chain. In this system, there are two actors, users and fillers.
-
Users are EOAs or smart contract wallets with a need to perform a payment or action on another chain. Typically, these users are using an application that has integrated the transfer system.
-
Fillers are market participants who help users execute intents for a fee. For the Alpha release of the system, the architecture is optimized for applications that fill intents for their own users.
The following section discusses technical details of the Eco Protocol. If you’re not familiar with concepts like Storage Proofs, please see the Storage Proofs section.
High-Level System Architecture
The Origin chain is the chain where the User requests the intent and the Destination chain is the chain where the filler executes a transfer request. The system relies on 3 contracts across these chains to manage cross-chain transfers:
-
IntentSource
Contract — lives on the Origin chain and is responsible for the management of intent origination, custody of funds and filler fulfillment. -
Inbox
Contract — lives on the Destination chain and is responsible for the management of intent fulfillment and prevention of double fills. -
Prover
Contract — lives on the Origin chain and is responsible for the management of intent fulfillment proof. Multiple types of prover contracts are currently supported in the Eco Protocol system. Different types of provers enable developers and app users to opt into speed or trust tradeoffs which best fit their needs.
Transfer Flow
Fulfilling a route request requires 4 basic steps. This example highlights an L2 to L2 transfer fulfillment:
-
User Originates Request:
-
The user locks up funds in the
IntentSource
contract on the Origin chain. The intent specifies a destination chain, a set of functions that must successfully be called with their corresponding calldata, and which prover will be used for validating intent fulfillment. For most requests, the contracts will be stablecoin contracts and users will request transfers to specific addresses. -
If the intent request is successfully initiated in the contract, it is assigned a hash identifier, and reward tokens are deposited for custody by the contract.
-
These tokens are a reward for anyone that fulfills the intent in time. If the intent is not fulfilled in time, the tokens can be reclaimed by the user.
-
-
Filler Completes Request:
-
A filler sees the intent on the
IntentSource
contract on the Origin chain. They call a function on theInbox
contract on the Destination Chain with the original data the user sent with the request. The contract calculates the hash based on the set of calls (which should match the hash on the Origin chain). -
The
Inbox
contract then executes the specific function calls. At the end of the calls, theInbox
contract makes sure that all the specified calls were successful, and if so, marks the intent as fulfilled. The intent is marked using a mapping that stores the address credited with the fulfillment, with the hash as the key. -
Because the hash is unique, the contract prevents anyone else from submitting a fill for an intent with the same hash. This prevents two fillers accidentally filling the same intent!
-
-
Filler Proves Fulfillment:
-
The Beta System supports two types of routes: the Native Route and the Hyperlane Route. The Native Route uses the
Prover
contract to prove intent fulfillment with storage proofs. The Hyperlane Route uses theHyperProver
contract to prove intent fulfillments. -
If the Native Path was selected in during intent origination:
-
The filler then submits a proof on the Origin chain to the
Prover
contract to claim the funds. The proof uses the L1Block oracle on the L2 to construct a series of Storage Proofs. These proofs derive the state root of the Destination chain, and make it accessible in the execution context of the Origin chain. -
With the state root of the origin chain, the fufillment of the intent can be proven via another storage proof. The proof proves that the intent was fulfilled on the Destination chain by proving the relevant storage slot in the
Inbox
contract using the Destination state root. -
The Native Path requires the state root to be settled per the settlement criteria of the L2.
-
-
If the Hyperlane Route was selected in during intent origination:
-
During the fulfillment on the
IntentSource
, the filler chooses whether they want an instant proof communication or to be added to a batch. -
If the instant fulfillment was selected, Hyperlane immediately sends a message that marks the intent as proven on the Origin chain in the
HyperProver
contract. -
If the batch fulfillment was selected, the intent is relayed in a batch by Hyperlane, which batches multiple intent fulfillments into a single message and marks them all as proven in the
Hyperprover
contract.
-
-
-
Filler Claims Reward
- After the intent is marked as fulfilled in the relevant Prover contract, the filler can claim funds from the
IntentSource
. If the intent was not fulfilled in time, the user can reclaim their funds after the end of the lockup period.
- After the intent is marked as fulfilled in the relevant Prover contract, the filler can claim funds from the
Native & Hyperlane Routes Flows
Native Route Transfer Flow
Hyperlane Route Transfer Flow
Interoperability
The system is designed to be maximally flexible. All three of the main contracts in the system are designed to be able to be swapped out by users originating intents. This means that the addition of an alternative proof mechanism or alternative logic in the intent source contract is as simple as deploying different contracts and specifying them in contract calls.