0
function _buy(bytes calldata _data) internal {
    (
        address router,
        uint256 amountIn,
        uint256 amountOutMin,
        address[] memory path
    ) = abi.decode(_data, (address, uint256, uint256, address[]));

    IERC20 fromToken = IERC20(path[0]);

    _approve(fromToken, router, amountIn);
    IPancakeRouter02(router)
        .swapExactTokensForTokensSupportingFeeOnTransferTokens(
            amountIn,
            amountOutMin,
            path,
            address(this),
            block.timestamp
        );
}

This is my code in solidity sometime a frontrunner bot come and my transaction got failed. i want if somebody is front running my transaction so my transaction doesnt perform if it perform and goes failed so the fee should be really low.

I am expecting low transaction on failed transaction via nodejs or inside the solidity.

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • This question is unclear, mostly due to the poor grammar. Please edit the title and question body to use proper grammar so that we can understand what you are trying to ask for. – TylerH Mar 23 '23 at 20:53

0 Answers0