1

There are a couple of methods in the Pancakeswap router contract ending in *SupportingFeeOnTransferTokens, such as swapExactTokensForTokensSupportingFeeOnTransferTokens

Example: https://github.com/pancakeswap/pancake-swap-periphery/blob/d769a6d136b74fde82502ec2f9334acc1afc0732/contracts/PancakeRouter.sol#L339

What's the practical difference between these "supporting fee" functions vs the vanilla swap functions and when should I call one over the other?

1 Answer 1

2

For anything like this, it's always best to refer to the original documentation... which exists on Uniswap site. PancakeSwap didn't seem bothered about copying the actual documentation, unlike everything else the copied... :-)

For swapExactTokensForTokensSupportingFeeOnTransferTokens the Uniswap docs are here:

Identical to swapExactTokensForTokens, but succeeds for tokens that take a fee on transfer.

So this family of functions should be used for tokens that take a fee (i.e. any tokens using reflection, e.g. RFI).

I believe when you attempt to use the vanilla functions with reflexive tokens, the swap will fail due to the fee changing the resultant amountIn value.

4
  • Honestly found it sad & hilarious that they copied everything but documentation. Would have saved me and everyone else so much time if they copied everything, including documentation.
    – Gajus
    Jun 2, 2021 at 15:00
  • @Gajus - completely agree :-) Jun 2, 2021 at 16:13
  • 1
    How does a user interface know if the token needs to be swapped with the SupportingFees function or the vanilla? Why not just always trade with the supporting fees function? Jun 2, 2021 at 18:58
  • There's a useFeeOnTransfer boolean that acts as a switch (github.com/pancakeswap/pancakeswap-sdk-v1/blob/…). I think this gets set if the user manually lowers the expected slippage. I haven't looked at it in detail, but I think the slippage calculations are different if there's a fee involved, so they can't just use this version for all trades. Jun 2, 2021 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.