EcoCross Settlement Integration
The future of interoperability is intents and EcoCross Settlement is the only production-ready, modular settlement layer built to facilitate cross-chain intents. The EcoCross Bridge and EcoCross+ products build on top of EcoCross Settlement to offer bridging to users and bridge abstraction to dApp developers.
With EcoCross Settlement, any other application or source of cross-chain intent order flow can leverage EcoCross Settlement to enable the fastest speeds and lowest fees for their interoperability use-case.
Integrating EcoCross Settlement into Your Application
This guide contains an examples for how to build on top of EcoCross Settlement
If you have further questions or suggestions for this guide, please send a message to the #developer-questions
channel in the EcoCross Telegram.
EcoCross Settlement Example
EcoCross Settlement is a very flexible system, so this example won't capture all that you can do. However, it should illustrate the types of integrations that are possible.
Architecture
The example application we're going to build has the following architecture:
User asks for a quote on a cross-chain swap from an offchain RFQ system.
Market-maker-relayers bid on the opportunity to fill the user.
The user signs the winning bid as a Permit2 order.
The Permit2 order is passed to the winning market-maker-relayer.
The market-maker-relayer sends a transaction where this order is put onchain.
In that transaction, the user's funds are pulled via Permit2. A bond is submitted by the market-maker-relayer in the transaction as well in the same currency as the user's funds.
An EcoCross deposit is created. The bond + user funds are set as the input amount. The market-maker-relayer is set as the exclusive relayer, so they are the only relayer who can submit the relay on the destination.
This tutorial will not implement the offchain components, but it will show a sample contract implementation for the contract that processes the Permit2 order.
Sample Implementation
Note: the implementation below has not been vetted, validated, or optimized in any way. It is purely meant as an illustrative example. Use this sample code at your own risk. See the comments in the code to understand what each portion of the code is doing.
Copy
Conclusion
As is shown in the example above, EcoCross Settlement can be used as a tool to verify cross-chain intent fulfillment in many different setups. The primary advantage is that the integrating protocol can abstract away the complexity of the verification and fulfillment, so they don't have to deal with the security, timing, and asynchrony challenges of building a cross-chain system.
EcoCross Settlement provides additional advantages over naive cross-chain settlement systems, which ultimately lead to better execution of intent fulfillment for users and relayers:
Aggregated and Optimistic Verification: The EcoCross Settlement system aggregates valid fills events off-chain to create a repayment bundle, which is then optimistically verified by UMA's Optimistic Oracle. This verification and repayment mechanism scales gas cost of repayment at O(1) instead of O(N) with the number of fills. This offers an order of magnitude in gas savings vs. other approaches and ultimately leads to better pricing for users and more profit for relayers.
Relayer Cross-chain Management: With EcoCross’ settlement architecture, repayment is made on the relayer’s chain of choice, reducing overhead and complexity of managing cross-chain positions. This lowers costs for relayers, enabling better pricing and execution for end-users. It is enabled by EcoCross’ Hub and Spoke model, where passive LPs extend loans to relayers for taking on time-value risk as funds are rebalanced through canonical bridges by the protocol.
Last updated