Fee
How to calculate fee rate?
Fee means the coin used to pay the protocol fee rate during the transaction differs from the gas consumed by the execution of the smart contract. Different pools has different fee rate. Each tick spacing corresponds to a specific fee rate.
tick spacing
fee rate
2
0.0001
10
0.0005
60
0.0025
200
0.01
For a single pathway, the fee is equal to the input amount multiplied by the fee rate.
In the case of multiple pathways or paths involving intermediary coins, we need to calculate the input amount multiplied by the fee rate for each individual swap. Then, convert all these amounts to the corresponding quantity in the input coin and sum them up.
In SDK, we provide sdk.Swap.calculateSwapFee()
method.
Example
Last updated