A Deep Dive into ERC-7683 for Cross-Chain Intent

BuildBearBuildBear
7 min read

The ecosystem has become more fragmented with the proliferation of multiple blockchains (rollups and appchains). Blockchain interoperability is essential to communicating, transferring assets, and connecting across these diverse blockchain networks.

Due to fragmented liquidity and interoperability issues, trading assets between different blockchains can be particularly challenging. ERC-7683 standard (draft) for cross-chain intents proposed by Uniswap Labs and Across is an interface for a cross-chain trade execution system. This standard aims to simplify cross-chain actions by providing a cohesive framework.

Here is a detailed overview of the standard for cross-chain intents and an analysis of how UniswapX brings cross-chain capability in swaps.

ERC-7683: A Unified Standard for Cross-Chain Intents

What is an Intent-based system?

A system that honors the “intention” of the user without worrying about the complexity of the process of execution. Cross-chain intents are when a user wants to act on one blockchain that results in an outcome on another blockchain.

Suppose Alice wants to trade her USDC on Ethereum for WETH on an L2. Traditionally, Alice would have to go through multiple steps including using bridges, and different wallets, making it complex and time-consuming.

With ERC-7683, Alice doesn’t need to take multiple steps or worry about how it happens. Intents-based systems simply allow users to specify the end state of the chain – and a network of fillers compete to fulfill the user’s outcome as fast and cheaply as possible.

What Problem Does ERC-7683 Solve?

Many intent-based systems rely on their own network of fillers, leading to a single point of failure and centralization risks. As intent-based systems grow, managing separate relayers and fillers for each protocol becomes challenging.

The ERC-7683 standard addresses these issues by standardizing cross-chain intents, enabling a universal filler network for more efficient transactions and making it easier for different systems to work together.

Key Components in Cross-chain Trade Execution with ERC7683:

A. Swapper (user): The one who signs an off-chain message defining the order with CrossChainOrder Struct, which contains all the necessary information about an order for the cross-chain trade.

struct CrossChainOrder {
    address settlementContract;  // Address of the contract to settle the order
    address swapper;             // User initiating the swap
    uint256 nonce;               // Unique number to prevent duplicate orders
    uint32 originChainId;        // ID of the originating blockchain
    uint32 initiateDeadline;     // Time by which the order must start
    uint32 fillDeadline;         // Time by which the order must complete
    bytes orderData;             // Additional data like tokens, amounts, destination chains
}

Additionally, ResolvedCrossChainOrder struct provides detailed information about the order, making it easier to compute the necessary inputs and outputs for fulfilling the order. This struct ensures both (swapper and filler) parties know exactly which tokens are exchanged, the amounts, and the blockchains involved.

struct ResolvedCrossChainOrder {
    address settlementContract;
    address swapper;
    uint256 nonce;
    uint32 originChainId;
    uint32 initiateDeadline;
    uint32 fillDeadline;
    Input[] swapperInputs;       // Tokens to be taken from the swapper
    Output[] swapperOutputs;     // Tokens to be given to the swapper
    Output[] fillerOutputs;      // Tokens to be given to the filler
}
struct Input {
    address token;               // ERC20 token address
    uint256 amount;              // Token amount
}
struct Output {
    address token;               // ERC20 token address (or native token if address is 0)
    uint256 amount;              // Token amount
    address recipient;           // Address to receive the output
    uint32 chainId;              // Destination blockchain ID
}

B. Filler (entity that completes the trade): Fillers are entities or smart contracts responsible for initiating trades on the origin chain, executing orders on the destination chain, and settling cross-chain orders.

Fillers receive rewards for the service they provide. They have a flexible design allowing customized behavior such as price resolution mechanisms, fulfillment constraints, and settlement procedures.

C. Settlement Contract: The ISettlementContract interface defines the basic structure for a settlement contract functions such as initiate and resolve.

interface ISettlementContract {
    function initiate(CrossChainOrder order, bytes signature, bytes fillerData) external;
    function resolve(CrossChainOrder order, bytes fillerData) external view returns (ResolvedCrossChainOrder);
}

How can ERC-7638 be used in other systems for Cross-chain functionality?

By extendingIsettlementContract, you can implement the ERC-7638 standard for cross-chain orders specific to any protocol.

