Protect Uniswap and pancakeswap Trading from bots that order seconds before you and then immediately resell it

You may have experienced instances where you ordered to purchase 100 tokens through Uniswap or PancakeSwap, but only received 90 tokens. This issue occurs during both buying and selling transactions, and is caused by front-running MEV bots. It is important to note that this problem is not caused by the project team, as some users may mistakenly believe. The slippage factor plays a significant role in this situation.

Slippage refers to the potential price movement in either direction after executing a swap. Each swap has a calculated “Price Impact” that you essentially impose on yourself. When purchasing a token with low liquidity, the price impact will increase rapidly even with a small purchase. The lower the liquidity, the more aggressive the AMM curve becomes. Your slippage should be set to at least match this price impact. If you are buying a popular token, the price impact may change as you click the swap button due to other people swapping. To ensure your swap executes within the desired slippage range, you can either pay more gas to expedite the transaction or slightly increase the slippage and pay less gas, assuming someone may swap before you. However, this method may leave an opportunity for frontrunner bots. These bots scan the mem pool for transactions.

Your transaction is added to the mempool, where bots scan for opportunities. If they detect a trade with a significant slippage window, they will execute the trade with triple the gas you used. However, if your slippage is minimal, the bot won’t attempt to snipe the trade.

Certain tokens have deflationary mechanisms, such as a 2% burn on each transaction. In this case, your slippage formula should include both the Price Impact and the Token Fee %. For example, if the price impact is 1% after you enter the swap, you should set your slippage to at least 3%.

Now How to avoid this situation.

-Use Low Slippage like 0.5 or 0.3 But it will take a lot of time to complete transaction.
-Use 1INCH Exchange – 1INCH Exchange protect your trading from front run bots.
-Update your RPC Endpoints-
Update your wallet settings with the following private RPC endpoints to safeguard your net worth from MEV bots and their nasty sandwich/front-running attacks:

🔷 On Ethereum:
• Network Name: Flashbots Protect
• New RPC URL: https://rpc.flashbots.net
• Chain ID: 1
• Currency Symbol: ETH
• Block Explorer URL: https://etherscan.io/

🔶 On BNB Chain:
• Network Name: BNB MEV Protect PancakeSwap x bloXroute
• New RPC URL: https://pancake-bnb.rpc.blxrbdn.com/
• Chain ID: 56
• Currency Symbol: BNB
• Block Explorer URL: https://bscscan.io/

Using above tip you can save your trade from front running bots that cheat your trades.