I've been able to do swaps through Uniswap's peripheral smart contract Router 02 by calling any of the functions such as:
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
However, none of these functions has any field referring to the slippage (amount the price moves in a trading pair between when a transaction is submitted and when it is executed), and I don't know exactly at which stage the slippage is set before launching the swap transaction.
Is there any way to handle the slippage tolerance programatically when executing a swap transaction?