Clarification on Fee Calculation for Swaps in ICPSwap

I’ve been reviewing a typical transaction from the ICPSwap ledger, and I have some questions about how the fees are calculated for token swaps. Here’s a snippet of the transaction I’m referring to:

{
  "token0Fee": 0,
  "token1Fee": 0,
  "poolFee": "3000",
  "token0Price": 1.0010005,
  "token1Price": 8.063265489197322,
  ...
}
  1. How exactly are the token0Fee , token1Fee and poolFee fields used? In this transaction, both are 0, but I’m curious when and how they are applied in general.
  2. For the poolFee, does it reduce the output amount of the token I’m receiving (token1 in this case)? If so, is the correct formula for calculating the final amount of token1:
    Final amount of token1=Pre-fee amount of token1×(1− poolFee/100000)
  3. Can someone provide a concrete example calculation for swapping 1000 units of token0 (ckUSDC) into token1 (ICP), assuming the same prices as above?

Thank you in advance for the help!

Tagging @ICPSwap to help clarify.

Thanks for the tag, Jennifer! @jennifertran

Hi, Jayesh! @jaesharma

  1. The token0Fee and token1Fee fields were used in an older version and are no longer in use. The dev team will optimize this in the future. Since the IC(P) network uses a reverse gas model, the gas fee (cycles) is covered by ICPSwap. As for the pool fee, it’s 0.3%, with 80% going to LPs and 20% used for buybacks and burning ICS.

  2. The poolFee refers to the trading fee. Considering the pool’s liquidity and potential slippage, we recommend using our API to check quotes—GitHub - ICPSwap-Labs/docs

  3. Similar to point 2, besides the trading fee, you should also consider the pool’s liquidity and slippage. You can also view the final quote directly on the ICPSwap frontend: ICPSwap

1 Like