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,
...
}
- How exactly are the
token0Fee
,token1Fee
andpoolFee
fields used? In this transaction, both are 0, but I’m curious when and how they are applied in general. - 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 oftoken1
:
Final amount of token1=Pre-fee amount of token1×(1− poolFee/100000) - Can someone provide a concrete example calculation for swapping 1000 units of
token0
(ckUSDC) intotoken1
(ICP), assuming the same prices as above?
Thank you in advance for the help!