What function should I use in my contract?

Continuing the discussion from How to tell from inside the contract exclusively using Pancakeswap if a transfer represents a sell or a buy:

Hello, If I want to create my own contract which used oppenzeppelin.IERC20 or oppenzeppelin.ERC20, should I just implement the transfer function or transferFrom function?

Both transfer and transferFrom are required by the ERC20 standard. It's not a choice.

And If i want to lock the user's LP token in my contract, which fuction should I use? thx

Contracts generally use approve + transferFrom.

1\ If user in pancakeswap who is going to swap token like swap bnb to my contract token, the function uniswap will call my contract is transfer and transferFrom, when this user swap bnb to token, uniswap will call transfer and msg.sender === PairToken, if this user going to sell token to bnb, uniswap will call transferFrom and msg.sender === user.address && to === PairToken
2\ If user is goint to add liquidity in uniswap, what function should pancake call ? msg.sender ===?