I has set this amountOutMin parameter in my code, but the amount of token I received was still less than it. Why is it like this?
The transaction is https://bscscan.com/tx/0xc04715372ef2b25fe4cb8b2bf422721ef5b7266f804dc06ce8b84b4c5f056cd3. This is maded by using the code through Pancakeswap V2 router.
The amountOutMin in this case was 8443229148751464555872256, bought with 0.001BNB, but the token received was 7,675,662,862,501,330.751356287.
By contrast, I made another trascation by official Pancakeswap V2 website directly few minutes later. The transcation is https://bscscan.com/tx/0x352e89799b319a1dc4d22ed1367bb8b952223b85b28212a8f67d93ff075c6de9. In this case, the amountOutMin was 7603157464191205469747941, bought with 0.001BNB, and the token received was 7,663,982,723,904,740.113505927, which was fine.
Does some one know why it is like this?
And another concern I have is that if amountOutMin was useless, can I use this swapExactETHForTokens function to buy tokens at the moment of a project launch? Since I want to buy the tokens with the launch price. Is it dangerous? Because 1. I may buy the token at the peak 2. I heard there is a Man-in-the-middle attack, who buy the token at a lower price and then sell it to you with higher price, is it true?