0

I don't understand the paramater AmountOutMin for this function.

From the docs, it seems that the call will fail, if the amount specified by this parameter, is not transferred to the user.

However, in this transaction, the amount of AmountOutMin is less than what was recieved, yet the transaction still competed.

Am I misunderstanding the parameter?

https://etherscan.io/tx/0x3167977ed9c502e44242ce2c83f6053c0e1d4f320003c66639a1c1439324eb34

AmountOutMin in this case is 2503268748949308471 which divided by 10^9 is 2503268748, which is less than what was recieved

1 Answer 1

1

When calling the router contract to issue a swapExactEthForTokens swap, due to the fluctuation of the market, the router takes a parameter called AmountOutMin which is how much token you want at least from this transaction , so you could still get more tokens than the AmountOutMin tokens initially set , its just you cant receive less tokens than the amountOutMin specified or the contract will fail.

in short: amountOutMin basically sets the amount of tokens you want to recieve at least from the swap. In this transaction, the AmountoutMin was set and the trader received more tokens than the amountOutMin and thats perfectly correct because he didnt get less than the minimum wanted token amount.

More Examples: Imagine a coin called STEER. its worth 0.5 ETH atm. I issue a swap 1 ETH for 2 STEER , transaction was deployed and my AmountOutMin was set to 2 STEER tokens from the swap. Suddenly however price dropped and now i can get 3 STEER tokens for the price of 1 ETH. The transaction still goes through as long as I get more than 2 STEER tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.