Only apply transaction fees to buy and sells, exclude wallet to wallet transfers

I’m trying to only apply transaction fees to buy, transfer, and sells from pancake swap, exluding wallet to wallet transfers. How do I go about this?

:computer: Environment

Remix

:memo:Details

I have my transaction fees working, my tokenomics are fine. I just want to exclude any wallet to wallet transfers from fees.

1 Like

You can try to add something like this inside transfer function:

if(sender == pair || recipient == pair) {
    ....
    ....
}

where pair is your token pair

1 Like

I don’t have a pair yet. I haven’t deployed yet. I just want to have fees on pancakeswap when buying or selling but no fees elsewise.

1 Like

man you have to replace pair with your variable name

1 Like

So should I change pair to the name of the token and change the dots to takefee=false

1 Like

In your code you should have a pair named like uniswapV2pair. SOmething similar to this

1 Like

Thank you so much for the tip.