Swapping is the act of taking one token and exchanging it for another. There are many protocols that help with, notably, UniSwap, PancakeSwap, CowSwap, and many more. These protocols can either center around decentralized liquidity or centralized liquidity, with various different caveats for different use cases.

The act of cross-chain swapping usually requires multiple steps by the user, each using a different protocol:

  1. Swapping from an erc20 to native currency
  2. Going to a bridge and bridging the native currency
  3. Swapping from native currency to an erc20 on destination

With Relay, we bundle these steps into one operation the user can take for the sake of cost and speed efficiency.

Cross-Chain Swaps via Relay

Relay builds on top of our pre-existing bridging infrastructure to allow cross-chain swapping. Our bridging infrastructure allows the fast transfer of native and some preset erc20 currencies cross-chains.

We can extend this to swapping, by helping the user swap out of any currency into native currency on the origin, with us as the recipient. And with bridging, we can help the user get into any currency they want on the destination, using our native balance on that chain.

Relay abstracts the complicated swapping layer and under the hood we use a combination of protocols, including ourselves sometimes, to help find the best prices for swapping. This way the user does not need to check multiple swap protocols to find the best price.

User Experience

For the client, it feels like just a regular swap. We bundle multiple origin and cross-chain swaps into one simple and fast user operation. Usually the flow is something along:

  • If its an erc20 input:
    • Approve permit2 on token, if first time ever swapping that token
    • Sign an approval
    • We execute your swap on origin and your bridge, including any extra destination swaps or call execution (like mints)
  • If its an eth input:
    • You send us ether
    • We execute your bridge, including any extra destination swaps or call execution (like mints)

We built infrastructure to help provide the best quotes, which is why we also support same-chain swapping. With same-chain swapping, either the user can self-execute the swap, or Relay can help with executing the swap in situations where the user does not have enough gas to pay for the transaction.