Overlay fee

What's overlay fee?

Users can now add an additional fee (Overlay Fee) on top of cetus aggregator. This fee is distinct from the existing Partner Swap Fee. Below are the key differences between Overlay Fee and Partner Fee:

  1. Scope of Application:

    • Partner Fee: Can only be collected within Cetus pools.

    • Overlay Fee: Applicable across all types of transaction paths.

  2. Fee Collection Mechanism:

    • Partner Fee: Temporarily stored within the contract and must be claimed using a Partner Cap.

    • Overlay Fee: Directly transferred to the designated Overlay Fee Receiver specified during SDK initialization, upon every transaction.

  3. Maximum Threshold:

    • The current maximum threshold configurable for the Overlay Fee is 1%.

  4. Slippage Calculation and Overlay Fee:

    • Overlay Fee is incorporated directly into the initial pre-calculation step for slippage evaluation. For example, when swapping 1 USDC to USDC, if the Overlay Fee is 0%, the pre-calculated output (amount out) will be 1,000,000. However, if the Overlay Fee is set to 0.5%, the pre-calculated amount out will display as 995,000, clearly indicating an Overlay Fee of 5,000.

How to set overlay fee and receiver?

const client = new AggregatorClient({
  endpoint,
  signer: wallet,
  client: suiClient,
  env: Env.Mainnet,
  pythUrls?: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"], // Optional. Custom Pyth price feed URLs. Defaults to null (uses built-in endpoints).
  partner?: "YOUR_CETUS_CLMM_PARTNER_ID", // Optional. Partner ID for CLMM fee sharing. Set once during initialization instead of per swap. Defaults to null (no fee sharing).
  cetusDlmmPartner?: "YOUR_CETUS_DLMM_PARTNER_ID", // Optional. Partner ID for DLMM fee sharing. Defaults to null (no fee sharing).
  overlayFeeRate?: 0.01, // Optional. Overlay fee rate (0.01 represents 1%). Defaults to 0 (no overlay fee).
  overlayFeeReceiver?: "0x..", // Optional. Address to receive the overlay fees. Defaults to null. Required if overlayFeeRate is set.
})

Last updated