💲Monetization / Take Fees

As an integrator, you can monetize LI.FI and collect fees from our Widget/SDK/API integration.

Our Fee Collector contract has been audited and is deployed to all our supported chains!

Any dApp that integrates LI.FI's Widget, SDK, or our API can now take fees from the volume they put through LI.FI.

How it works

When using LI.FI Widget or calling our SDK/API to request quotes for a transaction, you can pass a fee parameter specifying the percentage fee you'd be taking from the requested transaction. This percentage fee will be deducted from the user's initial asset and collected in a FeeCollection sub-contract inside LI.FI Contracts. You can then withdraw the funds from the wallet specified by you during our integration.

The fees are collected on every chain and for every token individually. We will provide tools to get an easy overview of the collected fees and prepare contract calls for you to withdraw them. Of course, our tools can also be used to swap and bridge the collected fees to another chain.

You can configure different wallets for different chains.

In order to monetize Solana requests we would need to whitelist on our end a SOL address also. You can create a Solana address from the same seed phrase you have for your EVM wallet.

How to apply

To set up your account and to start collecting fees, please contact our team via email sales@li.finance with "Monetization request" as the subject line.

What to provide in the request:

  • Your desired integrator string. It needs to be the same string as your API key if you have it. String can be any alphanumeric phrase with 23 character limit, all lower case, can contain "_", "-".

  • Wallet address where the fees will be collected. We need EVM and SOL address if you will be collecting fees on those chains.

How to set up

The fee parameter is the percent of the integrator's fee, that is taken from every transaction. The parameter expects a float number e.g 0.02 refers to 2% of the transaction volume. The maximum fee amount should be less than 100%. Also, you should pass your custom integrator string to ensure the fees are collected to the right account. LI.FI will receive a percentage share of the collected fees depending on the use case and volume.

See examples of how to set up fee collection for different environments:

Widget example

import { LiFiWidget, WidgetConfig } from '@lifi/widget';

const widgetConfig: WidgetConfig = {
  // Set fee parameter to 3%
  fee: 0.03,
  // Other options...
};

export const WidgetPage = () => {
  return (
    <LiFiWidget integrator="fee-demo" config={widgetConfig} />
  );
};

SDK example

import { LiFi } from '@lifi/sdk';

// Create an instance with default parameters for fee collection
const lifi = new LiFi({
  integrator: 'fee-demo',
  defaultRouteOptions: {
    fee: 0.03,
  },
  // Other options...
});

API example

const url = 'https://li.quest/v1/quote?fromChain=DAI&toChain=POL&fromToken=0x4ecaba5870353805a9f068101a40e0f32ed605c6&toToken=0x2791bca1f2de4661ed88a30c99a7a9449aa84174&fromAddress=0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0&toAddress=0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0&fromAmount=1000000&integrator=fee-demo&fee=0.03';
const options = {method: 'GET', headers: {accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));

More API examples can be found here.

Transaction example

Here you can find a link to the transaction where the integrator's fee was taken and the FeesCollected event was emitted.

Link to Etherscan

How to withdraw fees

When you successfully integrate our system and start collecting fees, you can withdraw the collected fees.

In the first step, it’s important to get the information about all collected fees with /v1/integrators/{integratorId} endpoint, where in the {integratorId} parameter you need to pass your integrator string. The response will contain fee balances for all supported chains and tokens.

To withdraw collected fees via /v1/integrators/{integratorId}/withdraw/{chainId} endpoint you need to pass your wallet address or your custom integrator string and the id of the chain from which the token’s fees should be withdrawn. As an optional parameter, an array of the token’s addresses might be provided to include in the generated transaction only the specified funds.

The Call Flow

Last updated