I wanted to implement a custom tax for pancake swap. currently, iam using pancake swap testnet ones.

iam stucking at these points. how to add custom tax for on swapping or at time of creating liquidity. In my contracts, if i added validation on transfer and transferFunction to take tax

Or any other ways to understand & implement a way for my logic to work

1 Answer 1


You would have to deduct the user's amount before calling in the swap function

  1. Take the users amount in your swap function, deduct the tax %
  2. Call in pancakeswaps SwapExactToken function in the custom swap function

Your Answer

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

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