I'm looking at this transaction in BSCScan: https://bscscan.com/tx/0x09a19072b2374340de10dc6ac235fcd0ba229ff1eba41e155f5b0a60f9c2e2cd

When looking at Input Data for the method call, the caller indicated 11764337867528 for amountOutMin. What unit is Pancake/Uniswap expecting this to be in? The actual amount out was closer to 11,764.337867528.

I suspect it's GWEI. Is that correct? On a related note is Gas always given in WEI?


The units used in contracts always ignore the amount of decimals in a token / Ether and utilize only integers.

In your case, I guess the token has 9 decimals. The decimals are only used when displaying the amount in various user interfaces, never inside contracts. So it's just a visual trick to make things easier to understand for users.

Tokens don't have any concept of "wei" or "gwei". The unit "wei" assumes that the asset has 18 decimal places, so you can't - even with imagination - use that with a token which has 9 decimal places.

You can read more about decimals here: https://ethereum.stackexchange.com/a/72481/31933

Furthermore, gas can't be denoted in "wei" units. Gas is a unit already, so for example a basic transaction costs 21000 gas. If you mean gas prices, those are given in user interfaces as gwei but in the background they are weis.

  • Thanks for the link! If I understand correctly, does that mean if I have a UI that allows someone to enter an "amount to buy" and they enter "0.01 BNB", I would need to know (or look up) the number of decimals for that token to be able to calculate the integer that needs to get passed into the Router's swapping methods? May 27 '21 at 16:57
  • Does this also apply to the USD value for a token, as shown by various price oracles? I.e. if the currently price is listed as 0.000005 and the token has 9 decimals, is that value actually just the "display value" and the absolute USD value per a absolute token has an extra 9 decimal places? May 27 '21 at 16:59
  • Yes you need to check the amount of decimals in the token, when converting the amounts. Any token amounts in UIs are typically the display amount, so you need to do the same conversions. If you have further questions, please post a new question May 27 '21 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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