In Uniswap the function router02#swapExactETHForTokens(...)
and other similar ones which do a swap, require a parameter for "mininum amount out".
function swapExactETHForTokens(
uint amountOutMin,
//.........
How is it usually calculated?
The same question goes in regards to the similar parameter - amountInMax
which is used, for instance in
function swapTokensForExactETH(
uint amountOut,
uint amountInMax, // !
//.....