Integral Docs


What is the relayer?
The Integral relayer is a smart contract that provides atomic liquidity to aggregators. By serving as an intermediate party between on-chain traders/aggregators and the Integral pools, the relayer allows immediate trade execution before routing to the pools.
Where is the relayer available?
Initially, it's available on Ethereum mainnet and Arbitrum One. It has been integrated by a number of major DEX aggregators. We continue to work with aggregators and other relevant protocols towards integration.
What are the available token pairs on the relayer?
Currently, the platform offers WETH-USDC, WETH-USDT and USDC-USDT, WETH-WBTC pairs.
How does the relayer establish price and depth?
The relayer allows trading the available liquidity, up to a certain threshold, at the worse of the spot price and 30 minute TWAP price. The API returns one bid and one ask. The highly capital efficient design of Integral pools allows virtually all of the liquidity in a pair to be traded as long as the order doesn't exceed the pair's liquidity.
How does the relayer affect Integral LPs?
It has no impact on current LPs, but additional aggregator trade volume would increase trade flow to the Integral pools.
How does the relayer affect Integral traders?
Traders can still use the traditional 30-minute TWAP functionality and access the relayer as an additional liquidity source through DEX aggregators such as Odos.
What is the relayer contract address?
How can I find the available token pairs for trading on the relayer?
For Ethereum Mainnet
  • Query the Factory using the allpairs and allPairsLength methods.
  • After obtaining a list of Integral pairs, check if the pair is enabled in the relayer using the isPairEnabled method.
For Arbitrum One:
  • Query the Factory using the allpairs and allPairsLength methods.
  • After obtaining a list of Integral pairs, check if the pair is enabled in the relayer using the isPairEnabled method.
From which liquidity pool does a trade draw the X and Y tokens?
The system contains various pairs/pools, and a mapping to them is available in the Factory contract.
How can I get a quote from the relayer?
The relayer has quoteSell + quoteBuy that only takes tokenIn and tokenOut. If we support the trade, it will return a valid estimate; if not, then it reverts.
How does the relayer decide when to execute trades?
The relayer will execute the order if there is enough liquidity, assuming that there is enough gas paid and the network is operational.
Do you have an example calling sell on the relayer?
You can simulate relayer transactions on tenderly.
Is there an API endpoint for pool liquidity data?
Yes, liquidity information is accessible through the standard API here:
How does the relayer provide quotes?
The relayer provides quotes as long as the order size is within the available liquidity. The contract has quoteBuy and quoteSell methods for obtaining quotes on specific amounts. The getPoolState method returns raw price, fee, limitMin, and limitMax data.
How can I calculate required input or output token amounts for a swap?
Utilize these functions for calculating token amounts:
  1. 1.
    calculateAmountIn: Determines the required input token amount for a specified output token amount.
  2. 2.
    calculateAmountOut: Computes the output token amount for a given input token amount.
How do I obtain spot and average prices for a token pair from the oracle?
Use the getPricesFromOracle function in the relayer contract, which returns the spot price and average price for a given token pair from the oracle.
How does the relayer contract manage token transfers?
The relayer contract uses these functions to handle token transfers: transferIn: Transfers input tokens to the contract. transferOut: Transfers output tokens to the recipient.
How can I monitor transactions and updates on the relayer contract?
The relayer contract includes emit statements for the Approve and Withdraw events. Track these events to monitor transactions and updates related to the contract.
Are there minimum and maximum input values for trading on the relayer?
Yes, minimum and maximum input values exist. You can use the checkLimits function to calculate such values.