Let us analyze with an example implementation of how ERC-7683 can work with Permit2 and Across. It defines a settlement contract that handles cross-chain orders on the Across network and uses Permit2 for token transfers. Here is how it works:

  • Alice creates a cross-chain order on the origin chain with essential parameters for the order. She signs the order using Permit2, a mechanism that allows secure token transfers.

  • The settlement contract receives Alice's signed order on the origin chain. It checks order details, verifies signatures, and takes the specified amount of ETH from Alice's account.

  • On the destination chain, filler resolves the order and prepares the USDC for Alice to fulfill the order.

  • Filler calls the fillCrossChainOrder in the SettlementContract to fulfill initiated orders and transfer USDC to Alice.

Benefits of ERC-7683

  • Interoperability: It allows for the seamless interaction between various networks, reducing complexity to bring cross-chain capability in any infrastructure.

  • Better User Experience: Simplifies the process for users, making cross-chain transactions more seamless.

  • Lower Entry Barriers and Costs: Easier for new fillers to enter the market, expanding the network. Reduced complexity and centralization lower transaction costs.

  • Broader Access: Applications benefit from a more extensive filler network, enhancing overall efficiency.

UseCase: UniswapX for Cross-Chain Trades

In July 2023, Uniswap introduced UniswapX for cross-chain functionality, the future of trading assets in crypto. Cross-chain trade is the process of trading tokens or assets between different blockchains. Integrating ERC-7683 into Uniswap's ecosystem can expand its capabilities beyond Ethereum and its L2s, enabling users to perform cross-chain trades.

UniswapX.png

Image Source: https://blog.uniswap.org/uniswapx-protocol

Let's quickly understand how UniswapX operates and how the implementation of ERC-7683 would be.

UniswapX is an auction-based protocol for finding the best price for user’s trade across AMMs and other onchain and off-chain liquidity sources. It follows an intent-based approach with new entities called “fillers”, which consist of market makers and MEV searchers, who bid for the trade in a Dutch auction to find the best price.

What is Dutch Auction?

Dutch auctions start with a high asking price and gradually lower until a bidder accepts it. This concept is how UniswapX fillers compete to give you the best prices. These fillers search their liquidity sources. The one offering the best price wins. If the filler cannot complete the trade, the price drops until the next filler can.

UniswapX would be the very first application using the cross-chain intent standard(ERC-7683). Let us see how UniswapX implementation of ERC7683 for cross-chain trade with Alice looks like:

intent_.png

Image from : https://x.com/Uniswap/status/1812847835693342996/photo/1

  • Alice creates a CrossChainOrder on Uniswap specifying her intention to swap ETH on Ethereum for USDC on another chain, let's say, 1 ETH for 1000 USDC.

  • The intent is then sent to the UniswapX Filler network, which checks their liquidity sources(Uniswap Protocol, Sushiswap, etc) for the price.

  • For example, Filler A offers 999 USDC for 1 WETH, Filler B offers 998 USDC and Uniswap v3 offers 996 USDC. Filler A wins the bid.

  • Alice accepts Filler A, as it offers the best price. And calls the initiate function on the ISettlementContract to begin the trade on Ethereum.

  • The filler then executes the trade on the destination chain swapping the tokens.

  • The filler calls the resolve function on the settlement contract to finalize the trade. If Filler A couldn’t complete the trade, the auction would continue at the next best price.

  • Alice and the filler receive their respective tokens according to the ResolvedCrossChainOrder details.

Conclusion

Rollups and L2 have scaled Ethereum but bring fragmentation. This fragmentation will grow as more rollups and app-chains come online. ERC-7683 simplifies cross-chain trading by providing a unified standard. This makes it easier for developers to build and for users to trade across different chains. Platforms like UniswapX can now offer seamless cross-chain trades, improving liquidity, reducing costs, and creating a more efficient ecosystem.

About BuildBear:

BuildBear is a platform tailored for DApp development and testing. Developers gain the freedom to construct a personalized Private Testnet sandbox across a variety of blockchain networks. The liberty to mint unlimited Native and ERC20 tokens, coupled with rapid transaction times on BuildBear (under 3 seconds!), enhances the DApp development lifecycle manifold. The platform comes equipped with tools and plugins designed for real-time testing and debugging, ensuring developers can keep tabs on intricate blockchain transactions with unparalleled ease.

Connect with us on Twitter | LinkedIn | Telegram | GitHub

Author: Sana

0
Subscribe to my newsletter

Read articles from BuildBear directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

BuildBear
BuildBear

BuildBear is a platform for testing dApps at scale, for teams. It provides users with their own private Testnet to test their smart contracts and dApps, which can be forked from any EVM chain. It also provides a Faucet, Explorer, and RPC for testing purposes.