Integral Relayer

With the addition of this atomic relayer, Integral liquidity will be available for both 30-minute TWAP swaps, and instant swaps at the worse of the spot price and past 30min TWAP.

The Integral Relayer is a smart contract designed to provide competitive atomic pricing for traders. It provides liquidity to aggregators, and is meant to be the intermediate party between on-chain traders/aggregators and the Integral pools. It takes an order, fills it immediately and atomically using its liquidity, and routes it subsequently to Integral pools which have a delay.

In essence, the relayer takes nominal price risk during the 30 minutes between when the initial trade is executed and when the relayer contract funds are refilled by the delayed trade execution from the Integral pool.

Superior Pricing

The relayer contract is to provide atomic liquidity to aggregators. Ultimately, liquidity comes from the Integral pools.

This means that the relayer can take full advantage of the liquidity depth and capital efficiency of Integral's pools. The relayer and the Integral unique designs are extremely capital efficient and allow the maximal use of the pool without incurring slippage. Assuming a $2mm TVL pool in ETH/USDC ($1mm ETH and $1mm USDC), the relayer can handle up to $1mm liquidity depth with minimal slippage.

As Integral pools grow in TVL liquidity depth and therefore trade execution will improve even more.

Workflow

To decide whether to accept an order to swap Token $A for Token $B, a few conditions need to be met:

  1. Calculate the amount of $B to give out using the price and an admin-configured fee.

  2. Check whether the relayer has enough $B to give out for the swap.

  3. Check whether the Integral LP has enough $B above a certain threshold to support the swap. This threshold includes a buffer to account for any changes in the 30-minute TWAP that may cause the downstream trade to fail.

  4. In addition to the above checks, the relayer service might also be suspended if there is high price volatility or if the LP is running at a significant loss or skew in token balance.

Auto-rebalance

There is a special internal swap function that is only admin-callable. This swap is basically the same as the public swap described above, except that swaps through this function will not route orders downstream to the Integral delay contract. This opens up a functionality for admin to re-balance the relayer pool (subjectively when it sees fit). For example, it is possible that some previous Integral delay swaps revert, which caused the relayer contract to be imbalanced; with this internal swap available, admin can trade in the correct direction to help the relayer pool rebalance.

What does the addition of Integral Relayer mean for Integral LPs?

The addition of Integral Relayer will have no impact on current LPs in the Integral pools. Since the relayer takes on any price risk and otherwise executes trades using the 30-minute TWAP functionality of Integral, it is just as if any other user were trading with the Integral capital pool.

We expect that the additional volume from aggregator trades will result in more trades flowing through the pool, improving volume and pool utilization. A net positive for all Integral LPs!

LPs will still benefit from mean-zero impermanent loss and the MEV protection currently offered by the Integral design.

Last updated