Differentiate buying and selling

I've got a question. how can we make differentiate between buying and selling fees? for example, who is buying the token, deposit 5%, and when want to sell, the fee would be 10%.

I presume you are using a contract that has a variable that stores the pair address right?
If yes, the logic is this:

BUY:
if(from == pair)

SELL:
if(to==pair)

1 Like

Thanks a lot.
But I tried it before with no lock of getting done correctly.

According to some guy in a TG group:

// is a buy
if (to == address(unirouter)) {
}

// is a sell
if (from == address(unipair)) {
}
1 Like

Thanks. Could you please share the group with me?

In reality I think

Buy:
if(from == pair)

Sell:
if(to == pair)

2 Likes

Admirable fighting spirit.