Technical Docs
Dao Docs
  • ✨Concepts
    • What is Connext?
    • How It Works
      • Architecture
      • Transaction Lifecycle
    • Background
      • What is a Bridge?
      • Modular Bridges
      • Message Verification
    • Use Cases
    • FAQ
  • 🤝Developers
    • Introduction
    • Quickstart
    • Guides
      • Frontend
      • SDK
      • Estimating Fees
      • Tracking xCalls
      • Authentication
      • Handling Failed xCalls
      • Nested xCalls
    • Reference
      • SDK
        • SdkShared
        • SdkBase
        • SdkPool
        • SdkRouter
        • SdkUtils
        • Types
      • Contracts
        • Calls
        • Routers
        • Stableswap
      • Subgraphs
        • Entities
        • Sample Queries
        • Subgraph Resources
      • Integration
        • Adapters
        • Receivers
    • Examples
      • Simple Bridge
      • Authenticated Greeter
      • Ping Pong
  • 📦Usecases
    • xERC20
      • Setup Overview
      • Detailed Setup Guide
      • Connext and xERC20s
    • Chain Abstraction
      • Chain Abstraction Guide
    • xGovernance
  • 📜Resources
    • Subgraphs
    • Deployments
  • 🖥️Routers
    • Basics
    • Spinning Up
    • Guides
      • Community Guides
      • Providing Liquidity
      • Managing Your Router
      • Security
    • Reference
      • Configuration
Powered by GitBook
On this page
  • SwapAdapter
  • Using on Origin
  • Using on Destination
  • Swappers
Edit on GitHub
  1. Developers
  2. Reference
  3. Integration

Adapters

PreviousIntegrationNextReceivers

Adapters are contracts that can hook into the normal flow of cross-chain transactions and augment their capabilities without requiring changes in existing contracts. The repository contains adapters that can be inherited for these purposes.

SwapAdapter

This adapter contains the logic for swapping tokens. The SwapAdapter can be used on either the origin or the destination side to execute a swap.

Using on Origin

SwapAndXCall is a contract that implements SwapAdapter and is meant to be used on the origin chain. It swaps the input tokens into desired output tokens before initiating the cross-chain transaction with xcall. This is useful in cases where you want users to be able to send any token to your contract and bridge them through Connext.

Using on Destination

SwapForwarderXReceiver also implements SwapAdapter but it's used on the destination chain. It swaps the tokens received from the bridge into desired output tokens before proceeding with the "forward call", which contains the rest of the logic that follows on the destination side. The ForwarderXReceiver that it implements is detailed in the next section for Receivers.

Swappers

The SwapAdapter holds a registry of allowedSwappers which are contracts that implement the ISwapper interface:

interface ISwapper {
  function swap(
    uint256 _amountIn,
    address _tokenIn,
    address _tokenOut,
    bytes calldata _swapData
  ) external payable returns (uint256 amountOut);
}

For example, the UniV3Swapper implements swap which internally calls Uniswap's ISwapRouter.exactInputSingle to execute the swap via Uniswap.

Currently, Connext provides the following Swappers:

  • OneInchUniswapV3

  • UniV2Swapper

  • UniV3Swapper

🤝
connext/integration