Hyphen Facet

How it works

The Hyphen Facet works by forwarding Hyphen V2 specific calls to the LiquidityPool Contract. All bridging is done by calling the depositErc20 method or depositNative method if you using a native token like ETH or MATIC.

Public Methods

  • function initHyphen(address _hyphenRouter)
    • Initializer method. Sets Hyphen LiquidityPool contract address for the specific chain
  • function startBridgeTokensViaHyphen(LiFiData memory _lifiData, HyphenData calldata _hyphenData)
    • Simply bridges tokens using Hyphen
  • function swapAndStartBridgeTokensViaHyphen(LiFiData memory _lifiData, LibSwap.SwapData[] calldata _swapData, HyphenData memory _hyphenData)
    • Performs swap(s) before bridging tokens using Hyphen

Hyphen Specific Parameters

Some of the methods listed above take a variable labeled _hyphenData. This data is specific to Hyphen and is represented as the following struct type:
/// @param token The contract address of the token being bridged.
/// @param amount The amount of tokens to bridge.
/// @param recipient The address of the token recipient after bridging.
/// @param toChainId The chainId of the chain to bridge to.
struct HyphenData {
address token;
uint256 amount;
address recipient;
uint256 toChainId;

Swap Data

Some methods accept a SwapData _swapData parameter.
Swapping is performed by a swap-specific library that expects an array of calldata to be run on various DEXs (i.e. Uniswap) to make one or multiple swaps before performing another action.
The swap library can be found here.

LiFi Data

Some methods accept a LiFiData _lifiData parameter.
This parameter is strictly for analytics purposes. It's used to emit events that we can later track and index in our subgraphs and provide data on how our contracts are being used. LiFiData and the events we can emit can be found here.

Getting Sample Calls to interact with the Facet

In the following some sample calls are shown that allow you to retrieve a populated transaction that can be sent to our contract via your wallet.
All examples use our /quote endpoint to retrieve a quote that contains a transactionRequest. This request can directly be sent to your wallet to trigger the transaction.
The quote result looks like the following:
const quoteResult = {
id: '0x...', // quote id
type: 'lifi', // the type of the quote (all lifi contract calls have the type "lifi")
tool: 'hyphen', // the bridge tool used for the transaction
action: {}, // information about what is going to happen
estimate: {}, // information about the estimated outcome of the call
includedSteps: [], // steps that are executed by the contract as part of this transaction, e.g. a swap step and a cross step
transactionRequest: {
// the transaction that can be sent using a wallet
data: '0x...',
to: '0x...',
value: '0x00',
chainId: 100,
gasLimit: '0x...',
gasPrice: '0x...',
A detailed explanation of how to use the /quote endpoint and how to trigger the transaction can be found here.
Hint: Don't forget to replace {YOUR_WALLET_ADDRESS} with your real wallet address in the examples.

Cross Only

To get a transaction for a transfer from 30 USDC.e on Avalanche to USDC on Binance you can execute the following request:
curl 'https://li.quest/v1/quote?fromChain=AVA&fromAmount=10000000&fromToken=USDC&toChain=POL&toToken=USDC&slippage=0.03&allowBridges=hyphen&fromAddress={YOUR_WALLET_ADDRESS}'

Swap & Cross

To get a transaction for a transfer from 30 USDT on Avalanche to USDC on Binance you can execute the following request:
curl 'https://li.quest/v1/quote?fromChain=POL&fromAmount=12000000&fromToken=USDT&toChain=AVA&toToken=USDC&slippage=0.03&allowBridges=hyphen&fromAddress={YOUR_WALLET_ADDRESS}'
Last modified 1mo ago
Copy link
How it works
Public Methods
Hyphen Specific Parameters
Swap Data
LiFi Data
Getting Sample Calls to interact with the Facet
Cross Only
Swap & Cross